// ce-53.2.6641 8d08b353415283763cf6e7cadb642aaba7b968e1
// Copyright 2013-2016 Evernote Corp. All rights reserved.
// http://www.evernote.com

/* @preserve
 * The MIT License (MIT)
 * 
 * Copyright (c) 2013-2015 Petka Antonov
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 * 
 */
/**
 * bluebird build version 3.4.5
 * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each
*/
!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.Promise=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 _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise) {
var SomePromiseArray = Promise._SomePromiseArray;
function any(promises) {
    var ret = new SomePromiseArray(promises);
    var promise = ret.promise();
    ret.setHowMany(1);
    ret.setUnwrap();
    ret.init();
    return promise;
}

Promise.any = function (promises) {
    return any(promises);
};

Promise.prototype.any = function () {
    return any(this);
};

};

},{}],2:[function(_dereq_,module,exports){
"use strict";
var firstLineError;
try {throw new Error(); } catch (e) {firstLineError = e;}
var schedule = _dereq_("./schedule");
var Queue = _dereq_("./queue");
var util = _dereq_("./util");

function Async() {
    this._customScheduler = false;
    this._isTickUsed = false;
    this._lateQueue = new Queue(16);
    this._normalQueue = new Queue(16);
    this._haveDrainedQueues = false;
    this._trampolineEnabled = true;
    var self = this;
    this.drainQueues = function () {
        self._drainQueues();
    };
    this._schedule = schedule;
}

Async.prototype.setScheduler = function(fn) {
    var prev = this._schedule;
    this._schedule = fn;
    this._customScheduler = true;
    return prev;
};

Async.prototype.hasCustomScheduler = function() {
    return this._customScheduler;
};

Async.prototype.enableTrampoline = function() {
    this._trampolineEnabled = true;
};

Async.prototype.disableTrampolineIfNecessary = function() {
    if (util.hasDevTools) {
        this._trampolineEnabled = false;
    }
};

Async.prototype.haveItemsQueued = function () {
    return this._isTickUsed || this._haveDrainedQueues;
};


Async.prototype.fatalError = function(e, isNode) {
    if (isNode) {
        process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) +
            "\n");
        process.exit(2);
    } else {
        this.throwLater(e);
    }
};

Async.prototype.throwLater = function(fn, arg) {
    if (arguments.length === 1) {
        arg = fn;
        fn = function () { throw arg; };
    }
    if (typeof setTimeout !== "undefined") {
        setTimeout(function() {
            fn(arg);
        }, 0);
    } else try {
        this._schedule(function() {
            fn(arg);
        });
    } catch (e) {
        throw new Error("No async scheduler available\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
    }
};

function AsyncInvokeLater(fn, receiver, arg) {
    this._lateQueue.push(fn, receiver, arg);
    this._queueTick();
}

function AsyncInvoke(fn, receiver, arg) {
    this._normalQueue.push(fn, receiver, arg);
    this._queueTick();
}

function AsyncSettlePromises(promise) {
    this._normalQueue._pushOne(promise);
    this._queueTick();
}

if (!util.hasDevTools) {
    Async.prototype.invokeLater = AsyncInvokeLater;
    Async.prototype.invoke = AsyncInvoke;
    Async.prototype.settlePromises = AsyncSettlePromises;
} else {
    Async.prototype.invokeLater = function (fn, receiver, arg) {
        if (this._trampolineEnabled) {
            AsyncInvokeLater.call(this, fn, receiver, arg);
        } else {
            this._schedule(function() {
                setTimeout(function() {
                    fn.call(receiver, arg);
                }, 100);
            });
        }
    };

    Async.prototype.invoke = function (fn, receiver, arg) {
        if (this._trampolineEnabled) {
            AsyncInvoke.call(this, fn, receiver, arg);
        } else {
            this._schedule(function() {
                fn.call(receiver, arg);
            });
        }
    };

    Async.prototype.settlePromises = function(promise) {
        if (this._trampolineEnabled) {
            AsyncSettlePromises.call(this, promise);
        } else {
            this._schedule(function() {
                promise._settlePromises();
            });
        }
    };
}

Async.prototype.invokeFirst = function (fn, receiver, arg) {
    this._normalQueue.unshift(fn, receiver, arg);
    this._queueTick();
};

Async.prototype._drainQueue = function(queue) {
    while (queue.length() > 0) {
        var fn = queue.shift();
        if (typeof fn !== "function") {
            fn._settlePromises();
            continue;
        }
        var receiver = queue.shift();
        var arg = queue.shift();
        fn.call(receiver, arg);
    }
};

Async.prototype._drainQueues = function () {
    this._drainQueue(this._normalQueue);
    this._reset();
    this._haveDrainedQueues = true;
    this._drainQueue(this._lateQueue);
};

Async.prototype._queueTick = function () {
    if (!this._isTickUsed) {
        this._isTickUsed = true;
        this._schedule(this.drainQueues);
    }
};

Async.prototype._reset = function () {
    this._isTickUsed = false;
};

module.exports = Async;
module.exports.firstLineError = firstLineError;

},{"./queue":26,"./schedule":29,"./util":36}],3:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {
var calledBind = false;
var rejectThis = function(_, e) {
    this._reject(e);
};

var targetRejected = function(e, context) {
    context.promiseRejectionQueued = true;
    context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
};

var bindingResolved = function(thisArg, context) {
    if (((this._bitField & 50397184) === 0)) {
        this._resolveCallback(context.target);
    }
};

var bindingRejected = function(e, context) {
    if (!context.promiseRejectionQueued) this._reject(e);
};

Promise.prototype.bind = function (thisArg) {
    if (!calledBind) {
        calledBind = true;
        Promise.prototype._propagateFrom = debug.propagateFromFunction();
        Promise.prototype._boundValue = debug.boundValueFunction();
    }
    var maybePromise = tryConvertToPromise(thisArg);
    var ret = new Promise(INTERNAL);
    ret._propagateFrom(this, 1);
    var target = this._target();
    ret._setBoundTo(maybePromise);
    if (maybePromise instanceof Promise) {
        var context = {
            promiseRejectionQueued: false,
            promise: ret,
            target: target,
            bindingPromise: maybePromise
        };
        target._then(INTERNAL, targetRejected, undefined, ret, context);
        maybePromise._then(
            bindingResolved, bindingRejected, undefined, ret, context);
        ret._setOnCancel(maybePromise);
    } else {
        ret._resolveCallback(target);
    }
    return ret;
};

Promise.prototype._setBoundTo = function (obj) {
    if (obj !== undefined) {
        this._bitField = this._bitField | 2097152;
        this._boundTo = obj;
    } else {
        this._bitField = this._bitField & (~2097152);
    }
};

Promise.prototype._isBound = function () {
    return (this._bitField & 2097152) === 2097152;
};

Promise.bind = function (thisArg, value) {
    return Promise.resolve(value).bind(thisArg);
};
};

},{}],4:[function(_dereq_,module,exports){
"use strict";
var old;
if (typeof Promise !== "undefined") old = Promise;
function noConflict() {
    try { if (Promise === bluebird) Promise = old; }
    catch (e) {}
    return bluebird;
}
var bluebird = _dereq_("./promise")();
bluebird.noConflict = noConflict;
module.exports = bluebird;

},{"./promise":22}],5:[function(_dereq_,module,exports){
"use strict";
var cr = Object.create;
if (cr) {
    var callerCache = cr(null);
    var getterCache = cr(null);
    callerCache[" size"] = getterCache[" size"] = 0;
}

module.exports = function(Promise) {
var util = _dereq_("./util");
var canEvaluate = util.canEvaluate;
var isIdentifier = util.isIdentifier;

var getMethodCaller;
var getGetter;
if (!true) {
var makeMethodCaller = function (methodName) {
    return new Function("ensureMethod", "                                    \n\
        return function(obj) {                                               \n\
            'use strict'                                                     \n\
            var len = this.length;                                           \n\
            ensureMethod(obj, 'methodName');                                 \n\
            switch(len) {                                                    \n\
                case 1: return obj.methodName(this[0]);                      \n\
                case 2: return obj.methodName(this[0], this[1]);             \n\
                case 3: return obj.methodName(this[0], this[1], this[2]);    \n\
                case 0: return obj.methodName();                             \n\
                default:                                                     \n\
                    return obj.methodName.apply(obj, this);                  \n\
            }                                                                \n\
        };                                                                   \n\
        ".replace(/methodName/g, methodName))(ensureMethod);
};

var makeGetter = function (propertyName) {
    return new Function("obj", "                                             \n\
        'use strict';                                                        \n\
        return obj.propertyName;                                             \n\
        ".replace("propertyName", propertyName));
};

var getCompiled = function(name, compiler, cache) {
    var ret = cache[name];
    if (typeof ret !== "function") {
        if (!isIdentifier(name)) {
            return null;
        }
        ret = compiler(name);
        cache[name] = ret;
        cache[" size"]++;
        if (cache[" size"] > 512) {
            var keys = Object.keys(cache);
            for (var i = 0; i < 256; ++i) delete cache[keys[i]];
            cache[" size"] = keys.length - 256;
        }
    }
    return ret;
};

getMethodCaller = function(name) {
    return getCompiled(name, makeMethodCaller, callerCache);
};

getGetter = function(name) {
    return getCompiled(name, makeGetter, getterCache);
};
}

function ensureMethod(obj, methodName) {
    var fn;
    if (obj != null) fn = obj[methodName];
    if (typeof fn !== "function") {
        var message = "Object " + util.classString(obj) + " has no method '" +
            util.toString(methodName) + "'";
        throw new Promise.TypeError(message);
    }
    return fn;
}

function caller(obj) {
    var methodName = this.pop();
    var fn = ensureMethod(obj, methodName);
    return fn.apply(obj, this);
}
Promise.prototype.call = function (methodName) {
    var args = [].slice.call(arguments, 1);;
    if (!true) {
        if (canEvaluate) {
            var maybeCaller = getMethodCaller(methodName);
            if (maybeCaller !== null) {
                return this._then(
                    maybeCaller, undefined, undefined, args, undefined);
            }
        }
    }
    args.push(methodName);
    return this._then(caller, undefined, undefined, args, undefined);
};

function namedGetter(obj) {
    return obj[this];
}
function indexedGetter(obj) {
    var index = +this;
    if (index < 0) index = Math.max(0, index + obj.length);
    return obj[index];
}
Promise.prototype.get = function (propertyName) {
    var isIndex = (typeof propertyName === "number");
    var getter;
    if (!isIndex) {
        if (canEvaluate) {
            var maybeGetter = getGetter(propertyName);
            getter = maybeGetter !== null ? maybeGetter : namedGetter;
        } else {
            getter = namedGetter;
        }
    } else {
        getter = indexedGetter;
    }
    return this._then(getter, undefined, undefined, propertyName, undefined);
};
};

},{"./util":36}],6:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise, PromiseArray, apiRejection, debug) {
var util = _dereq_("./util");
var tryCatch = util.tryCatch;
var errorObj = util.errorObj;
var async = Promise._async;

Promise.prototype["break"] = Promise.prototype.cancel = function() {
    if (!debug.cancellation()) return this._warn("cancellation is disabled");

    var promise = this;
    var child = promise;
    while (promise._isCancellable()) {
        if (!promise._cancelBy(child)) {
            if (child._isFollowing()) {
                child._followee().cancel();
            } else {
                child._cancelBranched();
            }
            break;
        }

        var parent = promise._cancellationParent;
        if (parent == null || !parent._isCancellable()) {
            if (promise._isFollowing()) {
                promise._followee().cancel();
            } else {
                promise._cancelBranched();
            }
            break;
        } else {
            if (promise._isFollowing()) promise._followee().cancel();
            promise._setWillBeCancelled();
            child = promise;
            promise = parent;
        }
    }
};

Promise.prototype._branchHasCancelled = function() {
    this._branchesRemainingToCancel--;
};

Promise.prototype._enoughBranchesHaveCancelled = function() {
    return this._branchesRemainingToCancel === undefined ||
           this._branchesRemainingToCancel <= 0;
};

Promise.prototype._cancelBy = function(canceller) {
    if (canceller === this) {
        this._branchesRemainingToCancel = 0;
        this._invokeOnCancel();
        return true;
    } else {
        this._branchHasCancelled();
        if (this._enoughBranchesHaveCancelled()) {
            this._invokeOnCancel();
            return true;
        }
    }
    return false;
};

Promise.prototype._cancelBranched = function() {
    if (this._enoughBranchesHaveCancelled()) {
        this._cancel();
    }
};

Promise.prototype._cancel = function() {
    if (!this._isCancellable()) return;
    this._setCancelled();
    async.invoke(this._cancelPromises, this, undefined);
};

Promise.prototype._cancelPromises = function() {
    if (this._length() > 0) this._settlePromises();
};

Promise.prototype._unsetOnCancel = function() {
    this._onCancelField = undefined;
};

Promise.prototype._isCancellable = function() {
    return this.isPending() && !this._isCancelled();
};

Promise.prototype.isCancellable = function() {
    return this.isPending() && !this.isCancelled();
};

Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
    if (util.isArray(onCancelCallback)) {
        for (var i = 0; i < onCancelCallback.length; ++i) {
            this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
        }
    } else if (onCancelCallback !== undefined) {
        if (typeof onCancelCallback === "function") {
            if (!internalOnly) {
                var e = tryCatch(onCancelCallback).call(this._boundValue());
                if (e === errorObj) {
                    this._attachExtraTrace(e.e);
                    async.throwLater(e.e);
                }
            }
        } else {
            onCancelCallback._resultCancelled(this);
        }
    }
};

Promise.prototype._invokeOnCancel = function() {
    var onCancelCallback = this._onCancel();
    this._unsetOnCancel();
    async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
};

Promise.prototype._invokeInternalOnCancel = function() {
    if (this._isCancellable()) {
        this._doInvokeOnCancel(this._onCancel(), true);
        this._unsetOnCancel();
    }
};

Promise.prototype._resultCancelled = function() {
    this.cancel();
};

};

},{"./util":36}],7:[function(_dereq_,module,exports){
"use strict";
module.exports = function(NEXT_FILTER) {
var util = _dereq_("./util");
var getKeys = _dereq_("./es5").keys;
var tryCatch = util.tryCatch;
var errorObj = util.errorObj;

function catchFilter(instances, cb, promise) {
    return function(e) {
        var boundTo = promise._boundValue();
        predicateLoop: for (var i = 0; i < instances.length; ++i) {
            var item = instances[i];

            if (item === Error ||
                (item != null && item.prototype instanceof Error)) {
                if (e instanceof item) {
                    return tryCatch(cb).call(boundTo, e);
                }
            } else if (typeof item === "function") {
                var matchesPredicate = tryCatch(item).call(boundTo, e);
                if (matchesPredicate === errorObj) {
                    return matchesPredicate;
                } else if (matchesPredicate) {
                    return tryCatch(cb).call(boundTo, e);
                }
            } else if (util.isObject(e)) {
                var keys = getKeys(item);
                for (var j = 0; j < keys.length; ++j) {
                    var key = keys[j];
                    if (item[key] != e[key]) {
                        continue predicateLoop;
                    }
                }
                return tryCatch(cb).call(boundTo, e);
            }
        }
        return NEXT_FILTER;
    };
}

return catchFilter;
};

},{"./es5":13,"./util":36}],8:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise) {
var longStackTraces = false;
var contextStack = [];

Promise.prototype._promiseCreated = function() {};
Promise.prototype._pushContext = function() {};
Promise.prototype._popContext = function() {return null;};
Promise._peekContext = Promise.prototype._peekContext = function() {};

function Context() {
    this._trace = new Context.CapturedTrace(peekContext());
}
Context.prototype._pushContext = function () {
    if (this._trace !== undefined) {
        this._trace._promiseCreated = null;
        contextStack.push(this._trace);
    }
};

Context.prototype._popContext = function () {
    if (this._trace !== undefined) {
        var trace = contextStack.pop();
        var ret = trace._promiseCreated;
        trace._promiseCreated = null;
        return ret;
    }
    return null;
};

function createContext() {
    if (longStackTraces) return new Context();
}

function peekContext() {
    var lastIndex = contextStack.length - 1;
    if (lastIndex >= 0) {
        return contextStack[lastIndex];
    }
    return undefined;
}
Context.CapturedTrace = null;
Context.create = createContext;
Context.deactivateLongStackTraces = function() {};
Context.activateLongStackTraces = function() {
    var Promise_pushContext = Promise.prototype._pushContext;
    var Promise_popContext = Promise.prototype._popContext;
    var Promise_PeekContext = Promise._peekContext;
    var Promise_peekContext = Promise.prototype._peekContext;
    var Promise_promiseCreated = Promise.prototype._promiseCreated;
    Context.deactivateLongStackTraces = function() {
        Promise.prototype._pushContext = Promise_pushContext;
        Promise.prototype._popContext = Promise_popContext;
        Promise._peekContext = Promise_PeekContext;
        Promise.prototype._peekContext = Promise_peekContext;
        Promise.prototype._promiseCreated = Promise_promiseCreated;
        longStackTraces = false;
    };
    longStackTraces = true;
    Promise.prototype._pushContext = Context.prototype._pushContext;
    Promise.prototype._popContext = Context.prototype._popContext;
    Promise._peekContext = Promise.prototype._peekContext = peekContext;
    Promise.prototype._promiseCreated = function() {
        var ctx = this._peekContext();
        if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;
    };
};
return Context;
};

},{}],9:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise, Context) {
var getDomain = Promise._getDomain;
var async = Promise._async;
var Warning = _dereq_("./errors").Warning;
var util = _dereq_("./util");
var canAttachTrace = util.canAttachTrace;
var unhandledRejectionHandled;
var possiblyUnhandledRejection;
var bluebirdFramePattern =
    /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;
var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/;
var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;
var stackFramePattern = null;
var formatStack = null;
var indentStackFrames = false;
var printWarning;
var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 &&
                        (true ||
                         util.env("BLUEBIRD_DEBUG") ||
                         util.env("NODE_ENV") === "development"));

var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 &&
    (debugging || util.env("BLUEBIRD_WARNINGS")));

var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 &&
    (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));

var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 &&
    (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));

Promise.prototype.suppressUnhandledRejections = function() {
    var target = this._target();
    target._bitField = ((target._bitField & (~1048576)) |
                      524288);
};

Promise.prototype._ensurePossibleRejectionHandled = function () {
    if ((this._bitField & 524288) !== 0) return;
    this._setRejectionIsUnhandled();
    async.invokeLater(this._notifyUnhandledRejection, this, undefined);
};

Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
    fireRejectionEvent("rejectionHandled",
                                  unhandledRejectionHandled, undefined, this);
};

Promise.prototype._setReturnedNonUndefined = function() {
    this._bitField = this._bitField | 268435456;
};

Promise.prototype._returnedNonUndefined = function() {
    return (this._bitField & 268435456) !== 0;
};

Promise.prototype._notifyUnhandledRejection = function () {
    if (this._isRejectionUnhandled()) {
        var reason = this._settledValue();
        this._setUnhandledRejectionIsNotified();
        fireRejectionEvent("unhandledRejection",
                                      possiblyUnhandledRejection, reason, this);
    }
};

Promise.prototype._setUnhandledRejectionIsNotified = function () {
    this._bitField = this._bitField | 262144;
};

Promise.prototype._unsetUnhandledRejectionIsNotified = function () {
    this._bitField = this._bitField & (~262144);
};

Promise.prototype._isUnhandledRejectionNotified = function () {
    return (this._bitField & 262144) > 0;
};

Promise.prototype._setRejectionIsUnhandled = function () {
    this._bitField = this._bitField | 1048576;
};

Promise.prototype._unsetRejectionIsUnhandled = function () {
    this._bitField = this._bitField & (~1048576);
    if (this._isUnhandledRejectionNotified()) {
        this._unsetUnhandledRejectionIsNotified();
        this._notifyUnhandledRejectionIsHandled();
    }
};

Promise.prototype._isRejectionUnhandled = function () {
    return (this._bitField & 1048576) > 0;
};

Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) {
    return warn(message, shouldUseOwnTrace, promise || this);
};

Promise.onPossiblyUnhandledRejection = function (fn) {
    var domain = getDomain();
    possiblyUnhandledRejection =
        typeof fn === "function" ? (domain === null ?
                                            fn : util.domainBind(domain, fn))
                                 : undefined;
};

Promise.onUnhandledRejectionHandled = function (fn) {
    var domain = getDomain();
    unhandledRejectionHandled =
        typeof fn === "function" ? (domain === null ?
                                            fn : util.domainBind(domain, fn))
                                 : undefined;
};

var disableLongStackTraces = function() {};
Promise.longStackTraces = function () {
    if (async.haveItemsQueued() && !config.longStackTraces) {
        throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
    }
    if (!config.longStackTraces && longStackTracesIsSupported()) {
        var Promise_captureStackTrace = Promise.prototype._captureStackTrace;
        var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;
        config.longStackTraces = true;
        disableLongStackTraces = function() {
            if (async.haveItemsQueued() && !config.longStackTraces) {
                throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
            }
            Promise.prototype._captureStackTrace = Promise_captureStackTrace;
            Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
            Context.deactivateLongStackTraces();
            async.enableTrampoline();
            config.longStackTraces = false;
        };
        Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
        Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
        Context.activateLongStackTraces();
        async.disableTrampolineIfNecessary();
    }
};

Promise.hasLongStackTraces = function () {
    return config.longStackTraces && longStackTracesIsSupported();
};

var fireDomEvent = (function() {
    try {
        if (typeof CustomEvent === "function") {
            var event = new CustomEvent("CustomEvent");
            util.global.dispatchEvent(event);
            return function(name, event) {
                var domEvent = new CustomEvent(name.toLowerCase(), {
                    detail: event,
                    cancelable: true
                });
                return !util.global.dispatchEvent(domEvent);
            };
        } else if (typeof Event === "function") {
            var event = new Event("CustomEvent");
            util.global.dispatchEvent(event);
            return function(name, event) {
                var domEvent = new Event(name.toLowerCase(), {
                    cancelable: true
                });
                domEvent.detail = event;
                return !util.global.dispatchEvent(domEvent);
            };
        } else {
            var event = document.createEvent("CustomEvent");
            event.initCustomEvent("testingtheevent", false, true, {});
            util.global.dispatchEvent(event);
            return function(name, event) {
                var domEvent = document.createEvent("CustomEvent");
                domEvent.initCustomEvent(name.toLowerCase(), false, true,
                    event);
                return !util.global.dispatchEvent(domEvent);
            };
        }
    } catch (e) {}
    return function() {
        return false;
    };
})();

var fireGlobalEvent = (function() {
    if (util.isNode) {
        return function() {
            return process.emit.apply(process, arguments);
        };
    } else {
        if (!util.global) {
            return function() {
                return false;
            };
        }
        return function(name) {
            var methodName = "on" + name.toLowerCase();
            var method = util.global[methodName];
            if (!method) return false;
            method.apply(util.global, [].slice.call(arguments, 1));
            return true;
        };
    }
})();

function generatePromiseLifecycleEventObject(name, promise) {
    return {promise: promise};
}

var eventToObjectGenerator = {
    promiseCreated: generatePromiseLifecycleEventObject,
    promiseFulfilled: generatePromiseLifecycleEventObject,
    promiseRejected: generatePromiseLifecycleEventObject,
    promiseResolved: generatePromiseLifecycleEventObject,
    promiseCancelled: generatePromiseLifecycleEventObject,
    promiseChained: function(name, promise, child) {
        return {promise: promise, child: child};
    },
    warning: function(name, warning) {
        return {warning: warning};
    },
    unhandledRejection: function (name, reason, promise) {
        return {reason: reason, promise: promise};
    },
    rejectionHandled: generatePromiseLifecycleEventObject
};

var activeFireEvent = function (name) {
    var globalEventFired = false;
    try {
        globalEventFired = fireGlobalEvent.apply(null, arguments);
    } catch (e) {
        async.throwLater(e);
        globalEventFired = true;
    }

    var domEventFired = false;
    try {
        domEventFired = fireDomEvent(name,
                    eventToObjectGenerator[name].apply(null, arguments));
    } catch (e) {
        async.throwLater(e);
        domEventFired = true;
    }

    return domEventFired || globalEventFired;
};

Promise.config = function(opts) {
    opts = Object(opts);
    if ("longStackTraces" in opts) {
        if (opts.longStackTraces) {
            Promise.longStackTraces();
        } else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {
            disableLongStackTraces();
        }
    }
    if ("warnings" in opts) {
        var warningsOption = opts.warnings;
        config.warnings = !!warningsOption;
        wForgottenReturn = config.warnings;

        if (util.isObject(warningsOption)) {
            if ("wForgottenReturn" in warningsOption) {
                wForgottenReturn = !!warningsOption.wForgottenReturn;
            }
        }
    }
    if ("cancellation" in opts && opts.cancellation && !config.cancellation) {
        if (async.haveItemsQueued()) {
            throw new Error(
                "cannot enable cancellation after promises are in use");
        }
        Promise.prototype._clearCancellationData =
            cancellationClearCancellationData;
        Promise.prototype._propagateFrom = cancellationPropagateFrom;
        Promise.prototype._onCancel = cancellationOnCancel;
        Promise.prototype._setOnCancel = cancellationSetOnCancel;
        Promise.prototype._attachCancellationCallback =
            cancellationAttachCancellationCallback;
        Promise.prototype._execute = cancellationExecute;
        propagateFromFunction = cancellationPropagateFrom;
        config.cancellation = true;
    }
    if ("monitoring" in opts) {
        if (opts.monitoring && !config.monitoring) {
            config.monitoring = true;
            Promise.prototype._fireEvent = activeFireEvent;
        } else if (!opts.monitoring && config.monitoring) {
            config.monitoring = false;
            Promise.prototype._fireEvent = defaultFireEvent;
        }
    }
};

function defaultFireEvent() { return false; }

Promise.prototype._fireEvent = defaultFireEvent;
Promise.prototype._execute = function(executor, resolve, reject) {
    try {
        executor(resolve, reject);
    } catch (e) {
        return e;
    }
};
Promise.prototype._onCancel = function () {};
Promise.prototype._setOnCancel = function (handler) { ; };
Promise.prototype._attachCancellationCallback = function(onCancel) {
    ;
};
Promise.prototype._captureStackTrace = function () {};
Promise.prototype._attachExtraTrace = function () {};
Promise.prototype._clearCancellationData = function() {};
Promise.prototype._propagateFrom = function (parent, flags) {
    ;
    ;
};

function cancellationExecute(executor, resolve, reject) {
    var promise = this;
    try {
        executor(resolve, reject, function(onCancel) {
            if (typeof onCancel !== "function") {
                throw new TypeError("onCancel must be a function, got: " +
                                    util.toString(onCancel));
            }
            promise._attachCancellationCallback(onCancel);
        });
    } catch (e) {
        return e;
    }
}

function cancellationAttachCancellationCallback(onCancel) {
    if (!this._isCancellable()) return this;

    var previousOnCancel = this._onCancel();
    if (previousOnCancel !== undefined) {
        if (util.isArray(previousOnCancel)) {
            previousOnCancel.push(onCancel);
        } else {
            this._setOnCancel([previousOnCancel, onCancel]);
        }
    } else {
        this._setOnCancel(onCancel);
    }
}

function cancellationOnCancel() {
    return this._onCancelField;
}

function cancellationSetOnCancel(onCancel) {
    this._onCancelField = onCancel;
}

function cancellationClearCancellationData() {
    this._cancellationParent = undefined;
    this._onCancelField = undefined;
}

function cancellationPropagateFrom(parent, flags) {
    if ((flags & 1) !== 0) {
        this._cancellationParent = parent;
        var branchesRemainingToCancel = parent._branchesRemainingToCancel;
        if (branchesRemainingToCancel === undefined) {
            branchesRemainingToCancel = 0;
        }
        parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;
    }
    if ((flags & 2) !== 0 && parent._isBound()) {
        this._setBoundTo(parent._boundTo);
    }
}

function bindingPropagateFrom(parent, flags) {
    if ((flags & 2) !== 0 && parent._isBound()) {
        this._setBoundTo(parent._boundTo);
    }
}
var propagateFromFunction = bindingPropagateFrom;

function boundValueFunction() {
    var ret = this._boundTo;
    if (ret !== undefined) {
        if (ret instanceof Promise) {
            if (ret.isFulfilled()) {
                return ret.value();
            } else {
                return undefined;
            }
        }
    }
    return ret;
}

function longStackTracesCaptureStackTrace() {
    this._trace = new CapturedTrace(this._peekContext());
}

function longStackTracesAttachExtraTrace(error, ignoreSelf) {
    if (canAttachTrace(error)) {
        var trace = this._trace;
        if (trace !== undefined) {
            if (ignoreSelf) trace = trace._parent;
        }
        if (trace !== undefined) {
            trace.attachExtraTrace(error);
        } else if (!error.__stackCleaned__) {
            var parsed = parseStackAndMessage(error);
            util.notEnumerableProp(error, "stack",
                parsed.message + "\n" + parsed.stack.join("\n"));
            util.notEnumerableProp(error, "__stackCleaned__", true);
        }
    }
}

function checkForgottenReturns(returnValue, promiseCreated, name, promise,
                               parent) {
    if (returnValue === undefined && promiseCreated !== null &&
        wForgottenReturn) {
        if (parent !== undefined && parent._returnedNonUndefined()) return;
        if ((promise._bitField & 65535) === 0) return;

        if (name) name = name + " ";
        var handlerLine = "";
        var creatorLine = "";
        if (promiseCreated._trace) {
            var traceLines = promiseCreated._trace.stack.split("\n");
            var stack = cleanStack(traceLines);
            for (var i = stack.length - 1; i >= 0; --i) {
                var line = stack[i];
                if (!nodeFramePattern.test(line)) {
                    var lineMatches = line.match(parseLinePattern);
                    if (lineMatches) {
                        handlerLine  = "at " + lineMatches[1] +
                            ":" + lineMatches[2] + ":" + lineMatches[3] + " ";
                    }
                    break;
                }
            }

            if (stack.length > 0) {
                var firstUserLine = stack[0];
                for (var i = 0; i < traceLines.length; ++i) {

                    if (traceLines[i] === firstUserLine) {
                        if (i > 0) {
                            creatorLine = "\n" + traceLines[i - 1];
                        }
                        break;
                    }
                }

            }
        }
        var msg = "a promise was created in a " + name +
            "handler " + handlerLine + "but was not returned from it, " +
            "see http://goo.gl/rRqMUw" +
            creatorLine;
        promise._warn(msg, true, promiseCreated);
    }
}

function deprecated(name, replacement) {
    var message = name +
        " is deprecated and will be removed in a future version.";
    if (replacement) message += " Use " + replacement + " instead.";
    return warn(message);
}

function warn(message, shouldUseOwnTrace, promise) {
    if (!config.warnings) return;
    var warning = new Warning(message);
    var ctx;
    if (shouldUseOwnTrace) {
        promise._attachExtraTrace(warning);
    } else if (config.longStackTraces && (ctx = Promise._peekContext())) {
        ctx.attachExtraTrace(warning);
    } else {
        var parsed = parseStackAndMessage(warning);
        warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
    }

    if (!activeFireEvent("warning", warning)) {
        formatAndLogError(warning, "", true);
    }
}

function reconstructStack(message, stacks) {
    for (var i = 0; i < stacks.length - 1; ++i) {
        stacks[i].push("From previous event:");
        stacks[i] = stacks[i].join("\n");
    }
    if (i < stacks.length) {
        stacks[i] = stacks[i].join("\n");
    }
    return message + "\n" + stacks.join("\n");
}

function removeDuplicateOrEmptyJumps(stacks) {
    for (var i = 0; i < stacks.length; ++i) {
        if (stacks[i].length === 0 ||
            ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {
            stacks.splice(i, 1);
            i--;
        }
    }
}

function removeCommonRoots(stacks) {
    var current = stacks[0];
    for (var i = 1; i < stacks.length; ++i) {
        var prev = stacks[i];
        var currentLastIndex = current.length - 1;
        var currentLastLine = current[currentLastIndex];
        var commonRootMeetPoint = -1;

        for (var j = prev.length - 1; j >= 0; --j) {
            if (prev[j] === currentLastLine) {
                commonRootMeetPoint = j;
                break;
            }
        }

        for (var j = commonRootMeetPoint; j >= 0; --j) {
            var line = prev[j];
            if (current[currentLastIndex] === line) {
                current.pop();
                currentLastIndex--;
            } else {
                break;
            }
        }
        current = prev;
    }
}

function cleanStack(stack) {
    var ret = [];
    for (var i = 0; i < stack.length; ++i) {
        var line = stack[i];
        var isTraceLine = "    (No stack trace)" === line ||
            stackFramePattern.test(line);
        var isInternalFrame = isTraceLine && shouldIgnore(line);
        if (isTraceLine && !isInternalFrame) {
            if (indentStackFrames && line.charAt(0) !== " ") {
                line = "    " + line;
            }
            ret.push(line);
        }
    }
    return ret;
}

function stackFramesAsArray(error) {
    var stack = error.stack.replace(/\s+$/g, "").split("\n");
    for (var i = 0; i < stack.length; ++i) {
        var line = stack[i];
        if ("    (No stack trace)" === line || stackFramePattern.test(line)) {
            break;
        }
    }
    if (i > 0) {
        stack = stack.slice(i);
    }
    return stack;
}

function parseStackAndMessage(error) {
    var stack = error.stack;
    var message = error.toString();
    stack = typeof stack === "string" && stack.length > 0
                ? stackFramesAsArray(error) : ["    (No stack trace)"];
    return {
        message: message,
        stack: cleanStack(stack)
    };
}

function formatAndLogError(error, title, isSoft) {
    if (typeof console !== "undefined") {
        var message;
        if (util.isObject(error)) {
            var stack = error.stack;
            message = title + formatStack(stack, error);
        } else {
            message = title + String(error);
        }
        if (typeof printWarning === "function") {
            printWarning(message, isSoft);
        } else if (typeof console.log === "function" ||
            typeof console.log === "object") {
            console.log(message);
        }
    }
}

function fireRejectionEvent(name, localHandler, reason, promise) {
    var localEventFired = false;
    try {
        if (typeof localHandler === "function") {
            localEventFired = true;
            if (name === "rejectionHandled") {
                localHandler(promise);
            } else {
                localHandler(reason, promise);
            }
        }
    } catch (e) {
        async.throwLater(e);
    }

    if (name === "unhandledRejection") {
        if (!activeFireEvent(name, reason, promise) && !localEventFired) {
            formatAndLogError(reason, "Unhandled rejection ");
        }
    } else {
        activeFireEvent(name, promise);
    }
}

function formatNonError(obj) {
    var str;
    if (typeof obj === "function") {
        str = "[function " +
            (obj.name || "anonymous") +
            "]";
    } else {
        str = obj && typeof obj.toString === "function"
            ? obj.toString() : util.toString(obj);
        var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/;
        if (ruselessToString.test(str)) {
            try {
                var newStr = JSON.stringify(obj);
                str = newStr;
            }
            catch(e) {

            }
        }
        if (str.length === 0) {
            str = "(empty array)";
        }
    }
    return ("(<" + snip(str) + ">, no stack trace)");
}

function snip(str) {
    var maxChars = 41;
    if (str.length < maxChars) {
        return str;
    }
    return str.substr(0, maxChars - 3) + "...";
}

function longStackTracesIsSupported() {
    return typeof captureStackTrace === "function";
}

var shouldIgnore = function() { return false; };
var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
function parseLineInfo(line) {
    var matches = line.match(parseLineInfoRegex);
    if (matches) {
        return {
            fileName: matches[1],
            line: parseInt(matches[2], 10)
        };
    }
}

function setBounds(firstLineError, lastLineError) {
    if (!longStackTracesIsSupported()) return;
    var firstStackLines = firstLineError.stack.split("\n");
    var lastStackLines = lastLineError.stack.split("\n");
    var firstIndex = -1;
    var lastIndex = -1;
    var firstFileName;
    var lastFileName;
    for (var i = 0; i < firstStackLines.length; ++i) {
        var result = parseLineInfo(firstStackLines[i]);
        if (result) {
            firstFileName = result.fileName;
            firstIndex = result.line;
            break;
        }
    }
    for (var i = 0; i < lastStackLines.length; ++i) {
        var result = parseLineInfo(lastStackLines[i]);
        if (result) {
            lastFileName = result.fileName;
            lastIndex = result.line;
            break;
        }
    }
    if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||
        firstFileName !== lastFileName || firstIndex >= lastIndex) {
        return;
    }

    shouldIgnore = function(line) {
        if (bluebirdFramePattern.test(line)) return true;
        var info = parseLineInfo(line);
        if (info) {
            if (info.fileName === firstFileName &&
                (firstIndex <= info.line && info.line <= lastIndex)) {
                return true;
            }
        }
        return false;
    };
}

function CapturedTrace(parent) {
    this._parent = parent;
    this._promisesCreated = 0;
    var length = this._length = 1 + (parent === undefined ? 0 : parent._length);
    captureStackTrace(this, CapturedTrace);
    if (length > 32) this.uncycle();
}
util.inherits(CapturedTrace, Error);
Context.CapturedTrace = CapturedTrace;

CapturedTrace.prototype.uncycle = function() {
    var length = this._length;
    if (length < 2) return;
    var nodes = [];
    var stackToIndex = {};

    for (var i = 0, node = this; node !== undefined; ++i) {
        nodes.push(node);
        node = node._parent;
    }
    length = this._length = i;
    for (var i = length - 1; i >= 0; --i) {
        var stack = nodes[i].stack;
        if (stackToIndex[stack] === undefined) {
            stackToIndex[stack] = i;
        }
    }
    for (var i = 0; i < length; ++i) {
        var currentStack = nodes[i].stack;
        var index = stackToIndex[currentStack];
        if (index !== undefined && index !== i) {
            if (index > 0) {
                nodes[index - 1]._parent = undefined;
                nodes[index - 1]._length = 1;
            }
            nodes[i]._parent = undefined;
            nodes[i]._length = 1;
            var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;

            if (index < length - 1) {
                cycleEdgeNode._parent = nodes[index + 1];
                cycleEdgeNode._parent.uncycle();
                cycleEdgeNode._length =
                    cycleEdgeNode._parent._length + 1;
            } else {
                cycleEdgeNode._parent = undefined;
                cycleEdgeNode._length = 1;
            }
            var currentChildLength = cycleEdgeNode._length + 1;
            for (var j = i - 2; j >= 0; --j) {
                nodes[j]._length = currentChildLength;
                currentChildLength++;
            }
            return;
        }
    }
};

CapturedTrace.prototype.attachExtraTrace = function(error) {
    if (error.__stackCleaned__) return;
    this.uncycle();
    var parsed = parseStackAndMessage(error);
    var message = parsed.message;
    var stacks = [parsed.stack];

    var trace = this;
    while (trace !== undefined) {
        stacks.push(cleanStack(trace.stack.split("\n")));
        trace = trace._parent;
    }
    removeCommonRoots(stacks);
    removeDuplicateOrEmptyJumps(stacks);
    util.notEnumerableProp(error, "stack", reconstructStack(message, stacks));
    util.notEnumerableProp(error, "__stackCleaned__", true);
};

var captureStackTrace = (function stackDetection() {
    var v8stackFramePattern = /^\s*at\s*/;
    var v8stackFormatter = function(stack, error) {
        if (typeof stack === "string") return stack;

        if (error.name !== undefined &&
            error.message !== undefined) {
            return error.toString();
        }
        return formatNonError(error);
    };

    if (typeof Error.stackTraceLimit === "number" &&
        typeof Error.captureStackTrace === "function") {
        Error.stackTraceLimit += 6;
        stackFramePattern = v8stackFramePattern;
        formatStack = v8stackFormatter;
        var captureStackTrace = Error.captureStackTrace;

        shouldIgnore = function(line) {
            return bluebirdFramePattern.test(line);
        };
        return function(receiver, ignoreUntil) {
            Error.stackTraceLimit += 6;
            captureStackTrace(receiver, ignoreUntil);
            Error.stackTraceLimit -= 6;
        };
    }
    var err = new Error();

    if (typeof err.stack === "string" &&
        err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) {
        stackFramePattern = /@/;
        formatStack = v8stackFormatter;
        indentStackFrames = true;
        return function captureStackTrace(o) {
            o.stack = new Error().stack;
        };
    }

    var hasStackAfterThrow;
    try { throw new Error(); }
    catch(e) {
        hasStackAfterThrow = ("stack" in e);
    }
    if (!("stack" in err) && hasStackAfterThrow &&
        typeof Error.stackTraceLimit === "number") {
        stackFramePattern = v8stackFramePattern;
        formatStack = v8stackFormatter;
        return function captureStackTrace(o) {
            Error.stackTraceLimit += 6;
            try { throw new Error(); }
            catch(e) { o.stack = e.stack; }
            Error.stackTraceLimit -= 6;
        };
    }

    formatStack = function(stack, error) {
        if (typeof stack === "string") return stack;

        if ((typeof error === "object" ||
            typeof error === "function") &&
            error.name !== undefined &&
            error.message !== undefined) {
            return error.toString();
        }
        return formatNonError(error);
    };

    return null;

})([]);

if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
    printWarning = function (message) {
        console.warn(message);
    };
    if (util.isNode && process.stderr.isTTY) {
        printWarning = function(message, isSoft) {
            var color = isSoft ? "\u001b[33m" : "\u001b[31m";
            console.warn(color + message + "\u001b[0m\n");
        };
    } else if (!util.isNode && typeof (new Error().stack) === "string") {
        printWarning = function(message, isSoft) {
            console.warn("%c" + message,
                        isSoft ? "color: darkorange" : "color: red");
        };
    }
}

var config = {
    warnings: warnings,
    longStackTraces: false,
    cancellation: false,
    monitoring: false
};

if (longStackTraces) Promise.longStackTraces();

return {
    longStackTraces: function() {
        return config.longStackTraces;
    },
    warnings: function() {
        return config.warnings;
    },
    cancellation: function() {
        return config.cancellation;
    },
    monitoring: function() {
        return config.monitoring;
    },
    propagateFromFunction: function() {
        return propagateFromFunction;
    },
    boundValueFunction: function() {
        return boundValueFunction;
    },
    checkForgottenReturns: checkForgottenReturns,
    setBounds: setBounds,
    warn: warn,
    deprecated: deprecated,
    CapturedTrace: CapturedTrace,
    fireDomEvent: fireDomEvent,
    fireGlobalEvent: fireGlobalEvent
};
};

},{"./errors":12,"./util":36}],10:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise) {
function returner() {
    return this.value;
}
function thrower() {
    throw this.reason;
}

Promise.prototype["return"] =
Promise.prototype.thenReturn = function (value) {
    if (value instanceof Promise) value.suppressUnhandledRejections();
    return this._then(
        returner, undefined, undefined, {value: value}, undefined);
};

Promise.prototype["throw"] =
Promise.prototype.thenThrow = function (reason) {
    return this._then(
        thrower, undefined, undefined, {reason: reason}, undefined);
};

Promise.prototype.catchThrow = function (reason) {
    if (arguments.length <= 1) {
        return this._then(
            undefined, thrower, undefined, {reason: reason}, undefined);
    } else {
        var _reason = arguments[1];
        var handler = function() {throw _reason;};
        return this.caught(reason, handler);
    }
};

Promise.prototype.catchReturn = function (value) {
    if (arguments.length <= 1) {
        if (value instanceof Promise) value.suppressUnhandledRejections();
        return this._then(
            undefined, returner, undefined, {value: value}, undefined);
    } else {
        var _value = arguments[1];
        if (_value instanceof Promise) _value.suppressUnhandledRejections();
        var handler = function() {return _value;};
        return this.caught(value, handler);
    }
};
};

},{}],11:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise, INTERNAL) {
var PromiseReduce = Promise.reduce;
var PromiseAll = Promise.all;

function promiseAllThis() {
    return PromiseAll(this);
}

function PromiseMapSeries(promises, fn) {
    return PromiseReduce(promises, fn, INTERNAL, INTERNAL);
}

Promise.prototype.each = function (fn) {
    return PromiseReduce(this, fn, INTERNAL, 0)
              ._then(promiseAllThis, undefined, undefined, this, undefined);
};

Promise.prototype.mapSeries = function (fn) {
    return PromiseReduce(this, fn, INTERNAL, INTERNAL);
};

Promise.each = function (promises, fn) {
    return PromiseReduce(promises, fn, INTERNAL, 0)
              ._then(promiseAllThis, undefined, undefined, promises, undefined);
};

Promise.mapSeries = PromiseMapSeries;
};


},{}],12:[function(_dereq_,module,exports){
"use strict";
var es5 = _dereq_("./es5");
var Objectfreeze = es5.freeze;
var util = _dereq_("./util");
var inherits = util.inherits;
var notEnumerableProp = util.notEnumerableProp;

function subError(nameProperty, defaultMessage) {
    function SubError(message) {
        if (!(this instanceof SubError)) return new SubError(message);
        notEnumerableProp(this, "message",
            typeof message === "string" ? message : defaultMessage);
        notEnumerableProp(this, "name", nameProperty);
        if (Error.captureStackTrace) {
            Error.captureStackTrace(this, this.constructor);
        } else {
            Error.call(this);
        }
    }
    inherits(SubError, Error);
    return SubError;
}

var _TypeError, _RangeError;
var Warning = subError("Warning", "warning");
var CancellationError = subError("CancellationError", "cancellation error");
var TimeoutError = subError("TimeoutError", "timeout error");
var AggregateError = subError("AggregateError", "aggregate error");
try {
    _TypeError = TypeError;
    _RangeError = RangeError;
} catch(e) {
    _TypeError = subError("TypeError", "type error");
    _RangeError = subError("RangeError", "range error");
}

var methods = ("join pop push shift unshift slice filter forEach some " +
    "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");

for (var i = 0; i < methods.length; ++i) {
    if (typeof Array.prototype[methods[i]] === "function") {
        AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
    }
}

es5.defineProperty(AggregateError.prototype, "length", {
    value: 0,
    configurable: false,
    writable: true,
    enumerable: true
});
AggregateError.prototype["isOperational"] = true;
var level = 0;
AggregateError.prototype.toString = function() {
    var indent = Array(level * 4 + 1).join(" ");
    var ret = "\n" + indent + "AggregateError of:" + "\n";
    level++;
    indent = Array(level * 4 + 1).join(" ");
    for (var i = 0; i < this.length; ++i) {
        var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "";
        var lines = str.split("\n");
        for (var j = 0; j < lines.length; ++j) {
            lines[j] = indent + lines[j];
        }
        str = lines.join("\n");
        ret += str + "\n";
    }
    level--;
    return ret;
};

function OperationalError(message) {
    if (!(this instanceof OperationalError))
        return new OperationalError(message);
    notEnumerableProp(this, "name", "OperationalError");
    notEnumerableProp(this, "message", message);
    this.cause = message;
    this["isOperational"] = true;

    if (message instanceof Error) {
        notEnumerableProp(this, "message", message.message);
        notEnumerableProp(this, "stack", message.stack);
    } else if (Error.captureStackTrace) {
        Error.captureStackTrace(this, this.constructor);
    }

}
inherits(OperationalError, Error);

var errorTypes = Error["__BluebirdErrorTypes__"];
if (!errorTypes) {
    errorTypes = Objectfreeze({
        CancellationError: CancellationError,
        TimeoutError: TimeoutError,
        OperationalError: OperationalError,
        RejectionError: OperationalError,
        AggregateError: AggregateError
    });
    es5.defineProperty(Error, "__BluebirdErrorTypes__", {
        value: errorTypes,
        writable: false,
        enumerable: false,
        configurable: false
    });
}

module.exports = {
    Error: Error,
    TypeError: _TypeError,
    RangeError: _RangeError,
    CancellationError: errorTypes.CancellationError,
    OperationalError: errorTypes.OperationalError,
    TimeoutError: errorTypes.TimeoutError,
    AggregateError: errorTypes.AggregateError,
    Warning: Warning
};

},{"./es5":13,"./util":36}],13:[function(_dereq_,module,exports){
var isES5 = (function(){
    "use strict";
    return this === undefined;
})();

if (isES5) {
    module.exports = {
        freeze: Object.freeze,
        defineProperty: Object.defineProperty,
        getDescriptor: Object.getOwnPropertyDescriptor,
        keys: Object.keys,
        names: Object.getOwnPropertyNames,
        getPrototypeOf: Object.getPrototypeOf,
        isArray: Array.isArray,
        isES5: isES5,
        propertyIsWritable: function(obj, prop) {
            var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
            return !!(!descriptor || descriptor.writable || descriptor.set);
        }
    };
} else {
    var has = {}.hasOwnProperty;
    var str = {}.toString;
    var proto = {}.constructor.prototype;

    var ObjectKeys = function (o) {
        var ret = [];
        for (var key in o) {
            if (has.call(o, key)) {
                ret.push(key);
            }
        }
        return ret;
    };

    var ObjectGetDescriptor = function(o, key) {
        return {value: o[key]};
    };

    var ObjectDefineProperty = function (o, key, desc) {
        o[key] = desc.value;
        return o;
    };

    var ObjectFreeze = function (obj) {
        return obj;
    };

    var ObjectGetPrototypeOf = function (obj) {
        try {
            return Object(obj).constructor.prototype;
        }
        catch (e) {
            return proto;
        }
    };

    var ArrayIsArray = function (obj) {
        try {
            return str.call(obj) === "[object Array]";
        }
        catch(e) {
            return false;
        }
    };

    module.exports = {
        isArray: ArrayIsArray,
        keys: ObjectKeys,
        names: ObjectKeys,
        defineProperty: ObjectDefineProperty,
        getDescriptor: ObjectGetDescriptor,
        freeze: ObjectFreeze,
        getPrototypeOf: ObjectGetPrototypeOf,
        isES5: isES5,
        propertyIsWritable: function() {
            return true;
        }
    };
}

},{}],14:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise, INTERNAL) {
var PromiseMap = Promise.map;

Promise.prototype.filter = function (fn, options) {
    return PromiseMap(this, fn, options, INTERNAL);
};

Promise.filter = function (promises, fn, options) {
    return PromiseMap(promises, fn, options, INTERNAL);
};
};

},{}],15:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise, tryConvertToPromise) {
var util = _dereq_("./util");
var CancellationError = Promise.CancellationError;
var errorObj = util.errorObj;

function PassThroughHandlerContext(promise, type, handler) {
    this.promise = promise;
    this.type = type;
    this.handler = handler;
    this.called = false;
    this.cancelPromise = null;
}

PassThroughHandlerContext.prototype.isFinallyHandler = function() {
    return this.type === 0;
};

function FinallyHandlerCancelReaction(finallyHandler) {
    this.finallyHandler = finallyHandler;
}

FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
    checkCancel(this.finallyHandler);
};

function checkCancel(ctx, reason) {
    if (ctx.cancelPromise != null) {
        if (arguments.length > 1) {
            ctx.cancelPromise._reject(reason);
        } else {
            ctx.cancelPromise._cancel();
        }
        ctx.cancelPromise = null;
        return true;
    }
    return false;
}

function succeed() {
    return finallyHandler.call(this, this.promise._target()._settledValue());
}
function fail(reason) {
    if (checkCancel(this, reason)) return;
    errorObj.e = reason;
    return errorObj;
}
function finallyHandler(reasonOrValue) {
    var promise = this.promise;
    var handler = this.handler;

    if (!this.called) {
        this.called = true;
        var ret = this.isFinallyHandler()
            ? handler.call(promise._boundValue())
            : handler.call(promise._boundValue(), reasonOrValue);
        if (ret !== undefined) {
            promise._setReturnedNonUndefined();
            var maybePromise = tryConvertToPromise(ret, promise);
            if (maybePromise instanceof Promise) {
                if (this.cancelPromise != null) {
                    if (maybePromise._isCancelled()) {
                        var reason =
                            new CancellationError("late cancellation observer");
                        promise._attachExtraTrace(reason);
                        errorObj.e = reason;
                        return errorObj;
                    } else if (maybePromise.isPending()) {
                        maybePromise._attachCancellationCallback(
                            new FinallyHandlerCancelReaction(this));
                    }
                }
                return maybePromise._then(
                    succeed, fail, undefined, this, undefined);
            }
        }
    }

    if (promise.isRejected()) {
        checkCancel(this);
        errorObj.e = reasonOrValue;
        return errorObj;
    } else {
        checkCancel(this);
        return reasonOrValue;
    }
}

Promise.prototype._passThrough = function(handler, type, success, fail) {
    if (typeof handler !== "function") return this.then();
    return this._then(success,
                      fail,
                      undefined,
                      new PassThroughHandlerContext(this, type, handler),
                      undefined);
};

Promise.prototype.lastly =
Promise.prototype["finally"] = function (handler) {
    return this._passThrough(handler,
                             0,
                             finallyHandler,
                             finallyHandler);
};

Promise.prototype.tap = function (handler) {
    return this._passThrough(handler, 1, finallyHandler);
};

return PassThroughHandlerContext;
};

},{"./util":36}],16:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise,
                          apiRejection,
                          INTERNAL,
                          tryConvertToPromise,
                          Proxyable,
                          debug) {
var errors = _dereq_("./errors");
var TypeError = errors.TypeError;
var util = _dereq_("./util");
var errorObj = util.errorObj;
var tryCatch = util.tryCatch;
var yieldHandlers = [];

function promiseFromYieldHandler(value, yieldHandlers, traceParent) {
    for (var i = 0; i < yieldHandlers.length; ++i) {
        traceParent._pushContext();
        var result = tryCatch(yieldHandlers[i])(value);
        traceParent._popContext();
        if (result === errorObj) {
            traceParent._pushContext();
            var ret = Promise.reject(errorObj.e);
            traceParent._popContext();
            return ret;
        }
        var maybePromise = tryConvertToPromise(result, traceParent);
        if (maybePromise instanceof Promise) return maybePromise;
    }
    return null;
}

function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
    if (debug.cancellation()) {
        var internal = new Promise(INTERNAL);
        var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);
        this._promise = internal.lastly(function() {
            return _finallyPromise;
        });
        internal._captureStackTrace();
        internal._setOnCancel(this);
    } else {
        var promise = this._promise = new Promise(INTERNAL);
        promise._captureStackTrace();
    }
    this._stack = stack;
    this._generatorFunction = generatorFunction;
    this._receiver = receiver;
    this._generator = undefined;
    this._yieldHandlers = typeof yieldHandler === "function"
        ? [yieldHandler].concat(yieldHandlers)
        : yieldHandlers;
    this._yieldedPromise = null;
    this._cancellationPhase = false;
}
util.inherits(PromiseSpawn, Proxyable);

PromiseSpawn.prototype._isResolved = function() {
    return this._promise === null;
};

PromiseSpawn.prototype._cleanup = function() {
    this._promise = this._generator = null;
    if (debug.cancellation() && this._finallyPromise !== null) {
        this._finallyPromise._fulfill();
        this._finallyPromise = null;
    }
};

PromiseSpawn.prototype._promiseCancelled = function() {
    if (this._isResolved()) return;
    var implementsReturn = typeof this._generator["return"] !== "undefined";

    var result;
    if (!implementsReturn) {
        var reason = new Promise.CancellationError(
            "generator .return() sentinel");
        Promise.coroutine.returnSentinel = reason;
        this._promise._attachExtraTrace(reason);
        this._promise._pushContext();
        result = tryCatch(this._generator["throw"]).call(this._generator,
                                                         reason);
        this._promise._popContext();
    } else {
        this._promise._pushContext();
        result = tryCatch(this._generator["return"]).call(this._generator,
                                                          undefined);
        this._promise._popContext();
    }
    this._cancellationPhase = true;
    this._yieldedPromise = null;
    this._continue(result);
};

PromiseSpawn.prototype._promiseFulfilled = function(value) {
    this._yieldedPromise = null;
    this._promise._pushContext();
    var result = tryCatch(this._generator.next).call(this._generator, value);
    this._promise._popContext();
    this._continue(result);
};

PromiseSpawn.prototype._promiseRejected = function(reason) {
    this._yieldedPromise = null;
    this._promise._attachExtraTrace(reason);
    this._promise._pushContext();
    var result = tryCatch(this._generator["throw"])
        .call(this._generator, reason);
    this._promise._popContext();
    this._continue(result);
};

PromiseSpawn.prototype._resultCancelled = function() {
    if (this._yieldedPromise instanceof Promise) {
        var promise = this._yieldedPromise;
        this._yieldedPromise = null;
        promise.cancel();
    }
};

PromiseSpawn.prototype.promise = function () {
    return this._promise;
};

PromiseSpawn.prototype._run = function () {
    this._generator = this._generatorFunction.call(this._receiver);
    this._receiver =
        this._generatorFunction = undefined;
    this._promiseFulfilled(undefined);
};

PromiseSpawn.prototype._continue = function (result) {
    var promise = this._promise;
    if (result === errorObj) {
        this._cleanup();
        if (this._cancellationPhase) {
            return promise.cancel();
        } else {
            return promise._rejectCallback(result.e, false);
        }
    }

    var value = result.value;
    if (result.done === true) {
        this._cleanup();
        if (this._cancellationPhase) {
            return promise.cancel();
        } else {
            return promise._resolveCallback(value);
        }
    } else {
        var maybePromise = tryConvertToPromise(value, this._promise);
        if (!(maybePromise instanceof Promise)) {
            maybePromise =
                promiseFromYieldHandler(maybePromise,
                                        this._yieldHandlers,
                                        this._promise);
            if (maybePromise === null) {
                this._promiseRejected(
                    new TypeError(
                        "A value %s was yielded that could not be treated as a promise\u000a\u000a    See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", value) +
                        "From coroutine:\u000a" +
                        this._stack.split("\n").slice(1, -7).join("\n")
                    )
                );
                return;
            }
        }
        maybePromise = maybePromise._target();
        var bitField = maybePromise._bitField;
        ;
        if (((bitField & 50397184) === 0)) {
            this._yieldedPromise = maybePromise;
            maybePromise._proxy(this, null);
        } else if (((bitField & 33554432) !== 0)) {
            Promise._async.invoke(
                this._promiseFulfilled, this, maybePromise._value()
            );
        } else if (((bitField & 16777216) !== 0)) {
            Promise._async.invoke(
                this._promiseRejected, this, maybePromise._reason()
            );
        } else {
            this._promiseCancelled();
        }
    }
};

Promise.coroutine = function (generatorFunction, options) {
    if (typeof generatorFunction !== "function") {
        throw new TypeError("generatorFunction must be a function\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
    }
    var yieldHandler = Object(options).yieldHandler;
    var PromiseSpawn$ = PromiseSpawn;
    var stack = new Error().stack;
    return function () {
        var generator = generatorFunction.apply(this, arguments);
        var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,
                                      stack);
        var ret = spawn.promise();
        spawn._generator = generator;
        spawn._promiseFulfilled(undefined);
        return ret;
    };
};

Promise.coroutine.addYieldHandler = function(fn) {
    if (typeof fn !== "function") {
        throw new TypeError("expecting a function but got " + util.classString(fn));
    }
    yieldHandlers.push(fn);
};

Promise.spawn = function (generatorFunction) {
    debug.deprecated("Promise.spawn()", "Promise.coroutine()");
    if (typeof generatorFunction !== "function") {
        return apiRejection("generatorFunction must be a function\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
    }
    var spawn = new PromiseSpawn(generatorFunction, this);
    var ret = spawn.promise();
    spawn._run(Promise.spawn);
    return ret;
};
};

},{"./errors":12,"./util":36}],17:[function(_dereq_,module,exports){
"use strict";
module.exports =
function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async,
         getDomain) {
var util = _dereq_("./util");
var canEvaluate = util.canEvaluate;
var tryCatch = util.tryCatch;
var errorObj = util.errorObj;
var reject;

if (!true) {
if (canEvaluate) {
    var thenCallback = function(i) {
        return new Function("value", "holder", "                             \n\
            'use strict';                                                    \n\
            holder.pIndex = value;                                           \n\
            holder.checkFulfillment(this);                                   \n\
            ".replace(/Index/g, i));
    };

    var promiseSetter = function(i) {
        return new Function("promise", "holder", "                           \n\
            'use strict';                                                    \n\
            holder.pIndex = promise;                                         \n\
            ".replace(/Index/g, i));
    };

    var generateHolderClass = function(total) {
        var props = new Array(total);
        for (var i = 0; i < props.length; ++i) {
            props[i] = "this.p" + (i+1);
        }
        var assignment = props.join(" = ") + " = null;";
        var cancellationCode= "var promise;\n" + props.map(function(prop) {
            return "                                                         \n\
                promise = " + prop + ";                                      \n\
                if (promise instanceof Promise) {                            \n\
                    promise.cancel();                                        \n\
                }                                                            \n\
            ";
        }).join("\n");
        var passedArguments = props.join(", ");
        var name = "Holder$" + total;


        var code = "return function(tryCatch, errorObj, Promise, async) {    \n\
            'use strict';                                                    \n\
            function [TheName](fn) {                                         \n\
                [TheProperties]                                              \n\
                this.fn = fn;                                                \n\
                this.asyncNeeded = true;                                     \n\
                this.now = 0;                                                \n\
            }                                                                \n\
                                                                             \n\
            [TheName].prototype._callFunction = function(promise) {          \n\
                promise._pushContext();                                      \n\
                var ret = tryCatch(this.fn)([ThePassedArguments]);           \n\
                promise._popContext();                                       \n\
                if (ret === errorObj) {                                      \n\
                    promise._rejectCallback(ret.e, false);                   \n\
                } else {                                                     \n\
                    promise._resolveCallback(ret);                           \n\
                }                                                            \n\
            };                                                               \n\
                                                                             \n\
            [TheName].prototype.checkFulfillment = function(promise) {       \n\
                var now = ++this.now;                                        \n\
                if (now === [TheTotal]) {                                    \n\
                    if (this.asyncNeeded) {                                  \n\
                        async.invoke(this._callFunction, this, promise);     \n\
                    } else {                                                 \n\
                        this._callFunction(promise);                         \n\
                    }                                                        \n\
                                                                             \n\
                }                                                            \n\
            };                                                               \n\
                                                                             \n\
            [TheName].prototype._resultCancelled = function() {              \n\
                [CancellationCode]                                           \n\
            };                                                               \n\
                                                                             \n\
            return [TheName];                                                \n\
        }(tryCatch, errorObj, Promise, async);                               \n\
        ";

        code = code.replace(/\[TheName\]/g, name)
            .replace(/\[TheTotal\]/g, total)
            .replace(/\[ThePassedArguments\]/g, passedArguments)
            .replace(/\[TheProperties\]/g, assignment)
            .replace(/\[CancellationCode\]/g, cancellationCode);

        return new Function("tryCatch", "errorObj", "Promise", "async", code)
                           (tryCatch, errorObj, Promise, async);
    };

    var holderClasses = [];
    var thenCallbacks = [];
    var promiseSetters = [];

    for (var i = 0; i < 8; ++i) {
        holderClasses.push(generateHolderClass(i + 1));
        thenCallbacks.push(thenCallback(i + 1));
        promiseSetters.push(promiseSetter(i + 1));
    }

    reject = function (reason) {
        this._reject(reason);
    };
}}

Promise.join = function () {
    var last = arguments.length - 1;
    var fn;
    if (last > 0 && typeof arguments[last] === "function") {
        fn = arguments[last];
        if (!true) {
            if (last <= 8 && canEvaluate) {
                var ret = new Promise(INTERNAL);
                ret._captureStackTrace();
                var HolderClass = holderClasses[last - 1];
                var holder = new HolderClass(fn);
                var callbacks = thenCallbacks;

                for (var i = 0; i < last; ++i) {
                    var maybePromise = tryConvertToPromise(arguments[i], ret);
                    if (maybePromise instanceof Promise) {
                        maybePromise = maybePromise._target();
                        var bitField = maybePromise._bitField;
                        ;
                        if (((bitField & 50397184) === 0)) {
                            maybePromise._then(callbacks[i], reject,
                                               undefined, ret, holder);
                            promiseSetters[i](maybePromise, holder);
                            holder.asyncNeeded = false;
                        } else if (((bitField & 33554432) !== 0)) {
                            callbacks[i].call(ret,
                                              maybePromise._value(), holder);
                        } else if (((bitField & 16777216) !== 0)) {
                            ret._reject(maybePromise._reason());
                        } else {
                            ret._cancel();
                        }
                    } else {
                        callbacks[i].call(ret, maybePromise, holder);
                    }
                }

                if (!ret._isFateSealed()) {
                    if (holder.asyncNeeded) {
                        var domain = getDomain();
                        if (domain !== null) {
                            holder.fn = util.domainBind(domain, holder.fn);
                        }
                    }
                    ret._setAsyncGuaranteed();
                    ret._setOnCancel(holder);
                }
                return ret;
            }
        }
    }
    var args = [].slice.call(arguments);;
    if (fn) args.pop();
    var ret = new PromiseArray(args).promise();
    return fn !== undefined ? ret.spread(fn) : ret;
};

};

},{"./util":36}],18:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise,
                          PromiseArray,
                          apiRejection,
                          tryConvertToPromise,
                          INTERNAL,
                          debug) {
var getDomain = Promise._getDomain;
var util = _dereq_("./util");
var tryCatch = util.tryCatch;
var errorObj = util.errorObj;

function MappingPromiseArray(promises, fn, limit, _filter) {
    this.constructor$(promises);
    this._promise._captureStackTrace();
    var domain = getDomain();
    this._callback = domain === null ? fn : util.domainBind(domain, fn);
    this._preservedValues = _filter === INTERNAL
        ? new Array(this.length())
        : null;
    this._limit = limit;
    this._inFlight = 0;
    this._queue = [];
    this._init$(undefined, -2);
}
util.inherits(MappingPromiseArray, PromiseArray);

MappingPromiseArray.prototype._init = function () {};

MappingPromiseArray.prototype._promiseFulfilled = function (value, index) {
    var values = this._values;
    var length = this.length();
    var preservedValues = this._preservedValues;
    var limit = this._limit;

    if (index < 0) {
        index = (index * -1) - 1;
        values[index] = value;
        if (limit >= 1) {
            this._inFlight--;
            this._drainQueue();
            if (this._isResolved()) return true;
        }
    } else {
        if (limit >= 1 && this._inFlight >= limit) {
            values[index] = value;
            this._queue.push(index);
            return false;
        }
        if (preservedValues !== null) preservedValues[index] = value;

        var promise = this._promise;
        var callback = this._callback;
        var receiver = promise._boundValue();
        promise._pushContext();
        var ret = tryCatch(callback).call(receiver, value, index, length);
        var promiseCreated = promise._popContext();
        debug.checkForgottenReturns(
            ret,
            promiseCreated,
            preservedValues !== null ? "Promise.filter" : "Promise.map",
            promise
        );
        if (ret === errorObj) {
            this._reject(ret.e);
            return true;
        }

        var maybePromise = tryConvertToPromise(ret, this._promise);
        if (maybePromise instanceof Promise) {
            maybePromise = maybePromise._target();
            var bitField = maybePromise._bitField;
            ;
            if (((bitField & 50397184) === 0)) {
                if (limit >= 1) this._inFlight++;
                values[index] = maybePromise;
                maybePromise._proxy(this, (index + 1) * -1);
                return false;
            } else if (((bitField & 33554432) !== 0)) {
                ret = maybePromise._value();
            } else if (((bitField & 16777216) !== 0)) {
                this._reject(maybePromise._reason());
                return true;
            } else {
                this._cancel();
                return true;
            }
        }
        values[index] = ret;
    }
    var totalResolved = ++this._totalResolved;
    if (totalResolved >= length) {
        if (preservedValues !== null) {
            this._filter(values, preservedValues);
        } else {
            this._resolve(values);
        }
        return true;
    }
    return false;
};

MappingPromiseArray.prototype._drainQueue = function () {
    var queue = this._queue;
    var limit = this._limit;
    var values = this._values;
    while (queue.length > 0 && this._inFlight < limit) {
        if (this._isResolved()) return;
        var index = queue.pop();
        this._promiseFulfilled(values[index], index);
    }
};

MappingPromiseArray.prototype._filter = function (booleans, values) {
    var len = values.length;
    var ret = new Array(len);
    var j = 0;
    for (var i = 0; i < len; ++i) {
        if (booleans[i]) ret[j++] = values[i];
    }
    ret.length = j;
    this._resolve(ret);
};

MappingPromiseArray.prototype.preservedValues = function () {
    return this._preservedValues;
};

function map(promises, fn, options, _filter) {
    if (typeof fn !== "function") {
        return apiRejection("expecting a function but got " + util.classString(fn));
    }

    var limit = 0;
    if (options !== undefined) {
        if (typeof options === "object" && options !== null) {
            if (typeof options.concurrency !== "number") {
                return Promise.reject(
                    new TypeError("'concurrency' must be a number but it is " +
                                    util.classString(options.concurrency)));
            }
            limit = options.concurrency;
        } else {
            return Promise.reject(new TypeError(
                            "options argument must be an object but it is " +
                             util.classString(options)));
        }
    }
    limit = typeof limit === "number" &&
        isFinite(limit) && limit >= 1 ? limit : 0;
    return new MappingPromiseArray(promises, fn, limit, _filter).promise();
}

Promise.prototype.map = function (fn, options) {
    return map(this, fn, options, null);
};

Promise.map = function (promises, fn, options, _filter) {
    return map(promises, fn, options, _filter);
};


};

},{"./util":36}],19:[function(_dereq_,module,exports){
"use strict";
module.exports =
function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {
var util = _dereq_("./util");
var tryCatch = util.tryCatch;

Promise.method = function (fn) {
    if (typeof fn !== "function") {
        throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
    }
    return function () {
        var ret = new Promise(INTERNAL);
        ret._captureStackTrace();
        ret._pushContext();
        var value = tryCatch(fn).apply(this, arguments);
        var promiseCreated = ret._popContext();
        debug.checkForgottenReturns(
            value, promiseCreated, "Promise.method", ret);
        ret._resolveFromSyncValue(value);
        return ret;
    };
};

Promise.attempt = Promise["try"] = function (fn) {
    if (typeof fn !== "function") {
        return apiRejection("expecting a function but got " + util.classString(fn));
    }
    var ret = new Promise(INTERNAL);
    ret._captureStackTrace();
    ret._pushContext();
    var value;
    if (arguments.length > 1) {
        debug.deprecated("calling Promise.try with more than 1 argument");
        var arg = arguments[1];
        var ctx = arguments[2];
        value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)
                                  : tryCatch(fn).call(ctx, arg);
    } else {
        value = tryCatch(fn)();
    }
    var promiseCreated = ret._popContext();
    debug.checkForgottenReturns(
        value, promiseCreated, "Promise.try", ret);
    ret._resolveFromSyncValue(value);
    return ret;
};

Promise.prototype._resolveFromSyncValue = function (value) {
    if (value === util.errorObj) {
        this._rejectCallback(value.e, false);
    } else {
        this._resolveCallback(value, true);
    }
};
};

},{"./util":36}],20:[function(_dereq_,module,exports){
"use strict";
var util = _dereq_("./util");
var maybeWrapAsError = util.maybeWrapAsError;
var errors = _dereq_("./errors");
var OperationalError = errors.OperationalError;
var es5 = _dereq_("./es5");

function isUntypedError(obj) {
    return obj instanceof Error &&
        es5.getPrototypeOf(obj) === Error.prototype;
}

var rErrorKey = /^(?:name|message|stack|cause)$/;
function wrapAsOperationalError(obj) {
    var ret;
    if (isUntypedError(obj)) {
        ret = new OperationalError(obj);
        ret.name = obj.name;
        ret.message = obj.message;
        ret.stack = obj.stack;
        var keys = es5.keys(obj);
        for (var i = 0; i < keys.length; ++i) {
            var key = keys[i];
            if (!rErrorKey.test(key)) {
                ret[key] = obj[key];
            }
        }
        return ret;
    }
    util.markAsOriginatingFromRejection(obj);
    return obj;
}

function nodebackForPromise(promise, multiArgs) {
    return function(err, value) {
        if (promise === null) return;
        if (err) {
            var wrapped = wrapAsOperationalError(maybeWrapAsError(err));
            promise._attachExtraTrace(wrapped);
            promise._reject(wrapped);
        } else if (!multiArgs) {
            promise._fulfill(value);
        } else {
            var args = [].slice.call(arguments, 1);;
            promise._fulfill(args);
        }
        promise = null;
    };
}

module.exports = nodebackForPromise;

},{"./errors":12,"./es5":13,"./util":36}],21:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise) {
var util = _dereq_("./util");
var async = Promise._async;
var tryCatch = util.tryCatch;
var errorObj = util.errorObj;

function spreadAdapter(val, nodeback) {
    var promise = this;
    if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);
    var ret =
        tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));
    if (ret === errorObj) {
        async.throwLater(ret.e);
    }
}

function successAdapter(val, nodeback) {
    var promise = this;
    var receiver = promise._boundValue();
    var ret = val === undefined
        ? tryCatch(nodeback).call(receiver, null)
        : tryCatch(nodeback).call(receiver, null, val);
    if (ret === errorObj) {
        async.throwLater(ret.e);
    }
}
function errorAdapter(reason, nodeback) {
    var promise = this;
    if (!reason) {
        var newReason = new Error(reason + "");
        newReason.cause = reason;
        reason = newReason;
    }
    var ret = tryCatch(nodeback).call(promise._boundValue(), reason);
    if (ret === errorObj) {
        async.throwLater(ret.e);
    }
}

Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback,
                                                                     options) {
    if (typeof nodeback == "function") {
        var adapter = successAdapter;
        if (options !== undefined && Object(options).spread) {
            adapter = spreadAdapter;
        }
        this._then(
            adapter,
            errorAdapter,
            undefined,
            this,
            nodeback
        );
    }
    return this;
};
};

},{"./util":36}],22:[function(_dereq_,module,exports){
"use strict";
module.exports = function() {
var makeSelfResolutionError = function () {
    return new TypeError("circular promise resolution chain\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
};
var reflectHandler = function() {
    return new Promise.PromiseInspection(this._target());
};
var apiRejection = function(msg) {
    return Promise.reject(new TypeError(msg));
};
function Proxyable() {}
var UNDEFINED_BINDING = {};
var util = _dereq_("./util");

var getDomain;
if (util.isNode) {
    getDomain = function() {
        var ret = process.domain;
        if (ret === undefined) ret = null;
        return ret;
    };
} else {
    getDomain = function() {
        return null;
    };
}
util.notEnumerableProp(Promise, "_getDomain", getDomain);

var es5 = _dereq_("./es5");
var Async = _dereq_("./async");
var async = new Async();
es5.defineProperty(Promise, "_async", {value: async});
var errors = _dereq_("./errors");
var TypeError = Promise.TypeError = errors.TypeError;
Promise.RangeError = errors.RangeError;
var CancellationError = Promise.CancellationError = errors.CancellationError;
Promise.TimeoutError = errors.TimeoutError;
Promise.OperationalError = errors.OperationalError;
Promise.RejectionError = errors.OperationalError;
Promise.AggregateError = errors.AggregateError;
var INTERNAL = function(){};
var APPLY = {};
var NEXT_FILTER = {};
var tryConvertToPromise = _dereq_("./thenables")(Promise, INTERNAL);
var PromiseArray =
    _dereq_("./promise_array")(Promise, INTERNAL,
                               tryConvertToPromise, apiRejection, Proxyable);
var Context = _dereq_("./context")(Promise);
 /*jshint unused:false*/
var createContext = Context.create;
var debug = _dereq_("./debuggability")(Promise, Context);
var CapturedTrace = debug.CapturedTrace;
var PassThroughHandlerContext =
    _dereq_("./finally")(Promise, tryConvertToPromise);
var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER);
var nodebackForPromise = _dereq_("./nodeback");
var errorObj = util.errorObj;
var tryCatch = util.tryCatch;
function check(self, executor) {
    if (typeof executor !== "function") {
        throw new TypeError("expecting a function but got " + util.classString(executor));
    }
    if (self.constructor !== Promise) {
        throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
    }
}

function Promise(executor) {
    this._bitField = 0;
    this._fulfillmentHandler0 = undefined;
    this._rejectionHandler0 = undefined;
    this._promise0 = undefined;
    this._receiver0 = undefined;
    if (executor !== INTERNAL) {
        check(this, executor);
        this._resolveFromExecutor(executor);
    }
    this._promiseCreated();
    this._fireEvent("promiseCreated", this);
}

Promise.prototype.toString = function () {
    return "[object Promise]";
};

Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
    var len = arguments.length;
    if (len > 1) {
        var catchInstances = new Array(len - 1),
            j = 0, i;
        for (i = 0; i < len - 1; ++i) {
            var item = arguments[i];
            if (util.isObject(item)) {
                catchInstances[j++] = item;
            } else {
                return apiRejection("expecting an object but got " +
                    "A catch statement predicate " + util.classString(item));
            }
        }
        catchInstances.length = j;
        fn = arguments[i];
        return this.then(undefined, catchFilter(catchInstances, fn, this));
    }
    return this.then(undefined, fn);
};

Promise.prototype.reflect = function () {
    return this._then(reflectHandler,
        reflectHandler, undefined, this, undefined);
};

Promise.prototype.then = function (didFulfill, didReject) {
    if (debug.warnings() && arguments.length > 0 &&
        typeof didFulfill !== "function" &&
        typeof didReject !== "function") {
        var msg = ".then() only accepts functions but was passed: " +
                util.classString(didFulfill);
        if (arguments.length > 1) {
            msg += ", " + util.classString(didReject);
        }
        this._warn(msg);
    }
    return this._then(didFulfill, didReject, undefined, undefined, undefined);
};

Promise.prototype.done = function (didFulfill, didReject) {
    var promise =
        this._then(didFulfill, didReject, undefined, undefined, undefined);
    promise._setIsFinal();
};

Promise.prototype.spread = function (fn) {
    if (typeof fn !== "function") {
        return apiRejection("expecting a function but got " + util.classString(fn));
    }
    return this.all()._then(fn, undefined, undefined, APPLY, undefined);
};

Promise.prototype.toJSON = function () {
    var ret = {
        isFulfilled: false,
        isRejected: false,
        fulfillmentValue: undefined,
        rejectionReason: undefined
    };
    if (this.isFulfilled()) {
        ret.fulfillmentValue = this.value();
        ret.isFulfilled = true;
    } else if (this.isRejected()) {
        ret.rejectionReason = this.reason();
        ret.isRejected = true;
    }
    return ret;
};

Promise.prototype.all = function () {
    if (arguments.length > 0) {
        this._warn(".all() was passed arguments but it does not take any");
    }
    return new PromiseArray(this).promise();
};

Promise.prototype.error = function (fn) {
    return this.caught(util.originatesFromRejection, fn);
};

Promise.getNewLibraryCopy = module.exports;

Promise.is = function (val) {
    return val instanceof Promise;
};

Promise.fromNode = Promise.fromCallback = function(fn) {
    var ret = new Promise(INTERNAL);
    ret._captureStackTrace();
    var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs
                                         : false;
    var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));
    if (result === errorObj) {
        ret._rejectCallback(result.e, true);
    }
    if (!ret._isFateSealed()) ret._setAsyncGuaranteed();
    return ret;
};

Promise.all = function (promises) {
    return new PromiseArray(promises).promise();
};

Promise.cast = function (obj) {
    var ret = tryConvertToPromise(obj);
    if (!(ret instanceof Promise)) {
        ret = new Promise(INTERNAL);
        ret._captureStackTrace();
        ret._setFulfilled();
        ret._rejectionHandler0 = obj;
    }
    return ret;
};

Promise.resolve = Promise.fulfilled = Promise.cast;

Promise.reject = Promise.rejected = function (reason) {
    var ret = new Promise(INTERNAL);
    ret._captureStackTrace();
    ret._rejectCallback(reason, true);
    return ret;
};

Promise.setScheduler = function(fn) {
    if (typeof fn !== "function") {
        throw new TypeError("expecting a function but got " + util.classString(fn));
    }
    return async.setScheduler(fn);
};

Promise.prototype._then = function (
    didFulfill,
    didReject,
    _,    receiver,
    internalData
) {
    var haveInternalData = internalData !== undefined;
    var promise = haveInternalData ? internalData : new Promise(INTERNAL);
    var target = this._target();
    var bitField = target._bitField;

    if (!haveInternalData) {
        promise._propagateFrom(this, 3);
        promise._captureStackTrace();
        if (receiver === undefined &&
            ((this._bitField & 2097152) !== 0)) {
            if (!((bitField & 50397184) === 0)) {
                receiver = this._boundValue();
            } else {
                receiver = target === this ? undefined : this._boundTo;
            }
        }
        this._fireEvent("promiseChained", this, promise);
    }

    var domain = getDomain();
    if (!((bitField & 50397184) === 0)) {
        var handler, value, settler = target._settlePromiseCtx;
        if (((bitField & 33554432) !== 0)) {
            value = target._rejectionHandler0;
            handler = didFulfill;
        } else if (((bitField & 16777216) !== 0)) {
            value = target._fulfillmentHandler0;
            handler = didReject;
            target._unsetRejectionIsUnhandled();
        } else {
            settler = target._settlePromiseLateCancellationObserver;
            value = new CancellationError("late cancellation observer");
            target._attachExtraTrace(value);
            handler = didReject;
        }

        async.invoke(settler, target, {
            handler: domain === null ? handler
                : (typeof handler === "function" &&
                    util.domainBind(domain, handler)),
            promise: promise,
            receiver: receiver,
            value: value
        });
    } else {
        target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
    }

    return promise;
};

Promise.prototype._length = function () {
    return this._bitField & 65535;
};

Promise.prototype._isFateSealed = function () {
    return (this._bitField & 117506048) !== 0;
};

Promise.prototype._isFollowing = function () {
    return (this._bitField & 67108864) === 67108864;
};

Promise.prototype._setLength = function (len) {
    this._bitField = (this._bitField & -65536) |
        (len & 65535);
};

Promise.prototype._setFulfilled = function () {
    this._bitField = this._bitField | 33554432;
    this._fireEvent("promiseFulfilled", this);
};

Promise.prototype._setRejected = function () {
    this._bitField = this._bitField | 16777216;
    this._fireEvent("promiseRejected", this);
};

Promise.prototype._setFollowing = function () {
    this._bitField = this._bitField | 67108864;
    this._fireEvent("promiseResolved", this);
};

Promise.prototype._setIsFinal = function () {
    this._bitField = this._bitField | 4194304;
};

Promise.prototype._isFinal = function () {
    return (this._bitField & 4194304) > 0;
};

Promise.prototype._unsetCancelled = function() {
    this._bitField = this._bitField & (~65536);
};

Promise.prototype._setCancelled = function() {
    this._bitField = this._bitField | 65536;
    this._fireEvent("promiseCancelled", this);
};

Promise.prototype._setWillBeCancelled = function() {
    this._bitField = this._bitField | 8388608;
};

Promise.prototype._setAsyncGuaranteed = function() {
    if (async.hasCustomScheduler()) return;
    this._bitField = this._bitField | 134217728;
};

Promise.prototype._receiverAt = function (index) {
    var ret = index === 0 ? this._receiver0 : this[
            index * 4 - 4 + 3];
    if (ret === UNDEFINED_BINDING) {
        return undefined;
    } else if (ret === undefined && this._isBound()) {
        return this._boundValue();
    }
    return ret;
};

Promise.prototype._promiseAt = function (index) {
    return this[
            index * 4 - 4 + 2];
};

Promise.prototype._fulfillmentHandlerAt = function (index) {
    return this[
            index * 4 - 4 + 0];
};

Promise.prototype._rejectionHandlerAt = function (index) {
    return this[
            index * 4 - 4 + 1];
};

Promise.prototype._boundValue = function() {};

Promise.prototype._migrateCallback0 = function (follower) {
    var bitField = follower._bitField;
    var fulfill = follower._fulfillmentHandler0;
    var reject = follower._rejectionHandler0;
    var promise = follower._promise0;
    var receiver = follower._receiverAt(0);
    if (receiver === undefined) receiver = UNDEFINED_BINDING;
    this._addCallbacks(fulfill, reject, promise, receiver, null);
};

Promise.prototype._migrateCallbackAt = function (follower, index) {
    var fulfill = follower._fulfillmentHandlerAt(index);
    var reject = follower._rejectionHandlerAt(index);
    var promise = follower._promiseAt(index);
    var receiver = follower._receiverAt(index);
    if (receiver === undefined) receiver = UNDEFINED_BINDING;
    this._addCallbacks(fulfill, reject, promise, receiver, null);
};

Promise.prototype._addCallbacks = function (
    fulfill,
    reject,
    promise,
    receiver,
    domain
) {
    var index = this._length();

    if (index >= 65535 - 4) {
        index = 0;
        this._setLength(0);
    }

    if (index === 0) {
        this._promise0 = promise;
        this._receiver0 = receiver;
        if (typeof fulfill === "function") {
            this._fulfillmentHandler0 =
                domain === null ? fulfill : util.domainBind(domain, fulfill);
        }
        if (typeof reject === "function") {
            this._rejectionHandler0 =
                domain === null ? reject : util.domainBind(domain, reject);
        }
    } else {
        var base = index * 4 - 4;
        this[base + 2] = promise;
        this[base + 3] = receiver;
        if (typeof fulfill === "function") {
            this[base + 0] =
                domain === null ? fulfill : util.domainBind(domain, fulfill);
        }
        if (typeof reject === "function") {
            this[base + 1] =
                domain === null ? reject : util.domainBind(domain, reject);
        }
    }
    this._setLength(index + 1);
    return index;
};

Promise.prototype._proxy = function (proxyable, arg) {
    this._addCallbacks(undefined, undefined, arg, proxyable, null);
};

Promise.prototype._resolveCallback = function(value, shouldBind) {
    if (((this._bitField & 117506048) !== 0)) return;
    if (value === this)
        return this._rejectCallback(makeSelfResolutionError(), false);
    var maybePromise = tryConvertToPromise(value, this);
    if (!(maybePromise instanceof Promise)) return this._fulfill(value);

    if (shouldBind) this._propagateFrom(maybePromise, 2);

    var promise = maybePromise._target();

    if (promise === this) {
        this._reject(makeSelfResolutionError());
        return;
    }

    var bitField = promise._bitField;
    if (((bitField & 50397184) === 0)) {
        var len = this._length();
        if (len > 0) promise._migrateCallback0(this);
        for (var i = 1; i < len; ++i) {
            promise._migrateCallbackAt(this, i);
        }
        this._setFollowing();
        this._setLength(0);
        this._setFollowee(promise);
    } else if (((bitField & 33554432) !== 0)) {
        this._fulfill(promise._value());
    } else if (((bitField & 16777216) !== 0)) {
        this._reject(promise._reason());
    } else {
        var reason = new CancellationError("late cancellation observer");
        promise._attachExtraTrace(reason);
        this._reject(reason);
    }
};

Promise.prototype._rejectCallback =
function(reason, synchronous, ignoreNonErrorWarnings) {
    var trace = util.ensureErrorObject(reason);
    var hasStack = trace === reason;
    if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
        var message = "a promise was rejected with a non-error: " +
            util.classString(reason);
        this._warn(message, true);
    }
    this._attachExtraTrace(trace, synchronous ? hasStack : false);
    this._reject(reason);
};

Promise.prototype._resolveFromExecutor = function (executor) {
    var promise = this;
    this._captureStackTrace();
    this._pushContext();
    var synchronous = true;
    var r = this._execute(executor, function(value) {
        promise._resolveCallback(value);
    }, function (reason) {
        promise._rejectCallback(reason, synchronous);
    });
    synchronous = false;
    this._popContext();

    if (r !== undefined) {
        promise._rejectCallback(r, true);
    }
};

Promise.prototype._settlePromiseFromHandler = function (
    handler, receiver, value, promise
) {
    var bitField = promise._bitField;
    if (((bitField & 65536) !== 0)) return;
    promise._pushContext();
    var x;
    if (receiver === APPLY) {
        if (!value || typeof value.length !== "number") {
            x = errorObj;
            x.e = new TypeError("cannot .spread() a non-array: " +
                                    util.classString(value));
        } else {
            x = tryCatch(handler).apply(this._boundValue(), value);
        }
    } else {
        x = tryCatch(handler).call(receiver, value);
    }
    var promiseCreated = promise._popContext();
    bitField = promise._bitField;
    if (((bitField & 65536) !== 0)) return;

    if (x === NEXT_FILTER) {
        promise._reject(value);
    } else if (x === errorObj) {
        promise._rejectCallback(x.e, false);
    } else {
        debug.checkForgottenReturns(x, promiseCreated, "",  promise, this);
        promise._resolveCallback(x);
    }
};

Promise.prototype._target = function() {
    var ret = this;
    while (ret._isFollowing()) ret = ret._followee();
    return ret;
};

Promise.prototype._followee = function() {
    return this._rejectionHandler0;
};

Promise.prototype._setFollowee = function(promise) {
    this._rejectionHandler0 = promise;
};

Promise.prototype._settlePromise = function(promise, handler, receiver, value) {
    var isPromise = promise instanceof Promise;
    var bitField = this._bitField;
    var asyncGuaranteed = ((bitField & 134217728) !== 0);
    if (((bitField & 65536) !== 0)) {
        if (isPromise) promise._invokeInternalOnCancel();

        if (receiver instanceof PassThroughHandlerContext &&
            receiver.isFinallyHandler()) {
            receiver.cancelPromise = promise;
            if (tryCatch(handler).call(receiver, value) === errorObj) {
                promise._reject(errorObj.e);
            }
        } else if (handler === reflectHandler) {
            promise._fulfill(reflectHandler.call(receiver));
        } else if (receiver instanceof Proxyable) {
            receiver._promiseCancelled(promise);
        } else if (isPromise || promise instanceof PromiseArray) {
            promise._cancel();
        } else {
            receiver.cancel();
        }
    } else if (typeof handler === "function") {
        if (!isPromise) {
            handler.call(receiver, value, promise);
        } else {
            if (asyncGuaranteed) promise._setAsyncGuaranteed();
            this._settlePromiseFromHandler(handler, receiver, value, promise);
        }
    } else if (receiver instanceof Proxyable) {
        if (!receiver._isResolved()) {
            if (((bitField & 33554432) !== 0)) {
                receiver._promiseFulfilled(value, promise);
            } else {
                receiver._promiseRejected(value, promise);
            }
        }
    } else if (isPromise) {
        if (asyncGuaranteed) promise._setAsyncGuaranteed();
        if (((bitField & 33554432) !== 0)) {
            promise._fulfill(value);
        } else {
            promise._reject(value);
        }
    }
};

Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) {
    var handler = ctx.handler;
    var promise = ctx.promise;
    var receiver = ctx.receiver;
    var value = ctx.value;
    if (typeof handler === "function") {
        if (!(promise instanceof Promise)) {
            handler.call(receiver, value, promise);
        } else {
            this._settlePromiseFromHandler(handler, receiver, value, promise);
        }
    } else if (promise instanceof Promise) {
        promise._reject(value);
    }
};

Promise.prototype._settlePromiseCtx = function(ctx) {
    this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
};

Promise.prototype._settlePromise0 = function(handler, value, bitField) {
    var promise = this._promise0;
    var receiver = this._receiverAt(0);
    this._promise0 = undefined;
    this._receiver0 = undefined;
    this._settlePromise(promise, handler, receiver, value);
};

Promise.prototype._clearCallbackDataAtIndex = function(index) {
    var base = index * 4 - 4;
    this[base + 2] =
    this[base + 3] =
    this[base + 0] =
    this[base + 1] = undefined;
};

Promise.prototype._fulfill = function (value) {
    var bitField = this._bitField;
    if (((bitField & 117506048) >>> 16)) return;
    if (value === this) {
        var err = makeSelfResolutionError();
        this._attachExtraTrace(err);
        return this._reject(err);
    }
    this._setFulfilled();
    this._rejectionHandler0 = value;

    if ((bitField & 65535) > 0) {
        if (((bitField & 134217728) !== 0)) {
            this._settlePromises();
        } else {
            async.settlePromises(this);
        }
    }
};

Promise.prototype._reject = function (reason) {
    var bitField = this._bitField;
    if (((bitField & 117506048) >>> 16)) return;
    this._setRejected();
    this._fulfillmentHandler0 = reason;

    if (this._isFinal()) {
        return async.fatalError(reason, util.isNode);
    }

    if ((bitField & 65535) > 0) {
        async.settlePromises(this);
    } else {
        this._ensurePossibleRejectionHandled();
    }
};

Promise.prototype._fulfillPromises = function (len, value) {
    for (var i = 1; i < len; i++) {
        var handler = this._fulfillmentHandlerAt(i);
        var promise = this._promiseAt(i);
        var receiver = this._receiverAt(i);
        this._clearCallbackDataAtIndex(i);
        this._settlePromise(promise, handler, receiver, value);
    }
};

Promise.prototype._rejectPromises = function (len, reason) {
    for (var i = 1; i < len; i++) {
        var handler = this._rejectionHandlerAt(i);
        var promise = this._promiseAt(i);
        var receiver = this._receiverAt(i);
        this._clearCallbackDataAtIndex(i);
        this._settlePromise(promise, handler, receiver, reason);
    }
};

Promise.prototype._settlePromises = function () {
    var bitField = this._bitField;
    var len = (bitField & 65535);

    if (len > 0) {
        if (((bitField & 16842752) !== 0)) {
            var reason = this._fulfillmentHandler0;
            this._settlePromise0(this._rejectionHandler0, reason, bitField);
            this._rejectPromises(len, reason);
        } else {
            var value = this._rejectionHandler0;
            this._settlePromise0(this._fulfillmentHandler0, value, bitField);
            this._fulfillPromises(len, value);
        }
        this._setLength(0);
    }
    this._clearCancellationData();
};

Promise.prototype._settledValue = function() {
    var bitField = this._bitField;
    if (((bitField & 33554432) !== 0)) {
        return this._rejectionHandler0;
    } else if (((bitField & 16777216) !== 0)) {
        return this._fulfillmentHandler0;
    }
};

function deferResolve(v) {this.promise._resolveCallback(v);}
function deferReject(v) {this.promise._rejectCallback(v, false);}

Promise.defer = Promise.pending = function() {
    debug.deprecated("Promise.defer", "new Promise");
    var promise = new Promise(INTERNAL);
    return {
        promise: promise,
        resolve: deferResolve,
        reject: deferReject
    };
};

util.notEnumerableProp(Promise,
                       "_makeSelfResolutionError",
                       makeSelfResolutionError);

_dereq_("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection,
    debug);
_dereq_("./bind")(Promise, INTERNAL, tryConvertToPromise, debug);
_dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug);
_dereq_("./direct_resolve")(Promise);
_dereq_("./synchronous_inspection")(Promise);
_dereq_("./join")(
    Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);
Promise.Promise = Promise;
Promise.version = "3.4.5";
_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
_dereq_('./call_get.js')(Promise);
_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
_dereq_('./timers.js')(Promise, INTERNAL, debug);
_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
_dereq_('./nodeify.js')(Promise);
_dereq_('./promisify.js')(Promise, INTERNAL);
_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);
_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);
_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
_dereq_('./settle.js')(Promise, PromiseArray, debug);
_dereq_('./some.js')(Promise, PromiseArray, apiRejection);
_dereq_('./filter.js')(Promise, INTERNAL);
_dereq_('./each.js')(Promise, INTERNAL);
_dereq_('./any.js')(Promise);
                                                         
    util.toFastProperties(Promise);                                          
    util.toFastProperties(Promise.prototype);                                
    function fillTypes(value) {                                              
        var p = new Promise(INTERNAL);                                       
        p._fulfillmentHandler0 = value;                                      
        p._rejectionHandler0 = value;                                        
        p._promise0 = value;                                                 
        p._receiver0 = value;                                                
    }                                                                        
    // Complete slack tracking, opt out of field-type tracking and           
    // stabilize map                                                         
    fillTypes({a: 1});                                                       
    fillTypes({b: 2});                                                       
    fillTypes({c: 3});                                                       
    fillTypes(1);                                                            
    fillTypes(function(){});                                                 
    fillTypes(undefined);                                                    
    fillTypes(false);                                                        
    fillTypes(new Promise(INTERNAL));                                        
    debug.setBounds(Async.firstLineError, util.lastLineError);               
    return Promise;                                                          

};

},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise, INTERNAL, tryConvertToPromise,
    apiRejection, Proxyable) {
var util = _dereq_("./util");
var isArray = util.isArray;

function toResolutionValue(val) {
    switch(val) {
    case -2: return [];
    case -3: return {};
    }
}

function PromiseArray(values) {
    var promise = this._promise = new Promise(INTERNAL);
    if (values instanceof Promise) {
        promise._propagateFrom(values, 3);
    }
    promise._setOnCancel(this);
    this._values = values;
    this._length = 0;
    this._totalResolved = 0;
    this._init(undefined, -2);
}
util.inherits(PromiseArray, Proxyable);

PromiseArray.prototype.length = function () {
    return this._length;
};

PromiseArray.prototype.promise = function () {
    return this._promise;
};

PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
    var values = tryConvertToPromise(this._values, this._promise);
    if (values instanceof Promise) {
        values = values._target();
        var bitField = values._bitField;
        ;
        this._values = values;

        if (((bitField & 50397184) === 0)) {
            this._promise._setAsyncGuaranteed();
            return values._then(
                init,
                this._reject,
                undefined,
                this,
                resolveValueIfEmpty
           );
        } else if (((bitField & 33554432) !== 0)) {
            values = values._value();
        } else if (((bitField & 16777216) !== 0)) {
            return this._reject(values._reason());
        } else {
            return this._cancel();
        }
    }
    values = util.asArray(values);
    if (values === null) {
        var err = apiRejection(
            "expecting an array or an iterable object but got " + util.classString(values)).reason();
        this._promise._rejectCallback(err, false);
        return;
    }

    if (values.length === 0) {
        if (resolveValueIfEmpty === -5) {
            this._resolveEmptyArray();
        }
        else {
            this._resolve(toResolutionValue(resolveValueIfEmpty));
        }
        return;
    }
    this._iterate(values);
};

PromiseArray.prototype._iterate = function(values) {
    var len = this.getActualLength(values.length);
    this._length = len;
    this._values = this.shouldCopyValues() ? new Array(len) : this._values;
    var result = this._promise;
    var isResolved = false;
    var bitField = null;
    for (var i = 0; i < len; ++i) {
        var maybePromise = tryConvertToPromise(values[i], result);

        if (maybePromise instanceof Promise) {
            maybePromise = maybePromise._target();
            bitField = maybePromise._bitField;
        } else {
            bitField = null;
        }

        if (isResolved) {
            if (bitField !== null) {
                maybePromise.suppressUnhandledRejections();
            }
        } else if (bitField !== null) {
            if (((bitField & 50397184) === 0)) {
                maybePromise._proxy(this, i);
                this._values[i] = maybePromise;
            } else if (((bitField & 33554432) !== 0)) {
                isResolved = this._promiseFulfilled(maybePromise._value(), i);
            } else if (((bitField & 16777216) !== 0)) {
                isResolved = this._promiseRejected(maybePromise._reason(), i);
            } else {
                isResolved = this._promiseCancelled(i);
            }
        } else {
            isResolved = this._promiseFulfilled(maybePromise, i);
        }
    }
    if (!isResolved) result._setAsyncGuaranteed();
};

PromiseArray.prototype._isResolved = function () {
    return this._values === null;
};

PromiseArray.prototype._resolve = function (value) {
    this._values = null;
    this._promise._fulfill(value);
};

PromiseArray.prototype._cancel = function() {
    if (this._isResolved() || !this._promise._isCancellable()) return;
    this._values = null;
    this._promise._cancel();
};

PromiseArray.prototype._reject = function (reason) {
    this._values = null;
    this._promise._rejectCallback(reason, false);
};

PromiseArray.prototype._promiseFulfilled = function (value, index) {
    this._values[index] = value;
    var totalResolved = ++this._totalResolved;
    if (totalResolved >= this._length) {
        this._resolve(this._values);
        return true;
    }
    return false;
};

PromiseArray.prototype._promiseCancelled = function() {
    this._cancel();
    return true;
};

PromiseArray.prototype._promiseRejected = function (reason) {
    this._totalResolved++;
    this._reject(reason);
    return true;
};

PromiseArray.prototype._resultCancelled = function() {
    if (this._isResolved()) return;
    var values = this._values;
    this._cancel();
    if (values instanceof Promise) {
        values.cancel();
    } else {
        for (var i = 0; i < values.length; ++i) {
            if (values[i] instanceof Promise) {
                values[i].cancel();
            }
        }
    }
};

PromiseArray.prototype.shouldCopyValues = function () {
    return true;
};

PromiseArray.prototype.getActualLength = function (len) {
    return len;
};

return PromiseArray;
};

},{"./util":36}],24:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise, INTERNAL) {
var THIS = {};
var util = _dereq_("./util");
var nodebackForPromise = _dereq_("./nodeback");
var withAppended = util.withAppended;
var maybeWrapAsError = util.maybeWrapAsError;
var canEvaluate = util.canEvaluate;
var TypeError = _dereq_("./errors").TypeError;
var defaultSuffix = "Async";
var defaultPromisified = {__isPromisified__: true};
var noCopyProps = [
    "arity",    "length",
    "name",
    "arguments",
    "caller",
    "callee",
    "prototype",
    "__isPromisified__"
];
var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");

var defaultFilter = function(name) {
    return util.isIdentifier(name) &&
        name.charAt(0) !== "_" &&
        name !== "constructor";
};

function propsFilter(key) {
    return !noCopyPropsPattern.test(key);
}

function isPromisified(fn) {
    try {
        return fn.__isPromisified__ === true;
    }
    catch (e) {
        return false;
    }
}

function hasPromisified(obj, key, suffix) {
    var val = util.getDataPropertyOrDefault(obj, key + suffix,
                                            defaultPromisified);
    return val ? isPromisified(val) : false;
}
function checkValid(ret, suffix, suffixRegexp) {
    for (var i = 0; i < ret.length; i += 2) {
        var key = ret[i];
        if (suffixRegexp.test(key)) {
            var keyWithoutAsyncSuffix = key.replace(suffixRegexp, "");
            for (var j = 0; j < ret.length; j += 2) {
                if (ret[j] === keyWithoutAsyncSuffix) {
                    throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a    See http://goo.gl/MqrFmX\u000a"
                        .replace("%s", suffix));
                }
            }
        }
    }
}

function promisifiableMethods(obj, suffix, suffixRegexp, filter) {
    var keys = util.inheritedDataKeys(obj);
    var ret = [];
    for (var i = 0; i < keys.length; ++i) {
        var key = keys[i];
        var value = obj[key];
        var passesDefaultFilter = filter === defaultFilter
            ? true : defaultFilter(key, value, obj);
        if (typeof value === "function" &&
            !isPromisified(value) &&
            !hasPromisified(obj, key, suffix) &&
            filter(key, value, obj, passesDefaultFilter)) {
            ret.push(key, value);
        }
    }
    checkValid(ret, suffix, suffixRegexp);
    return ret;
}

var escapeIdentRegex = function(str) {
    return str.replace(/([$])/, "\\$");
};

var makeNodePromisifiedEval;
if (!true) {
var switchCaseArgumentOrder = function(likelyArgumentCount) {
    var ret = [likelyArgumentCount];
    var min = Math.max(0, likelyArgumentCount - 1 - 3);
    for(var i = likelyArgumentCount - 1; i >= min; --i) {
        ret.push(i);
    }
    for(var i = likelyArgumentCount + 1; i <= 3; ++i) {
        ret.push(i);
    }
    return ret;
};

var argumentSequence = function(argumentCount) {
    return util.filledRange(argumentCount, "_arg", "");
};

var parameterDeclaration = function(parameterCount) {
    return util.filledRange(
        Math.max(parameterCount, 3), "_arg", "");
};

var parameterCount = function(fn) {
    if (typeof fn.length === "number") {
        return Math.max(Math.min(fn.length, 1023 + 1), 0);
    }
    return 0;
};

makeNodePromisifiedEval =
function(callback, receiver, originalName, fn, _, multiArgs) {
    var newParameterCount = Math.max(0, parameterCount(fn) - 1);
    var argumentOrder = switchCaseArgumentOrder(newParameterCount);
    var shouldProxyThis = typeof callback === "string" || receiver === THIS;

    function generateCallForArgumentCount(count) {
        var args = argumentSequence(count).join(", ");
        var comma = count > 0 ? ", " : "";
        var ret;
        if (shouldProxyThis) {
            ret = "ret = callback.call(this, {{args}}, nodeback); break;\n";
        } else {
            ret = receiver === undefined
                ? "ret = callback({{args}}, nodeback); break;\n"
                : "ret = callback.call(receiver, {{args}}, nodeback); break;\n";
        }
        return ret.replace("{{args}}", args).replace(", ", comma);
    }

    function generateArgumentSwitchCase() {
        var ret = "";
        for (var i = 0; i < argumentOrder.length; ++i) {
            ret += "case " + argumentOrder[i] +":" +
                generateCallForArgumentCount(argumentOrder[i]);
        }

        ret += "                                                             \n\
        default:                                                             \n\
            var args = new Array(len + 1);                                   \n\
            var i = 0;                                                       \n\
            for (var i = 0; i < len; ++i) {                                  \n\
               args[i] = arguments[i];                                       \n\
            }                                                                \n\
            args[i] = nodeback;                                              \n\
            [CodeForCall]                                                    \n\
            break;                                                           \n\
        ".replace("[CodeForCall]", (shouldProxyThis
                                ? "ret = callback.apply(this, args);\n"
                                : "ret = callback.apply(receiver, args);\n"));
        return ret;
    }

    var getFunctionCode = typeof callback === "string"
                                ? ("this != null ? this['"+callback+"'] : fn")
                                : "fn";
    var body = "'use strict';                                                \n\
        var ret = function (Parameters) {                                    \n\
            'use strict';                                                    \n\
            var len = arguments.length;                                      \n\
            var promise = new Promise(INTERNAL);                             \n\
            promise._captureStackTrace();                                    \n\
            var nodeback = nodebackForPromise(promise, " + multiArgs + ");   \n\
            var ret;                                                         \n\
            var callback = tryCatch([GetFunctionCode]);                      \n\
            switch(len) {                                                    \n\
                [CodeForSwitchCase]                                          \n\
            }                                                                \n\
            if (ret === errorObj) {                                          \n\
                promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\
            }                                                                \n\
            if (!promise._isFateSealed()) promise._setAsyncGuaranteed();     \n\
            return promise;                                                  \n\
        };                                                                   \n\
        notEnumerableProp(ret, '__isPromisified__', true);                   \n\
        return ret;                                                          \n\
    ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase())
        .replace("[GetFunctionCode]", getFunctionCode);
    body = body.replace("Parameters", parameterDeclaration(newParameterCount));
    return new Function("Promise",
                        "fn",
                        "receiver",
                        "withAppended",
                        "maybeWrapAsError",
                        "nodebackForPromise",
                        "tryCatch",
                        "errorObj",
                        "notEnumerableProp",
                        "INTERNAL",
                        body)(
                    Promise,
                    fn,
                    receiver,
                    withAppended,
                    maybeWrapAsError,
                    nodebackForPromise,
                    util.tryCatch,
                    util.errorObj,
                    util.notEnumerableProp,
                    INTERNAL);
};
}

function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {
    var defaultThis = (function() {return this;})();
    var method = callback;
    if (typeof method === "string") {
        callback = fn;
    }
    function promisified() {
        var _receiver = receiver;
        if (receiver === THIS) _receiver = this;
        var promise = new Promise(INTERNAL);
        promise._captureStackTrace();
        var cb = typeof method === "string" && this !== defaultThis
            ? this[method] : callback;
        var fn = nodebackForPromise(promise, multiArgs);
        try {
            cb.apply(_receiver, withAppended(arguments, fn));
        } catch(e) {
            promise._rejectCallback(maybeWrapAsError(e), true, true);
        }
        if (!promise._isFateSealed()) promise._setAsyncGuaranteed();
        return promise;
    }
    util.notEnumerableProp(promisified, "__isPromisified__", true);
    return promisified;
}

var makeNodePromisified = canEvaluate
    ? makeNodePromisifiedEval
    : makeNodePromisifiedClosure;

function promisifyAll(obj, suffix, filter, promisifier, multiArgs) {
    var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$");
    var methods =
        promisifiableMethods(obj, suffix, suffixRegexp, filter);

    for (var i = 0, len = methods.length; i < len; i+= 2) {
        var key = methods[i];
        var fn = methods[i+1];
        var promisifiedKey = key + suffix;
        if (promisifier === makeNodePromisified) {
            obj[promisifiedKey] =
                makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
        } else {
            var promisified = promisifier(fn, function() {
                return makeNodePromisified(key, THIS, key,
                                           fn, suffix, multiArgs);
            });
            util.notEnumerableProp(promisified, "__isPromisified__", true);
            obj[promisifiedKey] = promisified;
        }
    }
    util.toFastProperties(obj);
    return obj;
}

function promisify(callback, receiver, multiArgs) {
    return makeNodePromisified(callback, receiver, undefined,
                                callback, null, multiArgs);
}

Promise.promisify = function (fn, options) {
    if (typeof fn !== "function") {
        throw new TypeError("expecting a function but got " + util.classString(fn));
    }
    if (isPromisified(fn)) {
        return fn;
    }
    options = Object(options);
    var receiver = options.context === undefined ? THIS : options.context;
    var multiArgs = !!options.multiArgs;
    var ret = promisify(fn, receiver, multiArgs);
    util.copyDescriptors(fn, ret, propsFilter);
    return ret;
};

Promise.promisifyAll = function (target, options) {
    if (typeof target !== "function" && typeof target !== "object") {
        throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
    }
    options = Object(options);
    var multiArgs = !!options.multiArgs;
    var suffix = options.suffix;
    if (typeof suffix !== "string") suffix = defaultSuffix;
    var filter = options.filter;
    if (typeof filter !== "function") filter = defaultFilter;
    var promisifier = options.promisifier;
    if (typeof promisifier !== "function") promisifier = makeNodePromisified;

    if (!util.isIdentifier(suffix)) {
        throw new RangeError("suffix must be a valid identifier\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
    }

    var keys = util.inheritedDataKeys(target);
    for (var i = 0; i < keys.length; ++i) {
        var value = target[keys[i]];
        if (keys[i] !== "constructor" &&
            util.isClass(value)) {
            promisifyAll(value.prototype, suffix, filter, promisifier,
                multiArgs);
            promisifyAll(value, suffix, filter, promisifier, multiArgs);
        }
    }

    return promisifyAll(target, suffix, filter, promisifier, multiArgs);
};
};


},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(_dereq_,module,exports){
"use strict";
module.exports = function(
    Promise, PromiseArray, tryConvertToPromise, apiRejection) {
var util = _dereq_("./util");
var isObject = util.isObject;
var es5 = _dereq_("./es5");
var Es6Map;
if (typeof Map === "function") Es6Map = Map;

var mapToEntries = (function() {
    var index = 0;
    var size = 0;

    function extractEntry(value, key) {
        this[index] = value;
        this[index + size] = key;
        index++;
    }

    return function mapToEntries(map) {
        size = map.size;
        index = 0;
        var ret = new Array(map.size * 2);
        map.forEach(extractEntry, ret);
        return ret;
    };
})();

var entriesToMap = function(entries) {
    var ret = new Es6Map();
    var length = entries.length / 2 | 0;
    for (var i = 0; i < length; ++i) {
        var key = entries[length + i];
        var value = entries[i];
        ret.set(key, value);
    }
    return ret;
};

function PropertiesPromiseArray(obj) {
    var isMap = false;
    var entries;
    if (Es6Map !== undefined && obj instanceof Es6Map) {
        entries = mapToEntries(obj);
        isMap = true;
    } else {
        var keys = es5.keys(obj);
        var len = keys.length;
        entries = new Array(len * 2);
        for (var i = 0; i < len; ++i) {
            var key = keys[i];
            entries[i] = obj[key];
            entries[i + len] = key;
        }
    }
    this.constructor$(entries);
    this._isMap = isMap;
    this._init$(undefined, -3);
}
util.inherits(PropertiesPromiseArray, PromiseArray);

PropertiesPromiseArray.prototype._init = function () {};

PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {
    this._values[index] = value;
    var totalResolved = ++this._totalResolved;
    if (totalResolved >= this._length) {
        var val;
        if (this._isMap) {
            val = entriesToMap(this._values);
        } else {
            val = {};
            var keyOffset = this.length();
            for (var i = 0, len = this.length(); i < len; ++i) {
                val[this._values[i + keyOffset]] = this._values[i];
            }
        }
        this._resolve(val);
        return true;
    }
    return false;
};

PropertiesPromiseArray.prototype.shouldCopyValues = function () {
    return false;
};

PropertiesPromiseArray.prototype.getActualLength = function (len) {
    return len >> 1;
};

function props(promises) {
    var ret;
    var castValue = tryConvertToPromise(promises);

    if (!isObject(castValue)) {
        return apiRejection("cannot await properties of a non-object\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
    } else if (castValue instanceof Promise) {
        ret = castValue._then(
            Promise.props, undefined, undefined, undefined, undefined);
    } else {
        ret = new PropertiesPromiseArray(castValue).promise();
    }

    if (castValue instanceof Promise) {
        ret._propagateFrom(castValue, 2);
    }
    return ret;
}

Promise.prototype.props = function () {
    return props(this);
};

Promise.props = function (promises) {
    return props(promises);
};
};

},{"./es5":13,"./util":36}],26:[function(_dereq_,module,exports){
"use strict";
function arrayMove(src, srcIndex, dst, dstIndex, len) {
    for (var j = 0; j < len; ++j) {
        dst[j + dstIndex] = src[j + srcIndex];
        src[j + srcIndex] = void 0;
    }
}

function Queue(capacity) {
    this._capacity = capacity;
    this._length = 0;
    this._front = 0;
}

Queue.prototype._willBeOverCapacity = function (size) {
    return this._capacity < size;
};

Queue.prototype._pushOne = function (arg) {
    var length = this.length();
    this._checkCapacity(length + 1);
    var i = (this._front + length) & (this._capacity - 1);
    this[i] = arg;
    this._length = length + 1;
};

Queue.prototype._unshiftOne = function(value) {
    var capacity = this._capacity;
    this._checkCapacity(this.length() + 1);
    var front = this._front;
    var i = (((( front - 1 ) &
                    ( capacity - 1) ) ^ capacity ) - capacity );
    this[i] = value;
    this._front = i;
    this._length = this.length() + 1;
};

Queue.prototype.unshift = function(fn, receiver, arg) {
    this._unshiftOne(arg);
    this._unshiftOne(receiver);
    this._unshiftOne(fn);
};

Queue.prototype.push = function (fn, receiver, arg) {
    var length = this.length() + 3;
    if (this._willBeOverCapacity(length)) {
        this._pushOne(fn);
        this._pushOne(receiver);
        this._pushOne(arg);
        return;
    }
    var j = this._front + length - 3;
    this._checkCapacity(length);
    var wrapMask = this._capacity - 1;
    this[(j + 0) & wrapMask] = fn;
    this[(j + 1) & wrapMask] = receiver;
    this[(j + 2) & wrapMask] = arg;
    this._length = length;
};

Queue.prototype.shift = function () {
    var front = this._front,
        ret = this[front];

    this[front] = undefined;
    this._front = (front + 1) & (this._capacity - 1);
    this._length--;
    return ret;
};

Queue.prototype.length = function () {
    return this._length;
};

Queue.prototype._checkCapacity = function (size) {
    if (this._capacity < size) {
        this._resizeTo(this._capacity << 1);
    }
};

Queue.prototype._resizeTo = function (capacity) {
    var oldCapacity = this._capacity;
    this._capacity = capacity;
    var front = this._front;
    var length = this._length;
    var moveItemsCount = (front + length) & (oldCapacity - 1);
    arrayMove(this, 0, this, oldCapacity, moveItemsCount);
};

module.exports = Queue;

},{}],27:[function(_dereq_,module,exports){
"use strict";
module.exports = function(
    Promise, INTERNAL, tryConvertToPromise, apiRejection) {
var util = _dereq_("./util");

var raceLater = function (promise) {
    return promise.then(function(array) {
        return race(array, promise);
    });
};

function race(promises, parent) {
    var maybePromise = tryConvertToPromise(promises);

    if (maybePromise instanceof Promise) {
        return raceLater(maybePromise);
    } else {
        promises = util.asArray(promises);
        if (promises === null)
            return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
    }

    var ret = new Promise(INTERNAL);
    if (parent !== undefined) {
        ret._propagateFrom(parent, 3);
    }
    var fulfill = ret._fulfill;
    var reject = ret._reject;
    for (var i = 0, len = promises.length; i < len; ++i) {
        var val = promises[i];

        if (val === undefined && !(i in promises)) {
            continue;
        }

        Promise.cast(val)._then(fulfill, reject, undefined, ret, null);
    }
    return ret;
}

Promise.race = function (promises) {
    return race(promises, undefined);
};

Promise.prototype.race = function () {
    return race(this, undefined);
};

};

},{"./util":36}],28:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise,
                          PromiseArray,
                          apiRejection,
                          tryConvertToPromise,
                          INTERNAL,
                          debug) {
var getDomain = Promise._getDomain;
var util = _dereq_("./util");
var tryCatch = util.tryCatch;

function ReductionPromiseArray(promises, fn, initialValue, _each) {
    this.constructor$(promises);
    var domain = getDomain();
    this._fn = domain === null ? fn : util.domainBind(domain, fn);
    if (initialValue !== undefined) {
        initialValue = Promise.resolve(initialValue);
        initialValue._attachCancellationCallback(this);
    }
    this._initialValue = initialValue;
    this._currentCancellable = null;
    if(_each === INTERNAL) {
        this._eachValues = Array(this._length);
    } else if (_each === 0) {
        this._eachValues = null;
    } else {
        this._eachValues = undefined;
    }
    this._promise._captureStackTrace();
    this._init$(undefined, -5);
}
util.inherits(ReductionPromiseArray, PromiseArray);

ReductionPromiseArray.prototype._gotAccum = function(accum) {
    if (this._eachValues !== undefined && 
        this._eachValues !== null && 
        accum !== INTERNAL) {
        this._eachValues.push(accum);
    }
};

ReductionPromiseArray.prototype._eachComplete = function(value) {
    if (this._eachValues !== null) {
        this._eachValues.push(value);
    }
    return this._eachValues;
};

ReductionPromiseArray.prototype._init = function() {};

ReductionPromiseArray.prototype._resolveEmptyArray = function() {
    this._resolve(this._eachValues !== undefined ? this._eachValues
                                                 : this._initialValue);
};

ReductionPromiseArray.prototype.shouldCopyValues = function () {
    return false;
};

ReductionPromiseArray.prototype._resolve = function(value) {
    this._promise._resolveCallback(value);
    this._values = null;
};

ReductionPromiseArray.prototype._resultCancelled = function(sender) {
    if (sender === this._initialValue) return this._cancel();
    if (this._isResolved()) return;
    this._resultCancelled$();
    if (this._currentCancellable instanceof Promise) {
        this._currentCancellable.cancel();
    }
    if (this._initialValue instanceof Promise) {
        this._initialValue.cancel();
    }
};

ReductionPromiseArray.prototype._iterate = function (values) {
    this._values = values;
    var value;
    var i;
    var length = values.length;
    if (this._initialValue !== undefined) {
        value = this._initialValue;
        i = 0;
    } else {
        value = Promise.resolve(values[0]);
        i = 1;
    }

    this._currentCancellable = value;

    if (!value.isRejected()) {
        for (; i < length; ++i) {
            var ctx = {
                accum: null,
                value: values[i],
                index: i,
                length: length,
                array: this
            };
            value = value._then(gotAccum, undefined, undefined, ctx, undefined);
        }
    }

    if (this._eachValues !== undefined) {
        value = value
            ._then(this._eachComplete, undefined, undefined, this, undefined);
    }
    value._then(completed, completed, undefined, value, this);
};

Promise.prototype.reduce = function (fn, initialValue) {
    return reduce(this, fn, initialValue, null);
};

Promise.reduce = function (promises, fn, initialValue, _each) {
    return reduce(promises, fn, initialValue, _each);
};

function completed(valueOrReason, array) {
    if (this.isFulfilled()) {
        array._resolve(valueOrReason);
    } else {
        array._reject(valueOrReason);
    }
}

function reduce(promises, fn, initialValue, _each) {
    if (typeof fn !== "function") {
        return apiRejection("expecting a function but got " + util.classString(fn));
    }
    var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
    return array.promise();
}

function gotAccum(accum) {
    this.accum = accum;
    this.array._gotAccum(accum);
    var value = tryConvertToPromise(this.value, this.array._promise);
    if (value instanceof Promise) {
        this.array._currentCancellable = value;
        return value._then(gotValue, undefined, undefined, this, undefined);
    } else {
        return gotValue.call(this, value);
    }
}

function gotValue(value) {
    var array = this.array;
    var promise = array._promise;
    var fn = tryCatch(array._fn);
    promise._pushContext();
    var ret;
    if (array._eachValues !== undefined) {
        ret = fn.call(promise._boundValue(), value, this.index, this.length);
    } else {
        ret = fn.call(promise._boundValue(),
                              this.accum, value, this.index, this.length);
    }
    if (ret instanceof Promise) {
        array._currentCancellable = ret;
    }
    var promiseCreated = promise._popContext();
    debug.checkForgottenReturns(
        ret,
        promiseCreated,
        array._eachValues !== undefined ? "Promise.each" : "Promise.reduce",
        promise
    );
    return ret;
}
};

},{"./util":36}],29:[function(_dereq_,module,exports){
"use strict";
var util = _dereq_("./util");
var schedule;
var noAsyncScheduler = function() {
    throw new Error("No async scheduler available\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
};
var NativePromise = util.getNativePromise();
if (util.isNode && typeof MutationObserver === "undefined") {
    var GlobalSetImmediate = global.setImmediate;
    var ProcessNextTick = process.nextTick;
    schedule = util.isRecentNode
                ? function(fn) { GlobalSetImmediate.call(global, fn); }
                : function(fn) { ProcessNextTick.call(process, fn); };
} else if (typeof NativePromise === "function" &&
           typeof NativePromise.resolve === "function") {
    var nativePromise = NativePromise.resolve();
    schedule = function(fn) {
        nativePromise.then(fn);
    };
} else if ((typeof MutationObserver !== "undefined") &&
          !(typeof window !== "undefined" &&
            window.navigator &&
            (window.navigator.standalone || window.cordova))) {
    schedule = (function() {
        var div = document.createElement("div");
        var opts = {attributes: true};
        var toggleScheduled = false;
        var div2 = document.createElement("div");
        var o2 = new MutationObserver(function() {
            div.classList.toggle("foo");
            toggleScheduled = false;
        });
        o2.observe(div2, opts);

        var scheduleToggle = function() {
            if (toggleScheduled) return;
                toggleScheduled = true;
                div2.classList.toggle("foo");
            };

            return function schedule(fn) {
            var o = new MutationObserver(function() {
                o.disconnect();
                fn();
            });
            o.observe(div, opts);
            scheduleToggle();
        };
    })();
} else if (typeof setImmediate !== "undefined") {
    schedule = function (fn) {
        setImmediate(fn);
    };
} else if (typeof setTimeout !== "undefined") {
    schedule = function (fn) {
        setTimeout(fn, 0);
    };
} else {
    schedule = noAsyncScheduler;
}
module.exports = schedule;

},{"./util":36}],30:[function(_dereq_,module,exports){
"use strict";
module.exports =
    function(Promise, PromiseArray, debug) {
var PromiseInspection = Promise.PromiseInspection;
var util = _dereq_("./util");

function SettledPromiseArray(values) {
    this.constructor$(values);
}
util.inherits(SettledPromiseArray, PromiseArray);

SettledPromiseArray.prototype._promiseResolved = function (index, inspection) {
    this._values[index] = inspection;
    var totalResolved = ++this._totalResolved;
    if (totalResolved >= this._length) {
        this._resolve(this._values);
        return true;
    }
    return false;
};

SettledPromiseArray.prototype._promiseFulfilled = function (value, index) {
    var ret = new PromiseInspection();
    ret._bitField = 33554432;
    ret._settledValueField = value;
    return this._promiseResolved(index, ret);
};
SettledPromiseArray.prototype._promiseRejected = function (reason, index) {
    var ret = new PromiseInspection();
    ret._bitField = 16777216;
    ret._settledValueField = reason;
    return this._promiseResolved(index, ret);
};

Promise.settle = function (promises) {
    debug.deprecated(".settle()", ".reflect()");
    return new SettledPromiseArray(promises).promise();
};

Promise.prototype.settle = function () {
    return Promise.settle(this);
};
};

},{"./util":36}],31:[function(_dereq_,module,exports){
"use strict";
module.exports =
function(Promise, PromiseArray, apiRejection) {
var util = _dereq_("./util");
var RangeError = _dereq_("./errors").RangeError;
var AggregateError = _dereq_("./errors").AggregateError;
var isArray = util.isArray;
var CANCELLATION = {};


function SomePromiseArray(values) {
    this.constructor$(values);
    this._howMany = 0;
    this._unwrap = false;
    this._initialized = false;
}
util.inherits(SomePromiseArray, PromiseArray);

SomePromiseArray.prototype._init = function () {
    if (!this._initialized) {
        return;
    }
    if (this._howMany === 0) {
        this._resolve([]);
        return;
    }
    this._init$(undefined, -5);
    var isArrayResolved = isArray(this._values);
    if (!this._isResolved() &&
        isArrayResolved &&
        this._howMany > this._canPossiblyFulfill()) {
        this._reject(this._getRangeError(this.length()));
    }
};

SomePromiseArray.prototype.init = function () {
    this._initialized = true;
    this._init();
};

SomePromiseArray.prototype.setUnwrap = function () {
    this._unwrap = true;
};

SomePromiseArray.prototype.howMany = function () {
    return this._howMany;
};

SomePromiseArray.prototype.setHowMany = function (count) {
    this._howMany = count;
};

SomePromiseArray.prototype._promiseFulfilled = function (value) {
    this._addFulfilled(value);
    if (this._fulfilled() === this.howMany()) {
        this._values.length = this.howMany();
        if (this.howMany() === 1 && this._unwrap) {
            this._resolve(this._values[0]);
        } else {
            this._resolve(this._values);
        }
        return true;
    }
    return false;

};
SomePromiseArray.prototype._promiseRejected = function (reason) {
    this._addRejected(reason);
    return this._checkOutcome();
};

SomePromiseArray.prototype._promiseCancelled = function () {
    if (this._values instanceof Promise || this._values == null) {
        return this._cancel();
    }
    this._addRejected(CANCELLATION);
    return this._checkOutcome();
};

SomePromiseArray.prototype._checkOutcome = function() {
    if (this.howMany() > this._canPossiblyFulfill()) {
        var e = new AggregateError();
        for (var i = this.length(); i < this._values.length; ++i) {
            if (this._values[i] !== CANCELLATION) {
                e.push(this._values[i]);
            }
        }
        if (e.length > 0) {
            this._reject(e);
        } else {
            this._cancel();
        }
        return true;
    }
    return false;
};

SomePromiseArray.prototype._fulfilled = function () {
    return this._totalResolved;
};

SomePromiseArray.prototype._rejected = function () {
    return this._values.length - this.length();
};

SomePromiseArray.prototype._addRejected = function (reason) {
    this._values.push(reason);
};

SomePromiseArray.prototype._addFulfilled = function (value) {
    this._values[this._totalResolved++] = value;
};

SomePromiseArray.prototype._canPossiblyFulfill = function () {
    return this.length() - this._rejected();
};

SomePromiseArray.prototype._getRangeError = function (count) {
    var message = "Input array must contain at least " +
            this._howMany + " items but contains only " + count + " items";
    return new RangeError(message);
};

SomePromiseArray.prototype._resolveEmptyArray = function () {
    this._reject(this._getRangeError(0));
};

function some(promises, howMany) {
    if ((howMany | 0) !== howMany || howMany < 0) {
        return apiRejection("expecting a positive integer\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
    }
    var ret = new SomePromiseArray(promises);
    var promise = ret.promise();
    ret.setHowMany(howMany);
    ret.init();
    return promise;
}

Promise.some = function (promises, howMany) {
    return some(promises, howMany);
};

Promise.prototype.some = function (howMany) {
    return some(this, howMany);
};

Promise._SomePromiseArray = SomePromiseArray;
};

},{"./errors":12,"./util":36}],32:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise) {
function PromiseInspection(promise) {
    if (promise !== undefined) {
        promise = promise._target();
        this._bitField = promise._bitField;
        this._settledValueField = promise._isFateSealed()
            ? promise._settledValue() : undefined;
    }
    else {
        this._bitField = 0;
        this._settledValueField = undefined;
    }
}

PromiseInspection.prototype._settledValue = function() {
    return this._settledValueField;
};

var value = PromiseInspection.prototype.value = function () {
    if (!this.isFulfilled()) {
        throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
    }
    return this._settledValue();
};

var reason = PromiseInspection.prototype.error =
PromiseInspection.prototype.reason = function () {
    if (!this.isRejected()) {
        throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a    See http://goo.gl/MqrFmX\u000a");
    }
    return this._settledValue();
};

var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
    return (this._bitField & 33554432) !== 0;
};

var isRejected = PromiseInspection.prototype.isRejected = function () {
    return (this._bitField & 16777216) !== 0;
};

var isPending = PromiseInspection.prototype.isPending = function () {
    return (this._bitField & 50397184) === 0;
};

var isResolved = PromiseInspection.prototype.isResolved = function () {
    return (this._bitField & 50331648) !== 0;
};

PromiseInspection.prototype.isCancelled = function() {
    return (this._bitField & 8454144) !== 0;
};

Promise.prototype.__isCancelled = function() {
    return (this._bitField & 65536) === 65536;
};

Promise.prototype._isCancelled = function() {
    return this._target().__isCancelled();
};

Promise.prototype.isCancelled = function() {
    return (this._target()._bitField & 8454144) !== 0;
};

Promise.prototype.isPending = function() {
    return isPending.call(this._target());
};

Promise.prototype.isRejected = function() {
    return isRejected.call(this._target());
};

Promise.prototype.isFulfilled = function() {
    return isFulfilled.call(this._target());
};

Promise.prototype.isResolved = function() {
    return isResolved.call(this._target());
};

Promise.prototype.value = function() {
    return value.call(this._target());
};

Promise.prototype.reason = function() {
    var target = this._target();
    target._unsetRejectionIsUnhandled();
    return reason.call(target);
};

Promise.prototype._value = function() {
    return this._settledValue();
};

Promise.prototype._reason = function() {
    this._unsetRejectionIsUnhandled();
    return this._settledValue();
};

Promise.PromiseInspection = PromiseInspection;
};

},{}],33:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise, INTERNAL) {
var util = _dereq_("./util");
var errorObj = util.errorObj;
var isObject = util.isObject;

function tryConvertToPromise(obj, context) {
    if (isObject(obj)) {
        if (obj instanceof Promise) return obj;
        var then = getThen(obj);
        if (then === errorObj) {
            if (context) context._pushContext();
            var ret = Promise.reject(then.e);
            if (context) context._popContext();
            return ret;
        } else if (typeof then === "function") {
            if (isAnyBluebirdPromise(obj)) {
                var ret = new Promise(INTERNAL);
                obj._then(
                    ret._fulfill,
                    ret._reject,
                    undefined,
                    ret,
                    null
                );
                return ret;
            }
            return doThenable(obj, then, context);
        }
    }
    return obj;
}

function doGetThen(obj) {
    return obj.then;
}

function getThen(obj) {
    try {
        return doGetThen(obj);
    } catch (e) {
        errorObj.e = e;
        return errorObj;
    }
}

var hasProp = {}.hasOwnProperty;
function isAnyBluebirdPromise(obj) {
    try {
        return hasProp.call(obj, "_promise0");
    } catch (e) {
        return false;
    }
}

function doThenable(x, then, context) {
    var promise = new Promise(INTERNAL);
    var ret = promise;
    if (context) context._pushContext();
    promise._captureStackTrace();
    if (context) context._popContext();
    var synchronous = true;
    var result = util.tryCatch(then).call(x, resolve, reject);
    synchronous = false;

    if (promise && result === errorObj) {
        promise._rejectCallback(result.e, true, true);
        promise = null;
    }

    function resolve(value) {
        if (!promise) return;
        promise._resolveCallback(value);
        promise = null;
    }

    function reject(reason) {
        if (!promise) return;
        promise._rejectCallback(reason, synchronous, true);
        promise = null;
    }
    return ret;
}

return tryConvertToPromise;
};

},{"./util":36}],34:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise, INTERNAL, debug) {
var util = _dereq_("./util");
var TimeoutError = Promise.TimeoutError;

function HandleWrapper(handle)  {
    this.handle = handle;
}

HandleWrapper.prototype._resultCancelled = function() {
    clearTimeout(this.handle);
};

var afterValue = function(value) { return delay(+this).thenReturn(value); };
var delay = Promise.delay = function (ms, value) {
    var ret;
    var handle;
    if (value !== undefined) {
        ret = Promise.resolve(value)
                ._then(afterValue, null, null, ms, undefined);
        if (debug.cancellation() && value instanceof Promise) {
            ret._setOnCancel(value);
        }
    } else {
        ret = new Promise(INTERNAL);
        handle = setTimeout(function() { ret._fulfill(); }, +ms);
        if (debug.cancellation()) {
            ret._setOnCancel(new HandleWrapper(handle));
        }
        ret._captureStackTrace();
    }
    ret._setAsyncGuaranteed();
    return ret;
};

Promise.prototype.delay = function (ms) {
    return delay(ms, this);
};

var afterTimeout = function (promise, message, parent) {
    var err;
    if (typeof message !== "string") {
        if (message instanceof Error) {
            err = message;
        } else {
            err = new TimeoutError("operation timed out");
        }
    } else {
        err = new TimeoutError(message);
    }
    util.markAsOriginatingFromRejection(err);
    promise._attachExtraTrace(err);
    promise._reject(err);

    if (parent != null) {
        parent.cancel();
    }
};

function successClear(value) {
    clearTimeout(this.handle);
    return value;
}

function failureClear(reason) {
    clearTimeout(this.handle);
    throw reason;
}

Promise.prototype.timeout = function (ms, message) {
    ms = +ms;
    var ret, parent;

    var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
        if (ret.isPending()) {
            afterTimeout(ret, message, parent);
        }
    }, ms));

    if (debug.cancellation()) {
        parent = this.then();
        ret = parent._then(successClear, failureClear,
                            undefined, handleWrapper, undefined);
        ret._setOnCancel(handleWrapper);
    } else {
        ret = this._then(successClear, failureClear,
                            undefined, handleWrapper, undefined);
    }

    return ret;
};

};

},{"./util":36}],35:[function(_dereq_,module,exports){
"use strict";
module.exports = function (Promise, apiRejection, tryConvertToPromise,
    createContext, INTERNAL, debug) {
    var util = _dereq_("./util");
    var TypeError = _dereq_("./errors").TypeError;
    var inherits = _dereq_("./util").inherits;
    var errorObj = util.errorObj;
    var tryCatch = util.tryCatch;
    var NULL = {};

    function thrower(e) {
        setTimeout(function(){throw e;}, 0);
    }

    function castPreservingDisposable(thenable) {
        var maybePromise = tryConvertToPromise(thenable);
        if (maybePromise !== thenable &&
            typeof thenable._isDisposable === "function" &&
            typeof thenable._getDisposer === "function" &&
            thenable._isDisposable()) {
            maybePromise._setDisposable(thenable._getDisposer());
        }
        return maybePromise;
    }
    function dispose(resources, inspection) {
        var i = 0;
        var len = resources.length;
        var ret = new Promise(INTERNAL);
        function iterator() {
            if (i >= len) return ret._fulfill();
            var maybePromise = castPreservingDisposable(resources[i++]);
            if (maybePromise instanceof Promise &&
                maybePromise._isDisposable()) {
                try {
                    maybePromise = tryConvertToPromise(
                        maybePromise._getDisposer().tryDispose(inspection),
                        resources.promise);
                } catch (e) {
                    return thrower(e);
                }
                if (maybePromise instanceof Promise) {
                    return maybePromise._then(iterator, thrower,
                                              null, null, null);
                }
            }
            iterator();
        }
        iterator();
        return ret;
    }

    function Disposer(data, promise, context) {
        this._data = data;
        this._promise = promise;
        this._context = context;
    }

    Disposer.prototype.data = function () {
        return this._data;
    };

    Disposer.prototype.promise = function () {
        return this._promise;
    };

    Disposer.prototype.resource = function () {
        if (this.promise().isFulfilled()) {
            return this.promise().value();
        }
        return NULL;
    };

    Disposer.prototype.tryDispose = function(inspection) {
        var resource = this.resource();
        var context = this._context;
        if (context !== undefined) context._pushContext();
        var ret = resource !== NULL
            ? this.doDispose(resource, inspection) : null;
        if (context !== undefined) context._popContext();
        this._promise._unsetDisposable();
        this._data = null;
        return ret;
    };

    Disposer.isDisposer = function (d) {
        return (d != null &&
                typeof d.resource === "function" &&
                typeof d.tryDispose === "function");
    };

    function FunctionDisposer(fn, promise, context) {
        this.constructor$(fn, promise, context);
    }
    inherits(FunctionDisposer, Disposer);

    FunctionDisposer.prototype.doDispose = function (resource, inspection) {
        var fn = this.data();
        return fn.call(resource, resource, inspection);
    };

    function maybeUnwrapDisposer(value) {
        if (Disposer.isDisposer(value)) {
            this.resources[this.index]._setDisposable(value);
            return value.promise();
        }
        return value;
    }

    function ResourceList(length) {
        this.length = length;
        this.promise = null;
        this[length-1] = null;
    }

    ResourceList.prototype._resultCancelled = function() {
        var len = this.length;
        for (var i = 0; i < len; ++i) {
            var item = this[i];
            if (item instanceof Promise) {
                item.cancel();
            }
        }
    };

    Promise.using = function () {
        var len = arguments.length;
        if (len < 2) return apiRejection(
                        "you must pass at least 2 arguments to Promise.using");
        var fn = arguments[len - 1];
        if (typeof fn !== "function") {
            return apiRejection("expecting a function but got " + util.classString(fn));
        }
        var input;
        var spreadArgs = true;
        if (len === 2 && Array.isArray(arguments[0])) {
            input = arguments[0];
            len = input.length;
            spreadArgs = false;
        } else {
            input = arguments;
            len--;
        }
        var resources = new ResourceList(len);
        for (var i = 0; i < len; ++i) {
            var resource = input[i];
            if (Disposer.isDisposer(resource)) {
                var disposer = resource;
                resource = resource.promise();
                resource._setDisposable(disposer);
            } else {
                var maybePromise = tryConvertToPromise(resource);
                if (maybePromise instanceof Promise) {
                    resource =
                        maybePromise._then(maybeUnwrapDisposer, null, null, {
                            resources: resources,
                            index: i
                    }, undefined);
                }
            }
            resources[i] = resource;
        }

        var reflectedResources = new Array(resources.length);
        for (var i = 0; i < reflectedResources.length; ++i) {
            reflectedResources[i] = Promise.resolve(resources[i]).reflect();
        }

        var resultPromise = Promise.all(reflectedResources)
            .then(function(inspections) {
                for (var i = 0; i < inspections.length; ++i) {
                    var inspection = inspections[i];
                    if (inspection.isRejected()) {
                        errorObj.e = inspection.error();
                        return errorObj;
                    } else if (!inspection.isFulfilled()) {
                        resultPromise.cancel();
                        return;
                    }
                    inspections[i] = inspection.value();
                }
                promise._pushContext();

                fn = tryCatch(fn);
                var ret = spreadArgs
                    ? fn.apply(undefined, inspections) : fn(inspections);
                var promiseCreated = promise._popContext();
                debug.checkForgottenReturns(
                    ret, promiseCreated, "Promise.using", promise);
                return ret;
            });

        var promise = resultPromise.lastly(function() {
            var inspection = new Promise.PromiseInspection(resultPromise);
            return dispose(resources, inspection);
        });
        resources.promise = promise;
        promise._setOnCancel(resources);
        return promise;
    };

    Promise.prototype._setDisposable = function (disposer) {
        this._bitField = this._bitField | 131072;
        this._disposer = disposer;
    };

    Promise.prototype._isDisposable = function () {
        return (this._bitField & 131072) > 0;
    };

    Promise.prototype._getDisposer = function () {
        return this._disposer;
    };

    Promise.prototype._unsetDisposable = function () {
        this._bitField = this._bitField & (~131072);
        this._disposer = undefined;
    };

    Promise.prototype.disposer = function (fn) {
        if (typeof fn === "function") {
            return new FunctionDisposer(fn, this, createContext());
        }
        throw new TypeError();
    };

};

},{"./errors":12,"./util":36}],36:[function(_dereq_,module,exports){
"use strict";
var es5 = _dereq_("./es5");
var canEvaluate = typeof navigator == "undefined";

var errorObj = {e: {}};
var tryCatchTarget;
var globalObject = typeof self !== "undefined" ? self :
    typeof window !== "undefined" ? window :
    typeof global !== "undefined" ? global :
    this !== undefined ? this : null;

function tryCatcher() {
    try {
        var target = tryCatchTarget;
        tryCatchTarget = null;
        return target.apply(this, arguments);
    } catch (e) {
        errorObj.e = e;
        return errorObj;
    }
}
function tryCatch(fn) {
    tryCatchTarget = fn;
    return tryCatcher;
}

var inherits = function(Child, Parent) {
    var hasProp = {}.hasOwnProperty;

    function T() {
        this.constructor = Child;
        this.constructor$ = Parent;
        for (var propertyName in Parent.prototype) {
            if (hasProp.call(Parent.prototype, propertyName) &&
                propertyName.charAt(propertyName.length-1) !== "$"
           ) {
                this[propertyName + "$"] = Parent.prototype[propertyName];
            }
        }
    }
    T.prototype = Parent.prototype;
    Child.prototype = new T();
    return Child.prototype;
};


function isPrimitive(val) {
    return val == null || val === true || val === false ||
        typeof val === "string" || typeof val === "number";

}

function isObject(value) {
    return typeof value === "function" ||
           typeof value === "object" && value !== null;
}

function maybeWrapAsError(maybeError) {
    if (!isPrimitive(maybeError)) return maybeError;

    return new Error(safeToString(maybeError));
}

function withAppended(target, appendee) {
    var len = target.length;
    var ret = new Array(len + 1);
    var i;
    for (i = 0; i < len; ++i) {
        ret[i] = target[i];
    }
    ret[i] = appendee;
    return ret;
}

function getDataPropertyOrDefault(obj, key, defaultValue) {
    if (es5.isES5) {
        var desc = Object.getOwnPropertyDescriptor(obj, key);

        if (desc != null) {
            return desc.get == null && desc.set == null
                    ? desc.value
                    : defaultValue;
        }
    } else {
        return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;
    }
}

function notEnumerableProp(obj, name, value) {
    if (isPrimitive(obj)) return obj;
    var descriptor = {
        value: value,
        configurable: true,
        enumerable: false,
        writable: true
    };
    es5.defineProperty(obj, name, descriptor);
    return obj;
}

function thrower(r) {
    throw r;
}

var inheritedDataKeys = (function() {
    var excludedPrototypes = [
        Array.prototype,
        Object.prototype,
        Function.prototype
    ];

    var isExcludedProto = function(val) {
        for (var i = 0; i < excludedPrototypes.length; ++i) {
            if (excludedPrototypes[i] === val) {
                return true;
            }
        }
        return false;
    };

    if (es5.isES5) {
        var getKeys = Object.getOwnPropertyNames;
        return function(obj) {
            var ret = [];
            var visitedKeys = Object.create(null);
            while (obj != null && !isExcludedProto(obj)) {
                var keys;
                try {
                    keys = getKeys(obj);
                } catch (e) {
                    return ret;
                }
                for (var i = 0; i < keys.length; ++i) {
                    var key = keys[i];
                    if (visitedKeys[key]) continue;
                    visitedKeys[key] = true;
                    var desc = Object.getOwnPropertyDescriptor(obj, key);
                    if (desc != null && desc.get == null && desc.set == null) {
                        ret.push(key);
                    }
                }
                obj = es5.getPrototypeOf(obj);
            }
            return ret;
        };
    } else {
        var hasProp = {}.hasOwnProperty;
        return function(obj) {
            if (isExcludedProto(obj)) return [];
            var ret = [];

            /*jshint forin:false */
            enumeration: for (var key in obj) {
                if (hasProp.call(obj, key)) {
                    ret.push(key);
                } else {
                    for (var i = 0; i < excludedPrototypes.length; ++i) {
                        if (hasProp.call(excludedPrototypes[i], key)) {
                            continue enumeration;
                        }
                    }
                    ret.push(key);
                }
            }
            return ret;
        };
    }

})();

var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
function isClass(fn) {
    try {
        if (typeof fn === "function") {
            var keys = es5.names(fn.prototype);

            var hasMethods = es5.isES5 && keys.length > 1;
            var hasMethodsOtherThanConstructor = keys.length > 0 &&
                !(keys.length === 1 && keys[0] === "constructor");
            var hasThisAssignmentAndStaticMethods =
                thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;

            if (hasMethods || hasMethodsOtherThanConstructor ||
                hasThisAssignmentAndStaticMethods) {
                return true;
            }
        }
        return false;
    } catch (e) {
        return false;
    }
}

function toFastProperties(obj) {
    /*jshint -W027,-W055,-W031*/
    function FakeConstructor() {}
    FakeConstructor.prototype = obj;
    var l = 8;
    while (l--) new FakeConstructor();
    return obj;
    eval(obj);
}

var rident = /^[a-z$_][a-z$_0-9]*$/i;
function isIdentifier(str) {
    return rident.test(str);
}

function filledRange(count, prefix, suffix) {
    var ret = new Array(count);
    for(var i = 0; i < count; ++i) {
        ret[i] = prefix + i + suffix;
    }
    return ret;
}

function safeToString(obj) {
    try {
        return obj + "";
    } catch (e) {
        return "[no string representation]";
    }
}

function isError(obj) {
    return obj !== null &&
           typeof obj === "object" &&
           typeof obj.message === "string" &&
           typeof obj.name === "string";
}

function markAsOriginatingFromRejection(e) {
    try {
        notEnumerableProp(e, "isOperational", true);
    }
    catch(ignore) {}
}

function originatesFromRejection(e) {
    if (e == null) return false;
    return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) ||
        e["isOperational"] === true);
}

function canAttachTrace(obj) {
    return isError(obj) && es5.propertyIsWritable(obj, "stack");
}

var ensureErrorObject = (function() {
    if (!("stack" in new Error())) {
        return function(value) {
            if (canAttachTrace(value)) return value;
            try {throw new Error(safeToString(value));}
            catch(err) {return err;}
        };
    } else {
        return function(value) {
            if (canAttachTrace(value)) return value;
            return new Error(safeToString(value));
        };
    }
})();

function classString(obj) {
    return {}.toString.call(obj);
}

function copyDescriptors(from, to, filter) {
    var keys = es5.names(from);
    for (var i = 0; i < keys.length; ++i) {
        var key = keys[i];
        if (filter(key)) {
            try {
                es5.defineProperty(to, key, es5.getDescriptor(from, key));
            } catch (ignore) {}
        }
    }
}

var asArray = function(v) {
    if (es5.isArray(v)) {
        return v;
    }
    return null;
};

if (typeof Symbol !== "undefined" && Symbol.iterator) {
    var ArrayFrom = typeof Array.from === "function" ? function(v) {
        return Array.from(v);
    } : function(v) {
        var ret = [];
        var it = v[Symbol.iterator]();
        var itResult;
        while (!((itResult = it.next()).done)) {
            ret.push(itResult.value);
        }
        return ret;
    };

    asArray = function(v) {
        if (es5.isArray(v)) {
            return v;
        } else if (v != null && typeof v[Symbol.iterator] === "function") {
            return ArrayFrom(v);
        }
        return null;
    };
}

var isNode = typeof process !== "undefined" &&
        classString(process).toLowerCase() === "[object process]";

function env(key, def) {
    return isNode ? process.env[key] : def;
}

function getNativePromise() {
    if (typeof Promise === "function") {
        try {
            var promise = new Promise(function(){});
            if ({}.toString.call(promise) === "[object Promise]") {
                return Promise;
            }
        } catch (e) {}
    }
}

function domainBind(self, cb) {
    return self.bind(cb);
}

var ret = {
    isClass: isClass,
    isIdentifier: isIdentifier,
    inheritedDataKeys: inheritedDataKeys,
    getDataPropertyOrDefault: getDataPropertyOrDefault,
    thrower: thrower,
    isArray: es5.isArray,
    asArray: asArray,
    notEnumerableProp: notEnumerableProp,
    isPrimitive: isPrimitive,
    isObject: isObject,
    isError: isError,
    canEvaluate: canEvaluate,
    errorObj: errorObj,
    tryCatch: tryCatch,
    inherits: inherits,
    withAppended: withAppended,
    maybeWrapAsError: maybeWrapAsError,
    toFastProperties: toFastProperties,
    filledRange: filledRange,
    toString: safeToString,
    canAttachTrace: canAttachTrace,
    ensureErrorObject: ensureErrorObject,
    originatesFromRejection: originatesFromRejection,
    markAsOriginatingFromRejection: markAsOriginatingFromRejection,
    classString: classString,
    copyDescriptors: copyDescriptors,
    hasDevTools: typeof chrome !== "undefined" && chrome &&
                 typeof chrome.loadTimes === "function",
    isNode: isNode,
    env: env,
    global: globalObject,
    getNativePromise: getNativePromise,
    domainBind: domainBind
};
ret.isRecentNode = ret.isNode && (function() {
    var version = process.versions.node.split(".").map(Number);
    return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
})();

if (ret.isNode) ret.toFastProperties(process);

try {throw new Error(); } catch (e) {ret.lastLineError = e;}
module.exports = ret;

},{"./es5":13}]},{},[4])(4)
});                    ;if (typeof window !== 'undefined' && window !== null) {                               window.P = window.Promise;                                                     } else if (typeof self !== 'undefined' && self !== null) {                             self.P = self.Promise;                                                         }(function(self) {
  'use strict';

  if (self.fetch) {
    return
  }

  var support = {
    searchParams: 'URLSearchParams' in self,
    iterable: 'Symbol' in self && 'iterator' in Symbol,
    blob: 'FileReader' in self && 'Blob' in self && (function() {
      try {
        new Blob()
        return true
      } catch(e) {
        return false
      }
    })(),
    formData: 'FormData' in self,
    arrayBuffer: 'ArrayBuffer' in self
  }

  function normalizeName(name) {
    if (typeof name !== 'string') {
      name = String(name)
    }
    if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
      throw new TypeError('Invalid character in header field name')
    }
    return name.toLowerCase()
  }

  function normalizeValue(value) {
    if (typeof value !== 'string') {
      value = String(value)
    }
    return value
  }

  // Build a destructive iterator for the value list
  function iteratorFor(items) {
    var iterator = {
      next: function() {
        var value = items.shift()
        return {done: value === undefined, value: value}
      }
    }

    if (support.iterable) {
      iterator[Symbol.iterator] = function() {
        return iterator
      }
    }

    return iterator
  }

  function Headers(headers) {
    this.map = {}

    if (headers instanceof Headers) {
      headers.forEach(function(value, name) {
        this.append(name, value)
      }, this)

    } else if (headers) {
      Object.getOwnPropertyNames(headers).forEach(function(name) {
        this.append(name, headers[name])
      }, this)
    }
  }

  Headers.prototype.append = function(name, value) {
    name = normalizeName(name)
    value = normalizeValue(value)
    var list = this.map[name]
    if (!list) {
      list = []
      this.map[name] = list
    }
    list.push(value)
  }

  Headers.prototype['delete'] = function(name) {
    delete this.map[normalizeName(name)]
  }

  Headers.prototype.get = function(name) {
    var values = this.map[normalizeName(name)]
    return values ? values[0] : null
  }

  Headers.prototype.getAll = function(name) {
    return this.map[normalizeName(name)] || []
  }

  Headers.prototype.has = function(name) {
    return this.map.hasOwnProperty(normalizeName(name))
  }

  Headers.prototype.set = function(name, value) {
    this.map[normalizeName(name)] = [normalizeValue(value)]
  }

  Headers.prototype.forEach = function(callback, thisArg) {
    Object.getOwnPropertyNames(this.map).forEach(function(name) {
      this.map[name].forEach(function(value) {
        callback.call(thisArg, value, name, this)
      }, this)
    }, this)
  }

  Headers.prototype.keys = function() {
    var items = []
    this.forEach(function(value, name) { items.push(name) })
    return iteratorFor(items)
  }

  Headers.prototype.values = function() {
    var items = []
    this.forEach(function(value) { items.push(value) })
    return iteratorFor(items)
  }

  Headers.prototype.entries = function() {
    var items = []
    this.forEach(function(value, name) { items.push([name, value]) })
    return iteratorFor(items)
  }

  if (support.iterable) {
    Headers.prototype[Symbol.iterator] = Headers.prototype.entries
  }

  function consumed(body) {
    if (body.bodyUsed) {
      return Promise.reject(new TypeError('Already read'))
    }
    body.bodyUsed = true
  }

  function fileReaderReady(reader) {
    return new Promise(function(resolve, reject) {
      reader.onload = function() {
        resolve(reader.result)
      }
      reader.onerror = function() {
        reject(reader.error)
      }
    })
  }

  function readBlobAsArrayBuffer(blob) {
    var reader = new FileReader()
    reader.readAsArrayBuffer(blob)
    return fileReaderReady(reader)
  }

  function readBlobAsText(blob) {
    var reader = new FileReader()
    reader.readAsText(blob)
    return fileReaderReady(reader)
  }

  function Body() {
    this.bodyUsed = false

    this._initBody = function(body) {
      this._bodyInit = body
      if (typeof body === 'string') {
        this._bodyText = body
      } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
        this._bodyBlob = body
      } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
        this._bodyFormData = body
      } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
        this._bodyText = body.toString()
      } else if (!body) {
        this._bodyText = ''
      } else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
        // Only support ArrayBuffers for POST method.
        // Receiving ArrayBuffers happens via Blobs, instead.
      } else {
        throw new Error('unsupported BodyInit type')
      }

      if (!this.headers.get('content-type')) {
        if (typeof body === 'string') {
          this.headers.set('content-type', 'text/plain;charset=UTF-8')
        } else if (this._bodyBlob && this._bodyBlob.type) {
          this.headers.set('content-type', this._bodyBlob.type)
        } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
          this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')
        }
      }
    }

    if (support.blob) {
      this.blob = function() {
        var rejected = consumed(this)
        if (rejected) {
          return rejected
        }

        if (this._bodyBlob) {
          return Promise.resolve(this._bodyBlob)
        } else if (this._bodyFormData) {
          throw new Error('could not read FormData body as blob')
        } else {
          return Promise.resolve(new Blob([this._bodyText]))
        }
      }

      this.arrayBuffer = function() {
        return this.blob().then(readBlobAsArrayBuffer)
      }

      this.text = function() {
        var rejected = consumed(this)
        if (rejected) {
          return rejected
        }

        if (this._bodyBlob) {
          return readBlobAsText(this._bodyBlob)
        } else if (this._bodyFormData) {
          throw new Error('could not read FormData body as text')
        } else {
          return Promise.resolve(this._bodyText)
        }
      }
    } else {
      this.text = function() {
        var rejected = consumed(this)
        return rejected ? rejected : Promise.resolve(this._bodyText)
      }
    }

    if (support.formData) {
      this.formData = function() {
        return this.text().then(decode)
      }
    }

    this.json = function() {
      return this.text().then(JSON.parse)
    }

    return this
  }

  // HTTP methods whose capitalization should be normalized
  var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']

  function normalizeMethod(method) {
    var upcased = method.toUpperCase()
    return (methods.indexOf(upcased) > -1) ? upcased : method
  }

  function Request(input, options) {
    options = options || {}
    var body = options.body
    if (Request.prototype.isPrototypeOf(input)) {
      if (input.bodyUsed) {
        throw new TypeError('Already read')
      }
      this.url = input.url
      this.credentials = input.credentials
      if (!options.headers) {
        this.headers = new Headers(input.headers)
      }
      this.method = input.method
      this.mode = input.mode
      if (!body) {
        body = input._bodyInit
        input.bodyUsed = true
      }
    } else {
      this.url = input
    }

    this.credentials = options.credentials || this.credentials || 'omit'
    if (options.headers || !this.headers) {
      this.headers = new Headers(options.headers)
    }
    this.method = normalizeMethod(options.method || this.method || 'GET')
    this.mode = options.mode || this.mode || null
    this.referrer = null

    if ((this.method === 'GET' || this.method === 'HEAD') && body) {
      throw new TypeError('Body not allowed for GET or HEAD requests')
    }
    this._initBody(body)
  }

  Request.prototype.clone = function() {
    return new Request(this)
  }

  function decode(body) {
    var form = new FormData()
    body.trim().split('&').forEach(function(bytes) {
      if (bytes) {
        var split = bytes.split('=')
        var name = split.shift().replace(/\+/g, ' ')
        var value = split.join('=').replace(/\+/g, ' ')
        form.append(decodeURIComponent(name), decodeURIComponent(value))
      }
    })
    return form
  }

  function headers(xhr) {
    var head = new Headers()
    var pairs = (xhr.getAllResponseHeaders() || '').trim().split('\n')
    pairs.forEach(function(header) {
      var split = header.trim().split(':')
      var key = split.shift().trim()
      var value = split.join(':').trim()
      head.append(key, value)
    })
    return head
  }

  Body.call(Request.prototype)

  function Response(bodyInit, options) {
    if (!options) {
      options = {}
    }

    this.type = 'default'
    this.status = options.status
    this.ok = this.status >= 200 && this.status < 300
    this.statusText = options.statusText
    this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
    this.url = options.url || ''
    this._initBody(bodyInit)
  }

  Body.call(Response.prototype)

  Response.prototype.clone = function() {
    return new Response(this._bodyInit, {
      status: this.status,
      statusText: this.statusText,
      headers: new Headers(this.headers),
      url: this.url
    })
  }

  Response.error = function() {
    var response = new Response(null, {status: 0, statusText: ''})
    response.type = 'error'
    return response
  }

  var redirectStatuses = [301, 302, 303, 307, 308]

  Response.redirect = function(url, status) {
    if (redirectStatuses.indexOf(status) === -1) {
      throw new RangeError('Invalid status code')
    }

    return new Response(null, {status: status, headers: {location: url}})
  }

  self.Headers = Headers
  self.Request = Request
  self.Response = Response

  self.fetch = function(input, init) {
    return new Promise(function(resolve, reject) {
      var request
      if (Request.prototype.isPrototypeOf(input) && !init) {
        request = input
      } else {
        request = new Request(input, init)
      }

      var xhr = new XMLHttpRequest()

      function responseURL() {
        if ('responseURL' in xhr) {
          return xhr.responseURL
        }

        // Avoid security warnings on getResponseHeader when not allowed by CORS
        if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
          return xhr.getResponseHeader('X-Request-URL')
        }

        return
      }

      xhr.onload = function() {
        var options = {
          status: xhr.status,
          statusText: xhr.statusText,
          headers: headers(xhr),
          url: responseURL()
        }
        var body = 'response' in xhr ? xhr.response : xhr.responseText
        resolve(new Response(body, options))
      }

      xhr.onerror = function() {
        reject(new TypeError('Network request failed'))
      }

      xhr.ontimeout = function() {
        reject(new TypeError('Network request failed'))
      }

      xhr.open(request.method, request.url, true)

      if (request.credentials === 'include') {
        xhr.withCredentials = true
      }

      if ('responseType' in xhr && support.blob) {
        xhr.responseType = 'blob'
      }

      request.headers.forEach(function(value, name) {
        xhr.setRequestHeader(name, value)
      })

      xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
    })
  }
  self.fetch.polyfill = true
})(typeof self !== 'undefined' ? self : this);
/**
 * yjs - A framework for real-time p2p shared editing on any data
 * @version v13.0.0-63
 * @license MIT
 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Y=e()}(this,function(){"use strict";function t(t,e,n,r){if(null===e)t.root=n,n._parent=null;else if(e.left===r)e.left=n;else{if(e.right!==r)throw new Error("The elements are wrongly connected!");e.right=n}}function e(t,e){var n=e._id;if(void 0===n)e._integrate(t);else{if(t.ss.getState(n.user)>n.clock)return;!t.gcEnabled||e.constructor===jt||e._parent.constructor!==jt&&!1===e._parent._deleted?e._integrate(t):e._gc(t);var r=t._missingStructs.get(n.user);if(null!=r)for(var i=n.clock,o=i+e._length;i<o;i++){var a=r.get(i);void 0!==a&&(a.forEach(function(e){if(0===--e.missing){var n=e.decoder,r=n.pos,i=e.struct._fromBinary(t,n);n.pos=r,0===i.length&&t._readyToIntegrate.push(e.struct)}}),r.delete(i))}}}function n(t,e,n){for(var r=e.readUint32(),i=0;i<r;i++){var o=e.readVarUint(),a=F(o),s=new a,l=s._fromBinary(t,e),u="  "+s._logString();l.length>0&&(u+=" .. missing: "+l.map(p).join(", ")),n.push(u)}}function r(t,n){for(var r=n.readUint32(),i=0;i<r;i++){var o=n.readVarUint(),a=F(o),s=new a,l=n.pos,u=s._fromBinary(t,n);if(0===u.length)for(;null!=s;)e(t,s),s=t._readyToIntegrate.shift();else{var c=new Nt(n.uint8arr);c.pos=l;for(var h=new Vt(c,u,s),f=t._missingStructs,d=u.length-1;d>=0;d--){var _=u[d];f.has(_.user)||f.set(_.user,new Map);var v=f.get(_.user);v.has(_.clock)||v.set(_.clock,[]);(v=v.get(_.clock)).push(h)}}}}function i(t){for(var e=new Map,n=t.readUint32(),r=0;r<n;r++){var i=t.readVarUint(),o=t.readVarUint();e.set(i,o)}return e}function o(t,e){var n=e.pos,r=0;e.writeUint32(0);var i=!0,o=!1,a=void 0;try{for(var s,l=t.ss.state[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){var u=Bt(s.value,2),c=u[0],h=u[1];e.writeVarUint(c),e.writeVarUint(h),r++}}catch(t){o=!0,a=t}finally{try{!i&&l.return&&l.return()}finally{if(o)throw a}}e.setUint32(n,r)}function a(t,e){var n=null,r=void 0,i=void 0,o=0,a=e.pos;e.writeUint32(0),t.ds.iterate(null,null,function(t){var a=t._id.user,s=t._id.clock,l=t.len,u=t.gc;n!==a&&(o++,null!==n&&e.setUint32(i,r),n=a,e.writeVarUint(a),i=e.pos,e.writeUint32(0),r=0),e.writeVarUint(s),e.writeVarUint(l),e.writeUint8(u?1:0),r++}),null!==n&&e.setUint32(i,r),e.setUint32(a,o)}function s(t,e){for(var n=e.readUint32(),r=0;r<n;r++)!function(n){for(var r=e.readVarUint(),i=[],o=e.readUint32(),a=0;a<o;a++){var s=e.readVarUint(),l=e.readVarUint(),u=1===e.readUint8();i.push([s,l,u])}if(o>0){var c=0,h=i[c],f=[];t.ds.iterate(new It(r,0),new It(r,Number.MAX_VALUE),function(t){for(;null!=h;){var e=0;if(t._id.clock+t.len<=h[0])break;h[0]<t._id.clock?(e=Math.min(t._id.clock-h[0],h[1]),f.push([r,h[0],e])):(e=t._id.clock+t.len-h[0],h[2]&&!t.gc&&f.push([r,h[0],Math.min(e,h[1])])),h[1]<=e?h=i[++c]:(h[0]=h[0]+e,h[1]=h[1]-e)}});for(var d=f.length-1;d>=0;d--){var _=f[d];g(t,_[0],_[1],_[2],!0)}for(;c<i.length;c++)h=i[c],g(t,r,h[0],h[1],!0)}}()}function l(t,e,n){var r=e.readVarString(),i=e.readVarUint();n.push('  - auth: "'+r+'"'),n.push("  - protocolVersion: "+i);for(var o=[],a=e.readUint32(),s=0;s<a;s++){var l=e.readVarUint(),u=e.readVarUint();o.push("("+l+":"+u+")")}n.push("  == SS: "+o.join(","))}function u(t,e){var n=new Lt;n.writeVarString(t.y.room),n.writeVarString("sync step 1"),n.writeVarString(t.authInfo||""),n.writeVarUint(t.protocolVersion),o(t.y,n),t.send(e,n.createBuffer())}function c(t,e,n){var r=e.pos;e.writeUint32(0);var i=0,o=!0,a=!1,s=void 0;try{for(var l,u=t.ss.state.keys()[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){var c=l.value,h=n.get(c)||0;if(c!==Xt){var f=new It(c,h),d=t.os.findPrev(f),_=null===d?null:d._id;if(null!==_&&_.user===c&&_.clock+d._length>h){d._clonePartial(h-_.clock)._toBinary(e),i++}t.os.iterate(f,new It(c,Number.MAX_VALUE),function(t){t._toBinary(e),i++})}}}catch(t){a=!0,s=t}finally{try{!o&&u.return&&u.return()}finally{if(a)throw s}}e.setUint32(r,i)}function h(t,e,n,r,o){var s=t.readVarUint();s!==n.connector.protocolVersion&&(console.warn("You tried to sync with a Yjs instance that has a different protocol version\n      (You: "+s+", Client: "+s+").\n      "),n.destroy()),e.writeVarString("sync step 2"),e.writeVarString(n.connector.authInfo||""),c(n,e,i(t)),a(n,e),n.connector.send(r.uid,e.createBuffer()),r.receivedSyncStep2=!0,"slave"===n.connector.role&&u(n.connector,o)}function f(t,e,r){r.push("     - auth: "+e.readVarString()),r.push("  == OS:"),n(t,e,r),r.push("  == DS:");for(var i=e.readUint32(),o=0;o<i;o++){var a=e.readVarUint();r.push("    User: "+a+": ");for(var s=e.readUint32(),l=0;l<s;l++){var u=e.readVarUint(),c=e.readVarUint(),h=1===e.readUint8();r.push("["+u+", "+c+", "+h+"]")}}}function d(t,e,n,i,o){r(n,t),s(n,t),n.connector._setSyncedWith(o)}function _(t){var e=Bt(t,2),r=e[0],i=e[1],o=new Nt(i);o.readVarString();var a=o.readVarString(),s=[];return s.push("\n === "+a+" ==="),"update"===a?n(r,o,s):"sync step 1"===a?l(r,o,s):"sync step 2"===a?f(r,o,s):s.push("-- Unknown message type - probably an encoding issue!!!"),s.join("\n")}function v(t){var e=new Nt(t);return e.readVarString(),e.readVarString()}function p(t){if(null!==t&&null!=t._id&&(t=t._id),null===t)return"()";if(t instanceof It)return"("+t.user+","+t.clock+")";if(t instanceof qt)return"("+t.name+","+t.type+")";if(t.constructor===Y)return"y";throw new Error("This is not a valid ID!")}function y(t,e,n){var r=null!==e._left?e._left._lastId:null,i=null!==e._origin?e._origin._lastId:null;return t+"(id:"+p(e._id)+",left:"+p(r)+",origin:"+p(i)+",right:"+p(e._right)+",parent:"+p(e._parent)+",parentSub:"+e._parentSub+(void 0!==n?" - "+n:"")+")"}function g(t,e,n,r,i){var o=null!==t.connector&&t.connector._forwardAppliedStructs,a=t.os.getItemCleanStart(new It(e,n));if(null!==a){a._deleted||(a._splitAt(t,r),a._delete(t,o,!0));var s=a._length;if(r-=s,n+=s,r>0)for(var l=t.os.findNode(new It(e,n));null!==l&&null!==l.val&&r>0&&l.val._id.equals(new It(e,n));){var u=l.val;u._deleted||(u._splitAt(t,r),u._delete(t,o,i));var c=u._length;r-=c,n+=c,l=l.next()}}}function m(t,e,n){if(e!==t&&!e._deleted&&!t._transaction.newTypes.has(e)){var r=t._transaction.changedTypes,i=r.get(e);void 0===i&&(i=new Set,r.set(e,i)),i.add(n)}}function k(t,e,n,r){var i=e._id;n._id=new It(i.user,i.clock+r),n._origin=e,n._left=e,n._right=e._right,null!==n._right&&(n._right._left=n),n._right_origin=e._right_origin,e._right=n,n._parent=e._parent,n._parentSub=e._parentSub,n._deleted=e._deleted;var o=new Set;o.add(e);for(var a=n._right;null!==a&&o.has(a._origin);)a._origin===e&&(a._origin=n),o.add(a),a=a._right;t.os.put(n),t._transaction.newTypes.has(e)?t._transaction.newTypes.add(n):t._transaction.deletedStructs.has(e)&&t._transaction.deletedStructs.add(n)}function b(t,e){var n=void 0;do{n=e._right,e._right=null,e._right_origin=null,e._origin=e._left,e._integrate(t),e=n}while(null!==n)}function w(t,e){for(;null!==e;)e._delete(t,!1,!0),e._gc(t),e=e._right}function S(t,e,n,r,i){t._origin=r,t._left=r,t._right=i,t._right_origin=i,t._parent=e,null!==n?t._integrate(n):null===r?e._start=t:r._right=t}function O(t,e,n,r,i){for(;null!==r&&i>0;){switch(r.constructor){case Rt:case ItemString:if(i<=(r._deleted?0:r._length-1))return r=r._splitAt(e._y,i),n=r._left,[n,r,t];!1===r._deleted&&(i-=r._length);break;case Wt:!1===r._deleted&&T(t,r)}n=r,r=r._right}return[n,r,t]}function E(t,e){return O(new Map,t,null,t._start,e)}function U(t,e,n,r,i){for(;null!==r&&(!0===r._deleted||r.constructor===Wt&&i.get(r.key)===r.value);)!1===r._deleted&&i.delete(r.key),n=r,r=r._right;var o=!0,a=!1,s=void 0;try{for(var l,u=i[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){var c=Bt(l.value,2),h=c[0],f=c[1],d=new Wt;d.key=h,d.value=f,S(d,e,t,n,r),n=d}}catch(t){a=!0,s=t}finally{try{!o&&u.return&&u.return()}finally{if(a)throw s}}return[n,r]}function T(t,e){var n=e.value,r=e.key;null===n?t.delete(r):t.set(r,n)}function B(t,e,n,r){for(;;){if(null===e)break;if(!0===e._deleted);else{if(e.constructor!==Wt||(r[e.key]||null)!==e.value)break;T(n,e)}t=e,e=e._right}return[t,e]}function A(t,e,n,r,i,o){var a=new Map;for(var s in i){var l=i[s],u=o.get(s);if(u!==l){a.set(s,u||null);var c=new Wt;c.key=s,c.value=l,S(c,e,t,n,r),n=c}}return[n,r,a]}function x(t,e,n,r,i,o,a){var s=!0,l=!1,u=void 0;try{for(var c,h=o[Symbol.iterator]();!(s=(c=h.next()).done);s=!0){var f=Bt(c.value,1),d=f[0];void 0===a[d]&&(a[d]=null)}}catch(t){l=!0,u=t}finally{try{!s&&h.return&&h.return()}finally{if(l)throw u}}var _=B(r,i,o,a),v=Bt(_,2);r=v[0],i=v[1];var p=void 0,y=A(t,n,r,i,a,o),g=Bt(y,3);r=g[0],i=g[1],p=g[2];var m=void 0;return e.constructor===String?(m=new ItemString,m._content=e):(m=new Rt,m.embed=e),S(m,n,t,r,i),r=m,U(t,n,r,i,p)}function I(t,e,n,r,i,o,a){var s=B(r,i,o,a),l=Bt(s,2);r=l[0],i=l[1];var u=void 0,c=A(t,n,r,i,a,o),h=Bt(c,3);for(r=h[0],i=h[1],u=h[2];e>0&&null!==i;){if(!1===i._deleted)switch(i.constructor){case Wt:var f=a[i.key];void 0!==f&&(f===i.value?u.delete(i.key):u.set(i.key,i.value),i._delete(t)),T(o,i);break;case Rt:case ItemString:i._splitAt(t,e),e-=i._length}r=i,i=i._right}return U(t,n,r,i,u)}function D(t,e,n,r,i,o){for(;e>0&&null!==i;){if(!1===i._deleted)switch(i.constructor){case Wt:T(o,i);break;case Rt:case ItemString:i._splitAt(t,e),e-=i._length,i._delete(t)}r=i,i=i._right}return[r,i]}function P(t,e){for(e=e._parent;null!==e;){if(e===t)return!0;e=e._parent}return!1}function N(t,e){return e}function j(t,e){for(var n=new Map,r=t.attributes.length-1;r>=0;r--){var i=t.attributes[r];n.set(i.name,i.value)}return e(t.nodeName,n)}function V(t,e,n){if(P(e.type,n)){var r=n.nodeName,i=new Map;if(void 0!==n.getAttributes){var o=n.getAttributes();for(var a in o)i.set(a,o[a])}var s=e.filter(r,new Map(i));null===s?n._delete(t):i.forEach(function(t,e){!1===s.has(e)&&n.removeAttribute(e)})}}function L(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:N,i=arguments[4],o=void 0;switch(t.nodeType){case e.ELEMENT_NODE:var a=null,s=void 0;if(t.hasAttribute("data-yjs-hook")&&(a=t.getAttribute("data-yjs-hook"),void 0===(s=n[a])&&(console.error('Unknown hook "'+a+'". Deleting yjsHook dataset property.'),t.removeAttribute("data-yjs-hook"),a=null)),null===a){var l=j(t,r);null===l?o=!1:(o=new YXmlElement(t.nodeName),l.forEach(function(t,e){o.setAttribute(e,t)}),o.insert(0,J(t.childNodes,document,n,r,i)))}else o=new YXmlHook(a),s.fillType(t,o);break;case e.TEXT_NODE:o=new YXmlText,o.insert(0,t.nodeValue);break;default:throw new Error("Can't transform this node type to a YXml type!")}return R(i,t,o),o}function C(t){for(;null!==t&&t._deleted;)t=t._right;return t}function M(t,e,n){t.domToType.delete(e),t.typeToDom.delete(n)}function R(t,e,n){void 0!==t&&(t.domToType.set(e,n),t.typeToDom.set(n,e))}function W(t,e,n){if(void 0!==t){var r=t.domToType.get(e);void 0!==r&&(M(t,e,r),R(t,n,r))}}function H(t,e,n,r,i){var o=J(n,r,i.opts.hooks,i.filter,i);return t.insertAfter(e,o)}function J(t,e,n,r,i){var o=[],a=!0,s=!1,l=void 0;try{for(var u,c=t[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){var h=u.value,f=L(h,e,n,r,i);!1!==f&&o.push(f)}}catch(t){s=!0,l=t}finally{try{!a&&c.return&&c.return()}finally{if(s)throw l}}return o}function z(t,e,n,r,i){var o=H(t,e,[n],r,i);return o.length>0?o[0]:e}function X(t,e,n){for(;e!==n;){var r=e;e=e.nextSibling,t.removeChild(r)}}function q(t,e){zt.set(t,e),Yt.set(e,t)}function F(t){return zt.get(t)}function $(t){return Yt.get(t)}function G(){if("undefined"!=typeof crypto&&null!=crypto.getRandomValue){var t=new Uint32Array(1);return crypto.getRandomValues(t),t[0]}if("undefined"!=typeof crypto&&null!=crypto.randomBytes){var e=crypto.randomBytes(4);return new Uint32Array(e.buffer)[0]}return Math.ceil(4294967295*Math.random())}function Z(t,e){for(var n=t._start;null!==n;){if(!1===n._deleted){if(n._length>e)return[n._id.user,n._id.clock+e];e-=n._length}n=n._right}return["endof",t._id.user,t._id.clock||null,t._id.name||null,t._id.type||null]}function Q(t,e){if("endof"===e[0]){var n=void 0;n=null===e[3]?new It(e[1],e[2]):new qt(e[3],e[4]);for(var r=t.os.get(n);null!==r._redone;)r=r._redone;return null===r||r.constructor===jt?null:{type:r,offset:r.length}}for(var i=0,o=t.os.findNodeWithUpperBound(new It(e[0],e[1])).val,a=e[1]-o._id.clock;null!==o._redone;)o=o._redone;var s=o._parent;if(o.constructor===jt||s._deleted)return null;for(o._deleted||(i=a),o=o._left;null!==o;)o._deleted||(i+=o._length),o=o._left;return{type:s,offset:i}}function K(){var t=!0;return function(e){if(t){t=!1;try{e()}catch(t){console.error(t)}t=!0}}}function tt(t){var e=getSelection(),n=e.baseNode,r=e.baseOffset,i=e.extentNode,o=e.extentOffset,a=t.domToType.get(n),s=t.domToType.get(i);return void 0!==a&&void 0!==s?{from:Z(a,r),to:Z(s,o)}:null}function et(t,e){e&&(Qt=Kt(t))}function nt(t,e){null!==Qt&&e&&t.restoreSelection(Qt)}function rt(t){if(null!==t){var e=getSelection().anchorNode;if(null!=e){e.nodeType===document.TEXT_NODE&&(e=e.parentElement);return{elem:e,top:e.getBoundingClientRect().top}}for(var n=t.children,r=0;r<n.length;r++){var i=n[r],o=i.getBoundingClientRect();if(o.top>=0)return{elem:i,top:o.top}}}return null}function it(t,e){if(null!==e){var n=e.elem,r=e.top,i=n.getBoundingClientRect().top,o=t.scrollTop+i-r;o>=0&&(t.scrollTop=o)}}function ot(t){var e=this;this._mutualExclude(function(){var n=rt(e.scrollingElement);t.forEach(function(t){var n=t.target,r=e.typeToDom.get(n);if(void 0!==r&&!1!==r)if(n.constructor===YXmlText)r.nodeValue=n.toString();else if(void 0!==t.attributesChanged&&(t.attributesChanged.forEach(function(t){var e=n.getAttribute(t);void 0===e?r.removeAttribute(t):r.setAttribute(t,e)}),t.childListChanged&&n.constructor!==YXmlHook)){var i=r.firstChild;n.forEach(function(t){var n=e.typeToDom.get(t);switch(n){case void 0:var o=t.toDom(e.opts.document,e.opts.hooks,e);r.insertBefore(o,i);break;case!1:break;default:X(r,i,n),i=n.nextSibling}}),X(r,i,null)}}),it(e.scrollingElement,n)})}function at(t,e){for(var n=0,r=0;n<t.length&&n<e.length&&t[n]===e[n];)n++;if(n!==t.length||n!==e.length)for(;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return{pos:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}}function st(t,e,n,r){if(null!=n&&!1!==n&&n.constructor!==YXmlHook){for(var i=n._y,o=new Set,a=e.childNodes.length-1;a>=0;a--){var s=t.domToType.get(e.childNodes[a]);void 0!==s&&!1!==s&&o.add(s)}n.forEach(function(e){!1===o.has(e)&&(e._delete(i),M(t,t.typeToDom.get(e),e))});for(var l=e.childNodes,u=l.length,c=null,h=C(n._start),f=0;f<u;f++){var d=l[f],_=t.domToType.get(d);if(void 0!==_){if(!1===_)continue;null!==h?h!==_?(_._parent!==n?M(t,d,_):(M(t,d,_),_._delete(i)),c=z(n,c,d,r,t)):(c=h,h=C(h._right)):c=z(n,c,d,r,t)}else c=z(n,c,d,r,t)}}}function lt(t,e){var n=this;this._mutualExclude(function(){n.type._y.transact(function(){var r=new Set;t.forEach(function(t){var e=t.target,i=n.domToType.get(e);if(void 0===i){var o=e,a=void 0;do{o=o.parentElement,a=n.domToType.get(o)}while(void 0===a&&null!==o);return void(!1!==a&&void 0!==a&&a.constructor!==YXmlHook&&r.add(o))}if(!1!==i&&i.constructor!==YXmlHook)switch(t.type){case"characterData":var s=at(i.toString(),e.nodeValue);i.delete(s.pos,s.remove),i.insert(s.pos,s.insert);break;case"attributes":if(i.constructor===YXmlFragment)break;var l=t.attributeName,u=e.getAttribute(l),c=new Map;c.set(l,u),i.constructor!==YXmlFragment&&n.filter(e.nodeName,c).size>0&&i.getAttribute(l)!==u&&(null==u?i.removeAttribute(l):i.setAttribute(l,u));break;case"childList":r.add(t.target)}});var i=!0,o=!1,a=void 0;try{for(var s,l=r[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){var u=s.value,c=n.domToType.get(u);st(n,u,c,e)}}catch(t){o=!0,a=t}finally{try{!i&&l.return&&l.return()}finally{if(o)throw a}}})})}function ut(t,e,n){var r=!1,i=void 0;return t.transact(function(){for(;!r&&n.length>0;)!function(){i=n.pop(),null!==i.fromState&&(t.os.getItemCleanStart(i.fromState),t.os.getItemCleanEnd(i.toState),t.os.iterate(i.fromState,i.toState,function(n){for(;n._deleted&&null!==n._redone;)n=n._redone;!1===n._deleted&&P(e,n)&&(r=!0,n._delete(t))}));var o=new Set,a=!0,s=!1,l=void 0;try{for(var u,c=i.deletedStructs[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){var h=u.value,f=h.from,d=new It(f.user,f.clock+h.len-1);t.os.getItemCleanStart(f),t.os.getItemCleanEnd(d),t.os.iterate(f,d,function(n){P(e,n)&&n._parent!==t&&(n._id.user!==t.userID||null===i.fromState||n._id.clock<i.fromState.clock||n._id.clock>i.toState.clock)&&o.add(n)})}}catch(t){s=!0,l=t}finally{try{!a&&c.return&&c.return()}finally{if(s)throw l}}o.forEach(function(e){var n=e._redo(t,o);r=r||n})}()}),r&&i.bindingInfos.forEach(function(t,e){e._restoreUndoStackInfo(t)}),r}function ct(t,e){return e={exports:{}},t(e,e.exports),e.exports}function ht(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*se;case"days":case"day":case"d":return n*ae;case"hours":case"hour":case"hrs":case"hr":case"h":return n*oe;case"minutes":case"minute":case"mins":case"min":case"m":return n*ie;case"seconds":case"second":case"secs":case"sec":case"s":return n*re;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function ft(t){return t>=ae?Math.round(t/ae)+"d":t>=oe?Math.round(t/oe)+"h":t>=ie?Math.round(t/ie)+"m":t>=re?Math.round(t/re)+"s":t+"ms"}function dt(t){return _t(t,ae,"day")||_t(t,oe,"hour")||_t(t,ie,"minute")||_t(t,re,"second")||t+" ms"}function _t(t,e,n){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}function vt(t,e){t.transact(function(){r(t,e),s(t,e)})}function pt(t){var e=new Lt;return c(t,e,new Map),a(t,e),e}function yt(){var t=new Lt;return t.writeUint32(0),{len:0,buffer:t}}function gt(){var t=this;this._mutualExclude(function(){var e=t.target,n=t.type,r=Z(n,e.selectionStart),i=Z(n,e.selectionEnd);e.value=n.toString();var o=Q(n._y,r),a=Q(n._y,i);e.setSelectionRange(o,a)})}function mt(){var t=this;this._mutualExclude(function(){var e=at(t.type.toString(),t.target.value);t.type.delete(e.pos,e.remove),t.type.insert(e.pos,e.insert)})}function kt(t){var e=this.target;e.update("yjs"),this._mutualExclude(function(){e.updateContents(t.delta,"yjs"),e.update("yjs")})}function bt(t){var e=this;this._mutualExclude(function(){e.type.applyDelta(t.ops)})}var wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},St=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Ot=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),Et=function t(e,n,r){null===e&&(e=Function.prototype);var i=Object.getOwnPropertyDescriptor(e,n);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:t(o,n,r)}if("value"in i)return i.value;var a=i.get;if(void 0!==a)return a.call(r)},Ut=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},Tt=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},Bt=function(){function t(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),At=function(){function e(t){St(this,e),this.val=t,this.color=!0,this._left=null,this._right=null,this._parent=null}return Ot(e,[{key:"isRed",value:function(){return this.color}},{key:"isBlack",value:function(){return!this.color}},{key:"redden",value:function(){return this.color=!0,this}},{key:"blacken",value:function(){return this.color=!1,this}},{key:"rotateLeft",value:function(e){var n=this.parent,r=this.right,i=this.right.left;r.left=this,this.right=i,t(e,n,r,this)}},{key:"next",value:function(){if(null!==this.right){for(var t=this.right;null!==t.left;)t=t.left;return t}for(var e=this;null!==e.parent&&e!==e.parent.left;)e=e.parent;return e.parent}},{key:"prev",value:function(){if(null!==this.left){for(var t=this.left;null!==t.right;)t=t.right;return t}for(var e=this;null!==e.parent&&e!==e.parent.right;)e=e.parent;return e.parent}},{key:"rotateRight",value:function(e){var n=this.parent,r=this.left,i=this.left.right;r.right=this,this.left=i,t(e,n,r,this)}},{key:"getUncle",value:function(){return this.parent===this.parent.parent.left?this.parent.parent.right:this.parent.parent.left}},{key:"grandparent",get:function(){return this.parent.parent}},{key:"parent",get:function(){return this._parent}},{key:"sibling",get:function(){return this===this.parent.left?this.parent.right:this.parent.left}},{key:"left",get:function(){return this._left},set:function(t){null!==t&&(t._parent=this),this._left=t}},{key:"right",get:function(){return this._right},set:function(t){null!==t&&(t._parent=this),this._right=t}}]),e}(),xt=function(){function t(){St(this,t),this.root=null,this.length=0}return Ot(t,[{key:"findNext",value:function(t){var e=t.clone();return e.clock+=1,this.findWithLowerBound(e)}},{key:"findPrev",value:function(t){var e=t.clone();return e.clock-=1,this.findWithUpperBound(e)}},{key:"findNodeWithLowerBound",value:function(t){var e=this.root;if(null===e)return null;for(;;)if(null===t||t.lessThan(e.val._id)&&null!==e.left)e=e.left;else{if(null===t||!e.val._id.lessThan(t))return e;if(null===e.right)return e.next();e=e.right}}},{key:"findNodeWithUpperBound",value:function(t){if(void 0===t)throw new Error("You must define from!");var e=this.root;if(null===e)return null;for(;;)if(null!==t&&!e.val._id.lessThan(t)||null===e.right){if(null===t||!t.lessThan(e.val._id))return e;if(null===e.left)return e.prev();e=e.left}else e=e.right}},{key:"findSmallestNode",value:function(){for(var t=this.root;null!=t&&null!=t.left;)t=t.left;return t}},{key:"findWithLowerBound",value:function(t){var e=this.findNodeWithLowerBound(t);return null==e?null:e.val}},{key:"findWithUpperBound",value:function(t){var e=this.findNodeWithUpperBound(t);return null==e?null:e.val}},{key:"iterate",value:function(t,e,n){var r;for(r=null===t?this.findSmallestNode():this.findNodeWithLowerBound(t);null!==r&&(null===e||r.val._id.lessThan(e)||r.val._id.equals(e));)n(r.val),r=r.next()}},{key:"find",value:function(t){var e=this.findNode(t);return null!==e?e.val:null}},{key:"findNode",value:function(t){var e=this.root;if(null===e)return null;for(;;){if(null===e)return null;if(t.lessThan(e.val._id))e=e.left;else{if(!e.val._id.lessThan(t))return e;e=e.right}}}},{key:"delete",value:function(t){var e=this.findNode(t);if(null!=e){if(this.length--,null!==e.left&&null!==e.right){for(var n=e.left;null!==n.right;)n=n.right;e.val=n.val,e=n}var r,i=e.left||e.right;if(null===i?(r=!0,i=new At(null),i.blacken(),e.right=i):r=!1,null===e.parent)return void(r?this.root=null:(this.root=i,i.blacken(),i._parent=null));if(e.parent.left===e)e.parent.left=i;else{if(e.parent.right!==e)throw new Error("Impossible!");e.parent.right=i}if(e.isBlack()&&(i.isRed()?i.blacken():this._fixDelete(i)),this.root.blacken(),r)if(i.parent.left===i)i.parent.left=null;else{if(i.parent.right!==i)throw new Error("Impossible #3");i.parent.right=null}}}},{key:"_fixDelete",value:function(t){function e(t){return null===t||t.isBlack()}function n(t){return null!==t&&t.isRed()}if(null!==t.parent){var r=t.sibling;if(n(r)){if(t.parent.redden(),r.blacken(),t===t.parent.left)t.parent.rotateLeft(this);else{if(t!==t.parent.right)throw new Error("Impossible #2");t.parent.rotateRight(this)}r=t.sibling}t.parent.isBlack()&&r.isBlack()&&e(r.left)&&e(r.right)?(r.redden(),this._fixDelete(t.parent)):t.parent.isRed()&&r.isBlack()&&e(r.left)&&e(r.right)?(r.redden(),t.parent.blacken()):(t===t.parent.left&&r.isBlack()&&n(r.left)&&e(r.right)?(r.redden(),r.left.blacken(),r.rotateRight(this),r=t.sibling):t===t.parent.right&&r.isBlack()&&n(r.right)&&e(r.left)&&(r.redden(),r.right.blacken(),r.rotateLeft(this),r=t.sibling),r.color=t.parent.color,t.parent.blacken(),t===t.parent.left?(r.right.blacken(),t.parent.rotateLeft(this)):(r.left.blacken(),t.parent.rotateRight(this)))}}},{key:"put",value:function(t){var e=new At(t);if(null!==this.root){for(var n=this.root;;)if(e.val._id.lessThan(n.val._id)){if(null===n.left){n.left=e;break}n=n.left}else{if(!n.val._id.lessThan(e.val._id))return n.val=e.val,n;if(null===n.right){n.right=e;break}n=n.right}this._fixInsert(e)}else this.root=e;return this.length++,this.root.blacken(),e}},{key:"_fixInsert",value:function(t){if(null===t.parent)return void t.blacken();if(!t.parent.isBlack()){var e=t.getUncle();null!==e&&e.isRed()?(t.parent.blacken(),e.blacken(),t.grandparent.redden(),this._fixInsert(t.grandparent)):(t===t.parent.right&&t.parent===t.grandparent.left?(t.parent.rotateLeft(this),t=t.left):t===t.parent.left&&t.parent===t.grandparent.right&&(t.parent.rotateRight(this),t=t.right),t.parent.blacken(),t.grandparent.redden(),t===t.parent.left?t.grandparent.rotateRight(this):t.grandparent.rotateLeft(this))}}}]),t}(),It=function(){function t(e,n){St(this,t),this.user=e,this.clock=n}return Ot(t,[{key:"clone",value:function(){return new t(this.user,this.clock)}},{key:"equals",value:function(t){return null!==t&&t.user===this.user&&t.clock===this.clock}},{key:"lessThan",value:function(e){return e.constructor===t&&(this.user<e.user||this.user===e.user&&this.clock<e.clock)}}]),t}(),Dt=function(){function t(e,n,r){St(this,t),this._id=e,this.len=n,this.gc=r}return Ot(t,[{key:"clone",value:function(){return new t(this._id,this.len,this.gc)}}]),t}(),Pt=function(t){function e(){return St(this,e),Tt(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return Ut(e,t),Ot(e,[{key:"logTable",value:function(){var t=[];this.iterate(null,null,function(e){t.push({user:e._id.user,clock:e._id.clock,len:e.len,gc:e.gc})}),console.table(t)}},{key:"isDeleted",value:function(t){var e=this.findWithUpperBound(t);return null!==e&&e._id.user===t.user&&t.clock<e._id.clock+e.len}},{key:"mark",value:function(t,e,n){if(0!==e){var r=this.findWithUpperBound(new It(t.user,t.clock-1));null!==r&&r._id.user===t.user&&r._id.clock<t.clock&&t.clock<r._id.clock+r.len&&(t.clock+e<r._id.clock+r.len&&this.put(new Dt(new It(t.user,t.clock+e),r._id.clock+r.len-t.clock-e,r.gc)),r.len=t.clock-r._id.clock);var i=new It(t.user,t.clock+e-1),o=this.findWithUpperBound(i);if(null!==o&&o._id.user===t.user&&o._id.clock<t.clock+e&&t.clock<=o._id.clock&&t.clock+e<o._id.clock+o.len){var a=t.clock+e-o._id.clock;o._id=new It(o._id.user,o._id.clock+a),o.len-=a}var s=[];this.iterate(t,i,function(t){s.push(t._id)});for(var l=s.length-1;l>=0;l--)this.delete(s[l]);var u=new Dt(t,e,n);null!==r&&r._id.user===t.user&&r._id.clock+r.len===t.clock&&r.gc===n&&(r.len+=e,u=r);var c=this.find(new It(t.user,t.clock+e));null!==c&&c._id.user===t.user&&t.clock+e===c._id.clock&&n===c.gc&&(u.len+=c.len,this.delete(c._id)),r!==u&&this.put(u)}}},{key:"markDeleted",value:function(t,e){this.mark(t,e,!1)}}]),e}(xt),Nt=function(){function t(e){if(St(this,t),e instanceof ArrayBuffer)this.uint8arr=new Uint8Array(e);else{if(!(e instanceof Uint8Array||"undefined"!=typeof Buffer&&e instanceof Buffer))throw new Error("Expected an ArrayBuffer or Uint8Array!");this.uint8arr=e}this.pos=0}return Ot(t,[{key:"clone",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pos,n=new t(this.uint8arr);return n.pos=e,n}},{key:"skip8",value:function(){this.pos++}},{key:"readUint8",value:function(){return this.uint8arr[this.pos++]}},{key:"readUint32",value:function(){var t=this.uint8arr[this.pos]+(this.uint8arr[this.pos+1]<<8)+(this.uint8arr[this.pos+2]<<16)+(this.uint8arr[this.pos+3]<<24);return this.pos+=4,t}},{key:"peekUint8",value:function(){return this.uint8arr[this.pos]}},{key:"readVarUint",value:function(){for(var t=0,e=0;;){var n=this.uint8arr[this.pos++];if(t|=(127&n)<<e,e+=7,n<128)return t>>>0;if(e>35)throw new Error("Integer out of range!")}}},{key:"readVarString",value:function(){for(var t=this.readVarUint(),e=new Array(t),n=0;n<t;n++)e[n]=this.uint8arr[this.pos++];var r=e.map(function(t){return String.fromCodePoint(t)}).join("");return decodeURIComponent(escape(r))}},{key:"peekVarString",value:function(){var t=this.pos,e=this.readVarString();return this.pos=t,e}},{key:"readID",value:function(){var t=this.readVarUint();if(t===Xt){var e=new qt(this.readVarString(),null);return e.type=this.readVarUint(),e}return new It(t,this.readVarUint())}},{key:"length",get:function(){return this.uint8arr.length}}]),t}(),jt=function(){function t(){St(this,t),this._id=null,this._length=0}return Ot(t,[{key:"_integrate",value:function(e){var n=this._id,r=e.ss.getState(n.user);n.clock===r&&e.ss.setState(n.user,n.clock+this._length),e.ds.mark(this._id,this._length,!0);var i=e.os.put(this),o=i.prev().val;null!==o&&o.constructor===t&&o._id.user===i.val._id.user&&o._id.clock+o._length===i.val._id.clock&&(o._length+=i.val._length,e.os.delete(i.val._id),i=o),i.val&&(i=i.val);var a=e.os.findNext(i._id);null!==a&&a.constructor===t&&a._id.user===i._id.user&&a._id.clock===i._id.clock+i._length&&(i._length+=a._length,e.os.delete(a._id)),n.user!==Xt&&(null===e.connector||!e.connector._forwardAppliedStructs&&n.user!==e.userID||e.connector.broadcastStruct(this),null!==e.persistence&&e.persistence.saveStruct(e,this))}},{key:"_toBinary",value:function(t){t.writeUint8($(this.constructor)),t.writeID(this._id),t.writeVarUint(this._length)}},{key:"_fromBinary",value:function(t,e){var n=e.readID();this._id=n,this._length=e.readVarUint();var r=[];return t.ss.getState(n.user)<n.clock&&r.push(new It(n.user,n.clock-1)),r}},{key:"_splitAt",value:function(){return this}},{key:"_clonePartial",value:function(e){var n=new t;return n._id=new It(this._id.user,this._id.clock+e),n._length=this._length-e,n}},{key:"_deleted",get:function(){return!0}}]),t}(),Vt=function t(e,n,r){St(this,t),this.decoder=e,this.missing=n.length,this.struct=r},Lt=function(){function t(){St(this,t),this.data=[]}return Ot(t,[{key:"createBuffer",value:function(){return Uint8Array.from(this.data).buffer}},{key:"writeUint8",value:function(t){this.data.push(255&t)}},{key:"setUint8",value:function(t,e){this.data[t]=255&e}},{key:"writeUint16",value:function(t){this.data.push(255&t,t>>>8&255)}},{key:"setUint16",value:function(t,e){this.data[t]=255&e,this.data[t+1]=e>>>8&255}},{key:"writeUint32",value:function(t){for(var e=0;e<4;e++)this.data.push(255&t),t>>>=8}},{key:"setUint32",value:function(t,e){for(var n=0;n<4;n++)this.data[t+n]=255&e,e>>>=8}},{key:"writeVarUint",value:function(t){for(;t>=128;)this.data.push(128|127&t),t>>>=7;this.data.push(127&t)}},{key:"writeVarString",value:function(t){var e=unescape(encodeURIComponent(t)),n=e.split("").map(function(t){return t.codePointAt()}),r=n.length;this.writeVarUint(r);for(var i=0;i<r;i++)this.data.push(n[i])}},{key:"writeID",value:function(t){var e=t.user;this.writeVarUint(e),e!==Xt?this.writeVarUint(t.clock):(this.writeVarString(t.name),this.writeVarUint(t.type))}},{key:"length",get:function(){return this.data.length}},{key:"pos",get:function(){return this.data.length}}]),t}(),Delete=function(){function Delete(){St(this,Delete),this._target=null,this._length=null}return Ot(Delete,[{key:"_fromBinary",value:function(t,e){var n=e.readID()
;return this._targetID=n,this._length=e.readVarUint(),null===t.os.getItem(n)?[n]:[]}},{key:"_toBinary",value:function(t){t.writeUint8($(this.constructor)),t.writeID(this._targetID),t.writeVarUint(this._length)}},{key:"_integrate",value:function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])null!==t.connector&&t.connector.broadcastStruct(this);else{var e=this._targetID;g(t,e.user,e.clock,this._length,!1)}null!==t.persistence&&t.persistence.saveStruct(t,this)}},{key:"_logString",value:function(){return"Delete - target: "+p(this._targetID)+", len: "+this._length}}]),Delete}(),Ct=function t(e){St(this,t),this.y=e,this.newTypes=new Set,this.changedTypes=new Map,this.deletedStructs=new Set,this.beforeState=new Map,this.changedParentTypes=new Map},Item=function(){function Item(){St(this,Item),this._id=null,this._origin=null,this._left=null,this._right=null,this._right_origin=null,this._parent=null,this._parentSub=null,this._deleted=!1,this._redone=null}return Ot(Item,[{key:"_copy",value:function(){return new this.constructor}},{key:"_redo",value:function(t,e){if(null!==this._redone)return this._redone;var n=this._copy(),r=void 0,i=void 0;null===this._parentSub?(r=this._left,i=this):(r=null,i=this._parent._map.get(this._parentSub),i._delete(t));var o=this._parent;if(!(!0!==o._deleted||null!==o._redone||e.has(o)&&o._redo(t,e)))return!1;if(null!==o._redone){for(o=o._redone;null!==r;){if(null!==r._redone&&r._redone._parent===o){r=r._redone;break}r=r._left}for(;null!==i;)null!==i._redone&&i._redone._parent===o&&(i=i._redone),i=i._right}return n._origin=r,n._left=r,n._right=i,n._right_origin=i,n._parent=o,n._parentSub=this._parentSub,n._integrate(t),this._redone=n,!0}},{key:"_splitAt",value:function(t,e){return 0===e?this:this._right}},{key:"_delete",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this._deleted){this._deleted=!0,t.ds.mark(this._id,this._length,!1);var n=new Delete;n._targetID=this._id,n._length=this._length,e?n._integrate(t,!0):null!==t.persistence&&t.persistence.saveStruct(t,n),m(t,this._parent,this._parentSub),t._transaction.deletedStructs.add(this)}}},{key:"_gcChildren",value:function(t){}},{key:"_gc",value:function(t){var e=new jt;e._id=this._id,e._length=this._length,t.os.delete(this._id),e._integrate(t)}},{key:"_beforeChange",value:function(){}},{key:"_integrate",value:function(t){t._transaction.newTypes.add(this);var e=this._parent,n=this._id,r=null===n?t.userID:n.user,i=t.ss.getState(r);if(null===n)this._id=t.ss.getNextID(this._length);else if(n.user===Xt);else{if(n.clock<i)return[];if(n.clock!==i)throw new Error("Can not apply yet!");t.ss.setState(n.user,i+this._length)}e._deleted||t._transaction.changedTypes.has(e)||t._transaction.newTypes.has(e)||this._parent._beforeChange();var o=void 0;o=null!==this._left?this._left._right:null!==this._parentSub?this._parent._map.get(this._parentSub)||null:this._parent._start;for(var a=new Set,s=new Set;null!==o&&o!==this._right;){if(s.add(o),a.add(o),this._origin===o._origin)o._id.user<this._id.user&&(this._left=o,a.clear());else{if(!s.has(o._origin))break;a.has(o._origin)||(this._left=o,a.clear())}o=o._right}var l=this._parentSub;if(null===this._left){var u=void 0;if(null!==l){var c=e._map;u=c.get(l)||null,c.set(l,this)}else u=e._start,e._start=this;this._right=u,null!==u&&(u._left=this)}else{var h=this._left,f=h._right;this._right=f,h._right=this,null!==f&&(f._left=this)}e._deleted&&this._delete(t,!1),t.os.put(this),m(t,e,l),this._id.user!==Xt&&(null===t.connector||!t.connector._forwardAppliedStructs&&this._id.user!==t.userID||t.connector.broadcastStruct(this),null!==t.persistence&&t.persistence.saveStruct(t,this))}},{key:"_toBinary",value:function(t){t.writeUint8($(this.constructor));var e=0;null!==this._origin&&(e+=1),null!==this._right_origin&&(e+=4),null!==this._parentSub&&(e+=8),t.writeUint8(e),t.writeID(this._id),1&e&&t.writeID(this._origin._lastId),4&e&&t.writeID(this._right_origin._id),0==(5&e)&&t.writeID(this._parent._id),8&e&&t.writeVarString(JSON.stringify(this._parentSub))}},{key:"_fromBinary",value:function(t,e){var n=[],r=e.readUint8(),i=e.readID();if(this._id=i,1&r){var o=e.readID(),a=t.os.getItemCleanEnd(o);null===a?n.push(o):(this._origin=a,this._left=this._origin)}if(4&r){var s=e.readID(),l=t.os.getItemCleanStart(s);null===l?n.push(s):(this._right=l,this._right_origin=l)}if(0==(5&r)){var u=e.readID();if(null===this._parent){var c=void 0;c=u.constructor===qt?t.os.get(u):t.os.getItem(u),null===c?n.push(u):this._parent=c}}else null===this._parent&&(null!==this._origin?this._origin.constructor===jt?this._parent=this._origin:this._parent=this._origin._parent:null!==this._right_origin&&(this._right_origin.constructor===jt?this._parent=this._right_origin:this._parent=this._right_origin._parent));return 8&r&&(this._parentSub=JSON.parse(e.readVarString())),t.ss.getState(i.user)<i.clock&&n.push(new It(i.user,i.clock-1)),n}},{key:"_lastId",get:function(){return new It(this._id.user,this._id.clock+this._length-1)}},{key:"_length",get:function(){return 1}},{key:"_countable",get:function(){return!0}}]),Item}(),Mt=function(){function t(){St(this,t),this.eventListeners=[]}return Ot(t,[{key:"destroy",value:function(){this.eventListeners=null}},{key:"addEventListener",value:function(t){this.eventListeners.push(t)}},{key:"removeEventListener",value:function(t){this.eventListeners=this.eventListeners.filter(function(e){return t!==e})}},{key:"removeAllEventListeners",value:function(){this.eventListeners=[]}},{key:"callEventListeners",value:function(t,e){for(var n=0;n<this.eventListeners.length;n++)try{(0,this.eventListeners[n])(e)}catch(t){console.error(t)}}}]),t}(),Type=function(t){function Type(){St(this,Type);var t=Tt(this,(Type.__proto__||Object.getPrototypeOf(Type)).call(this));return t._map=new Map,t._start=null,t._y=null,t._eventHandler=new Mt,t._deepEventHandler=new Mt,t}return Ut(Type,t),Ot(Type,[{key:"getPathTo",value:function(t){if(t===this)return[];for(var e=[],n=this._y;t!==this&&t!==n;){var r=t._parent;if(null!==t._parentSub)e.unshift(t._parentSub);else{var i=!0,o=!1,a=void 0;try{for(var s,l=r[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){var u=Bt(s.value,2),c=u[0];if(u[1]===t){e.unshift(c);break}}}catch(t){o=!0,a=t}finally{try{!i&&l.return&&l.return()}finally{if(o)throw a}}}t=r}if(t!==this)throw new Error("The type is not a child of this node");return e}},{key:"_callEventHandler",value:function(t,e){var n=t.changedParentTypes;this._eventHandler.callEventListeners(t,e);for(var r=this;r!==this._y;){var i=n.get(r);void 0===i&&(i=[],n.set(r,i)),i.push(e),r=r._parent}}},{key:"_transact",value:function(t){var e=this._y;null!==e?e.transact(t):t(e)}},{key:"observe",value:function(t){this._eventHandler.addEventListener(t)}},{key:"observeDeep",value:function(t){this._deepEventHandler.addEventListener(t)}},{key:"unobserve",value:function(t){this._eventHandler.removeEventListener(t)}},{key:"unobserveDeep",value:function(t){this._deepEventHandler.removeEventListener(t)}},{key:"_integrate",value:function(t){Et(Type.prototype.__proto__||Object.getPrototypeOf(Type.prototype),"_integrate",this).call(this,t),this._y=t;var e=this._start;null!==e&&(this._start=null,b(t,e));var n=this._map;this._map=new Map;var r=!0,i=!1,o=void 0;try{for(var a,s=n.values()[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){b(t,a.value)}}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}}},{key:"_gcChildren",value:function(t){w(t,this._start),this._start=null,this._map.forEach(function(e){w(t,e)}),this._map=new Map}},{key:"_gc",value:function(t){this._gcChildren(t),Et(Type.prototype.__proto__||Object.getPrototypeOf(Type.prototype),"_gc",this).call(this,t)}},{key:"_delete",value:function(t,e,n){void 0!==n&&t.gcEnabled||(n=!1===t._hasUndoManager&&t.gcEnabled),Et(Type.prototype.__proto__||Object.getPrototypeOf(Type.prototype),"_delete",this).call(this,t,e,n),t._transaction.changedTypes.delete(this);var r=!0,i=!1,o=void 0;try{for(var a,s=this._map.values()[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var l=a.value;l instanceof Item&&!l._deleted&&l._delete(t,!1,n)}}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}for(var u=this._start;null!==u;)u._deleted||u._delete(t,!1,n),u=u._right;n&&this._gcChildren(t)}}]),Type}(Item),ItemJSON=function(t){function ItemJSON(){St(this,ItemJSON);var t=Tt(this,(ItemJSON.__proto__||Object.getPrototypeOf(ItemJSON)).call(this));return t._content=null,t}return Ut(ItemJSON,t),Ot(ItemJSON,[{key:"_copy",value:function(){var t=Et(ItemJSON.prototype.__proto__||Object.getPrototypeOf(ItemJSON.prototype),"_copy",this).call(this);return t._content=this._content,t}},{key:"_fromBinary",value:function(t,e){var n=Et(ItemJSON.prototype.__proto__||Object.getPrototypeOf(ItemJSON.prototype),"_fromBinary",this).call(this,t,e),r=e.readVarUint();this._content=new Array(r);for(var i=0;i<r;i++){var o=e.readVarString(),a=void 0;a="undefined"===o?void 0:JSON.parse(o),this._content[i]=a}return n}},{key:"_toBinary",value:function(t){Et(ItemJSON.prototype.__proto__||Object.getPrototypeOf(ItemJSON.prototype),"_toBinary",this).call(this,t);var e=this._content.length;t.writeVarUint(e);for(var n=0;n<e;n++){var r=void 0,i=this._content[n];r=void 0===i?"undefined":JSON.stringify(i),t.writeVarString(r)}}},{key:"_logString",value:function(){return y("ItemJSON",this,"content:"+JSON.stringify(this._content))}},{key:"_splitAt",value:function(t,e){if(0===e)return this;if(e>=this._length)return this._right;var n=new ItemJSON;return n._content=this._content.splice(e),k(t,this,n,e),n}},{key:"_length",get:function(){return this._content.length}}]),ItemJSON}(Item),ItemString=function(t){function ItemString(){St(this,ItemString);var t=Tt(this,(ItemString.__proto__||Object.getPrototypeOf(ItemString)).call(this));return t._content=null,t}return Ut(ItemString,t),Ot(ItemString,[{key:"_copy",value:function(){var t=Et(ItemString.prototype.__proto__||Object.getPrototypeOf(ItemString.prototype),"_copy",this).call(this);return t._content=this._content,t}},{key:"_fromBinary",value:function(t,e){var n=Et(ItemString.prototype.__proto__||Object.getPrototypeOf(ItemString.prototype),"_fromBinary",this).call(this,t,e);return this._content=e.readVarString(),n}},{key:"_toBinary",value:function(t){Et(ItemString.prototype.__proto__||Object.getPrototypeOf(ItemString.prototype),"_toBinary",this).call(this,t),t.writeVarString(this._content)}},{key:"_logString",value:function(){return y("ItemString",this,'content:"'+this._content+'"')}},{key:"_splitAt",value:function(t,e){if(0===e)return this;if(e>=this._length)return this._right;var n=new ItemString;return n._content=this._content.slice(e),this._content=this._content.slice(0,e),k(t,this,n,e),n}},{key:"_length",get:function(){return this._content.length}}]),ItemString}(Item),YEvent=function(){function YEvent(t){St(this,YEvent),this.target=t,this.currentTarget=t}return Ot(YEvent,[{key:"path",get:function(){return this.currentTarget.getPathTo(this.target)}}]),YEvent}(),YArrayEvent=function(t){function YArrayEvent(t,e,n){St(this,YArrayEvent);var r=Tt(this,(YArrayEvent.__proto__||Object.getPrototypeOf(YArrayEvent)).call(this,t));return r.remote=e,r._transaction=n,r._addedElements=null,r._removedElements=null,r}return Ut(YArrayEvent,t),Ot(YArrayEvent,[{key:"addedElements",get:function(){if(null===this._addedElements){var t=this.target,e=this._transaction,n=new Set;e.newTypes.forEach(function(r){r._parent!==t||e.deletedStructs.has(r)||n.add(r)}),this._addedElements=n}return this._addedElements}},{key:"removedElements",get:function(){if(null===this._removedElements){var t=this.target,e=this._transaction,n=new Set;e.deletedStructs.forEach(function(r){r._parent!==t||e.newTypes.has(r)||n.add(r)}),this._removedElements=n}return this._removedElements}}]),YArrayEvent}(YEvent),YArray=function(t){function YArray(){return St(this,YArray),Tt(this,(YArray.__proto__||Object.getPrototypeOf(YArray)).apply(this,arguments))}return Ut(YArray,t),Ot(YArray,[{key:"_callObserver",value:function(t,e,n){this._callEventHandler(t,new YArrayEvent(this,n,t))}},{key:"get",value:function(t){for(var e=this._start;null!==e;){if(!e._deleted&&e._countable){if(t<e._length)return e.constructor===ItemJSON||e.constructor===ItemString?e._content[t]:e;t-=e._length}e=e._right}}},{key:"toArray",value:function(){return this.map(function(t){return t})}},{key:"toJSON",value:function(){return this.map(function(t){return t instanceof Type?null!==t.toJSON?t.toJSON():t.toString():t})}},{key:"map",value:function(t){var e=this,n=[];return this.forEach(function(r,i){n.push(t(r,i,e))}),n}},{key:"forEach",value:function(t){for(var e=0,n=this._start;null!==n;){if(!n._deleted&&n._countable)if(n instanceof Type)t(n,e++,this);else for(var r=n._content,i=r.length,o=0;o<i;o++)e++,t(r[o],e,this);n=n._right}}},{key:Symbol.iterator,value:function(){return{next:function(){for(;null!==this._item&&(this._item._deleted||this._item._length<=this._itemElement);)this._item=this._item._right,this._itemElement=0;if(null===this._item)return{done:!0};var t=void 0;return t=this._item instanceof Type?this._item:this._item._content[this._itemElement++],{value:t,done:!1}},_item:this._start,_itemElement:0,_count:0}}},{key:"delete",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this._y.transact(function(){for(var r=e._start,i=0;null!==r&&n>0;){if(!r._deleted&&r._countable)if(i<=t&&t<i+r._length){var o=t-i;r=r._splitAt(e._y,o),r._splitAt(e._y,n),n-=r._length,r._delete(e._y),i+=o}else i+=r._length;r=r._right}}),n>0)throw new Error("Delete exceeds the range of the YArray")}},{key:"insertAfter",value:function(t,e){var n=this;return this._transact(function(r){var i=void 0;i=null===t?n._start:t._right;for(var o=null,a=0;a<e.length;a++){var s=e[a];"function"==typeof s&&(s=new s),s instanceof Type?(null!==o&&(null!==r&&o._integrate(r),t=o,o=null),s._origin=t,s._left=t,s._right=i,s._right_origin=i,s._parent=n,null!==r?s._integrate(r):null===t?n._start=s:t._right=s,t=s):(null===o&&(o=new ItemJSON,o._origin=t,o._left=t,o._right=i,o._right_origin=i,o._parent=n,o._content=[]),o._content.push(s))}null!==o&&(null!==r?o._integrate(r):null===o._left&&(n._start=o))}),e}},{key:"insert",value:function(t,e){var n=this;this._transact(function(){for(var r=null,i=n._start,o=0,a=n._y;null!==i;){var s=i._deleted?0:i._length-1;if(o<=t&&t<=o+s){var l=t-o;i=i._splitAt(a,l),r=i._left,o+=l;break}i._deleted||(o+=i._length),r=i,i=i._right}if(t>o)throw new Error("Index exceeds array range!");n.insertAfter(r,e)})}},{key:"push",value:function(t){for(var e=this._start,n=null;null!==e;)e._deleted||(n=e),e=e._right;this.insertAfter(n,t)}},{key:"_logString",value:function(){return y("YArray",this,"start:"+p(this._start)+'"')}},{key:"length",get:function(){for(var t=0,e=this._start;null!==e;)!e._deleted&&e._countable&&(t+=e._length),e=e._right;return t}}]),YArray}(Type),YMapEvent=function(t){function YMapEvent(t,e,n){St(this,YMapEvent);var r=Tt(this,(YMapEvent.__proto__||Object.getPrototypeOf(YMapEvent)).call(this,t));return r.keysChanged=e,r.remote=n,r}return Ut(YMapEvent,t),YMapEvent}(YEvent),YMap=function(t){function YMap(){return St(this,YMap),Tt(this,(YMap.__proto__||Object.getPrototypeOf(YMap)).apply(this,arguments))}return Ut(YMap,t),Ot(YMap,[{key:"_callObserver",value:function(t,e,n){this._callEventHandler(t,new YMapEvent(this,e,n))}},{key:"toJSON",value:function(){var t={},e=!0,n=!1,r=void 0;try{for(var i,o=this._map[Symbol.iterator]();!(e=(i=o.next()).done);e=!0){var a=Bt(i.value,2),s=a[0],l=a[1];if(!l._deleted){var u=void 0;u=l instanceof Type?void 0!==l.toJSON?l.toJSON():l.toString():l._content[0],t[s]=u}}}catch(t){n=!0,r=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw r}}return t}},{key:"keys",value:function(){var t=[],e=!0,n=!1,r=void 0;try{for(var i,o=this._map[Symbol.iterator]();!(e=(i=o.next()).done);e=!0){var a=Bt(i.value,2),s=a[0];a[1]._deleted||t.push(s)}}catch(t){n=!0,r=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw r}}return t}},{key:"delete",value:function(t){var e=this;this._transact(function(n){var r=e._map.get(t);null!==n&&void 0!==r&&r._delete(n)})}},{key:"set",value:function(t,e){var n=this;return this._transact(function(r){var i=n._map.get(t)||null;if(null!==i){if(i.constructor===ItemJSON&&!i._deleted&&i._content[0]===e)return e;null!==r&&i._delete(r)}var o=void 0;"function"==typeof e?(o=new e,e=o):e instanceof Item?o=e:(o=new ItemJSON,o._content=[e]),o._right=i,o._right_origin=i,o._parent=n,o._parentSub=t,null!==r?o._integrate(r):n._map.set(t,o)}),e}},{key:"get",value:function(t){var e=this._map.get(t);if(void 0!==e&&!e._deleted)return e instanceof Type?e:e._content[e._content.length-1]}},{key:"has",value:function(t){var e=this._map.get(t);return void 0!==e&&!e._deleted}},{key:"_logString",value:function(){return y("YMap",this,"mapSize:"+this._map.size)}}]),YMap}(Type),Rt=function(t){function e(){St(this,e);var t=Tt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return t.embed=null,t}return Ut(e,t),Ot(e,[{key:"_copy",value:function(t,n){var r=Et(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_copy",this).call(this,t,n);return r.embed=this.embed,r}},{key:"_fromBinary",value:function(t,n){var r=Et(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_fromBinary",this).call(this,t,n);return this.embed=JSON.parse(n.readVarString()),r}},{key:"_toBinary",value:function(t){Et(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_toBinary",this).call(this,t),t.writeVarString(JSON.stringify(this.embed))}},{key:"_logString",value:function(){return y("ItemEmbed",this,"embed:"+JSON.stringify(this.embed))}},{key:"_length",get:function(){return 1}}]),e}(Item),Wt=function(t){function e(){St(this,e);var t=Tt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return t.key=null,t.value=null,t}return Ut(e,t),Ot(e,[{key:"_copy",value:function(t,n){var r=Et(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_copy",this).call(this,t,n);return r.key=this.key,r.value=this.value,r}},{key:"_fromBinary",value:function(t,n){var r=Et(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_fromBinary",this).call(this,t,n);return this.key=n.readVarString(),this.value=JSON.parse(n.readVarString()),r}},{key:"_toBinary",value:function(t){Et(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_toBinary",this).call(this,t),t.writeVarString(this.key),t.writeVarString(JSON.stringify(this.value))}},{key:"_logString",value:function(){return y("ItemFormat",this,"key:"+JSON.stringify(this.key)+",value:"+JSON.stringify(this.value))}},{key:"_length",get:function(){return 1}},{key:"_countable",get:function(){return!1}}]),e}(Item),Ht=function(t){function e(t,n,r){St(this,e);var i=Tt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n,r));return i._delta=null,i}return Ut(e,t),Ot(e,[{key:"delta",get:function(){var t=this;if(null===this._delta){var e=this.target._y;e.transact(function(){var n=t.target._start,r=[],i=t.addedElements,o=t.removedElements;t._delta=r;for(var a=null,s={},l=new Map,u=new Map,c="",h=0,f=0,d=function(){if(null!==a){var t=void 0;switch(a){case"delete":t={delete:f},f=0;break;case"insert":if(t={insert:c},l.size>0){t.attributes={};var e=!0,n=!1,i=void 0;try{for(var o,u=l[Symbol.iterator]();!(e=(o=u.next()).done);e=!0){var d=Bt(o.value,2),_=d[0],v=d[1];null!==v&&(t.attributes[_]=v)}}catch(t){n=!0,i=t}finally{try{!e&&u.return&&u.return()}finally{if(n)throw i}}}c="";break;case"retain":if(t={retain:h},Object.keys(s).length>0){t.attributes={};for(var _ in s)t.attributes[_]=s[_]}h=0}r.push(t),a=null}};null!==n;){switch(n.constructor){case Rt:i.has(n)?(d(),a="insert",c=n.embed,d()):o.has(n)?("delete"!==a&&(d(),a="delete"),f+=1):!1===n._deleted&&("retain"!==a&&(d(),a="retain"),h+=1);break;case ItemString:i.has(n)?("insert"!==a&&(d(),a="insert"),c+=n._content):o.has(n)?("delete"!==a&&(d(),a="delete"),f+=n._length):!1===n._deleted&&("retain"!==a&&(d(),a="retain"),h+=n._length);break;case Wt:if(i.has(n)){(l.get(n.key)||null)!==n.value?("retain"===a&&d(),n.value===(u.get(n.key)||null)?delete s[n.key]:s[n.key]=n.value):n._delete(e)}else if(o.has(n)){u.set(n.key,n.value);var _=l.get(n.key)||null;_!==n.value&&("retain"===a&&d(),s[n.key]=_)}else if(!1===n._deleted){u.set(n.key,n.value);var v=s[n.key];void 0!==v&&(v!==n.value?("retain"===a&&d(),null===n.value?s[n.key]=n.value:delete s[n.key]):n._delete(e))}!1===n._deleted&&("insert"===a&&d(),T(l,n))}n=n._right}for(d();t._delta.length>0;){var p=t._delta[t._delta.length-1];if(void 0===p.retain||void 0!==p.attributes)break;t._delta.pop()}})}return this._delta}}]),e}(YArrayEvent),YText=function(t){function YText(t){St(this,YText);var e=Tt(this,(YText.__proto__||Object.getPrototypeOf(YText)).call(this));if("string"==typeof t){var n=new ItemString;n._parent=e,n._content=t,e._start=n}return e}return Ut(YText,t),Ot(YText,[{key:"_callObserver",value:function(t,e,n){this._callEventHandler(t,new Ht(this,n,t))}},{key:"toString",value:function(){for(var t="",e=this._start;null!==e;)!e._deleted&&e._countable&&(t+=e._content),e=e._right;return t}},{key:"applyDelta",value:function(t){var e=this;this._transact(function(n){for(var r=null,i=e._start,o=new Map,a=0;a<t.length;a++){var s=t[a];if(void 0!==s.insert){var l=x(n,s.insert,e,r,i,o,s.attributes||{}),u=Bt(l,2);r=u[0],i=u[1]}else if(void 0!==s.retain){var c=I(n,s.retain,e,r,i,o,s.attributes||{}),h=Bt(c,2);r=h[0],i=h[1]}else if(void 0!==s.delete){var f=D(n,s.delete,e,r,i,o),d=Bt(f,2);r=d[0],i=d[1]}}})}},{key:"toDelta",value:function(){function t(){if(r.length>0){var t={},i=!1,o=!0,a=!1,s=void 0;try{for(var l,u=n[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){var c=Bt(l.value,2),h=c[0],f=c[1];i=!0,t[h]=f}}catch(t){a=!0,s=t}finally{try{!o&&u.return&&u.return()}finally{if(a)throw s}}var d={insert:r};i&&(d.attributes=t),e.push(d),r=""}}for(var e=[],n=new Map,r="",i=this._start;null!==i;){if(!i._deleted)switch(i.constructor){case ItemString:r+=i._content;break;case Wt:t(),T(n,i)}i=i._right}return t(),e}},{key:"insert",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e.length<=0||this._transact(function(i){var o=E(n,t),a=Bt(o,3),s=a[0],l=a[1],u=a[2];x(i,e,n,s,l,u,r)})}},{key:"insertEmbed",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e.constructor!==Object)throw new Error("Embed must be an Object");this._transact(function(i){var o=E(n,t),a=Bt(o,3),s=a[0],l=a[1],u=a[2];x(i,e,n,s,l,u,r)})}},{key:"delete",value:function(t,e){var n=this;0!==e&&this._transact(function(r){var i=E(n,t),o=Bt(i,3),a=o[0],s=o[1],l=o[2];D(r,e,n,a,s,l)})}},{key:"format",value:function(t,e,n){var r=this;this._transact(function(i){var o=E(r,t),a=Bt(o,3),s=a[0],l=a[1],u=a[2];null!==l&&I(i,e,r,s,l,u,n)})}},{key:"_logString",value:function(){return y("YText",this)}}]),YText}(YArray),YXmlHook=function(t){function YXmlHook(t){St(this,YXmlHook);var e=Tt(this,(YXmlHook.__proto__||Object.getPrototypeOf(YXmlHook)).call(this));return e.hookName=null,void 0!==t&&(e.hookName=t),e}return Ut(YXmlHook,t),Ot(YXmlHook,[{key:"_copy",value:function(){var t=Et(YXmlHook.prototype.__proto__||Object.getPrototypeOf(YXmlHook.prototype),"_copy",this).call(this);return t.hookName=this.hookName,t}},{key:"toDom",value:function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=arguments[2],n=t[this.hookName],r=void 0;return r=void 0!==n?n.createDom(this):document.createElement(this.hookName),r.setAttribute("data-yjs-hook",this.hookName),R(e,r,this),r}},{key:"_fromBinary",value:function(t,e){var n=Et(YXmlHook.prototype.__proto__||Object.getPrototypeOf(YXmlHook.prototype),"_fromBinary",this).call(this,t,e);return this.hookName=e.readVarString(),n}},{key:"_toBinary",value:function(t){Et(YXmlHook.prototype.__proto__||Object.getPrototypeOf(YXmlHook.prototype),"_toBinary",this).call(this,t),t.writeVarString(this.hookName)}},{key:"_integrate",value:function(t){if(null===this.hookName)throw new Error("hookName must be defined!");Et(YXmlHook.prototype.__proto__||Object.getPrototypeOf(YXmlHook.prototype),"_integrate",this).call(this,t)}}]),YXmlHook}(YMap),Jt=function(){function t(e,n){St(this,t),this._filter=n||function(){return!0},this._root=e,this._currentNode=e,this._firstCall=!0}return Ot(t,[{key:Symbol.iterator,value:function(){return this}},{key:"next",value:function(){var t=this._currentNode;if(this._firstCall&&(this._firstCall=!1,!t._deleted&&this._filter(t)))return{value:t,done:!1};do{if(t._deleted||t.constructor!==YXmlFragment._YXmlElement&&t.constructor!==YXmlFragment||null===t._start){for(;t!==this._root;){if(null!==t._right){t=t._right;break}t=t._parent}t===this._root&&(t=null)}else t=t._start;if(t===this._root)break}while(null!==t&&(t._deleted||!this._filter(t)));return this._currentNode=t,null===t?{done:!0}:{value:t,done:!1}}}]),t}(),YXmlEvent=function(t){function YXmlEvent(t,e,n,r){St(this,YXmlEvent);var i=Tt(this,(YXmlEvent.__proto__||Object.getPrototypeOf(YXmlEvent)).call(this,t));return i._transaction=r,i.childListChanged=!1,i.attributesChanged=new Set,i.remote=n,e.forEach(function(t){null===t?i.childListChanged=!0:i.attributesChanged.add(t)}),i}return Ut(YXmlEvent,t),YXmlEvent}(YEvent),YXmlFragment=function(t){function YXmlFragment(){return St(this,YXmlFragment),Tt(this,(YXmlFragment.__proto__||Object.getPrototypeOf(YXmlFragment)).apply(this,arguments))}return Ut(YXmlFragment,t),Ot(YXmlFragment,[{key:"createTreeWalker",value:function(t){return new Jt(this,t)}},{key:"querySelector",value:function(t){t=t.toUpperCase();var e=new Jt(this,function(e){return e.nodeName===t}),n=e.next();return n.done?null:n.value}},{key:"querySelectorAll",value:function(t){return t=t.toUpperCase(),Array.from(new Jt(this,function(e){return e.nodeName===t}))}},{key:"_callObserver",value:function(t,e,n){this._callEventHandler(t,new YXmlEvent(this,e,n,t))}},{key:"toString",value:function(){return this.map(function(t){return t.toString()}).join("")}},{key:"_delete",value:function(t,e,n){Et(YXmlFragment.prototype.__proto__||Object.getPrototypeOf(YXmlFragment.prototype),"_delete",this).call(this,t,e,n)}},{key:"toDom",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2],r=t.createDocumentFragment();return R(n,r,this),this.forEach(function(i){r.insertBefore(i.toDom(t,e,n),null)}),r}},{key:"_logString",value:function(){return y("YXml",this)}}]),YXmlFragment}(YArray),YXmlElement=function(t){function YXmlElement(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"UNDEFINED";St(this,YXmlElement);var e=Tt(this,(YXmlElement.__proto__||Object.getPrototypeOf(YXmlElement)).call(this));return e.nodeName=t.toUpperCase(),e}return Ut(YXmlElement,t),Ot(YXmlElement,[{key:"_copy",value:function(){var t=Et(YXmlElement.prototype.__proto__||Object.getPrototypeOf(YXmlElement.prototype),"_copy",this).call(this);return t.nodeName=this.nodeName,t}},{key:"_fromBinary",value:function(t,e){var n=Et(YXmlElement.prototype.__proto__||Object.getPrototypeOf(YXmlElement.prototype),"_fromBinary",this).call(this,t,e);return this.nodeName=e.readVarString(),n}},{key:"_toBinary",value:function(t){Et(YXmlElement.prototype.__proto__||Object.getPrototypeOf(YXmlElement.prototype),"_toBinary",this).call(this,t),t.writeVarString(this.nodeName)}},{key:"_integrate",value:function(t){if(null===this.nodeName)throw new Error("nodeName must be defined!");Et(YXmlElement.prototype.__proto__||Object.getPrototypeOf(YXmlElement.prototype),"_integrate",this).call(this,t)}},{key:"toString",value:function(){var t=this.getAttributes(),e=[],n=[];for(var r in t)n.push(r);n.sort();for(var i=n.length,o=0;o<i;o++){var a=n[o];e.push(a+'="'+t[a]+'"')}var s=this.nodeName.toLocaleLowerCase();return"<"+s+(e.length>0?" "+e.join(" "):"")+">"+Et(YXmlElement.prototype.__proto__||Object.getPrototypeOf(YXmlElement.prototype),"toString",this).call(this)+"</"+s+">"}},{key:"removeAttribute",value:function(t){return YMap.prototype.delete.call(this,t)}},{key:"setAttribute",value:function(t,e){return YMap.prototype.set.call(this,t,e)}},{key:"getAttribute",value:function(t){return YMap.prototype.get.call(this,t)}},{key:"getAttributes",value:function(){var t={},e=!0,n=!1,r=void 0;try{for(var i,o=this._map[Symbol.iterator]();!(e=(i=o.next()).done);e=!0){var a=Bt(i.value,2),s=a[0],l=a[1];l._deleted||(t[s]=l._content[0])}}catch(t){n=!0,r=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw r}}return t}},{key:"toDom",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2],r=t.createElement(this.nodeName),i=this.getAttributes();for(var o in i)r.setAttribute(o,i[o]);return this.forEach(function(i){r.appendChild(i.toDom(t,e,n))}),R(n,r,this),r}}]),YXmlElement}(YXmlFragment);YXmlFragment._YXmlElement=YXmlElement;var YXmlText=function(t){function YXmlText(){return St(this,YXmlText),Tt(this,(YXmlText.__proto__||Object.getPrototypeOf(YXmlText)).apply(this,arguments))}return Ut(YXmlText,t),Ot(YXmlText,[{key:"toDom",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments[2],n=t.createTextNode(this.toString());return R(e,n,this),n}},{key:"_delete",value:function(t,e,n){Et(YXmlText.prototype.__proto__||Object.getPrototypeOf(YXmlText.prototype),"_delete",this).call(this,t,e,n)}}]),YXmlText}(YText),zt=new Map,Yt=new Map;q(0,ItemJSON),q(1,ItemString),q(10,Wt),q(11,Rt),q(2,Delete),q(3,YArray),q(4,YMap),q(5,YText),q(6,YXmlFragment),q(7,YXmlElement),q(8,YXmlText),q(9,YXmlHook),q(12,jt);var Xt=16777215,qt=function(){function t(e,n){St(this,t),this.user=Xt,this.name=e,this.type=$(n)}return Ot(t,[{key:"equals",value:function(t){return null!==t&&t.user===this.user&&t.name===this.name&&t.type===this.type}},{key:"lessThan",value:function(e){return e.constructor!==t||(this.user<e.user||this.user===e.user&&(this.name<e.name||this.name===e.name&&this.type<e.type))}}]),t}(),Ft=function(t){function e(t){St(this,e);var n=Tt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.y=t,n}return Ut(e,t),Ot(e,[{key:"logTable",value:function(){var t=[];this.iterate(null,null,function(e){e.constructor===jt?t.push({id:p(e),content:e._length,deleted:"GC"}):t.push({id:p(e),origin:p(null===e._origin?null:e._origin._lastId),left:p(null===e._left?null:e._left._lastId),right:p(e._right),right_origin:p(e._right_origin),parent:p(e._parent),parentSub:e._parentSub,deleted:e._deleted,content:JSON.stringify(e._content)})}),console.table(t)}},{key:"get",value:function(t){var e=this.find(t);if(null===e&&t instanceof qt){var n=F(t.type),r=this.y;e=new n,e._id=t,e._parent=r,r.transact(function(){e._integrate(r)}),this.put(e)}return e}},{key:"getItem",value:function(t){var e=this.findWithUpperBound(t);if(null===e)return null;var n=e._id;return t.user===n.user&&t.clock<n.clock+e._length?e:null}},{key:"getItemCleanStart",value:function(t){var e=this.getItem(t);if(null===e||1===e._length)return e;var n=e._id;return n.clock===t.clock?e:e._splitAt(this.y,t.clock-n.clock)}},{key:"getItemCleanEnd",value:function(t){var e=this.getItem(t);if(null===e||1===e._length)return e;var n=e._id;return n.clock+e._length-1===t.clock?e:(e._splitAt(this.y,t.clock-n.clock+1),e)}}]),e}(xt),$t=function(){function t(e){St(this,t),this.y=e,this.state=new Map}return Ot(t,[{key:"logTable",value:function(){var t=[],e=!0,n=!1,r=void 0;try{for(var i,o=this.state[Symbol.iterator]();!(e=(i=o.next()).done);e=!0){var a=Bt(i.value,2),s=a[0],l=a[1];t.push({user:s,state:l})}}catch(t){n=!0,r=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw r}}console.table(t)}},{key:"getNextID",value:function(t){var e=this.y.userID,n=this.getState(e);return this.setState(e,n+t),new It(e,n)}},{key:"updateRemoteState",value:function(t){for(var e=t._id.user,n=this.state.get(e);null!==t&&t._id.clock===n;)n+=t._length,t=this.y.os.get(new It(e,n))
;this.state.set(e,n)}},{key:"getState",value:function(t){var e=this.state.get(t);return null==e?0:e}},{key:"setState",value:function(t,e){var n=this.y._transaction.beforeState;n.has(t)||n.set(t,this.getState(t)),this.state.set(t,e)}}]),t}(),Gt=function(){function t(){St(this,t),this._eventListener=new Map,this._stateListener=new Map}return Ot(t,[{key:"_getListener",value:function(t){var e=this._eventListener.get(t);return void 0===e&&(e={once:new Set,on:new Set},this._eventListener.set(t,e)),e}},{key:"once",value:function(t,e){this._getListener(t).once.add(e)}},{key:"on",value:function(t,e){this._getListener(t).on.add(e)}},{key:"_initStateListener",value:function(t){var e=this._stateListener.get(t);return void 0===e&&(e={},e.promise=new Promise(function(t){e.resolve=t}),this._stateListener.set(t,e)),e}},{key:"when",value:function(t){return this._initStateListener(t).promise}},{key:"off",value:function(t,e){if(null==t||null==e)throw new Error("You must specify event name and function!");var n=this._eventListener.get(t);void 0!==n&&(n.on.delete(e),n.once.delete(e))}},{key:"emit",value:function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this._initStateListener(t).resolve();var i=this._eventListener.get(t);void 0!==i?(i.on.forEach(function(t){return t.apply(null,n)}),i.once.forEach(function(t){return t.apply(null,n)}),i.once=new Set):"error"===t&&console.error(n[0])}},{key:"destroy",value:function(){this._eventListener=null}}]),t}(),Zt=function(){function t(e,n){St(this,t),this.type=e,this.target=n,this._mutualExclude=K()}return Ot(t,[{key:"destroy",value:function(){this.type=null,this.target=null}}]),t}(),Qt=null,Kt="undefined"!=typeof getSelection?tt:function(){return null},te=function(t){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};St(this,e);var i=Tt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));i.opts=r,r.document=r.document||document,r.hooks=r.hooks||{},i.scrollingElement=r.scrollingElement||null,i.domToType=new Map,i.typeToDom=new Map,i.filter=r.filter||N,n.innerHTML="",t.forEach(function(t){n.insertBefore(t.toDom(r.document,r.hooks,i),null)}),i._typeObserver=ot.bind(i),i._domObserver=function(t){lt.call(i,t,r.document)},t.observeDeep(i._typeObserver),i._mutationObserver=new MutationObserver(i._domObserver),i._mutationObserver.observe(n,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),i._currentSel=null,document.addEventListener("selectionchange",function(){i._currentSel=Kt(i)});var o=t._y;return i.y=o,i._beforeTransactionHandler=function(t,e,n){i._domObserver(i._mutationObserver.takeRecords()),i._mutualExclude(function(){et(i,n)})},o.on("beforeTransaction",i._beforeTransactionHandler),i._afterTransactionHandler=function(t,e,n){i._mutualExclude(function(){nt(i,n)}),e.deletedStructs.forEach(function(t){var e=i.typeToDom.get(t);void 0!==e&&M(i,e,t)})},o.on("afterTransaction",i._afterTransactionHandler),i._beforeObserverCallsHandler=function(t,e){e.changedTypes.forEach(function(e,n){(e.size>1||1===e.size&&!1===e.has(null))&&V(t,i,n)}),e.newTypes.forEach(function(e){V(t,i,e)})},o.on("beforeObserverCalls",i._beforeObserverCallsHandler),R(i,n,t),i}return Ut(e,t),Ot(e,[{key:"setFilter",value:function(t){this.filter=t}},{key:"_getUndoStackInfo",value:function(){return this.getSelection()}},{key:"_restoreUndoStackInfo",value:function(t){this.restoreSelection(t)}},{key:"getSelection",value:function(){return this._currentSel}},{key:"restoreSelection",value:function(t){if(null!==t){var e=t.to,n=t.from,r=!1,i=getSelection(),o=i.baseNode,a=i.baseOffset,s=i.extentNode,l=i.extentOffset;if(null!==n){var u=Q(this.y,n);if(null!==u){var c=this.typeToDom.get(u.type),h=u.offset;c===o&&h===a||(o=c,a=h,r=!0)}}if(null!==e){var f=Q(this.y,e);if(null!==f){var d=this.typeToDom.get(f.type),_=f.offset;d===s&&_===l||(s=d,l=_,r=!0)}}r&&i.setBaseAndExtent(o,a,s,l)}}},{key:"destroy",value:function(){this.domToType=null,this.typeToDom=null,this.type.unobserveDeep(this._typeObserver),this._mutationObserver.disconnect();var t=this.type._y;t.off("beforeTransaction",this._beforeTransactionHandler),t.off("beforeObserverCalls",this._beforeObserverCallsHandler),t.off("afterTransaction",this._afterTransactionHandler),Et(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this)}}]),e}(Zt),Y=function(t){function Y(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};St(this,Y);var i=Tt(this,(Y.__proto__||Object.getPrototypeOf(Y)).call(this));i.gcEnabled=r.gc||!1,i.room=t,null!=e&&(e.connector.room=t),i._contentReady=!1,i._opts=e,"number"!=typeof e.userID?i.userID=G():i.userID=e.userID,i.share={},i.ds=new Pt(i),i.os=new Ft(i),i.ss=new $t(i),i._missingStructs=new Map,i._readyToIntegrate=[],i._transaction=null,i.connector=null,i.connected=!1;var o=function(){null!=e&&(i.connector=new Y[e.connector.name](i,e.connector),i.connected=!0,i.emit("connectorReady"))};return i.persistence=null,null!=n?(i.persistence=n,n._init(i).then(o)):o(),i._parent=null,i._hasUndoManager=!1,i}return Ut(Y,t),Ot(Y,[{key:"_setContentReady",value:function(){this._contentReady||(this._contentReady=!0,this.emit("content"))}},{key:"whenContentReady",value:function(){var t=this;return this._contentReady?Promise.resolve():new Promise(function(e){t.once("content",e)})}},{key:"_beforeChange",value:function(){}},{key:"transact",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=null===this._transaction;n&&(this._transaction=new Ct(this),this.emit("beforeTransaction",this,this._transaction,e));try{t(this)}catch(t){console.error(t)}if(n){this.emit("beforeObserverCalls",this,this._transaction,e);var r=this._transaction;this._transaction=null,r.changedTypes.forEach(function(t,n){n._deleted||n._callObserver(r,t,e)}),r.changedParentTypes.forEach(function(t,e){e._deleted||(t=t.filter(function(t){return!t.target._deleted}),t.forEach(function(t){t.currentTarget=e}),e._deepEventHandler.callEventListeners(r,t))}),this.emit("afterTransaction",this,r,e)}}},{key:"define",value:function(t,e){var n=new qt(t,e),r=this.os.get(n);if(void 0===this.share[t])this.share[t]=r;else if(this.share[t]!==r)throw new Error("Type is already defined with a different constructor");return r}},{key:"get",value:function(t){return this.share[t]}},{key:"disconnect",value:function(){return this.connected?(this.connected=!1,this.connector.disconnect()):Promise.resolve()}},{key:"reconnect",value:function(){return this.connected?Promise.resolve():(this.connected=!0,this.connector.reconnect())}},{key:"destroy",value:function(){Et(Y.prototype.__proto__||Object.getPrototypeOf(Y.prototype),"destroy",this).call(this),this.share=null,null!=this.connector&&(null!=this.connector.destroy?this.connector.destroy():this.connector.disconnect()),null!==this.persistence&&(this.persistence.deinit(this),this.persistence=null),this.os=null,this.ds=null,this.ss=null}},{key:"_start",get:function(){return null},set:function(t){return null}}]),Y}(Gt);Y.extend=function(){for(var t=0;t<arguments.length;t++){var e=arguments[t];if("function"!=typeof e)throw new Error("Expected a function!");e(Y)}};var ee=function t(e,n,r){var i=this;St(this,t),this.created=new Date;var o=n.beforeState;o.has(e.userID)?(this.toState=new It(e.userID,e.ss.getState(e.userID)-1),this.fromState=new It(e.userID,o.get(e.userID))):(this.toState=null,this.fromState=null),this.deletedStructs=new Set,n.deletedStructs.forEach(function(t){i.deletedStructs.add({from:t._id,len:t._length})}),this.bindingInfos=r},ne=function(){function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};St(this,t),this.options=r,this._bindings=new Set(r.bindings),r.captureTimeout=null==r.captureTimeout?500:r.captureTimeout,this._undoBuffer=[],this._redoBuffer=[],this._scope=e,this._undoing=!1,this._redoing=!1,this._lastTransactionWasUndo=!1;var i=e._y;this.y=i,i._hasUndoManager=!0;var o=void 0;i.on("beforeTransaction",function(t,e,r){r||(o=new Map,n._bindings.forEach(function(t){o.set(t,t._getUndoStackInfo())}))}),i.on("afterTransaction",function(t,i,a){if(!a&&i.changedParentTypes.has(e)){var s=new ee(t,i,o);if(n._undoing)n._lastTransactionWasUndo=!0,n._redoBuffer.push(s);else{var l=n._undoBuffer.length>0?n._undoBuffer[n._undoBuffer.length-1]:null;!1===n._redoing&&!1===n._lastTransactionWasUndo&&null!==l&&(r.captureTimeout<0||s.created-l.created<=r.captureTimeout)?(l.created=s.created,null!==s.toState&&(l.toState=s.toState,null===l.fromState&&(l.fromState=s.fromState)),s.deletedStructs.forEach(l.deletedStructs.add,l.deletedStructs)):(n._lastTransactionWasUndo=!1,n._undoBuffer.push(s)),n._redoing||(n._redoBuffer=[])}}})}return Ot(t,[{key:"flushChanges",value:function(){this._lastTransactionWasUndo=!0}},{key:"undo",value:function(){this._undoing=!0;var t=ut(this.y,this._scope,this._undoBuffer);return this._undoing=!1,t}},{key:"redo",value:function(){this._redoing=!0;var t=ut(this.y,this._scope,this._redoBuffer);return this._redoing=!1,t}}]),t}(),re=1e3,ie=60*re,oe=60*ie,ae=24*oe,se=365.25*ae,le=function(t,e){e=e||{};var n=void 0===t?"undefined":wt(t);if("string"===n&&t.length>0)return ht(t);if("number"===n&&!1===isNaN(t))return e.long?dt(t):ft(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))},ue=Object.freeze({default:le,__moduleExports:le}),ce=ue&&le||ue,he=ct(function(t,e){function n(t){var n,r=0;for(n in t)r=(r<<5)-r+t.charCodeAt(n),r|=0;return e.colors[Math.abs(r)%e.colors.length]}function r(t){function r(){if(r.enabled){var t=r,n=+new Date,i=n-(l||n);t.diff=i,t.prev=l,t.curr=n,l=n;for(var o=new Array(arguments.length),a=0;a<o.length;a++)o[a]=arguments[a];o[0]=e.coerce(o[0]),"string"!=typeof o[0]&&o.unshift("%O");var s=0;o[0]=o[0].replace(/%([a-zA-Z%])/g,function(n,r){if("%%"===n)return n;s++;var i=e.formatters[r];if("function"==typeof i){var a=o[s];n=i.call(t,a),o.splice(s,1),s--}return n}),e.formatArgs.call(t,o);(r.log||e.log||console.log.bind(console)).apply(t,o)}}return r.namespace=t,r.enabled=e.enabled(t),r.useColors=e.useColors(),r.color=n(t),"function"==typeof e.init&&e.init(r),r}function i(t){e.save(t),e.names=[],e.skips=[];for(var n=("string"==typeof t?t:"").split(/[\s,]+/),r=n.length,i=0;i<r;i++)n[i]&&(t=n[i].replace(/\*/g,".*?"),"-"===t[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")))}function o(){e.enable("")}function a(t){var n,r;for(n=0,r=e.skips.length;n<r;n++)if(e.skips[n].test(t))return!1;for(n=0,r=e.names.length;n<r;n++)if(e.names[n].test(t))return!0;return!1}function s(t){return t instanceof Error?t.stack||t.message:t}e=t.exports=r.debug=r.default=r,e.coerce=s,e.disable=o,e.enable=i,e.enabled=a,e.humanize=ce,e.names=[],e.skips=[],e.formatters={};var l}),fe=he.coerce,de=he.disable,_e=he.enable,ve=he.enabled,pe=he.humanize,ye=he.names,ge=he.skips,me=he.formatters,ke=Object.freeze({default:he,__moduleExports:he,coerce:fe,disable:de,enable:_e,enabled:ve,humanize:pe,names:ye,skips:ge,formatters:me}),be=ke&&he||ke,we=ct(function(t,e){function n(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function r(t){var n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),n){var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var i=0,o=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(i++,"%c"===t&&(o=i))}),t.splice(o,0,r)}}function i(){return"object"===("undefined"==typeof console?"undefined":wt(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function o(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}}function a(){var t;try{t=e.storage.debug}catch(t){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t}e=t.exports=be,e.log=i,e.formatArgs=r,e.save=o,e.load=a,e.useColors=n,e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(a())}),Se=(we.log,we.formatArgs,we.save,we.load,we.useColors,we.storage,we.colors,function(){function t(e,n){if(St(this,t),this.y=e,this.opts=n,null==n.role||"master"===n.role)this.role="master";else{if("slave"!==n.role)throw new Error("Role must be either 'master' or 'slave'!");this.role="slave"}this.log=we("y:connector"),this.logMessage=we("y:connector-message"),this._forwardAppliedStructs=n.forwardAppliedOperations||!1,this.role=n.role,this.connections=new Map,this.isSynced=!1,this.userEventListeners=[],this.whenSyncedListeners=[],this.currentSyncTarget=null,this.debug=!0===n.debug,this.broadcastBuffer=new Lt,this.broadcastBufferSize=0,this.protocolVersion=11,this.authInfo=n.auth||null,this.checkAuth=n.checkAuth||function(){return Promise.resolve("write")},null==n.maxBufferLength?this.maxBufferLength=-1:this.maxBufferLength=n.maxBufferLength}return Ot(t,[{key:"reconnect",value:function(){this.log("reconnecting..")}},{key:"disconnect",value:function(){return this.log("discronnecting.."),this.connections=new Map,this.isSynced=!1,this.currentSyncTarget=null,this.whenSyncedListeners=[],Promise.resolve()}},{key:"onUserEvent",value:function(t){this.userEventListeners.push(t)}},{key:"removeUserEventListener",value:function(t){this.userEventListeners=this.userEventListeners.filter(function(e){return t!==e})}},{key:"userLeft",value:function(t){if(this.connections.has(t)){this.log("%s: User left %s",this.y.userID,t),this.connections.delete(t),this._setSyncedWith(null);var e=!0,n=!1,r=void 0;try{for(var i,o=this.userEventListeners[Symbol.iterator]();!(e=(i=o.next()).done);e=!0){(0,i.value)({action:"userLeft",user:t})}}catch(t){n=!0,r=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw r}}}}},{key:"userJoined",value:function(t,e,n){if(null==e)throw new Error("You must specify the role of the joined user!");if(this.connections.has(t))throw new Error("This user already joined!");this.log("%s: User joined %s",this.y.userID,t),this.connections.set(t,{uid:t,isSynced:!1,role:e,processAfterAuth:[],processAfterSync:[],auth:n||null,receivedSyncStep2:!1});var r={};r.promise=new Promise(function(t){r.resolve=t}),this.connections.get(t).syncStep2=r;var i=!0,o=!1,a=void 0;try{for(var s,l=this.userEventListeners[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){(0,s.value)({action:"userJoined",user:t,role:e})}}catch(t){o=!0,a=t}finally{try{!i&&l.return&&l.return()}finally{if(o)throw a}}this._syncWithUser(t)}},{key:"whenSynced",value:function(t){this.isSynced?t():this.whenSyncedListeners.push(t)}},{key:"_syncWithUser",value:function(t){"slave"!==this.role&&u(this,t)}},{key:"_fireIsSyncedListeners",value:function(){if(!this.isSynced){this.isSynced=!0;var t=!0,e=!1,n=void 0;try{for(var r,i=this.whenSyncedListeners[Symbol.iterator]();!(t=(r=i.next()).done);t=!0){(0,r.value)()}}catch(t){e=!0,n=t}finally{try{!t&&i.return&&i.return()}finally{if(e)throw n}}this.whenSyncedListeners=[],this.y._setContentReady(),this.y.emit("synced")}}},{key:"send",value:function(t,e){var n=this.y;if(!(e instanceof ArrayBuffer||e instanceof Uint8Array))throw new Error("Expected Message to be an ArrayBuffer or Uint8Array - don't use this method to send custom messages");this.log("User%s to User%s: Send '%y'",n.userID,t,e),this.logMessage("User%s to User%s: Send %Y",n.userID,t,[n,e])}},{key:"broadcast",value:function(t){var e=this.y;if(!(t instanceof ArrayBuffer||t instanceof Uint8Array))throw new Error("Expected Message to be an ArrayBuffer or Uint8Array - don't use this method to send custom messages");this.log("User%s: Broadcast '%y'",e.userID,t),this.logMessage("User%s: Broadcast: %Y",e.userID,[e,t])}},{key:"broadcastStruct",value:function(t){var e=this,n=0===this.broadcastBuffer.length;if(n&&(this.broadcastBuffer.writeVarString(this.y.room),this.broadcastBuffer.writeVarString("update"),this.broadcastBufferSize=0,this.broadcastBufferSizePos=this.broadcastBuffer.pos,this.broadcastBuffer.writeUint32(0)),this.broadcastBufferSize++,t._toBinary(this.broadcastBuffer),this.maxBufferLength>0&&this.broadcastBuffer.length>this.maxBufferLength){var r=this.broadcastBuffer;r.setUint32(this.broadcastBufferSizePos,this.broadcastBufferSize),this.broadcastBuffer=new Lt,this.whenRemoteResponsive().then(function(){e.broadcast(r.createBuffer())})}else n&&setTimeout(function(){if(e.broadcastBuffer.length>0){var t=e.broadcastBuffer;t.setUint32(e.broadcastBufferSizePos,e.broadcastBufferSize),e.broadcast(t.createBuffer()),e.broadcastBuffer=new Lt}},0)}},{key:"whenRemoteResponsive",value:function(){return new Promise(function(t){setTimeout(t,100)})}},{key:"receiveMessage",value:function(t,e,n){var r=this,i=this.y,o=i.userID;if(n=n||!1,!(e instanceof ArrayBuffer||e instanceof Uint8Array))return Promise.reject(new Error("Expected Message to be an ArrayBuffer or Uint8Array!"));if(t===o)return Promise.resolve();var a=new Nt(e),s=new Lt,l=a.readVarString();s.writeVarString(l);var u=a.readVarString(),c=this.connections.get(t);if(this.log("User%s from User%s: Receive '%s'",o,t,u),this.logMessage("User%s from User%s: Receive %Y",o,t,[i,e]),null==c&&!n)throw new Error("Received message from unknown peer!");if("sync step 1"===u||"sync step 2"===u){var h=a.readVarUint();if(null==c.auth)return c.processAfterAuth.push([u,c,a,s,t]),this.checkAuth(h,i,t).then(function(t){null==c.auth&&(c.auth=t,i.emit("userAuthenticated",{user:c.uid,auth:t}));var e=c.processAfterAuth;c.processAfterAuth=[],e.forEach(function(t){return r.computeMessage(t[0],t[1],t[2],t[3],t[4])})})}!n&&null==c.auth||"update"===u&&!c.isSynced?c.processAfterSync.push([u,c,a,s,t,!1]):this.computeMessage(u,c,a,s,t,n)}},{key:"computeMessage",value:function(t,e,n,i,o,a){if("sync step 1"!==t||"write"!==e.auth&&"read"!==e.auth){var s=this.y;s.transact(function(){if("sync step 2"===t&&"write"===e.auth)d(n,i,s,e,o);else{if("update"!==t||!a&&"write"!==e.auth)throw new Error("Unable to receive message");r(s,n)}},!0)}else h(n,i,this.y,e,o)}},{key:"_setSyncedWith",value:function(t){var e=this;if(null!=t){var n=this.connections.get(t);n.isSynced=!0;var r=n.processAfterSync;n.processAfterSync=[],r.forEach(function(t){e.computeMessage(t[0],t[1],t[2],t[3],t[4])})}var i=Array.from(this.connections.values());i.length>0&&i.every(function(t){return t.isSynced})&&this._fireIsSyncedListeners()}}]),t}()),Oe=function(){function t(e){St(this,t),this.opts=e,this.ys=new Map}return Ot(t,[{key:"_init",value:function(t){var e=this,n=this.ys.get(t);return void 0===n?(n=yt(),n.mutualExclude=K(),this.ys.set(t,n),this.init(t).then(function(){return t.on("afterTransaction",function(t,n){var r=e.ys.get(t);if(r.len>0){r.buffer.setUint32(0,r.len),e.saveUpdate(t,r.buffer.createBuffer(),n);var i=yt();for(var o in i)r[o]=i[o]}}),e.retrieve(t)}).then(function(){return Promise.resolve(n)})):Promise.resolve(n)}},{key:"deinit",value:function(t){this.ys.delete(t),t.persistence=null}},{key:"destroy",value:function(){this.ys=null}},{key:"removePersistedData",value:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.ys.forEach(function(r,i){i.room===t&&(n?i.destroy():e.deinit(i))})}},{key:"saveUpdate",value:function(t){}},{key:"saveStruct",value:function(t,e){var n=this.ys.get(t);void 0!==n&&n.mutualExclude(function(){e._toBinary(n.buffer),n.len++})}},{key:"retrieve",value:function(t,e,n){var i=this.ys.get(t);void 0!==i&&i.mutualExclude(function(){t.transact(function(){if(null!=e&&vt(t,new Nt(new Uint8Array(e))),null!=n)for(var i=0;i<n.length;i++)r(t,new Nt(new Uint8Array(n[i])))}),t.emit("persistenceReady")})}},{key:"persist",value:function(t){return pt(t).createBuffer()}}]),t}(),Ee=function(t){function e(t,n){St(this,e);var r=Tt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return n.value=t.toString(),r._typeObserver=gt.bind(r),r._domObserver=mt.bind(r),t.observe(r._typeObserver),n.addEventListener("input",r._domObserver),r}return Ut(e,t),Ot(e,[{key:"destroy",value:function(){this.type.unobserve(this._typeObserver),this.target.unobserve(this._domObserver),Et(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this)}}]),e}(Zt),Ue=function(t){function e(t,n){St(this,e);var r=Tt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return n.setContents(t.toDelta(),"yjs"),r._typeObserver=kt.bind(r),r._quillObserver=bt.bind(r),t.observe(r._typeObserver),n.on("text-change",r._quillObserver),r}return Ut(e,t),Ot(e,[{key:"destroy",value:function(){this.type.unobserve(this._typeObserver),this.target.off("text-change",this._quillObserver),Et(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this)}}]),e}(Zt);return Y.AbstractConnector=Se,Y.AbstractPersistence=Oe,Y.Array=YArray,Y.Map=YMap,Y.Text=YText,Y.XmlElement=YXmlElement,Y.XmlFragment=YXmlFragment,Y.XmlText=YXmlText,Y.XmlHook=YXmlHook,Y.TextareaBinding=Ee,Y.QuillBinding=Ue,Y.DomBinding=te,te.domToType=L,te.domsToTypes=J,te.switchAssociation=W,Y.utils={BinaryDecoder:Nt,UndoManager:ne,getRelativePosition:Z,fromRelativePosition:Q,registerStruct:q,integrateRemoteStructs:r,toBinary:pt,fromBinary:vt},Y.debug=we,we.formatters.Y=_,we.formatters.y=v,Y});
//# sourceMappingURL=y.js.map
/**
 * y-indexeddb - IndexedDB database adapter for Yjs
 * @version v9.0.0-6
 * @license MIT
 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.extendYIndexedDBPersistence=t()}(this,function(){"use strict";function e(e){return new Promise(function(t,n){e.onerror=function(e){n(new Error(e.target.error))},e.onblocked=function(){location.reload()},e.onsuccess=function(e){t(e.target.result)}})}function t(e){return new Promise(function(t,n){var r=indexedDB.open(e);window.r1=r,r.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains("model")&&(t.deleteObjectStore("updates"),t.deleteObjectStore("model"),t.deleteObjectStore("custom")),t.createObjectStore("updates",{autoIncrement:!0}),t.createObjectStore("model"),t.createObjectStore("custom")},r.onerror=function(e){n(new Error(e.target.error))},r.onblocked=function(){location.reload()},r.onsuccess=function(e){var n=e.target.result;n.onversionchange=function(){n.close()},t(n)}})}function n(n){var l=function(l){function f(e){r(this,f);var t=c(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,e));return window.addEventListener("unload",function(){t.ys.forEach(function(e,t){null!==e.db?e.db.close():e._db.then(function(e){return e.close()})})}),t}return a(f,l),o(f,[{key:"init",value:function(e){var r=this.ys.get(e),o=e.room;r.db=null;var i=t(o);return i.then(function(e){r.db=e}),"undefined"!=typeof BroadcastChannel?(r.channel=new BroadcastChannel("__yjs__"+o),r.channel.addEventListener("message",function(t){r.mutualExclude(function(){e.transact(function(){n.utils.integrateRemoteStructs(e,new n.utils.BinaryDecoder(t.data))},!0)})})):r.channel=null,i}},{key:"deinit",value:function(e){this.ys.get(e).db.close(),i(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"deinit",this).call(this,e)}},{key:"set",value:function(t,n,r){return e(this.ys.get(t).db.transaction(["custom"],"readwrite").objectStore("custom").put(r,n))}},{key:"get",value:function(t,n){return e(this.ys.get(t).db.transaction(["custom"],"readwrite").objectStore("custom").get(n))}},{key:"removePersistedData",value:function(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return i(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"removePersistedData",this).call(this,t,n),e(indexedDB.deleteDatabase(t))}},{key:"saveUpdate",value:function(t,n){var r=this,o=this.ys.get(t);null!==o.channel&&o.channel.postMessage(n);var i=o.db.transaction(["updates"],"readwrite"),a=i.objectStore("updates");a.put(n),e(a.count()).then(function(e){e>=s&&r.persist(t)})}},{key:"saveStruct",value:function(e,t){i(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"saveStruct",this).call(this,e,t)}},{key:"retrieve",value:function(t){var n=this,r=this.ys.get(t),o=r.db.transaction(["updates","model"],"readonly"),a=o.objectStore("model"),c=o.objectStore("updates");return Promise.all([e(a.get(0)),e(c.getAll())]).then(function(e){var r=u(e,2),o=r[0],a=r[1];i(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"retrieve",n).call(n,t,o,a)})}},{key:"persist",value:function(t){var r=this,o=this.ys.get(t),i=o.db,a=i.transaction(["updates","model"],"readwrite"),c=a.objectStore("updates");return e(c.getAll()).then(function(e){n.AbstractPersistence.prototype.retrieve.call(r,t,null,e);var o=n.AbstractPersistence.prototype.persist.call(r,t);if(e.length>0){a.objectStore("model").put(o,0),c.clear()}})}}]),f}(n.AbstractPersistence);return n.IndexedDB=l,l}var r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,n,r)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(r)},a=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},c=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},u=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&c.return&&c.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=500;return"undefined"!=typeof Y&&n(Y),n});
//# sourceMappingURL=y-indexeddb.js.map
/**
 * en-y-websockets-client - Websockets connector for Yjs (browser/node client)
 * @version v10.0.44
 * @license MIT
 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.yWebsocketsClient=e()}(this,function(){"use strict";function t(t,e){return e={exports:{}},t(e,e.exports),e.exports}function e(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*G;case"days":case"day":case"d":return n*J;case"hours":case"hour":case"hrs":case"hr":case"h":return n*F;case"minutes":case"minute":case"mins":case"min":case"m":return n*z;case"seconds":case"second":case"secs":case"sec":case"s":return n*X;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function n(t){return t>=J?Math.round(t/J)+"d":t>=F?Math.round(t/F)+"h":t>=z?Math.round(t/z)+"m":t>=X?Math.round(t/X)+"s":t+"ms"}function o(t){return r(t,J,"day")||r(t,F,"hour")||r(t,z,"minute")||r(t,X,"second")||t+" ms"}function r(t,e,n){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}function s(t,e){var n=t;e=e||P.location,null==t&&(t=e.protocol+"//"+e.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?e.protocol+t:e.host+t),/^(https?|wss?):\/\//.test(t)||(tt("protocol-less url %s",t),t=void 0!==e?e.protocol+"//"+t:"https://"+t),tt("parse %s",t),n=L(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var o=-1!==n.host.indexOf(":"),r=o?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+r+":"+n.port,n.href=n.protocol+"://"+r+(e&&e.port===n.port?"":":"+n.port),n}function i(t){if(!t||"object"!==(void 0===t?"undefined":U(t)))return!1;if(rt(t)){for(var e=0,n=t.length;e<n;e++)if(i(t[e]))return!0;return!1}if("function"==typeof P.Buffer&&P.Buffer.isBuffer&&P.Buffer.isBuffer(t)||"function"==typeof P.ArrayBuffer&&t instanceof ArrayBuffer||it&&t instanceof Blob||at&&t instanceof File)return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return i(t.toJSON(),!0);for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)&&i(t[o]))return!0;return!1}function a(t){return P.Buffer&&P.Buffer.isBuffer(t)||P.ArrayBuffer&&t instanceof ArrayBuffer}function c(t,e){if(!t)return t;if(pt(t)){var n={_placeholder:!0,num:e.length};return e.push(t),n}if(ut(t)){for(var o=new Array(t.length),r=0;r<t.length;r++)o[r]=c(t[r],e);return o}if("object"===(void 0===t?"undefined":U(t))&&!(t instanceof Date)){var o={};for(var s in t)o[s]=c(t[s],e);return o}return t}function h(t,e){if(!t)return t;if(t&&t._placeholder)return e[t.num];if(ut(t))for(var n=0;n<t.length;n++)t[n]=h(t[n],e);else if("object"===(void 0===t?"undefined":U(t)))for(var o in t)t[o]=h(t[o],e);return t}function u(t,e,n){function o(t,s){if(o.count<=0)throw new Error("after called too many times");--o.count,t?(r=!0,e(t),e=n):0!==o.count||r||e(null,s)}var r=!1;return n=n||p,o.count=t,0===t?e():o}function p(){}function l(t){for(var e=0;e<t.length;e++){var n=t[e];if(n.buffer instanceof ArrayBuffer){var o=n.buffer;if(n.byteLength!==o.byteLength){var r=new Uint8Array(n.byteLength);r.set(new Uint8Array(o,n.byteOffset,n.byteLength)),o=r.buffer}t[e]=o}}}function f(t,e){e=e||{};var n=new It;l(t);for(var o=0;o<t.length;o++)n.append(t[o]);return e.type?n.getBlob(e.type):n.getBlob()}function d(t,e){return l(t),new Blob(t,e||{})}function y(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}function m(t){var e="";do{e=Ut[t%jt]+e,t=Math.floor(t/jt)}while(t>0);return e}function g(t){var e=0;for(Wt=0;Wt<t.length;Wt++)e=e*jt+qt[t.charAt(Wt)];return e}function v(){var t=m(+new Date);return t!==Mt?(Vt=0,Mt=t):t+"."+m(Vt++)}function b(t){var e=t&&t.forceBase64;zt&&!e||(this.supportsBinary=!1),Bt.call(this,t)}function k(){}function E(t){if(Yt.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,P.location){var e="https:"===location.protocol,n=location.port;n||(n=e?443:80),this.xd=t.hostname!==P.location.hostname||n!==t.port,this.xs=t.secure!==e}}function _(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}function T(){for(var t in _.requests)_.requests.hasOwnProperty(t)&&_.requests[t].abort()}function w(){}function A(t){Yt.call(this,t),this.query=this.query||{},$t||(P.___eio||(P.___eio=[]),$t=P.___eio),this.index=$t.length;var e=this;$t.push(function(t){e.onData(t)}),this.query.j=this.index,P.document&&P.addEventListener&&P.addEventListener("beforeunload",function(){e.script&&(e.script.onerror=w)},!1)}function N(t){t&&t.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=ie&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(ae=ee),Bt.call(this,t)}function I(t){var e=!1,n=!1,o=!1!==t.jsonp;if(P.location){var r="https:"===location.protocol,s=location.port;s||(s=r?443:80),e=t.hostname!==location.hostname||s!==t.port,n=t.secure!==r}if(t.xdomain=e,t.xscheme=n,"open"in new Et(t)&&!t.forceJSONP)return new Jt(t);if(!o)throw new Error("JSONP disabled");return new Zt(t)}function C(t,e){if(!(this instanceof C))return new C(t,e);e=e||{},t&&"object"===(void 0===t?"undefined":U(t))&&(e=t,t=null),t?(t=L(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=L(e.host).host),this.secure=null!=e.secure?e.secure:P.location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||(P.location?location.hostname:"localhost"),this.port=e.port||(P.location&&location.port?location.port:this.secure?443:80),this.query=e.query||{},"string"==typeof this.query&&(this.query=xt.decode(this.query)),this.upgrade=!1!==e.upgrade,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=!1!==e.jsonp,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.transportOptions=e.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=!1!==e.perMessageDeflate&&(e.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||null,this.key=e.key||null,this.passphrase=e.passphrase||null,this.cert=e.cert||null,this.ca=e.ca||null,this.ciphers=e.ciphers||null,this.rejectUnauthorized=void 0===e.rejectUnauthorized||e.rejectUnauthorized,this.forceNode=!!e.forceNode;var n="object"===U(P)&&P;n.global===n&&(e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),e.localAddress&&(this.localAddress=e.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function O(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function S(t,e){var n=[];e=e||0;for(var o=e||0;o<t.length;o++)n[o-e]=t[o];return n}function D(t,e,n){return t.on(e,n),{destroy:function(){t.removeListener(e,n)}}}function R(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}function B(t,e){if(!(this instanceof B))return new B(t,e);t&&"object"===(void 0===t?"undefined":U(t))&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new De({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=e.parser||bt;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==e.autoConnect,this.autoConnect&&this.open()}function M(t){var e=function(e){function n(t,e){if(j(this,n),void 0===e)throw new Error("Options must not be undefined!");e.role="slave",e.preferUntransformed=!0,!1!==e.initSync&&(e.initSync=!0);var o=K(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));if(o._sentSync=!1,e.options=e.options||{},o.options=e,null==e.url)throw new Error("No rte url provided!");o.serverVersion=null,o.lastUpdateMarker=-1,o.clientID=o.y.userID,o.rteEvents=[],o._businessID=null,o._noteContentInfo=new Ke(o.y),o._syncMetadata={},o.options.newNote&&(o._syncMetadata.updateSequenceNumber=0,o._syncMetadata.contentDirty=!0),o.handshakeTimeout=null,o._handshakeTimeoutHandler=o._handshakeTimeoutHandler.bind(o);var r=function(){return null};return o.errorHandler=e.errorHandler,o.socketHandlers={connect:e.socketHandlers.connect||r,connectError:e.socketHandlers.connectError||r,reconnect:e.socketHandlers.reconnect||r,reconnectAttempt:e.socketHandlers.reconnectAttempt||r,reconnectError:e.socketHandlers.reconnectError||r,disconnect:e.socketHandlers.disconnect||r},o.utilities={resetYjsModel:e.utilities.resetYjsModel||r,noteSavedNotification:e.utilities.noteSavedNotification||r,errorHandler:e.utilities.errorHandler||r,permissionsHandler:e.utilities.permissionsHandler||r,userConnectionsHandler:e.utilities.userConnectionsHandler||r},o._tornDown=!1,o._setupYJSEventsHandlers(),o._reconnectTimeout=Ge.RECONNECT_WATCHDOG_TIMEOUT,o._reconnectInterval=null,o._previousConnectionAttemptTime=0,o._setupReconnectWatchdog(),o.createWebSocketIO(),o}return W(n,e),q(n,[{key:"createWebSocketIO",value:function(){var e=this,n=new Date;if(this._previousConnectionAttemptTime+Ge.TIME_TO_COMPLETE_PREVIOUS_CONNECTION_ESTABLISHMENT_BY>n)return void Ve.debug("previous connection is still trying to establish");this._previousConnectionAttemptTime=n,this.socket&&this.destroy(),this.options.options.reconnection=!0,this.options.options.reconnectionDelay=Ge.RECONNECT_DELAY,this.options.options.reconnectionDelayMax=1e4,this.options.options.reconnectionAttempts=1/0,this.options.options.transports=["websocket"],this.options.options.timeout=Ge.CLIENT_CONNECT_TIMEOUT,"query"in this.options.options||(this.options.options.query={}),this.options.options.query.version=tn,this.options.options.query.room=this.options.room;var o=this.options.socket||Pe(this.options.url,this.options.options);this.socket=o,this._pendingRequests={},this._pendingRequestsId=0;var r=new Date;o.on("pong",function(){r=new Date});var s=setInterval(function(){o!==e.socket?clearInterval(s):new Date-r>3e4&&e.createWebSocketIO()},15e3);this._onConnect=function(){e.options.initSync&&(e._sentSync=!0,e._previousConnectionAttemptTime=0,Ve.debug("Connected to room "+e.options.room),o.emit("joinRoom",e.options.room),e._verifyContentVersion("server"))},o.on("connect",this._onConnect),o.connected?this._onConnect():o.connect();var i=function(){e._previousConnectionAttemptTime=0,e.socketHandlers.connectError(),e.destroy()};o.on("connect_error",i),o.on("connect_timeout",i),this.onRteEvent(function(t){var n=t.type;if(null==n)return void Ve.error("Received message without type specified!");switch(n){case"handshake":return void e._handshakeMessageHandler(t);case"lastUpdateMarker":return void e._lastUpdateMarkerMessageHandler(t);case"noteSaved":return void e._noteSavedMessageHandler(t);case"realtimeError":return void e._handleErrorMessage(t);case"realtimePermissionsChanged":return void e._permissionsChangedMessageHandler(t);case"userConnections":return void e._userConnectionsMessageHandler(t);case en:return void e._commandMessageHandler(t)}}),o.on("reconnect",this.socketHandlers.reconnect),o.on("reconnect_attempt",this.socketHandlers.reconnectAttempt),o.on("reconnect_error",this.socketHandlers.reconnectError),this._onDisconnect=function(n){Ve.debug("got disconnect"),e.destroy(),t.AbstractConnector.prototype.disconnect.call(e)},o.on("disconnect",this._onDisconnect)}},{key:"initSync",value:function(t){this.options.initSync||(this.options.initSync=!0,null!=t.room&&(this.options.room=t.room)),this.socket.connected&&this._onConnect()}},{key:"disconnect",value:function(){if(!this.socket)return void Ve.error("Trying to disconnect when socket has been destroyed.");Ve.debug("Disconnected from room "+this.options.room),this.socket.emit("leaveRoom",this.options.room),this._disconnect()}},{key:"destroy",value:function(){var t=this;this.socket&&(this.socket.off("disconnect",this._onDisconnect),this.socket.off("yjsEvent",this._onYjsEvent),this.rteEvents.forEach(function(e){return t.socket.off("rteEvent",e)}),this.rteEvents=[],this.socket.off("connect",this._onConnect),this.options.socket||(this.socket.close(),this.socket.destroy()),this._disconnect(),this.socket=null)}},{key:"reconnect",value:function(){Ve.debug("Reconnect"),V(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"reconnect",this).call(this)}},{key:"sendRteEvent",value:function(t){t.room=this.options.room,this.socket.emit("rteEvent",t)}},{key:"onRteEvent",value:function(t){this.rteEvents.push(t),this.socket.on("rteEvent",t)}},{key:"send",value:function(t,e){if(this._sentSync){if(!this.socket)return void Ve.error("Trying to send message "+e+" when socket has been destroyed.");this.socket.emit("yjsEvent",e),V(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"send",this).call(this,t,e)}}},{key:"broadcast",value:function(t){if(this._sentSync){if(!this.socket)return void Ve.error("Trying to broadcast message "+t+" when socket has been destroyed.");this.socket.emit("yjsEvent",t),V(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"broadcast",this).call(this,t)}}},{key:"whenRemoteResponsive",value:function(){var t=this;return new Promise(function(e){t.socket.emit("yjsResponsive",t.options.room,e)})}},{key:"isDisconnected",value:function(){return this.socket.disconnected}},{key:"sendDeleteNoteMessage",value:function(){if(!this.socket)return void Ve.error("Trying to send delete note message when socket has been destroyed.");this.sendRteEvent({type:"deleteNote",contentVersion:this.contentVersion,protocolVersion:this.protocolVersion,auth:this.authInfo})}},{key:"updateAuthToken",value:function(t){this.options.authToken=t,this.socket&&this.sendRteEvent({type:"updateAuthToken",contentVersion:this.contentVersion,protocolVersion:this.protocolVersion,authToken:this.options.authToken})}},{key:"executeCommand",value:function(t,e){var n=this;return new Promise(function(o,r){if(!n.socket)return Ve.error("Trying to execute command when socket has been destroyed."),r();var s=n._pendingRequestsId++;n.sendRteEvent({type:en,requestID:s,command:t,data:e}),n._pendingRequests[s]=o})}},{key:"updateUserConnectionsIfNeeded",value:function(t){if(!this.socket)return void Ve.error("Trying to update user connections when socket has been destroyed.");this.sendRteEvent({type:"updateUserConnections",contentVersion:this.contentVersion,protocolVersion:this.protocolVersion,auth:this.authInfo,timestamp:t})}},{key:"debugDisconnect",value:function(){this._tornDown=!0,this.destroy()}},{key:"debugReconnect",value:function(){this._tornDown=!1,this._setupReconnectWatchdog()}},{key:"_handleErrorMessage",value:function(t){switch(t.errorDomain){case Fe.INTERNAL:this.destroy(),null!=t.reconnectTimeout&&(this._reconnectTimeout=t.reconnectTimeout,this._setupReconnectWatchdog());break;case Fe.SESSION:this.utilities.errorHandler(Ze(t.errorCode));break;default:Ve.error("Unknown RTE server error!"),this.destroy()}}},{key:"_verifyContentVersion",value:function(t){var e=this;if(!this.socket)return void Ve.error("Trying to send handshake message when socket has been destroyed.");this.handshakeTimeout=setTimeout(this._handshakeTimeoutHandler,Ge.HANDSHAKE_TIMEOUT_INTERVAL);var n=null,o=null;this._noteContentInfo.getContentHash().then(function(t){return n=t,e._noteContentInfo.getSessionID()}).then(function(t){o=t}).then(function(){e.sendRteEvent({type:"handshake",contentVersion:e.contentVersion,protocolVersion:e.protocolVersion,auth:e.authInfo,authToken:e.options.authToken,businessAuthToken:e.options.businessAuthToken,serviceHost:e.options.serviceHost,shardID:e.options.shardID,userName:e.options.userName,sessionID:o,clientID:e.clientID,newNote:e.options.newNote,notebookGuid:e.options.notebookGuid,noteTitle:e.options.noteTitle,contentHash:n,platform:e.options.platform})})}},{key:"_handshakeTimeoutHandler",value:function(){this.handshakeTimeout=null,this.socketHandlers.connect(!1),this.destroy()}},{key:"_shouldReconnect",value:function(){return!this._tornDown&&!1!==this.options.should_reconnect}},{key:"_clearReconnectWatchdog",value:function(){this._reconnectInterval&&(clearInterval(this._reconnectInterval),this._reconnectInterval=null)}},{key:"_setupReconnectWatchdog",value:function(){var t=this;this._clearReconnectWatchdog(),this._reconnectTimeout<0||(this._reconnectInterval=setInterval(function(){t._shouldReconnect()&&!t.socket&&t.createWebSocketIO()},this._reconnectTimeout))}},{key:"_disconnect",value:function(){this.socketHandlers.disconnect(),this.options.socket||this.socket.disconnect(),V(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"disconnect",this).call(this)}},{key:"_setupYJSEventsHandlers",value:function(){this._yjsSyncedEventHandler=this._yjsSyncedEventHandler.bind(this),this.y.on("synced",this._yjsSyncedEventHandler),this._yjsAfterTransactionEventHandler=this._yjsAfterTransactionEventHandler.bind(this),this.y.on("afterTransaction",this._yjsAfterTransactionEventHandler),this._yjsErrorEventHandler=this._yjsErrorEventHandler.bind(this),this.y.on("error",this._yjsErrorEventHandler)}},{key:"_yjsSyncedEventHandler",value:function(){var t=this;this.socketHandlers.connect(!0),this._noteContentInfo.getContentDirty().then(function(e){t._syncMetadata.contentDirty=e,e&&t.sendRteEvent({type:"bumpUpdateMarker"})})}},{key:"_yjsAfterTransactionEventHandler",value:function(e,n){if(this.y!==e)return void Ve.error("Trying to handle YJS 'afterTransaction' event for wrong Y-instance.");n.changedParentTypes.has(e.define("content",t.Map))&&(this._syncMetadata.contentDirty=!0,this._noteContentInfo.setContentDirty(!0))}},{key:"_yjsErrorEventHandler",value:function(t){Ve.error("Unexpected YJS error: "+t),this.utilities.errorHandler($e(Ye.INTERNAL_FAILURE))}},{key:"_handshakeMessageHandler",value:function(e){var n=this;if(null!=e){var o=!!e.accepted;Ve.debug("Received handshake response: "+JSON.stringify(e)),Ve.debug("message.accpeted = "+o),clearTimeout(this.handshakeTimeout),this.handshakeTimeout=null,o?(this._noteContentInfo.setSessionID(e.sessionID),this.serverVersion=e.serverVersion,this._businessID=null!=e.businessID?e.businessID:null,null!=e.contentHash&&this._noteContentInfo.setContentHash(e.contentHash),null!=e.syncMetadata&&this._updateClientSyncMetadata(e.syncMetadata),this.utilities.permissionsHandler(!1===e.canEditNote),this.userJoined("server","master"),null!=this._onYjsEvent&&this.socket.off("yjsEvent",this._onYjsEvent),this._onYjsEvent=function(e){new t.utils.BinaryDecoder(e).readVarString()===n.options.room&&n.receiveMessage("server",e)},this.socket.on("yjsEvent",this._onYjsEvent)):(e.errorCode===Je.INCOMPATIBLE_MODEL?this.utilities.resetYjsModel():Qe(e.errorCode)||this.utilities.errorHandler(Ze(e.errorCode)),this.socketHandlers.connect(!1),this.destroy())}}},{key:"_updateClientSyncMetadata",value:function(t){this._syncMetadata.contentHash=t.contentHash,this._syncMetadata.lastEditedBy=t.lastEditedBy,this._syncMetadata.updated=t.updated,this._syncMetadata.updateSequenceNumber=t.updateSequenceNumber;var e=this.lastUpdateMarker>=0&&this.lastUpdateMarker>t.updateMarker;this._syncMetadata.contentDirty=e,this._noteContentInfo.setContentDirty(e)}},{key:"_noteSavedMessageHandler",value:function(t){if(null!=t){this._updateClientSyncMetadata(t);var e=t.contentHash;this._noteContentInfo.setContentHash(e),this.syncMetadata.contentDirty||this.utilities.noteSavedNotification(this._syncMetadata)}}},{key:"_lastUpdateMarkerMessageHandler",value:function(t){null!=t&&(this.lastUpdateMarker=t.updateMarker)}},{key:"_permissionsChangedMessageHandler",value:function(t){null!=t&&this.utilities.permissionsHandler(!1===t.canEditNote)}},{key:"_userConnectionsMessageHandler",value:function(t){null!=t&&this.utilities.userConnectionsHandler(t.userConnections,t.timestamp)}},{key:"_commandMessageHandler",value:function(t){if(null!=t){var e=this._pendingRequests[t.requestID];e?(e(t),delete this._pendingRequests[t.requestID]):Ve.error("Didn't find handler for "+t)}}},{key:"businessID",get:function(){return this._businessID}},{key:"syncMetadata",get:function(){return this._syncMetadata}}]),n}(t.AbstractConnector);e.io=Pe,t["websockets-client"]=e}var P="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},H=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,x=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],L=function(t){var e=t,n=t.indexOf("["),o=t.indexOf("]");-1!=n&&-1!=o&&(t=t.substring(0,n)+t.substring(n,o).replace(/:/g,";")+t.substring(o,t.length));for(var r=H.exec(t||""),s={},i=14;i--;)s[x[i]]=r[i]||"";return-1!=n&&-1!=o&&(s.source=e,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s},U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},q=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),V=function t(e,n,o){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,n);if(void 0===r){var s=Object.getPrototypeOf(e);return null===s?void 0:t(s,n,o)}if("value"in r)return r.value;var i=r.get;if(void 0!==i)return i.call(o)},W=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},K=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},X=1e3,z=60*X,F=60*z,J=24*F,G=365.25*J,$=function(t,r){r=r||{};var s=void 0===t?"undefined":U(t);if("string"===s&&t.length>0)return e(t);if("number"===s&&!1===isNaN(t))return r.long?o(t):n(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))},Z=t(function(t,e){function n(t){var n,o=0;for(n in t)o=(o<<5)-o+t.charCodeAt(n),o|=0;return e.colors[Math.abs(o)%e.colors.length]}function o(t){function o(){if(o.enabled){var t=o,n=+new Date,r=n-(c||n);t.diff=r,t.prev=c,t.curr=n,c=n;for(var s=new Array(arguments.length),i=0;i<s.length;i++)s[i]=arguments[i];s[0]=e.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var a=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(n,o){if("%%"===n)return n;a++;var r=e.formatters[o];if("function"==typeof r){var i=s[a];n=r.call(t,i),s.splice(a,1),a--}return n}),e.formatArgs.call(t,s);(o.log||e.log||console.log.bind(console)).apply(t,s)}}return o.namespace=t,o.enabled=e.enabled(t),o.useColors=e.useColors(),o.color=n(t),"function"==typeof e.init&&e.init(o),o}function r(t){e.save(t),e.names=[],e.skips=[];for(var n=("string"==typeof t?t:"").split(/[\s,]+/),o=n.length,r=0;r<o;r++)n[r]&&(t=n[r].replace(/\*/g,".*?"),"-"===t[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")))}function s(){e.enable("")}function i(t){var n,o;for(n=0,o=e.skips.length;n<o;n++)if(e.skips[n].test(t))return!1;for(n=0,o=e.names.length;n<o;n++)if(e.names[n].test(t))return!0;return!1}function a(t){return t instanceof Error?t.stack||t.message:t}e=t.exports=o.debug=o.default=o,e.coerce=a,e.disable=s,e.enable=r,e.enabled=i,e.humanize=$,e.names=[],e.skips=[],e.formatters={};var c}),Q=t(function(t,e){function n(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(t){var n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),n){var o="color: "+this.color;t.splice(1,0,o,"color: inherit");var r=0,s=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(r++,"%c"===t&&(s=r))}),t.splice(s,0,o)}}function r(){return"object"===("undefined"==typeof console?"undefined":U(console))&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}}function i(){var t;try{t=e.storage.debug}catch(t){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t}e=t.exports=Z,e.log=r,e.formatArgs=o,e.save=s,e.load=i,e.useColors=n,e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(i())}),tt=Q("socket.io-client:url"),et=s,nt=t(function(t){function e(t){if(t)return n(t)}function n(t){for(var n in e.prototype)t[n]=e.prototype[n];return t}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o,r=0;r<n.length;r++)if((o=n[r])===e||o.fn===e){n.splice(r,1);break}return this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n){n=n.slice(0);for(var o=0,r=n.length;o<r;++o)n[o].apply(this,e)}return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length}}),ot={}.toString,rt=Array.isArray||function(t){return"[object Array]"==ot.call(t)},st=Object.prototype.toString,it="function"==typeof P.Blob||"[object BlobConstructor]"===st.call(P.Blob),at="function"==typeof P.File||"[object FileConstructor]"===st.call(P.File),ct=i,ht={}.toString,ut=Array.isArray||function(t){return"[object Array]"==ht.call(t)},pt=a,lt=Object.prototype.toString,ft="function"==typeof P.Blob||"[object BlobConstructor]"===lt.call(P.Blob),dt="function"==typeof P.File||"[object FileConstructor]"===lt.call(P.File),yt=function(t){var e=[],n=t.data,o=t;return o.data=c(n,e),o.attachments=e.length,{packet:o,buffers:e}},mt=function(t,e){return t.data=h(t.data,e),t.attachments=void 0,t},gt=function(t,e){function n(t,s,i){if(!t)return t;if(ft&&t instanceof Blob||dt&&t instanceof File){o++;var a=new FileReader;a.onload=function(){i?i[s]=this.result:r=this.result,--o||e(r)},a.readAsArrayBuffer(t)}else if(ut(t))for(var c=0;c<t.length;c++)n(t[c],c,t);else if("object"===(void 0===t?"undefined":U(t))&&!pt(t))for(var h in t)n(t[h],h,t)}var o=0,r=t;n(r),o||e(r)},vt={deconstructPacket:yt,reconstructPacket:mt,removeBlobs:gt},bt=t(function(t,e){function n(){}function o(t){var n=""+t.type;return e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(n+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(n+=t.nsp+","),null!=t.id&&(n+=t.id),null!=t.data&&(n+=JSON.stringify(t.data)),u("encoded %j as %s",t,n),n}function r(t,e){function n(t){var n=vt.deconstructPacket(t),r=o(n.packet),s=n.buffers;s.unshift(r),e(s)}vt.removeBlobs(t,n)}function s(){this.reconstructor=null}function i(t){var n=0,o={type:Number(t.charAt(0))};if(null==e.types[o.type])return h();if(e.BINARY_EVENT===o.type||e.BINARY_ACK===o.type){for(var r="";"-"!==t.charAt(++n)&&(r+=t.charAt(n),n!=t.length););if(r!=Number(r)||"-"!==t.charAt(n))throw new Error("Illegal attachments");o.attachments=Number(r)}if("/"===t.charAt(n+1))for(o.nsp="";++n;){var s=t.charAt(n);if(","===s)break;if(o.nsp+=s,n===t.length)break}else o.nsp="/";var i=t.charAt(n+1);if(""!==i&&Number(i)==i){for(o.id="";++n;){var s=t.charAt(n);if(null==s||Number(s)!=s){--n;break}if(o.id+=t.charAt(n),n===t.length)break}o.id=Number(o.id)}return t.charAt(++n)&&(o=a(o,t.substr(n))),u("decoded %s as %j",t,o),o}function a(t,e){try{t.data=JSON.parse(e)}catch(t){return h()}return t}function c(t){this.reconPack=t,this.buffers=[]}function h(){return{type:e.ERROR,data:"parser error"}}var u=Q("socket.io-parser");e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=n,e.Decoder=s,n.prototype.encode=function(t,n){if(t.type!==e.EVENT&&t.type!==e.ACK||!ct(t.data)||(t.type=t.type===e.EVENT?e.BINARY_EVENT:e.BINARY_ACK),u("encoding packet %j",t),e.BINARY_EVENT===t.type||e.BINARY_ACK===t.type)r(t,n);else{n([o(t)])}},nt(s.prototype),s.prototype.add=function(t){var n;if("string"==typeof t)n=i(t),e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type?(this.reconstructor=new c(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!pt(t)&&!t.base64)throw new Error("Unknown type: "+t)
;if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(n=this.reconstructor.takeBinaryData(t))&&(this.reconstructor=null,this.emit("decoded",n))}},s.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},c.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=vt.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},c.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}}),kt=t(function(t){try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){t.exports=!1}}),Et=function(t){var e=t.xdomain,n=t.xscheme,o=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!e||kt))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!n&&o)return new XDomainRequest}catch(t){}if(!e)try{return new(P[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}},_t=Object.keys||function(t){var e=[],n=Object.prototype.hasOwnProperty;for(var o in t)n.call(t,o)&&e.push(o);return e},Tt=function(t,e,n){var o=t.byteLength;if(e=e||0,n=n||o,t.slice)return t.slice(e,n);if(e<0&&(e+=o),n<0&&(n+=o),n>o&&(n=o),e>=o||e>=n||0===o)return new ArrayBuffer(0);for(var r=new Uint8Array(t),s=new Uint8Array(n-e),i=e,a=0;i<n;i++,a++)s[a]=r[i];return s.buffer},wt=u,At=t(function(t,e){!function(n){function o(t){for(var e,n,o=[],r=0,s=t.length;r<s;)e=t.charCodeAt(r++),e>=55296&&e<=56319&&r<s?(n=t.charCodeAt(r++),56320==(64512&n)?o.push(((1023&e)<<10)+(1023&n)+65536):(o.push(e),r--)):o.push(e);return o}function r(t){for(var e,n=t.length,o=-1,r="";++o<n;)e=t[o],e>65535&&(e-=65536,r+=v(e>>>10&1023|55296),e=56320|1023&e),r+=v(e);return r}function s(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function i(t,e){return v(t>>e&63|128)}function a(t,e){if(0==(4294967168&t))return v(t);var n="";return 0==(4294965248&t)?n=v(t>>6&31|192):0==(4294901760&t)?(s(t,e)||(t=65533),n=v(t>>12&15|224),n+=i(t,6)):0==(4292870144&t)&&(n=v(t>>18&7|240),n+=i(t,12),n+=i(t,6)),n+=v(63&t|128)}function c(t,e){e=e||{};for(var n,r=!1!==e.strict,s=o(t),i=s.length,c=-1,h="";++c<i;)n=s[c],h+=a(n,r);return h}function h(){if(g>=m)throw Error("Invalid byte index");var t=255&y[g];if(g++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function u(t){var e,n,o,r,i;if(g>m)throw Error("Invalid byte index");if(g==m)return!1;if(e=255&y[g],g++,0==(128&e))return e;if(192==(224&e)){if(n=h(),(i=(31&e)<<6|n)>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&e)){if(n=h(),o=h(),(i=(15&e)<<12|n<<6|o)>=2048)return s(i,t)?i:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(n=h(),o=h(),r=h(),(i=(7&e)<<18|n<<12|o<<6|r)>=65536&&i<=1114111))return i;throw Error("Invalid UTF-8 detected")}function p(t,e){e=e||{};var n=!1!==e.strict;y=o(t),m=y.length,g=0;for(var s,i=[];!1!==(s=u(n));)i.push(s);return r(i)}var l=e,f=t&&t.exports==l&&t,d="object"==U(P)&&P;d.global!==d&&d.window!==d||(n=d);var y,m,g,v=String.fromCharCode,b={version:"2.1.2",encode:c,decode:p};if(l&&!l.nodeType)if(f)f.exports=b;else{var k={},E=k.hasOwnProperty;for(var _ in b)E.call(b,_)&&(l[_]=b[_])}else n.utf8=b}(P)}),Nt=t(function(t,e){!function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(256),o=0;o<t.length;o++)n[t.charCodeAt(o)]=o;e.encode=function(e){var n,o=new Uint8Array(e),r=o.length,s="";for(n=0;n<r;n+=3)s+=t[o[n]>>2],s+=t[(3&o[n])<<4|o[n+1]>>4],s+=t[(15&o[n+1])<<2|o[n+2]>>6],s+=t[63&o[n+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s},e.decode=function(t){var e,o,r,s,i,a=.75*t.length,c=t.length,h=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var u=new ArrayBuffer(a),p=new Uint8Array(u);for(e=0;e<c;e+=4)o=n[t.charCodeAt(e)],r=n[t.charCodeAt(e+1)],s=n[t.charCodeAt(e+2)],i=n[t.charCodeAt(e+3)],p[h++]=o<<2|r>>4,p[h++]=(15&r)<<4|s>>2,p[h++]=(3&s)<<6|63&i;return u}}()}),It=P.BlobBuilder||P.WebKitBlobBuilder||P.MSBlobBuilder||P.MozBlobBuilder,Ct=function(){try{return 2===new Blob(["hi"]).size}catch(t){return!1}}(),Ot=Ct&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(t){return!1}}(),St=It&&It.prototype.append&&It.prototype.getBlob,Dt=function(){return Ct?Ot?P.Blob:d:St?f:void 0}(),Rt=t(function(t,e){function n(t,n){return n("b"+e.packets[t.type]+t.data.data)}function o(t,n,o){if(!n)return e.encodeBase64Packet(t,o);var r=t.data,s=new Uint8Array(r),i=new Uint8Array(1+r.byteLength);i[0]=l[t.type];for(var a=0;a<s.length;a++)i[a+1]=s[a];return o(i.buffer)}function r(t,n,o){if(!n)return e.encodeBase64Packet(t,o);var r=new FileReader;return r.onload=function(){t.data=r.result,e.encodePacket(t,n,!0,o)},r.readAsArrayBuffer(t.data)}function s(t,n,o){if(!n)return e.encodeBase64Packet(t,o);if(p)return r(t,n,o);var s=new Uint8Array(1);return s[0]=l[t.type],o(new Dt([s.buffer,t.data]))}function i(t){try{t=At.decode(t,{strict:!1})}catch(t){return!1}return t}function a(t,e,n){for(var o=new Array(t.length),r=wt(t.length,n),s=0;s<t.length;s++)!function(t,n,r){e(n,function(e,n){o[t]=n,r(e,o)})}(s,t[s],r)}var c;P&&P.ArrayBuffer&&(c=Nt);var h="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),u="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),p=h||u;e.protocol=3;var l=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},f=_t(l),d={type:"error",data:"parser error"};e.encodePacket=function(t,e,r,i){"function"==typeof e&&(i=e,e=!1),"function"==typeof r&&(i=r,r=null);var a=void 0===t.data?void 0:t.data.buffer||t.data;if(P.ArrayBuffer&&a instanceof ArrayBuffer)return o(t,e,i);if(Dt&&a instanceof P.Blob)return s(t,e,i);if(a&&a.base64)return n(t,i);var c=l[t.type];return void 0!==t.data&&(c+=r?At.encode(String(t.data),{strict:!1}):String(t.data)),i(""+c)},e.encodeBase64Packet=function(t,n){var o="b"+e.packets[t.type];if(Dt&&t.data instanceof P.Blob){var r=new FileReader;return r.onload=function(){var t=r.result.split(",")[1];n(o+t)},r.readAsDataURL(t.data)}var s;try{s=String.fromCharCode.apply(null,new Uint8Array(t.data))}catch(e){for(var i=new Uint8Array(t.data),a=new Array(i.length),c=0;c<i.length;c++)a[c]=i[c];s=String.fromCharCode.apply(null,a)}return o+=P.btoa(s),n(o)},e.decodePacket=function(t,n,o){if(void 0===t)return d;if("string"==typeof t){if("b"===t.charAt(0))return e.decodeBase64Packet(t.substr(1),n);if(o&&!1===(t=i(t)))return d;var r=t.charAt(0);return Number(r)==r&&f[r]?t.length>1?{type:f[r],data:t.substring(1)}:{type:f[r]}:d}var s=new Uint8Array(t),r=s[0],a=Tt(t,1);return Dt&&"blob"===n&&(a=new Dt([a])),{type:f[r],data:a}},e.decodeBase64Packet=function(t,e){var n=f[t.charAt(0)];if(!c)return{type:n,data:{base64:!0,data:t.substr(1)}};var o=c.decode(t.substr(1));return"blob"===e&&Dt&&(o=new Dt([o])),{type:n,data:o}},e.encodePayload=function(t,n,o){function r(t){return t.length+":"+t}function s(t,o){e.encodePacket(t,!!i&&n,!1,function(t){o(null,r(t))})}"function"==typeof n&&(o=n,n=null);var i=ct(t);return n&&i?Dt&&!p?e.encodePayloadAsBlob(t,o):e.encodePayloadAsArrayBuffer(t,o):t.length?void a(t,s,function(t,e){return o(e.join(""))}):o("0:")},e.decodePayload=function(t,n,o){if("string"!=typeof t)return e.decodePayloadAsBinary(t,n,o);"function"==typeof n&&(o=n,n=null);var r;if(""===t)return o(d,0,1);for(var s,i,a="",c=0,h=t.length;c<h;c++){var u=t.charAt(c);if(":"===u){if(""===a||a!=(s=Number(a)))return o(d,0,1);if(i=t.substr(c+1,s),a!=i.length)return o(d,0,1);if(i.length){if(r=e.decodePacket(i,n,!1),d.type===r.type&&d.data===r.data)return o(d,0,1);if(!1===o(r,c+s,h))return}c+=s,a=""}else a+=u}return""!==a?o(d,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,n){function o(t,n){e.encodePacket(t,!0,!0,function(t){return n(null,t)})}if(!t.length)return n(new ArrayBuffer(0));a(t,o,function(t,e){var o=e.reduce(function(t,e){var n;return n="string"==typeof e?e.length:e.byteLength,t+n.toString().length+n+2},0),r=new Uint8Array(o),s=0;return e.forEach(function(t){var e="string"==typeof t,n=t;if(e){for(var o=new Uint8Array(t.length),i=0;i<t.length;i++)o[i]=t.charCodeAt(i);n=o.buffer}r[s++]=e?0:1;for(var a=n.byteLength.toString(),i=0;i<a.length;i++)r[s++]=parseInt(a[i]);r[s++]=255;for(var o=new Uint8Array(n),i=0;i<o.length;i++)r[s++]=o[i]}),n(r.buffer)})},e.encodePayloadAsBlob=function(t,n){function o(t,n){e.encodePacket(t,!0,!0,function(t){var e=new Uint8Array(1);if(e[0]=1,"string"==typeof t){for(var o=new Uint8Array(t.length),r=0;r<t.length;r++)o[r]=t.charCodeAt(r);t=o.buffer,e[0]=0}for(var s=t instanceof ArrayBuffer?t.byteLength:t.size,i=s.toString(),a=new Uint8Array(i.length+1),r=0;r<i.length;r++)a[r]=parseInt(i[r]);if(a[i.length]=255,Dt){var c=new Dt([e.buffer,a.buffer,t]);n(null,c)}})}a(t,o,function(t,e){return n(new Dt(e))})},e.decodePayloadAsBinary=function(t,n,o){"function"==typeof n&&(o=n,n=null);for(var r=t,s=[];r.byteLength>0;){for(var i=new Uint8Array(r),a=0===i[0],c="",h=1;255!==i[h];h++){if(c.length>310)return o(d,0,1);c+=i[h]}r=Tt(r,2+c.length),c=parseInt(c);var u=Tt(r,0,c);if(a)try{u=String.fromCharCode.apply(null,new Uint8Array(u))}catch(t){var p=new Uint8Array(u);u="";for(var h=0;h<p.length;h++)u+=String.fromCharCode(p[h])}s.push(u),r=Tt(r,c)}var l=s.length;s.forEach(function(t,r){o(e.decodePacket(t,n,!0),r,l)})}}),Bt=y;nt(y.prototype),y.prototype.onError=function(t,e){var n=new Error(t);return n.type="TransportError",n.description=e,this.emit("error",n),this},y.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},y.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},y.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},y.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},y.prototype.onData=function(t){var e=Rt.decodePacket(t,this.socket.binaryType);this.onPacket(e)},y.prototype.onPacket=function(t){this.emit("packet",t)},y.prototype.onClose=function(){this.readyState="closed",this.emit("close")};for(var Mt,Pt=function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e},Ht=function(t){for(var e={},n=t.split("&"),o=0,r=n.length;o<r;o++){var s=n[o].split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return e},xt={encode:Pt,decode:Ht},Lt=function(t,e){var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t},Ut="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),jt=64,qt={},Vt=0,Wt=0;Wt<jt;Wt++)qt[Ut[Wt]]=Wt;v.encode=m,v.decode=g;var Kt=v,Xt=Q("engine.io-client:polling"),Yt=b,zt=function(){return null!=new Et({xdomain:!1}).responseType}();Lt(b,Bt),b.prototype.name="polling",b.prototype.doOpen=function(){this.poll()},b.prototype.pause=function(t){function e(){Xt("paused"),n.readyState="paused",t()}var n=this;if(this.readyState="pausing",this.polling||!this.writable){var o=0;this.polling&&(Xt("we are currently polling - waiting to pause"),o++,this.once("pollComplete",function(){Xt("pre-pause polling complete"),--o||e()})),this.writable||(Xt("we are currently writing - waiting to pause"),o++,this.once("drain",function(){Xt("pre-pause writing complete"),--o||e()}))}else e()},b.prototype.poll=function(){Xt("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},b.prototype.onData=function(t){var e=this;Xt("polling got data %s",t);var n=function(t,n,o){if("opening"===e.readyState&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)};Rt.decodePayload(t,this.socket.binaryType,n),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():Xt('ignoring poll - transport state "%s"',this.readyState))},b.prototype.doClose=function(){function t(){Xt("writing close packet"),e.write([{type:"close"}])}var e=this;"open"===this.readyState?(Xt("transport open - closing"),t()):(Xt("transport not open - deferring close"),this.once("open",t))},b.prototype.write=function(t){var e=this;this.writable=!1;var n=function(){e.writable=!0,e.emit("drain")};Rt.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,n)})},b.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(t[this.timestampParam]=Kt()),this.supportsBinary||t.sid||(t.b64=1),t=xt.encode(t),this.port&&("https"===e&&443!==Number(this.port)||"http"===e&&80!==Number(this.port))&&(n=":"+this.port),t.length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t};var Ft=Q("engine.io-client:polling-xhr"),Jt=E,Gt=_;Lt(E,Yt),E.prototype.supportsBinary=!0,E.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new _(t)},E.prototype.doWrite=function(t,e){var n="string"!=typeof t&&void 0!==t,o=this.request({method:"POST",data:t,isBinary:n}),r=this;o.on("success",e),o.on("error",function(t){r.onError("xhr post error",t)}),this.sendXhr=o},E.prototype.doPoll=function(){Ft("xhr poll");var t=this.request(),e=this;t.on("data",function(t){e.onData(t)}),t.on("error",function(t){e.onError("xhr poll error",t)}),this.pollXhr=t},nt(_.prototype),_.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var e=this.xhr=new Et(t),n=this;try{Ft("xhr open %s: %s",this.method,this.uri),e.open(this.method,this.uri,this.async);try{if(this.extraHeaders){e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0);for(var o in this.extraHeaders)this.extraHeaders.hasOwnProperty(o)&&e.setRequestHeader(o,this.extraHeaders[o])}}catch(t){}if("POST"===this.method)try{this.isBinary?e.setRequestHeader("Content-type","application/octet-stream"):e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{e.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in e&&(e.withCredentials=!0),this.requestTimeout&&(e.timeout=this.requestTimeout),this.hasXDR()?(e.onload=function(){n.onLoad()},e.onerror=function(){n.onError(e.responseText)}):e.onreadystatechange=function(){if(2===e.readyState){var t;try{t=e.getResponseHeader("Content-Type")}catch(t){}"application/octet-stream"===t&&(e.responseType="arraybuffer")}4===e.readyState&&(200===e.status||1223===e.status?n.onLoad():setTimeout(function(){n.onError(e.status)},0))},Ft("xhr data %s",this.data),e.send(this.data)}catch(t){return void setTimeout(function(){n.onError(t)},0)}P.document&&(this.index=_.requestsCount++,_.requests[this.index]=this)},_.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},_.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},_.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},_.prototype.cleanup=function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=k:this.xhr.onreadystatechange=k,t)try{this.xhr.abort()}catch(t){}P.document&&delete _.requests[this.index],this.xhr=null}},_.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch(t){}t="application/octet-stream"===e?this.xhr.response||this.xhr.responseText:this.xhr.responseText}catch(t){this.onError(t)}null!=t&&this.onData(t)},_.prototype.hasXDR=function(){return void 0!==P.XDomainRequest&&!this.xs&&this.enablesXDR},_.prototype.abort=function(){this.cleanup()},_.requestsCount=0,_.requests={},P.document&&(P.attachEvent?P.attachEvent("onunload",T):P.addEventListener&&P.addEventListener("beforeunload",T,!1)),Jt.Request=Gt;var $t,Zt=A,Qt=/\n/g,te=/\\n/g;Lt(A,Yt),A.prototype.supportsBinary=!1,A.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),Yt.prototype.doClose.call(this)},A.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(e,n):(document.head||document.body).appendChild(e),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},A.prototype.doWrite=function(t,e){function n(){o(),e()}function o(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(t){r.onError("jsonp polling iframe removal error",t)}try{var t='<iframe src="javascript:0" name="'+r.iframeId+'">';s=document.createElement(t)}catch(t){s=document.createElement("iframe"),s.name=r.iframeId,s.src="javascript:0"}s.id=r.iframeId,r.form.appendChild(s),r.iframe=s}var r=this;if(!this.form){var s,i=document.createElement("form"),a=document.createElement("textarea"),c=this.iframeId="eio_iframe_"+this.index;i.className="socketio",i.style.position="absolute",i.style.top="-1000px",i.style.left="-1000px",i.target=c,i.method="POST",i.setAttribute("accept-charset","utf-8"),a.name="d",i.appendChild(a),document.body.appendChild(i),this.form=i,this.area=a}this.form.action=this.uri(),o(),t=t.replace(te,"\\\n"),this.area.value=t.replace(Qt,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===r.iframe.readyState&&n()}:this.iframe.onload=n};var ee,ne={},oe=Object.freeze({default:ne}),re=oe&&ne||oe,se=Q("engine.io-client:websocket"),ie=P.WebSocket||P.MozWebSocket;if("undefined"==typeof window)try{ee=re}catch(t){}var ae=ie;ae||"undefined"!=typeof window||(ae=ee);var ce=N;Lt(N,Bt),N.prototype.name="websocket",N.prototype.supportsBinary=!0,N.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket?e?new ae(t,e):new ae(t):new ae(t,e,n)}catch(t){return this.emit("error",t)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},N.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},N.prototype.write=function(t){function e(){n.emit("flush"),setTimeout(function(){n.writable=!0,n.emit("drain")},0)}var n=this;this.writable=!1;for(var o=t.length,r=0,s=o;r<s;r++)!function(t){Rt.encodePacket(t,n.supportsBinary,function(r){if(!n.usingBrowserWebSocket){var s={};if(t.options&&(s.compress=t.options.compress),n.perMessageDeflate){("string"==typeof r?P.Buffer.byteLength(r):r.length)<n.perMessageDeflate.threshold&&(s.compress=!1)}}try{n.usingBrowserWebSocket?n.ws.send(r):n.ws.send(r,s)}catch(t){se("websocket closed before onclose event")}--o||e()})}(t[r])},N.prototype.onClose=function(){Bt.prototype.onClose.call(this)},N.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},N.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",n="";return this.port&&("wss"===e&&443!==Number(this.port)||"ws"===e&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=Kt()),this.supportsBinary||(t.b64=1),t=xt.encode(t),t.length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t},N.prototype.check=function(){return!(!ae||"__initialize"in ae&&this.name===N.prototype.name)};var he=I,ue=ce,pe={polling:he,websocket:ue},le=[].indexOf,fe=function(t,e){if(le)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1},de=/^[\],:{}\s]*$/,ye=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,me=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,ge=/(?:^|:|,)(?:\s*\[)+/g,ve=/^\s+/,be=/\s+$/,ke=function(t){return"string"==typeof t&&t?(t=t.replace(ve,"").replace(be,""),P.JSON&&JSON.parse?JSON.parse(t):de.test(t.replace(ye,"@").replace(me,"]").replace(ge,""))?new Function("return "+t)():void 0):null},Ee=Q("engine.io-client:socket"),_e=C;C.priorWebsocketSuccess=!1,nt(C.prototype),C.protocol=Rt.protocol,C.Socket=C,C.Transport=Bt,C.transports=pe,C.parser=Rt,C.prototype.createTransport=function(t){Ee('creating transport "%s"',t);var e=O(this.query);e.EIO=Rt.protocol,e.transport=t;var n=this.transportOptions[t]||{};return this.id&&(e.sid=this.id),new pe[t]({query:e,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0})},C.prototype.open=function(){var t;if(this.rememberUpgrade&&C.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},C.prototype.setTransport=function(t){Ee("setting transport %s",t.name);var e=this;this.transport&&(Ee("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},C.prototype.probe=function(t){function e(){if(u.onlyBinaryUpgrades){var e=!this.supportsBinary&&u.transport.supportsBinary;h=h||e}h||(Ee('probe transport "%s" opened',t),c.send([{type:"ping",data:"probe"}]),c.once("packet",function(e){if(!h)if("pong"===e.type&&"probe"===e.data){if(Ee('probe transport "%s" pong',t),u.upgrading=!0,u.emit("upgrading",c),!c)return;C.priorWebsocketSuccess="websocket"===c.name,Ee('pausing current transport "%s"',u.transport.name),u.transport.pause(function(){h||"closed"!==u.readyState&&(Ee("changing transport and sending upgrade packet"),a(),u.setTransport(c),c.send([{type:"upgrade"}]),u.emit("upgrade",c),c=null,u.upgrading=!1,u.flush())})}else{Ee('probe transport "%s" failed',t);var n=new Error("probe error");n.transport=c.name,u.emit("upgradeError",n)}}))}function n(){h||(h=!0,a(),c.close(),c=null)}function o(e){var o=new Error("probe error: "+e);o.transport=c.name,n(),Ee('probe transport "%s" failed because of error: %s',t,e),u.emit("upgradeError",o)}function r(){o("transport closed")}function s(){o("socket closed")}function i(t){c&&t.name!==c.name&&(Ee('"%s" works - aborting "%s"',t.name,c.name),n())}function a(){c.removeListener("open",e),c.removeListener("error",o),c.removeListener("close",r),u.removeListener("close",s),u.removeListener("upgrading",i)}Ee('probing transport "%s"',t);var c=this.createTransport(t,{probe:1}),h=!1,u=this;C.priorWebsocketSuccess=!1,c.once("open",e),c.once("error",o),c.once("close",r),this.once("close",s),this.once("upgrading",i),c.open()},C.prototype.onOpen=function(){if(Ee("socket open"),this.readyState="open",C.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){Ee("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},C.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(Ee('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(ke(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}else Ee('packet received with socket readyState "%s"',this.readyState)},C.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},C.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!==e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},C.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){Ee("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},C.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})},C.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},C.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(Ee("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},C.prototype.write=C.prototype.send=function(t,e,n){return this.sendPacket("message",t,e,n),this},C.prototype.sendPacket=function(t,e,n,o){if("function"==typeof e&&(o=e,e=void 0),"function"==typeof n&&(o=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){n=n||{},n.compress=!1!==n.compress;var r={type:t,data:e,options:n};this.emit("packetCreate",r),this.writeBuffer.push(r),o&&this.once("flush",o),this.flush()}},C.prototype.close=function(){function t(){o.onClose("forced close"),Ee("socket closing - telling transport to close"),o.transport.close()}function e(){o.removeListener("upgrade",e),o.removeListener("upgradeError",e),t()}function n(){o.once("upgrade",e),o.once("upgradeError",e)}if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var o=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?n():t()}):this.upgrading?n():t()}return this},C.prototype.onError=function(t){Ee("socket error %j",t),C.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},C.prototype.onClose=function(t,e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){Ee('socket close with reason: "%s"',t);var n=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),n.writeBuffer=[],n.prevBufferLen=0}},C.prototype.filterUpgrades=function(t){for(var e=[],n=0,o=t.length;n<o;n++)~fe(this.transports,t[n])&&e.push(t[n]);return e};var Te=_e,we=Rt;Te.parser=we;var Ae=Te,Ne=S,Ie=D,Ce=[].slice,Oe=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var n=Ce.call(arguments,2);return function(){return e.apply(t,n.concat(Ce.call(arguments)))}},Se=t(function(t,e){function n(t,e,n){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}var o=Q("socket.io-client:socket");t.exports=n;var r={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},s=nt.prototype.emit;nt(n.prototype),n.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[Ie(t,"open",Oe(this,"onopen")),Ie(t,"packet",Oe(this,"onpacket")),Ie(t,"close",Oe(this,"onclose"))]}},n.prototype.open=n.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting"),this)},n.prototype.send=function(){var t=Ne(arguments);return t.unshift("message"),this.emit.apply(this,t),this},n.prototype.emit=function(t){if(r.hasOwnProperty(t))return s.apply(this,arguments),this;var e=Ne(arguments),n={type:bt.EVENT,data:e};return n.options={},n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof e[e.length-1]&&(o("emitting packet with ack id %d",this.ids),this.acks[this.ids]=e.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),delete this.flags,this},n.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},n.prototype.onopen=function(){if(o("transport is open - connecting"),"/"!==this.nsp)if(this.query){var t="object"===U(this.query)?xt.encode(this.query):this.query;o("sending connect packet with query %s",t),this.packet({type:bt.CONNECT,query:t})}else this.packet({type:bt.CONNECT})},n.prototype.onclose=function(t){o("close (%s)",t),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},n.prototype.onpacket=function(t){if(t.nsp===this.nsp)switch(t.type){case bt.CONNECT:this.onconnect();break;case bt.EVENT:case bt.BINARY_EVENT:this.onevent(t);break;case bt.ACK:case bt.BINARY_ACK:this.onack(t);break;case bt.DISCONNECT:this.ondisconnect();break;case bt.ERROR:this.emit("error",t.data)}},n.prototype.onevent=function(t){var e=t.data||[];o("emitting event %j",e),null!=t.id&&(o("attaching ack callback to event"),e.push(this.ack(t.id))),this.connected?s.apply(this,e):this.receiveBuffer.push(e)},n.prototype.ack=function(t){var e=this,n=!1;return function(){if(!n){n=!0;var r=Ne(arguments);o("sending ack %j",r),e.packet({type:bt.ACK,id:t,data:r})}}},n.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e?(o("calling ack %s with %j",t.id,t.data),e.apply(this,t.data),delete this.acks[t.id]):o("bad ack %s",t.id)},n.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},n.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)s.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t])
;this.sendBuffer=[]},n.prototype.ondisconnect=function(){o("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},n.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},n.prototype.close=n.prototype.disconnect=function(){return this.connected&&(o("performing disconnect (%s)",this.nsp),this.packet({type:bt.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},n.prototype.compress=function(t){return this.flags=this.flags||{},this.flags.compress=t,this}}),De=R;R.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},R.prototype.reset=function(){this.attempts=0},R.prototype.setMin=function(t){this.ms=t},R.prototype.setMax=function(t){this.max=t},R.prototype.setJitter=function(t){this.jitter=t};var Re=Q("socket.io-client:manager"),Be=Object.prototype.hasOwnProperty,Me=B;B.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var t in this.nsps)Be.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},B.prototype.updateSocketIds=function(){for(var t in this.nsps)Be.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},B.prototype.generateId=function(t){return("/"===t?"":t+"#")+this.engine.id},nt(B.prototype),B.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},B.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},B.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},B.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},B.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},B.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},B.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},B.prototype.open=B.prototype.connect=function(t,e){if(Re("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;Re("opening %s",this.uri),this.engine=Ae(this.uri,this.opts);var n=this.engine,o=this;this.readyState="opening",this.skipReconnect=!1;var r=Ie(n,"open",function(){o.onopen(),t&&t()}),s=Ie(n,"error",function(e){if(Re("connect_error"),o.cleanup(),o.readyState="closed",o.emitAll("connect_error",e),t){var n=new Error("Connection error");n.data=e,t(n)}else o.maybeReconnectOnOpen()});if(!1!==this._timeout){var i=this._timeout;Re("connect attempt will timeout after %d",i);var a=setTimeout(function(){Re("connect attempt timed out after %d",i),r.destroy(),n.close(),n.emit("error","timeout"),o.emitAll("connect_timeout",i)},i);this.subs.push({destroy:function(){clearTimeout(a)}})}return this.subs.push(r),this.subs.push(s),this},B.prototype.onopen=function(){Re("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(Ie(t,"data",Oe(this,"ondata"))),this.subs.push(Ie(t,"ping",Oe(this,"onping"))),this.subs.push(Ie(t,"pong",Oe(this,"onpong"))),this.subs.push(Ie(t,"error",Oe(this,"onerror"))),this.subs.push(Ie(t,"close",Oe(this,"onclose"))),this.subs.push(Ie(this.decoder,"decoded",Oe(this,"ondecoded")))},B.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},B.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},B.prototype.ondata=function(t){this.decoder.add(t)},B.prototype.ondecoded=function(t){this.emit("packet",t)},B.prototype.onerror=function(t){Re("error",t),this.emitAll("error",t)},B.prototype.socket=function(t,e){function n(){~fe(r.connecting,o)||r.connecting.push(o)}var o=this.nsps[t];if(!o){o=new Se(this,t,e),this.nsps[t]=o;var r=this;o.on("connecting",n),o.on("connect",function(){o.id=r.generateId(t)}),this.autoConnect&&n()}return o},B.prototype.destroy=function(t){var e=fe(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},B.prototype.packet=function(t){Re("writing packet %j",t);var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(n){for(var o=0;o<n.length;o++)e.engine.write(n[o],t.options);e.encoding=!1,e.processPacketQueue()}))},B.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},B.prototype.cleanup=function(){Re("cleanup");for(var t=this.subs.length,e=0;e<t;e++){this.subs.shift().destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},B.prototype.close=B.prototype.disconnect=function(){Re("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},B.prototype.onclose=function(t){Re("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},B.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)Re("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();Re("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var n=setTimeout(function(){t.skipReconnect||(Re("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(Re("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(Re("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(n)}})}},B.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)};var Pe=t(function(t,e){function n(t,e){"object"===(void 0===t?"undefined":U(t))&&(e=t,t=void 0),e=e||{};var n,s=et(t),i=s.source,a=s.id,c=s.path,h=r[a]&&c in r[a].nsps,u=e.forceNew||e["force new connection"]||!1===e.multiplex||h;return u?(o("ignoring socket cache for %s",i),n=Me(i,e)):(r[a]||(o("new io instance for %s",i),r[a]=Me(i,e)),n=r[a]),s.query&&!e.query&&(e.query=s.query),n.socket(s.path,e)}var o=Q("socket.io-client");t.exports=e=n;var r=e.managers={};e.protocol=bt.protocol,e.connect=n,e.Manager=Me,e.Socket=Se}),He={trace:1,debug3:2,debug2:3,debug:4,info:5,warn:6,error:7},xe=function(){return(new Error).stack.split("\n")[4].split("at ")[1].trim()},Le=function(t){var e=t.split(/\s+/);if(e.length>1){var n=/\(.*\/(.*)\)/g.exec(e[e.length-1]);if(null!=n&&n.length>1)return e[0]+"::"+n[1]}return t},Ue=function(){if(1==qe){var t=xe();return Le(t)}return""},je=4,qe=!1,Ve=function(){function t(){j(this,t)}return q(t,null,[{key:"setLevel",value:function(t){if(!(t in He))throw new Error("invalid log type");je=He[t]}},{key:"showFileAndLineInfo",value:function(t){qe=t}},{key:"trace",value:function(t){je<=He.trace&&console.trace("[RTE]: TRACE "+Ue()+" "+t)}},{key:"debug",value:function(t){je<=He.debug&&console.log("[RTE]: DEBUG "+Ue()+" "+t)}},{key:"debug2",value:function(t){je<=He.debug2&&console.log("[RTE]: DEBUG2 "+Ue()+" "+t)}},{key:"debug3",value:function(t){je<=He.debug3&&console.log("[RTE]: DEBUG3 "+Ue()+" "+t)}},{key:"info",value:function(t){je<=He.info&&console.info("[RTE]: INFO "+Ue()+" "+t)}},{key:"warn",value:function(t){je<=He.warn&&console.warn("[RTE]: WARN "+Ue()+" "+t)}},{key:"error",value:function(t){je<=He.error&&console.error("[RTE]: ERROR "+Ue()+" "+t)}}]),t}(),We={contentDirty:"dirtyContent",contentHash:"contentHash",sessionID:"sessionID"},Ke=function(){function t(e){j(this,t),this._yInstance=e,this._usePersistence=null!==e.persistence,this._sessionID=null,this._contentHash=null,this._contentDirty=!1}return q(t,[{key:"getContentDirty",value:function(){return this._usePersistence?this._yInstance.persistence.get(this._yInstance,We.contentDirty):Promise.resolve(this._contentDirty)}},{key:"setContentDirty",value:function(t){if(this._usePersistence)return void this._yInstance.persistence.set(this._yInstance,We.contentDirty,t);this._contentDirty=t}},{key:"getContentHash",value:function(){return this._usePersistence?this._yInstance.persistence.get(this._yInstance,We.contentHash):Promise.resolve(this._contentHash)}},{key:"setContentHash",value:function(t){if(this._usePersistence)return void this._yInstance.persistence.set(this._yInstance,We.contentHash,t);this._contentHash=t}},{key:"getSessionID",value:function(){return this._usePersistence?this._yInstance.persistence.get(this._yInstance,We.sessionID):Promise.resolve(this._sessionID)}},{key:"setSessionID",value:function(t){if(this._usePersistence)return void this._yInstance.persistence.set(this._yInstance,We.sessionID,t);this._sessionID=t}}]),t}(),Xe={CLIENT:"RealtimeClientDomain",SERVER:"RealtimeServerDomain"},Ye={UNKNOWN:-1,INTERNAL_FAILURE:2},ze={UNKNOWN:-1,AUTH_EXPIRED:1,SESSION_START_DENIED:2,INCOMPATIBLE_MODEL:4,INCOMPATIBLE_CONTENT_CLASS:5,INCOMPLETE_PARAMETERS:6,INVALID_AUTH_HOST:7,INVALID_SERVICE_HOST:8,BLOCKED_ROOM:9,PERMISSION_DENIED:10,INVALID_ENML_GENERATED:11,SHUT_DOWN_ROOM:12,NOTE_SIZE_EXCEEDED:13,SERVICE_UNAVAILABLE:14,INVALID_COMMAND:15,CANNOT_GET_ROOM_LOCK:16,ATTEMPTING_TO_UNLOCK_NOT_OWNED_LOCK:17},Fe={INTERNAL:0,SESSION:1},Je={UNKNOWN:-1,AUTH_EXPIRED:0,SESSION_START_DENIED:1,INCOMPATIBLE_MODEL:3,INCOMPATIBLE_CONTENT_CLASS:4,INCOMPLETE_PARAMETERS:5,INVALID_AUTH_HOST:6,INVALID_SERVICE_HOST:7,BLOCKED_ROOM:8,PERMISSION_DENIED:9,INVALID_ENML_GENERATED:10,SHUT_DOWN_ROOM:11,NOTE_SIZE_EXCEEDED:12,SERVICE_UNAVAILABLE:13,INVALID_COMMAND:14,CANNOT_GET_ROOM_LOCK:15,ATTEMPTING_TO_UNLOCK_NOT_OWNED_LOCK:16},Ge={RECONNECT_DELAY:1e3,RECONNECT_WATCHDOG_TIMEOUT:5e3,CLIENT_CONNECT_TIMEOUT:15e3,TIME_TO_COMPLETE_PREVIOUS_CONNECTION_ESTABLISHMENT_BY:2e4,HANDSHAKE_TIMEOUT_INTERVAL:6e5},$e=function(t){var e=Ye.UNKNOWN,n="Unknown client error. Code: "+t;switch(t){case Ye.INTERNAL_FAILURE:e=t,n="Internal error."}return{code:e,domain:Xe.CLIENT,message:n}},Ze=function(t){var e=ze.UNKNOWN,n="Unknown server error. Code: "+t;switch(t){case Je.AUTH_EXPIRED:e=ze.AUTH_EXPIRED,n="Auth token has been expired.";break;case Je.SESSION_START_DENIED:e=ze.SESSION_START_DENIED,n="User has no permissions to start RTE session.";break;case Je.INCOMPATIBLE_MODEL:e=ze.INCOMPATIBLE_MODEL,n="Client and server have incompatible model states.";break;case Je.INCOMPATIBLE_CONTENT_CLASS:e=ze.INCOMPATIBLE_CONTENT_CLASS,n="The note was created in a another app.";break;case Je.INCOMPLETE_PARAMETERS:e=ze.INCOMPLETE_PARAMETERS,n="Incomplete parameters.";break;case Je.INVALID_AUTH_HOST:e=ze.INVALID_AUTH_HOST,n="Invalid auth host. There is already session for the note with a different service host created.";break;case Je.INVALID_SERVICE_HOST:e=ze.INVALID_SERVICE_HOST,n="The service host specified is not supported or denied by RTE server.";break;case Je.BLOCKED_ROOM:e=ze.BLOCKED_ROOM,n="The note is blocked by RTE server.";break;case Je.PERMISSION_DENIED:e=ze.PERMISSION_DENIED,n="Permissions denied.";break;case Je.INVALID_ENML_GENERATED:e=ze.INVALID_ENML_GENERATED,n="There was an error while generating/persisting ENML.";break;case Je.SHUT_DOWN_ROOM:e=ze.SHUT_DOWN_ROOM,n="Session has been shut down. Try again later.";break;case Je.NOTE_SIZE_EXCEEDED:e=ze.NOTE_SIZE_EXCEEDED,n="Exceeded allowed note content size.";break;case Je.SERVICE_UNAVAILABLE:e=ze.SERVICE_UNAVAILABLE,n="Evernote server is unavailable.";break;case Je.INVALID_COMMAND:e=ze.INVALID_COMMAND,n="Invalid command sent to the server.";break;case Je.CANNOT_GET_ROOM_LOCK:e=ze.CANNOT_GET_ROOM_LOCK,n="It was not possible to get internal room lock.";break;case Je.ATTEMPTING_TO_UNLOCK_NOT_OWNED_LOCK:e=ze.ATTEMPTING_TO_UNLOCK_NOT_OWNED_LOCK,n="User tried to release the lock owned by another user."}return{code:e,domain:Xe.SERVER,message:n}},Qe=function(t){return t===Je.SHUT_DOWN_ROOM||t===Je.SERVICE_UNAVAILABLE||t===Je.SESSION_START_DENIED},tn=10,en="plugin";return"undefined"!=typeof Y&&M(Y),M});
//# sourceMappingURL=y-websockets-client.js.map
!function(){function n(n){return n&&(n.ownerDocument||n.document||n).documentElement}function t(n){return n&&(n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView)}function e(n,t){return t>n?-1:n>t?1:n>=t?0:NaN}function r(n){return null===n?NaN:+n}function i(n){return!isNaN(n)}function u(n){return{left:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var u=r+i>>>1;n(t[u],e)<0?r=u+1:i=u}return r},right:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var u=r+i>>>1;n(t[u],e)>0?i=u:r=u+1}return r}}}function o(n){return n.length}function a(n){for(var t=1;n*t%1;)t*=10;return t}function l(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function c(){this._=Object.create(null)}function f(n){return(n+="")===bo||n[0]===_o?_o+n:n}function s(n){return(n+="")[0]===_o?n.slice(1):n}function h(n){return f(n)in this._}function p(n){return(n=f(n))in this._&&delete this._[n]}function g(){var n=[];for(var t in this._)n.push(s(t));return n}function v(){var n=0;for(var t in this._)++n;return n}function d(){for(var n in this._)return!1;return!0}function y(){this._=Object.create(null)}function m(n){return n}function M(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function x(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=wo.length;r>e;++e){var i=wo[e]+t;if(i in n)return i}}function b(){}function _(){}function w(n){function t(){for(var t,r=e,i=-1,u=r.length;++i<u;)(t=r[i].on)&&t.apply(this,arguments);return n}var e=[],r=new c;return t.on=function(t,i){var u,o=r.get(t);return arguments.length<2?o&&o.on:(o&&(o.on=null,e=e.slice(0,u=e.indexOf(o)).concat(e.slice(u+1)),r.remove(t)),i&&e.push(r.set(t,{on:i})),n)},t}function S(){ao.event.preventDefault()}function k(){for(var n,t=ao.event;n=t.sourceEvent;)t=n;return t}function N(n){for(var t=new _,e=0,r=arguments.length;++e<r;)t[arguments[e]]=w(t);return t.of=function(e,r){return function(i){try{var u=i.sourceEvent=ao.event;i.target=n,ao.event=i,t[i.type].apply(e,r)}finally{ao.event=u}}},t}function E(n){return ko(n,Co),n}function A(n){return"function"==typeof n?n:function(){return No(n,this)}}function C(n){return"function"==typeof n?n:function(){return Eo(n,this)}}function z(n,t){function e(){this.removeAttribute(n)}function r(){this.removeAttributeNS(n.space,n.local)}function i(){this.setAttribute(n,t)}function u(){this.setAttributeNS(n.space,n.local,t)}function o(){var e=t.apply(this,arguments);null==e?this.removeAttribute(n):this.setAttribute(n,e)}function a(){var e=t.apply(this,arguments);null==e?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}return n=ao.ns.qualify(n),null==t?n.local?r:e:"function"==typeof t?n.local?a:o:n.local?u:i}function L(n){return n.trim().replace(/\s+/g," ")}function q(n){return new RegExp("(?:^|\\s+)"+ao.requote(n)+"(?:\\s+|$)","g")}function T(n){return(n+"").trim().split(/^|\s+/)}function R(n,t){function e(){for(var e=-1;++e<i;)n[e](this,t)}function r(){for(var e=-1,r=t.apply(this,arguments);++e<i;)n[e](this,r)}n=T(n).map(D);var i=n.length;return"function"==typeof t?r:e}function D(n){var t=q(n);return function(e,r){if(i=e.classList)return r?i.add(n):i.remove(n);var i=e.getAttribute("class")||"";r?(t.lastIndex=0,t.test(i)||e.setAttribute("class",L(i+" "+n))):e.setAttribute("class",L(i.replace(t," ")))}}function P(n,t,e){function r(){this.style.removeProperty(n)}function i(){this.style.setProperty(n,t,e)}function u(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,e)}return null==t?r:"function"==typeof t?u:i}function U(n,t){function e(){delete this[n]}function r(){this[n]=t}function i(){var e=t.apply(this,arguments);null==e?delete this[n]:this[n]=e}return null==t?e:"function"==typeof t?i:r}function j(n){function t(){var t=this.ownerDocument,e=this.namespaceURI;return e===zo&&t.documentElement.namespaceURI===zo?t.createElement(n):t.createElementNS(e,n)}function e(){return this.ownerDocument.createElementNS(n.space,n.local)}return"function"==typeof n?n:(n=ao.ns.qualify(n)).local?e:t}function F(){var n=this.parentNode;n&&n.removeChild(this)}function H(n){return{__data__:n}}function O(n){return function(){return Ao(this,n)}}function I(n){return arguments.length||(n=e),function(t,e){return t&&e?n(t.__data__,e.__data__):!t-!e}}function Y(n,t){for(var e=0,r=n.length;r>e;e++)for(var i,u=n[e],o=0,a=u.length;a>o;o++)(i=u[o])&&t(i,o,e);return n}function Z(n){return ko(n,qo),n}function V(n){var t,e;return function(r,i,u){var o,a=n[u].update,l=a.length;for(u!=e&&(e=u,t=0),i>=t&&(t=i+1);!(o=a[t])&&++t<l;);return o}}function X(n,t,e){function r(){var t=this[o];t&&(this.removeEventListener(n,t,t.$),delete this[o])}function i(){var i=l(t,co(arguments));r.call(this),this.addEventListener(n,this[o]=i,i.$=e),i._=t}function u(){var t,e=new RegExp("^__on([^.]+)"+ao.requote(n)+"$");for(var r in this)if(t=r.match(e)){var i=this[r];this.removeEventListener(t[1],i,i.$),delete this[r]}}var o="__on"+n,a=n.indexOf("."),l=$;a>0&&(n=n.slice(0,a));var c=To.get(n);return c&&(n=c,l=B),a?t?i:r:t?b:u}function $(n,t){return function(e){var r=ao.event;ao.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{ao.event=r}}}function B(n,t){var e=$(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function W(e){var r=".dragsuppress-"+ ++Do,i="click"+r,u=ao.select(t(e)).on("touchmove"+r,S).on("dragstart"+r,S).on("selectstart"+r,S);if(null==Ro&&(Ro="onselectstart"in e?!1:x(e.style,"userSelect")),Ro){var o=n(e).style,a=o[Ro];o[Ro]="none"}return function(n){if(u.on(r,null),Ro&&(o[Ro]=a),n){var t=function(){u.on(i,null)};u.on(i,function(){S(),t()},!0),setTimeout(t,0)}}}function J(n,e){e.changedTouches&&(e=e.changedTouches[0]);var r=n.ownerSVGElement||n;if(r.createSVGPoint){var i=r.createSVGPoint();if(0>Po){var u=t(n);if(u.scrollX||u.scrollY){r=ao.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();Po=!(o.f||o.e),r.remove()}}return Po?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}function G(){return ao.event.changedTouches[0].identifier}function K(n){return n>0?1:0>n?-1:0}function Q(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function nn(n){return n>1?0:-1>n?Fo:Math.acos(n)}function tn(n){return n>1?Io:-1>n?-Io:Math.asin(n)}function en(n){return((n=Math.exp(n))-1/n)/2}function rn(n){return((n=Math.exp(n))+1/n)/2}function un(n){return((n=Math.exp(2*n))-1)/(n+1)}function on(n){return(n=Math.sin(n/2))*n}function an(){}function ln(n,t,e){return this instanceof ln?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof ln?new ln(n.h,n.s,n.l):_n(""+n,wn,ln):new ln(n,t,e)}function cn(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?u+(o-u)*n/60:180>n?o:240>n?u+(o-u)*(240-n)/60:u}function i(n){return Math.round(255*r(n))}var u,o;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,u=2*e-o,new mn(i(n+120),i(n),i(n-120))}function fn(n,t,e){return this instanceof fn?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof fn?new fn(n.h,n.c,n.l):n instanceof hn?gn(n.l,n.a,n.b):gn((n=Sn((n=ao.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new fn(n,t,e)}function sn(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new hn(e,Math.cos(n*=Yo)*t,Math.sin(n)*t)}function hn(n,t,e){return this instanceof hn?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof hn?new hn(n.l,n.a,n.b):n instanceof fn?sn(n.h,n.c,n.l):Sn((n=mn(n)).r,n.g,n.b):new hn(n,t,e)}function pn(n,t,e){var r=(n+16)/116,i=r+t/500,u=r-e/200;return i=vn(i)*na,r=vn(r)*ta,u=vn(u)*ea,new mn(yn(3.2404542*i-1.5371385*r-.4985314*u),yn(-.969266*i+1.8760108*r+.041556*u),yn(.0556434*i-.2040259*r+1.0572252*u))}function gn(n,t,e){return n>0?new fn(Math.atan2(e,t)*Zo,Math.sqrt(t*t+e*e),n):new fn(NaN,NaN,n)}function vn(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function dn(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function yn(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function mn(n,t,e){return this instanceof mn?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof mn?new mn(n.r,n.g,n.b):_n(""+n,mn,cn):new mn(n,t,e)}function Mn(n){return new mn(n>>16,n>>8&255,255&n)}function xn(n){return Mn(n)+""}function bn(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function _n(n,t,e){var r,i,u,o=0,a=0,l=0;if(r=/([a-z]+)\((.*)\)/.exec(n=n.toLowerCase()))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(Nn(i[0]),Nn(i[1]),Nn(i[2]))}return(u=ua.get(n))?t(u.r,u.g,u.b):(null==n||"#"!==n.charAt(0)||isNaN(u=parseInt(n.slice(1),16))||(4===n.length?(o=(3840&u)>>4,o=o>>4|o,a=240&u,a=a>>4|a,l=15&u,l=l<<4|l):7===n.length&&(o=(16711680&u)>>16,a=(65280&u)>>8,l=255&u)),t(o,a,l))}function wn(n,t,e){var r,i,u=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-u,l=(o+u)/2;return a?(i=.5>l?a/(o+u):a/(2-o-u),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=NaN,i=l>0&&1>l?0:r),new ln(r,i,l)}function Sn(n,t,e){n=kn(n),t=kn(t),e=kn(e);var r=dn((.4124564*n+.3575761*t+.1804375*e)/na),i=dn((.2126729*n+.7151522*t+.072175*e)/ta),u=dn((.0193339*n+.119192*t+.9503041*e)/ea);return hn(116*i-16,500*(r-i),200*(i-u))}function kn(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Nn(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function En(n){return"function"==typeof n?n:function(){return n}}function An(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Cn(t,e,n,r)}}function Cn(n,t,e,r){function i(){var n,t=l.status;if(!t&&Ln(l)||t>=200&&300>t||304===t){try{n=e.call(u,l)}catch(r){return void o.error.call(u,r)}o.load.call(u,n)}else o.error.call(u,l)}var u={},o=ao.dispatch("beforesend","progress","load","error"),a={},l=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(n)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(n){var t=ao.event;ao.event=n;try{o.progress.call(u,l)}finally{ao.event=t}},u.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",u)},u.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",u):t},u.responseType=function(n){return arguments.length?(c=n,u):c},u.response=function(n){return e=n,u},["get","post"].forEach(function(n){u[n]=function(){return u.send.apply(u,[n].concat(co(arguments)))}}),u.send=function(e,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),l.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),l.setRequestHeader)for(var f in a)l.setRequestHeader(f,a[f]);return null!=t&&l.overrideMimeType&&l.overrideMimeType(t),null!=c&&(l.responseType=c),null!=i&&u.on("error",i).on("load",function(n){i(null,n)}),o.beforesend.call(u,l),l.send(null==r?null:r),u},u.abort=function(){return l.abort(),u},ao.rebind(u,o,"on"),null==r?u:u.get(zn(r))}function zn(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function Ln(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function qn(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var i=e+t,u={c:n,t:i,n:null};return aa?aa.n=u:oa=u,aa=u,la||(ca=clearTimeout(ca),la=1,fa(Tn)),u}function Tn(){var n=Rn(),t=Dn()-n;t>24?(isFinite(t)&&(clearTimeout(ca),ca=setTimeout(Tn,t)),la=0):(la=1,fa(Tn))}function Rn(){for(var n=Date.now(),t=oa;t;)n>=t.t&&t.c(n-t.t)&&(t.c=null),t=t.n;return n}function Dn(){for(var n,t=oa,e=1/0;t;)t.c?(t.t<e&&(e=t.t),t=(n=t).n):t=n?n.n=t.n:oa=t.n;return aa=n,e}function Pn(n,t){return t-(n?Math.ceil(Math.log(n)/Math.LN10):1)}function Un(n,t){var e=Math.pow(10,3*xo(8-t));return{scale:t>8?function(n){return n/e}:function(n){return n*e},symbol:n}}function jn(n){var t=n.decimal,e=n.thousands,r=n.grouping,i=n.currency,u=r&&e?function(n,t){for(var i=n.length,u=[],o=0,a=r[0],l=0;i>0&&a>0&&(l+a+1>t&&(a=Math.max(1,t-l)),u.push(n.substring(i-=a,i+a)),!((l+=a+1)>t));)a=r[o=(o+1)%r.length];return u.reverse().join(e)}:m;return function(n){var e=ha.exec(n),r=e[1]||" ",o=e[2]||">",a=e[3]||"-",l=e[4]||"",c=e[5],f=+e[6],s=e[7],h=e[8],p=e[9],g=1,v="",d="",y=!1,m=!0;switch(h&&(h=+h.substring(1)),(c||"0"===r&&"="===o)&&(c=r="0",o="="),p){case"n":s=!0,p="g";break;case"%":g=100,d="%",p="f";break;case"p":g=100,d="%",p="r";break;case"b":case"o":case"x":case"X":"#"===l&&(v="0"+p.toLowerCase());case"c":m=!1;case"d":y=!0,h=0;break;case"s":g=-1,p="r"}"$"===l&&(v=i[0],d=i[1]),"r"!=p||h||(p="g"),null!=h&&("g"==p?h=Math.max(1,Math.min(21,h)):"e"!=p&&"f"!=p||(h=Math.max(0,Math.min(20,h)))),p=pa.get(p)||Fn;var M=c&&s;return function(n){var e=d;if(y&&n%1)return"";var i=0>n||0===n&&0>1/n?(n=-n,"-"):"-"===a?"":a;if(0>g){var l=ao.formatPrefix(n,h);n=l.scale(n),e=l.symbol+d}else n*=g;n=p(n,h);var x,b,_=n.lastIndexOf(".");if(0>_){var w=m?n.lastIndexOf("e"):-1;0>w?(x=n,b=""):(x=n.substring(0,w),b=n.substring(w))}else x=n.substring(0,_),b=t+n.substring(_+1);!c&&s&&(x=u(x,1/0));var S=v.length+x.length+b.length+(M?0:i.length),k=f>S?new Array(S=f-S+1).join(r):"";return M&&(x=u(k+x,k.length?f-b.length:1/0)),i+=v,n=x+b,("<"===o?i+n+k:">"===o?k+i+n:"^"===o?k.substring(0,S>>=1)+i+n+k.substring(S):i+(M?n:k+n))+e}}}function Fn(n){return n+""}function Hn(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function On(n,t,e){function r(t){var e=n(t),r=u(e,1);return r-t>t-e?e:r}function i(e){return t(e=n(new va(e-1)),1),e}function u(n,e){return t(n=new va(+n),e),n}function o(n,r,u){var o=i(n),a=[];if(u>1)for(;r>o;)e(o)%u||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{va=Hn;var r=new Hn;return r._=n,o(r,t,e)}finally{va=Date}}n.floor=n,n.round=r,n.ceil=i,n.offset=u,n.range=o;var l=n.utc=In(n);return l.floor=l,l.round=In(r),l.ceil=In(i),l.offset=In(u),l.range=a,n}function In(n){return function(t,e){try{va=Hn;var r=new Hn;return r._=t,n(r,e)._}finally{va=Date}}}function Yn(n){function t(n){function t(t){for(var e,i,u,o=[],a=-1,l=0;++a<r;)37===n.charCodeAt(a)&&(o.push(n.slice(l,a)),null!=(i=ya[e=n.charAt(++a)])&&(e=n.charAt(++a)),(u=A[e])&&(e=u(t,null==i?"e"===e?" ":"0":i)),o.push(e),l=a+1);return o.push(n.slice(l,a)),o.join("")}var r=n.length;return t.parse=function(t){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},i=e(r,n,t,0);if(i!=t.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var u=null!=r.Z&&va!==Hn,o=new(u?Hn:va);return"j"in r?o.setFullYear(r.y,0,r.j):"W"in r||"U"in r?("w"in r||(r.w="W"in r?1:0),o.setFullYear(r.y,0,1),o.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(o.getDay()+5)%7:r.w+7*r.U-(o.getDay()+6)%7)):o.setFullYear(r.y,r.m,r.d),o.setHours(r.H+(r.Z/100|0),r.M+r.Z%100,r.S,r.L),u?o._:o},t.toString=function(){return n},t}function e(n,t,e,r){for(var i,u,o,a=0,l=t.length,c=e.length;l>a;){if(r>=c)return-1;if(i=t.charCodeAt(a++),37===i){if(o=t.charAt(a++),u=C[o in ya?t.charAt(a++):o],!u||(r=u(n,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){_.lastIndex=0;var r=_.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){x.lastIndex=0;var r=x.exec(t.slice(e));return r?(n.w=b.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){N.lastIndex=0;var r=N.exec(t.slice(e));return r?(n.m=E.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.slice(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,A.c.toString(),t,r)}function l(n,t,r){return e(n,A.x.toString(),t,r)}function c(n,t,r){return e(n,A.X.toString(),t,r)}function f(n,t,e){var r=M.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var s=n.dateTime,h=n.date,p=n.time,g=n.periods,v=n.days,d=n.shortDays,y=n.months,m=n.shortMonths;t.utc=function(n){function e(n){try{va=Hn;var t=new va;return t._=n,r(t)}finally{va=Date}}var r=t(n);return e.parse=function(n){try{va=Hn;var t=r.parse(n);return t&&t._}finally{va=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ct;var M=ao.map(),x=Vn(v),b=Xn(v),_=Vn(d),w=Xn(d),S=Vn(y),k=Xn(y),N=Vn(m),E=Xn(m);g.forEach(function(n,t){M.set(n.toLowerCase(),t)});var A={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return m[n.getMonth()]},B:function(n){return y[n.getMonth()]},c:t(s),d:function(n,t){return Zn(n.getDate(),t,2)},e:function(n,t){return Zn(n.getDate(),t,2)},H:function(n,t){return Zn(n.getHours(),t,2)},I:function(n,t){return Zn(n.getHours()%12||12,t,2)},j:function(n,t){return Zn(1+ga.dayOfYear(n),t,3)},L:function(n,t){return Zn(n.getMilliseconds(),t,3)},m:function(n,t){return Zn(n.getMonth()+1,t,2)},M:function(n,t){return Zn(n.getMinutes(),t,2)},p:function(n){return g[+(n.getHours()>=12)]},S:function(n,t){return Zn(n.getSeconds(),t,2)},U:function(n,t){return Zn(ga.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Zn(ga.mondayOfYear(n),t,2)},x:t(h),X:t(p),y:function(n,t){return Zn(n.getFullYear()%100,t,2)},Y:function(n,t){return Zn(n.getFullYear()%1e4,t,4)},Z:at,"%":function(){return"%"}},C={a:r,A:i,b:u,B:o,c:a,d:tt,e:tt,H:rt,I:rt,j:et,L:ot,m:nt,M:it,p:f,S:ut,U:Bn,w:$n,W:Wn,x:l,X:c,y:Gn,Y:Jn,Z:Kn,"%":lt};return t}function Zn(n,t,e){var r=0>n?"-":"",i=(r?-n:n)+"",u=i.length;return r+(e>u?new Array(e-u+1).join(t)+i:i)}function Vn(n){return new RegExp("^(?:"+n.map(ao.requote).join("|")+")","i")}function Xn(n){for(var t=new c,e=-1,r=n.length;++e<r;)t.set(n[e].toLowerCase(),e);return t}function $n(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+1));return r?(n.w=+r[0],e+r[0].length):-1}function Bn(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e));return r?(n.U=+r[0],e+r[0].length):-1}function Wn(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e));return r?(n.W=+r[0],e+r[0].length):-1}function Jn(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+4));return r?(n.y=+r[0],e+r[0].length):-1}function Gn(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.y=Qn(+r[0]),e+r[0].length):-1}function Kn(n,t,e){return/^[+-]\d{4}$/.test(t=t.slice(e,e+5))?(n.Z=-t,e+5):-1}function Qn(n){return n+(n>68?1900:2e3)}function nt(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function tt(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function et(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function rt(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function it(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function ut(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ot(n,t,e){ma.lastIndex=0;var r=ma.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function at(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=xo(t)/60|0,i=xo(t)%60;return e+Zn(r,"0",2)+Zn(i,"0",2)}function lt(n,t,e){Ma.lastIndex=0;var r=Ma.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ct(n){for(var t=n.length,e=-1;++e<t;)n[e][0]=this(n[e][0]);return function(t){for(var e=0,r=n[e];!r[1](t);)r=n[++e];return r[0](t)}}function ft(){}function st(n,t,e){var r=e.s=n+t,i=r-n,u=r-i;e.t=n-u+(t-i)}function ht(n,t){n&&wa.hasOwnProperty(n.type)&&wa[n.type](n,t)}function pt(n,t,e){var r,i=-1,u=n.length-e;for(t.lineStart();++i<u;)r=n[i],t.point(r[0],r[1],r[2]);t.lineEnd()}function gt(n,t){var e=-1,r=n.length;for(t.polygonStart();++e<r;)pt(n[e],t,1);t.polygonEnd()}function vt(){function n(n,t){n*=Yo,t=t*Yo/2+Fo/4;var e=n-r,o=e>=0?1:-1,a=o*e,l=Math.cos(t),c=Math.sin(t),f=u*c,s=i*l+f*Math.cos(a),h=f*o*Math.sin(a);ka.add(Math.atan2(h,s)),r=n,i=l,u=c}var t,e,r,i,u;Na.point=function(o,a){Na.point=n,r=(t=o)*Yo,i=Math.cos(a=(e=a)*Yo/2+Fo/4),u=Math.sin(a)},Na.lineEnd=function(){n(t,e)}}function dt(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function yt(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function mt(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function Mt(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function xt(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function bt(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function _t(n){return[Math.atan2(n[1],n[0]),tn(n[2])]}function wt(n,t){return xo(n[0]-t[0])<Uo&&xo(n[1]-t[1])<Uo}function St(n,t){n*=Yo;var e=Math.cos(t*=Yo);kt(e*Math.cos(n),e*Math.sin(n),Math.sin(t))}function kt(n,t,e){++Ea,Ca+=(n-Ca)/Ea,za+=(t-za)/Ea,La+=(e-La)/Ea}function Nt(){function n(n,i){n*=Yo;var u=Math.cos(i*=Yo),o=u*Math.cos(n),a=u*Math.sin(n),l=Math.sin(i),c=Math.atan2(Math.sqrt((c=e*l-r*a)*c+(c=r*o-t*l)*c+(c=t*a-e*o)*c),t*o+e*a+r*l);Aa+=c,qa+=c*(t+(t=o)),Ta+=c*(e+(e=a)),Ra+=c*(r+(r=l)),kt(t,e,r)}var t,e,r;ja.point=function(i,u){i*=Yo;var o=Math.cos(u*=Yo);t=o*Math.cos(i),e=o*Math.sin(i),r=Math.sin(u),ja.point=n,kt(t,e,r)}}function Et(){ja.point=St}function At(){function n(n,t){n*=Yo;var e=Math.cos(t*=Yo),o=e*Math.cos(n),a=e*Math.sin(n),l=Math.sin(t),c=i*l-u*a,f=u*o-r*l,s=r*a-i*o,h=Math.sqrt(c*c+f*f+s*s),p=r*o+i*a+u*l,g=h&&-nn(p)/h,v=Math.atan2(h,p);Da+=g*c,Pa+=g*f,Ua+=g*s,Aa+=v,qa+=v*(r+(r=o)),Ta+=v*(i+(i=a)),Ra+=v*(u+(u=l)),kt(r,i,u)}var t,e,r,i,u;ja.point=function(o,a){t=o,e=a,ja.point=n,o*=Yo;var l=Math.cos(a*=Yo);r=l*Math.cos(o),i=l*Math.sin(o),u=Math.sin(a),kt(r,i,u)},ja.lineEnd=function(){n(t,e),ja.lineEnd=Et,ja.point=St}}function Ct(n,t){function e(e,r){return e=n(e,r),t(e[0],e[1])}return n.invert&&t.invert&&(e.invert=function(e,r){return e=t.invert(e,r),e&&n.invert(e[0],e[1])}),e}function zt(){return!0}function Lt(n,t,e,r,i){var u=[],o=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,e=n[0],r=n[t];if(wt(e,r)){i.lineStart();for(var a=0;t>a;++a)i.point((e=n[a])[0],e[1]);return void i.lineEnd()}var l=new Tt(e,n,null,!0),c=new Tt(e,null,l,!1);l.o=c,u.push(l),o.push(c),l=new Tt(r,n,null,!1),c=new Tt(r,null,l,!0),l.o=c,u.push(l),o.push(c)}}),o.sort(t),qt(u),qt(o),u.length){for(var a=0,l=e,c=o.length;c>a;++a)o[a].e=l=!l;for(var f,s,h=u[0];;){for(var p=h,g=!0;p.v;)if((p=p.n)===h)return;f=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(g)for(var a=0,c=f.length;c>a;++a)i.point((s=f[a])[0],s[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(g){f=p.p.z;for(var a=f.length-1;a>=0;--a)i.point((s=f[a])[0],s[1])}else r(p.x,p.p.x,-1,i);p=p.p}p=p.o,f=p.z,g=!g}while(!p.v);i.lineEnd()}}}function qt(n){if(t=n.length){for(var t,e,r=0,i=n[0];++r<t;)i.n=e=n[r],e.p=i,i=e;i.n=e=n[0],e.p=i}}function Tt(n,t,e,r){this.x=n,this.z=t,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function Rt(n,t,e,r){return function(i,u){function o(t,e){var r=i(t,e);n(t=r[0],e=r[1])&&u.point(t,e)}function a(n,t){var e=i(n,t);d.point(e[0],e[1])}function l(){m.point=a,d.lineStart()}function c(){m.point=o,d.lineEnd()}function f(n,t){v.push([n,t]);var e=i(n,t);x.point(e[0],e[1])}function s(){x.lineStart(),v=[]}function h(){f(v[0][0],v[0][1]),x.lineEnd();var n,t=x.clean(),e=M.buffer(),r=e.length;if(v.pop(),g.push(v),v=null,r)if(1&t){n=e[0];var i,r=n.length-1,o=-1;if(r>0){for(b||(u.polygonStart(),b=!0),u.lineStart();++o<r;)u.point((i=n[o])[0],i[1]);u.lineEnd()}}else r>1&&2&t&&e.push(e.pop().concat(e.shift())),p.push(e.filter(Dt))}var p,g,v,d=t(u),y=i.invert(r[0],r[1]),m={point:o,lineStart:l,lineEnd:c,polygonStart:function(){m.point=f,m.lineStart=s,m.lineEnd=h,p=[],g=[]},polygonEnd:function(){m.point=o,m.lineStart=l,m.lineEnd=c,p=ao.merge(p);var n=Ot(y,g);p.length?(b||(u.polygonStart(),b=!0),Lt(p,Ut,n,e,u)):n&&(b||(u.polygonStart(),b=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),b&&(u.polygonEnd(),b=!1),p=g=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}},M=Pt(),x=t(M),b=!1;return m}}function Dt(n){return n.length>1}function Pt(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:b,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Ut(n,t){return((n=n.x)[0]<0?n[1]-Io-Uo:Io-n[1])-((t=t.x)[0]<0?t[1]-Io-Uo:Io-t[1])}function jt(n){var t,e=NaN,r=NaN,i=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(u,o){var a=u>0?Fo:-Fo,l=xo(u-e);xo(l-Fo)<Uo?(n.point(e,r=(r+o)/2>0?Io:-Io),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(u,r),t=0):i!==a&&l>=Fo&&(xo(e-i)<Uo&&(e-=i*Uo),xo(u-a)<Uo&&(u-=a*Uo),r=Ft(e,r,u,o),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(a,r),t=0),n.point(e=u,r=o),i=a},lineEnd:function(){n.lineEnd(),e=r=NaN},clean:function(){return 2-t}}}function Ft(n,t,e,r){var i,u,o=Math.sin(n-e);return xo(o)>Uo?Math.atan((Math.sin(t)*(u=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(t))*Math.sin(n))/(i*u*o)):(t+r)/2}function Ht(n,t,e,r){var i;if(null==n)i=e*Io,r.point(-Fo,i),r.point(0,i),r.point(Fo,i),r.point(Fo,0),r.point(Fo,-i),r.point(0,-i),r.point(-Fo,-i),r.point(-Fo,0),r.point(-Fo,i);else if(xo(n[0]-t[0])>Uo){var u=n[0]<t[0]?Fo:-Fo;i=e*u/2,r.point(-u,i),r.point(0,i),r.point(u,i)}else r.point(t[0],t[1])}function Ot(n,t){var e=n[0],r=n[1],i=[Math.sin(e),-Math.cos(e),0],u=0,o=0;ka.reset();for(var a=0,l=t.length;l>a;++a){var c=t[a],f=c.length;if(f)for(var s=c[0],h=s[0],p=s[1]/2+Fo/4,g=Math.sin(p),v=Math.cos(p),d=1;;){d===f&&(d=0),n=c[d];var y=n[0],m=n[1]/2+Fo/4,M=Math.sin(m),x=Math.cos(m),b=y-h,_=b>=0?1:-1,w=_*b,S=w>Fo,k=g*M;if(ka.add(Math.atan2(k*_*Math.sin(w),v*x+k*Math.cos(w))),u+=S?b+_*Ho:b,S^h>=e^y>=e){var N=mt(dt(s),dt(n));bt(N);var E=mt(i,N);bt(E);var A=(S^b>=0?-1:1)*tn(E[2]);(r>A||r===A&&(N[0]||N[1]))&&(o+=S^b>=0?1:-1)}if(!d++)break;h=y,g=M,v=x,s=n}}return(-Uo>u||Uo>u&&-Uo>ka)^1&o}function It(n){function t(n,t){return Math.cos(n)*Math.cos(t)>u}function e(n){var e,u,l,c,f;return{lineStart:function(){c=l=!1,f=1},point:function(s,h){var p,g=[s,h],v=t(s,h),d=o?v?0:i(s,h):v?i(s+(0>s?Fo:-Fo),h):0;if(!e&&(c=l=v)&&n.lineStart(),v!==l&&(p=r(e,g),(wt(e,p)||wt(g,p))&&(g[0]+=Uo,g[1]+=Uo,v=t(g[0],g[1]))),v!==l)f=0,v?(n.lineStart(),p=r(g,e),n.point(p[0],p[1])):(p=r(e,g),n.point(p[0],p[1]),n.lineEnd()),e=p;else if(a&&e&&o^v){var y;d&u||!(y=r(g,e,!0))||(f=0,o?(n.lineStart(),n.point(y[0][0],y[0][1]),n.point(y[1][0],y[1][1]),n.lineEnd()):(n.point(y[1][0],y[1][1]),n.lineEnd(),n.lineStart(),n.point(y[0][0],y[0][1])))}!v||e&&wt(e,g)||n.point(g[0],g[1]),e=g,l=v,u=d},lineEnd:function(){l&&n.lineEnd(),e=null},clean:function(){return f|(c&&l)<<1}}}function r(n,t,e){var r=dt(n),i=dt(t),o=[1,0,0],a=mt(r,i),l=yt(a,a),c=a[0],f=l-c*c;if(!f)return!e&&n;var s=u*l/f,h=-u*c/f,p=mt(o,a),g=xt(o,s),v=xt(a,h);Mt(g,v);var d=p,y=yt(g,d),m=yt(d,d),M=y*y-m*(yt(g,g)-1);if(!(0>M)){var x=Math.sqrt(M),b=xt(d,(-y-x)/m);if(Mt(b,g),b=_t(b),!e)return b;var _,w=n[0],S=t[0],k=n[1],N=t[1];w>S&&(_=w,w=S,S=_);var E=S-w,A=xo(E-Fo)<Uo,C=A||Uo>E;if(!A&&k>N&&(_=k,k=N,N=_),C?A?k+N>0^b[1]<(xo(b[0]-w)<Uo?k:N):k<=b[1]&&b[1]<=N:E>Fo^(w<=b[0]&&b[0]<=S)){var z=xt(d,(-y+x)/m);return Mt(z,g),[b,_t(z)]}}}function i(t,e){var r=o?n:Fo-n,i=0;return-r>t?i|=1:t>r&&(i|=2),-r>e?i|=4:e>r&&(i|=8),i}var u=Math.cos(n),o=u>0,a=xo(u)>Uo,l=ve(n,6*Yo);return Rt(t,e,l,o?[0,-n]:[-Fo,n-Fo])}function Yt(n,t,e,r){return function(i){var u,o=i.a,a=i.b,l=o.x,c=o.y,f=a.x,s=a.y,h=0,p=1,g=f-l,v=s-c;if(u=n-l,g||!(u>0)){if(u/=g,0>g){if(h>u)return;p>u&&(p=u)}else if(g>0){if(u>p)return;u>h&&(h=u)}if(u=e-l,g||!(0>u)){if(u/=g,0>g){if(u>p)return;u>h&&(h=u)}else if(g>0){if(h>u)return;p>u&&(p=u)}if(u=t-c,v||!(u>0)){if(u/=v,0>v){if(h>u)return;p>u&&(p=u)}else if(v>0){if(u>p)return;u>h&&(h=u)}if(u=r-c,v||!(0>u)){if(u/=v,0>v){if(u>p)return;u>h&&(h=u)}else if(v>0){if(h>u)return;p>u&&(p=u)}return h>0&&(i.a={x:l+h*g,y:c+h*v}),1>p&&(i.b={x:l+p*g,y:c+p*v}),i}}}}}}function Zt(n,t,e,r){function i(r,i){return xo(r[0]-n)<Uo?i>0?0:3:xo(r[0]-e)<Uo?i>0?2:1:xo(r[1]-t)<Uo?i>0?1:0:i>0?3:2}function u(n,t){return o(n.x,t.x)}function o(n,t){var e=i(n,1),r=i(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function l(n){for(var t=0,e=d.length,r=n[1],i=0;e>i;++i)for(var u,o=1,a=d[i],l=a.length,c=a[0];l>o;++o)u=a[o],c[1]<=r?u[1]>r&&Q(c,u,n)>0&&++t:u[1]<=r&&Q(c,u,n)<0&&--t,c=u;return 0!==t}function c(u,a,l,c){var f=0,s=0;if(null==u||(f=i(u,l))!==(s=i(a,l))||o(u,a)<0^l>0){do c.point(0===f||3===f?n:e,f>1?r:t);while((f=(f+l+4)%4)!==s)}else c.point(a[0],a[1])}function f(i,u){return i>=n&&e>=i&&u>=t&&r>=u}function s(n,t){f(n,t)&&a.point(n,t)}function h(){C.point=g,d&&d.push(y=[]),S=!0,w=!1,b=_=NaN}function p(){v&&(g(m,M),x&&w&&E.rejoin(),v.push(E.buffer())),C.point=s,w&&a.lineEnd()}function g(n,t){n=Math.max(-Ha,Math.min(Ha,n)),t=Math.max(-Ha,Math.min(Ha,t));var e=f(n,t);if(d&&y.push([n,t]),S)m=n,M=t,x=e,S=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&w)a.point(n,t);else{var r={a:{x:b,y:_},b:{x:n,y:t}};A(r)?(w||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),k=!1):e&&(a.lineStart(),a.point(n,t),k=!1)}b=n,_=t,w=e}var v,d,y,m,M,x,b,_,w,S,k,N=a,E=Pt(),A=Yt(n,t,e,r),C={point:s,lineStart:h,lineEnd:p,polygonStart:function(){a=E,v=[],d=[],k=!0},polygonEnd:function(){a=N,v=ao.merge(v);var t=l([n,r]),e=k&&t,i=v.length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),c(null,null,1,a),a.lineEnd()),i&&Lt(v,u,t,c,a),a.polygonEnd()),v=d=y=null}};return C}}function Vt(n){var t=0,e=Fo/3,r=ae(n),i=r(t,e);return i.parallels=function(n){return arguments.length?r(t=n[0]*Fo/180,e=n[1]*Fo/180):[t/Fo*180,e/Fo*180]},i}function Xt(n,t){function e(n,t){var e=Math.sqrt(u-2*i*Math.sin(t))/i;return[e*Math.sin(n*=i),o-e*Math.cos(n)]}var r=Math.sin(n),i=(r+Math.sin(t))/2,u=1+r*(2*i-r),o=Math.sqrt(u)/i;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/i,tn((u-(n*n+e*e)*i*i)/(2*i))]},e}function $t(){function n(n,t){Ia+=i*n-r*t,r=n,i=t}var t,e,r,i;$a.point=function(u,o){$a.point=n,t=r=u,e=i=o},$a.lineEnd=function(){n(t,e)}}function Bt(n,t){Ya>n&&(Ya=n),n>Va&&(Va=n),Za>t&&(Za=t),t>Xa&&(Xa=t)}function Wt(){function n(n,t){o.push("M",n,",",t,u)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function i(){o.push("Z")}var u=Jt(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return u=Jt(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function Jt(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Gt(n,t){Ca+=n,za+=t,++La}function Kt(){function n(n,r){var i=n-t,u=r-e,o=Math.sqrt(i*i+u*u);qa+=o*(t+n)/2,Ta+=o*(e+r)/2,Ra+=o,Gt(t=n,e=r)}var t,e;Wa.point=function(r,i){Wa.point=n,Gt(t=r,e=i)}}function Qt(){Wa.point=Gt}function ne(){function n(n,t){var e=n-r,u=t-i,o=Math.sqrt(e*e+u*u);qa+=o*(r+n)/2,Ta+=o*(i+t)/2,Ra+=o,o=i*n-r*t,Da+=o*(r+n),Pa+=o*(i+t),Ua+=3*o,Gt(r=n,i=t)}var t,e,r,i;Wa.point=function(u,o){Wa.point=n,Gt(t=r=u,e=i=o)},Wa.lineEnd=function(){n(t,e)}}function te(n){function t(t,e){n.moveTo(t+o,e),n.arc(t,e,o,0,Ho)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function i(){a.point=t}function u(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:i,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=i,a.point=t},pointRadius:function(n){return o=n,a},result:b};return a}function ee(n){function t(n){return(a?r:e)(n)}function e(t){return ue(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){M=NaN,S.point=u,t.lineStart()}function u(e,r){var u=dt([e,r]),o=n(e,r);i(M,x,m,b,_,w,M=o[0],x=o[1],m=e,b=u[0],_=u[1],w=u[2],a,t),t.point(M,x)}function o(){S.point=e,t.lineEnd()}function l(){
r(),S.point=c,S.lineEnd=f}function c(n,t){u(s=n,h=t),p=M,g=x,v=b,d=_,y=w,S.point=u}function f(){i(M,x,m,b,_,w,p,g,s,v,d,y,a,t),S.lineEnd=o,o()}var s,h,p,g,v,d,y,m,M,x,b,_,w,S={point:e,lineStart:r,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=l},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function i(t,e,r,a,l,c,f,s,h,p,g,v,d,y){var m=f-t,M=s-e,x=m*m+M*M;if(x>4*u&&d--){var b=a+p,_=l+g,w=c+v,S=Math.sqrt(b*b+_*_+w*w),k=Math.asin(w/=S),N=xo(xo(w)-1)<Uo||xo(r-h)<Uo?(r+h)/2:Math.atan2(_,b),E=n(N,k),A=E[0],C=E[1],z=A-t,L=C-e,q=M*z-m*L;(q*q/x>u||xo((m*z+M*L)/x-.5)>.3||o>a*p+l*g+c*v)&&(i(t,e,r,a,l,c,A,C,N,b/=S,_/=S,w,d,y),y.point(A,C),i(A,C,N,b,_,w,f,s,h,p,g,v,d,y))}}var u=.5,o=Math.cos(30*Yo),a=16;return t.precision=function(n){return arguments.length?(a=(u=n*n)>0&&16,t):Math.sqrt(u)},t}function re(n){var t=ee(function(t,e){return n([t*Zo,e*Zo])});return function(n){return le(t(n))}}function ie(n){this.stream=n}function ue(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function oe(n){return ae(function(){return n})()}function ae(n){function t(n){return n=a(n[0]*Yo,n[1]*Yo),[n[0]*h+l,c-n[1]*h]}function e(n){return n=a.invert((n[0]-l)/h,(c-n[1])/h),n&&[n[0]*Zo,n[1]*Zo]}function r(){a=Ct(o=se(y,M,x),u);var n=u(v,d);return l=p-n[0]*h,c=g+n[1]*h,i()}function i(){return f&&(f.valid=!1,f=null),t}var u,o,a,l,c,f,s=ee(function(n,t){return n=u(n,t),[n[0]*h+l,c-n[1]*h]}),h=150,p=480,g=250,v=0,d=0,y=0,M=0,x=0,b=Fa,_=m,w=null,S=null;return t.stream=function(n){return f&&(f.valid=!1),f=le(b(o,s(_(n)))),f.valid=!0,f},t.clipAngle=function(n){return arguments.length?(b=null==n?(w=n,Fa):It((w=+n)*Yo),i()):w},t.clipExtent=function(n){return arguments.length?(S=n,_=n?Zt(n[0][0],n[0][1],n[1][0],n[1][1]):m,i()):S},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(p=+n[0],g=+n[1],r()):[p,g]},t.center=function(n){return arguments.length?(v=n[0]%360*Yo,d=n[1]%360*Yo,r()):[v*Zo,d*Zo]},t.rotate=function(n){return arguments.length?(y=n[0]%360*Yo,M=n[1]%360*Yo,x=n.length>2?n[2]%360*Yo:0,r()):[y*Zo,M*Zo,x*Zo]},ao.rebind(t,s,"precision"),function(){return u=n.apply(this,arguments),t.invert=u.invert&&e,r()}}function le(n){return ue(n,function(t,e){n.point(t*Yo,e*Yo)})}function ce(n,t){return[n,t]}function fe(n,t){return[n>Fo?n-Ho:-Fo>n?n+Ho:n,t]}function se(n,t,e){return n?t||e?Ct(pe(n),ge(t,e)):pe(n):t||e?ge(t,e):fe}function he(n){return function(t,e){return t+=n,[t>Fo?t-Ho:-Fo>t?t+Ho:t,e]}}function pe(n){var t=he(n);return t.invert=he(-n),t}function ge(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,l=Math.sin(n)*e,c=Math.sin(t),f=c*r+a*i;return[Math.atan2(l*u-f*o,a*r-c*i),tn(f*u+l*o)]}var r=Math.cos(n),i=Math.sin(n),u=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,l=Math.sin(n)*e,c=Math.sin(t),f=c*u-l*o;return[Math.atan2(l*u+c*o,a*r+f*i),tn(f*r-a*i)]},e}function ve(n,t){var e=Math.cos(n),r=Math.sin(n);return function(i,u,o,a){var l=o*t;null!=i?(i=de(e,i),u=de(e,u),(o>0?u>i:i>u)&&(i+=o*Ho)):(i=n+o*Ho,u=n-.5*l);for(var c,f=i;o>0?f>u:u>f;f-=l)a.point((c=_t([e,-r*Math.cos(f),-r*Math.sin(f)]))[0],c[1])}}function de(n,t){var e=dt(t);e[0]-=n,bt(e);var r=nn(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Uo)%(2*Math.PI)}function ye(n,t,e){var r=ao.range(n,t-Uo,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function me(n,t,e){var r=ao.range(n,t-Uo,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function Me(n){return n.source}function xe(n){return n.target}function be(n,t,e,r){var i=Math.cos(t),u=Math.sin(t),o=Math.cos(r),a=Math.sin(r),l=i*Math.cos(n),c=i*Math.sin(n),f=o*Math.cos(e),s=o*Math.sin(e),h=2*Math.asin(Math.sqrt(on(r-t)+i*o*on(e-n))),p=1/Math.sin(h),g=h?function(n){var t=Math.sin(n*=h)*p,e=Math.sin(h-n)*p,r=e*l+t*f,i=e*c+t*s,o=e*u+t*a;return[Math.atan2(i,r)*Zo,Math.atan2(o,Math.sqrt(r*r+i*i))*Zo]}:function(){return[n*Zo,t*Zo]};return g.distance=h,g}function _e(){function n(n,i){var u=Math.sin(i*=Yo),o=Math.cos(i),a=xo((n*=Yo)-t),l=Math.cos(a);Ja+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*u-e*o*l)*a),e*u+r*o*l),t=n,e=u,r=o}var t,e,r;Ga.point=function(i,u){t=i*Yo,e=Math.sin(u*=Yo),r=Math.cos(u),Ga.point=n},Ga.lineEnd=function(){Ga.point=Ga.lineEnd=b}}function we(n,t){function e(t,e){var r=Math.cos(t),i=Math.cos(e),u=n(r*i);return[u*i*Math.sin(t),u*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),i=t(r),u=Math.sin(i),o=Math.cos(i);return[Math.atan2(n*u,r*o),Math.asin(r&&e*u/r)]},e}function Se(n,t){function e(n,t){o>0?-Io+Uo>t&&(t=-Io+Uo):t>Io-Uo&&(t=Io-Uo);var e=o/Math.pow(i(t),u);return[e*Math.sin(u*n),o-e*Math.cos(u*n)]}var r=Math.cos(n),i=function(n){return Math.tan(Fo/4+n/2)},u=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(i(t)/i(n)),o=r*Math.pow(i(n),u)/u;return u?(e.invert=function(n,t){var e=o-t,r=K(u)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/u,2*Math.atan(Math.pow(o/r,1/u))-Io]},e):Ne}function ke(n,t){function e(n,t){var e=u-t;return[e*Math.sin(i*n),u-e*Math.cos(i*n)]}var r=Math.cos(n),i=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),u=r/i+n;return xo(i)<Uo?ce:(e.invert=function(n,t){var e=u-t;return[Math.atan2(n,e)/i,u-K(i)*Math.sqrt(n*n+e*e)]},e)}function Ne(n,t){return[n,Math.log(Math.tan(Fo/4+t/2))]}function Ee(n){var t,e=oe(n),r=e.scale,i=e.translate,u=e.clipExtent;return e.scale=function(){var n=r.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.translate=function(){var n=i.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.clipExtent=function(n){var o=u.apply(e,arguments);if(o===e){if(t=null==n){var a=Fo*r(),l=i();u([[l[0]-a,l[1]-a],[l[0]+a,l[1]+a]])}}else t&&(o=null);return o},e.clipExtent(null)}function Ae(n,t){return[Math.log(Math.tan(Fo/4+t/2)),-n]}function Ce(n){return n[0]}function ze(n){return n[1]}function Le(n){for(var t=n.length,e=[0,1],r=2,i=2;t>i;i++){for(;r>1&&Q(n[e[r-2]],n[e[r-1]],n[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function qe(n,t){return n[0]-t[0]||n[1]-t[1]}function Te(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Re(n,t,e,r){var i=n[0],u=e[0],o=t[0]-i,a=r[0]-u,l=n[1],c=e[1],f=t[1]-l,s=r[1]-c,h=(a*(l-c)-s*(i-u))/(s*o-a*f);return[i+h*o,l+h*f]}function De(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Pe(){rr(this),this.edge=this.site=this.circle=null}function Ue(n){var t=cl.pop()||new Pe;return t.site=n,t}function je(n){Be(n),ol.remove(n),cl.push(n),rr(n)}function Fe(n){var t=n.circle,e=t.x,r=t.cy,i={x:e,y:r},u=n.P,o=n.N,a=[n];je(n);for(var l=u;l.circle&&xo(e-l.circle.x)<Uo&&xo(r-l.circle.cy)<Uo;)u=l.P,a.unshift(l),je(l),l=u;a.unshift(l),Be(l);for(var c=o;c.circle&&xo(e-c.circle.x)<Uo&&xo(r-c.circle.cy)<Uo;)o=c.N,a.push(c),je(c),c=o;a.push(c),Be(c);var f,s=a.length;for(f=1;s>f;++f)c=a[f],l=a[f-1],nr(c.edge,l.site,c.site,i);l=a[0],c=a[s-1],c.edge=Ke(l.site,c.site,null,i),$e(l),$e(c)}function He(n){for(var t,e,r,i,u=n.x,o=n.y,a=ol._;a;)if(r=Oe(a,o)-u,r>Uo)a=a.L;else{if(i=u-Ie(a,o),!(i>Uo)){r>-Uo?(t=a.P,e=a):i>-Uo?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var l=Ue(n);if(ol.insert(t,l),t||e){if(t===e)return Be(t),e=Ue(t.site),ol.insert(l,e),l.edge=e.edge=Ke(t.site,l.site),$e(t),void $e(e);if(!e)return void(l.edge=Ke(t.site,l.site));Be(t),Be(e);var c=t.site,f=c.x,s=c.y,h=n.x-f,p=n.y-s,g=e.site,v=g.x-f,d=g.y-s,y=2*(h*d-p*v),m=h*h+p*p,M=v*v+d*d,x={x:(d*m-p*M)/y+f,y:(h*M-v*m)/y+s};nr(e.edge,c,g,x),l.edge=Ke(c,n,null,x),e.edge=Ke(n,g,null,x),$e(t),$e(e)}}function Oe(n,t){var e=n.site,r=e.x,i=e.y,u=i-t;if(!u)return r;var o=n.P;if(!o)return-(1/0);e=o.site;var a=e.x,l=e.y,c=l-t;if(!c)return a;var f=a-r,s=1/u-1/c,h=f/c;return s?(-h+Math.sqrt(h*h-2*s*(f*f/(-2*c)-l+c/2+i-u/2)))/s+r:(r+a)/2}function Ie(n,t){var e=n.N;if(e)return Oe(e,t);var r=n.site;return r.y===t?r.x:1/0}function Ye(n){this.site=n,this.edges=[]}function Ze(n){for(var t,e,r,i,u,o,a,l,c,f,s=n[0][0],h=n[1][0],p=n[0][1],g=n[1][1],v=ul,d=v.length;d--;)if(u=v[d],u&&u.prepare())for(a=u.edges,l=a.length,o=0;l>o;)f=a[o].end(),r=f.x,i=f.y,c=a[++o%l].start(),t=c.x,e=c.y,(xo(r-t)>Uo||xo(i-e)>Uo)&&(a.splice(o,0,new tr(Qe(u.site,f,xo(r-s)<Uo&&g-i>Uo?{x:s,y:xo(t-s)<Uo?e:g}:xo(i-g)<Uo&&h-r>Uo?{x:xo(e-g)<Uo?t:h,y:g}:xo(r-h)<Uo&&i-p>Uo?{x:h,y:xo(t-h)<Uo?e:p}:xo(i-p)<Uo&&r-s>Uo?{x:xo(e-p)<Uo?t:s,y:p}:null),u.site,null)),++l)}function Ve(n,t){return t.angle-n.angle}function Xe(){rr(this),this.x=this.y=this.arc=this.site=this.cy=null}function $e(n){var t=n.P,e=n.N;if(t&&e){var r=t.site,i=n.site,u=e.site;if(r!==u){var o=i.x,a=i.y,l=r.x-o,c=r.y-a,f=u.x-o,s=u.y-a,h=2*(l*s-c*f);if(!(h>=-jo)){var p=l*l+c*c,g=f*f+s*s,v=(s*p-c*g)/h,d=(l*g-f*p)/h,s=d+a,y=fl.pop()||new Xe;y.arc=n,y.site=i,y.x=v+o,y.y=s+Math.sqrt(v*v+d*d),y.cy=s,n.circle=y;for(var m=null,M=ll._;M;)if(y.y<M.y||y.y===M.y&&y.x<=M.x){if(!M.L){m=M.P;break}M=M.L}else{if(!M.R){m=M;break}M=M.R}ll.insert(m,y),m||(al=y)}}}}function Be(n){var t=n.circle;t&&(t.P||(al=t.N),ll.remove(t),fl.push(t),rr(t),n.circle=null)}function We(n){for(var t,e=il,r=Yt(n[0][0],n[0][1],n[1][0],n[1][1]),i=e.length;i--;)t=e[i],(!Je(t,n)||!r(t)||xo(t.a.x-t.b.x)<Uo&&xo(t.a.y-t.b.y)<Uo)&&(t.a=t.b=null,e.splice(i,1))}function Je(n,t){var e=n.b;if(e)return!0;var r,i,u=n.a,o=t[0][0],a=t[1][0],l=t[0][1],c=t[1][1],f=n.l,s=n.r,h=f.x,p=f.y,g=s.x,v=s.y,d=(h+g)/2,y=(p+v)/2;if(v===p){if(o>d||d>=a)return;if(h>g){if(u){if(u.y>=c)return}else u={x:d,y:l};e={x:d,y:c}}else{if(u){if(u.y<l)return}else u={x:d,y:c};e={x:d,y:l}}}else if(r=(h-g)/(v-p),i=y-r*d,-1>r||r>1)if(h>g){if(u){if(u.y>=c)return}else u={x:(l-i)/r,y:l};e={x:(c-i)/r,y:c}}else{if(u){if(u.y<l)return}else u={x:(c-i)/r,y:c};e={x:(l-i)/r,y:l}}else if(v>p){if(u){if(u.x>=a)return}else u={x:o,y:r*o+i};e={x:a,y:r*a+i}}else{if(u){if(u.x<o)return}else u={x:a,y:r*a+i};e={x:o,y:r*o+i}}return n.a=u,n.b=e,!0}function Ge(n,t){this.l=n,this.r=t,this.a=this.b=null}function Ke(n,t,e,r){var i=new Ge(n,t);return il.push(i),e&&nr(i,n,t,e),r&&nr(i,t,n,r),ul[n.i].edges.push(new tr(i,n,t)),ul[t.i].edges.push(new tr(i,t,n)),i}function Qe(n,t,e){var r=new Ge(n,null);return r.a=t,r.b=e,il.push(r),r}function nr(n,t,e,r){n.a||n.b?n.l===e?n.b=r:n.a=r:(n.a=r,n.l=t,n.r=e)}function tr(n,t,e){var r=n.a,i=n.b;this.edge=n,this.site=t,this.angle=e?Math.atan2(e.y-t.y,e.x-t.x):n.l===t?Math.atan2(i.x-r.x,r.y-i.y):Math.atan2(r.x-i.x,i.y-r.y)}function er(){this._=null}function rr(n){n.U=n.C=n.L=n.R=n.P=n.N=null}function ir(n,t){var e=t,r=t.R,i=e.U;i?i.L===e?i.L=r:i.R=r:n._=r,r.U=i,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function ur(n,t){var e=t,r=t.L,i=e.U;i?i.L===e?i.L=r:i.R=r:n._=r,r.U=i,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function or(n){for(;n.L;)n=n.L;return n}function ar(n,t){var e,r,i,u=n.sort(lr).pop();for(il=[],ul=new Array(n.length),ol=new er,ll=new er;;)if(i=al,u&&(!i||u.y<i.y||u.y===i.y&&u.x<i.x))u.x===e&&u.y===r||(ul[u.i]=new Ye(u),He(u),e=u.x,r=u.y),u=n.pop();else{if(!i)break;Fe(i.arc)}t&&(We(t),Ze(t));var o={cells:ul,edges:il};return ol=ll=il=ul=null,o}function lr(n,t){return t.y-n.y||t.x-n.x}function cr(n,t,e){return(n.x-e.x)*(t.y-n.y)-(n.x-t.x)*(e.y-n.y)}function fr(n){return n.x}function sr(n){return n.y}function hr(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function pr(n,t,e,r,i,u){if(!n(t,e,r,i,u)){var o=.5*(e+i),a=.5*(r+u),l=t.nodes;l[0]&&pr(n,l[0],e,r,o,a),l[1]&&pr(n,l[1],o,r,i,a),l[2]&&pr(n,l[2],e,a,o,u),l[3]&&pr(n,l[3],o,a,i,u)}}function gr(n,t,e,r,i,u,o){var a,l=1/0;return function c(n,f,s,h,p){if(!(f>u||s>o||r>h||i>p)){if(g=n.point){var g,v=t-n.x,d=e-n.y,y=v*v+d*d;if(l>y){var m=Math.sqrt(l=y);r=t-m,i=e-m,u=t+m,o=e+m,a=g}}for(var M=n.nodes,x=.5*(f+h),b=.5*(s+p),_=t>=x,w=e>=b,S=w<<1|_,k=S+4;k>S;++S)if(n=M[3&S])switch(3&S){case 0:c(n,f,s,x,b);break;case 1:c(n,x,s,h,b);break;case 2:c(n,f,b,x,p);break;case 3:c(n,x,b,h,p)}}}(n,r,i,u,o),a}function vr(n,t){n=ao.rgb(n),t=ao.rgb(t);var e=n.r,r=n.g,i=n.b,u=t.r-e,o=t.g-r,a=t.b-i;return function(n){return"#"+bn(Math.round(e+u*n))+bn(Math.round(r+o*n))+bn(Math.round(i+a*n))}}function dr(n,t){var e,r={},i={};for(e in n)e in t?r[e]=Mr(n[e],t[e]):i[e]=n[e];for(e in t)e in n||(i[e]=t[e]);return function(n){for(e in r)i[e]=r[e](n);return i}}function yr(n,t){return n=+n,t=+t,function(e){return n*(1-e)+t*e}}function mr(n,t){var e,r,i,u=hl.lastIndex=pl.lastIndex=0,o=-1,a=[],l=[];for(n+="",t+="";(e=hl.exec(n))&&(r=pl.exec(t));)(i=r.index)>u&&(i=t.slice(u,i),a[o]?a[o]+=i:a[++o]=i),(e=e[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:yr(e,r)})),u=pl.lastIndex;return u<t.length&&(i=t.slice(u),a[o]?a[o]+=i:a[++o]=i),a.length<2?l[0]?(t=l[0].x,function(n){return t(n)+""}):function(){return t}:(t=l.length,function(n){for(var e,r=0;t>r;++r)a[(e=l[r]).i]=e.x(n);return a.join("")})}function Mr(n,t){for(var e,r=ao.interpolators.length;--r>=0&&!(e=ao.interpolators[r](n,t)););return e}function xr(n,t){var e,r=[],i=[],u=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(Mr(n[e],t[e]));for(;u>e;++e)i[e]=n[e];for(;o>e;++e)i[e]=t[e];return function(n){for(e=0;a>e;++e)i[e]=r[e](n);return i}}function br(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function _r(n){return function(t){return 1-n(1-t)}}function wr(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function Sr(n){return n*n}function kr(n){return n*n*n}function Nr(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function Er(n){return function(t){return Math.pow(t,n)}}function Ar(n){return 1-Math.cos(n*Io)}function Cr(n){return Math.pow(2,10*(n-1))}function zr(n){return 1-Math.sqrt(1-n*n)}function Lr(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Ho*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Ho/t)}}function qr(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Tr(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Rr(n,t){n=ao.hcl(n),t=ao.hcl(t);var e=n.h,r=n.c,i=n.l,u=t.h-e,o=t.c-r,a=t.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return sn(e+u*n,r+o*n,i+a*n)+""}}function Dr(n,t){n=ao.hsl(n),t=ao.hsl(t);var e=n.h,r=n.s,i=n.l,u=t.h-e,o=t.s-r,a=t.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return cn(e+u*n,r+o*n,i+a*n)+""}}function Pr(n,t){n=ao.lab(n),t=ao.lab(t);var e=n.l,r=n.a,i=n.b,u=t.l-e,o=t.a-r,a=t.b-i;return function(n){return pn(e+u*n,r+o*n,i+a*n)+""}}function Ur(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function jr(n){var t=[n.a,n.b],e=[n.c,n.d],r=Hr(t),i=Fr(t,e),u=Hr(Or(e,t,-i))||0;t[0]*e[1]<e[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,i*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-e[0],e[1]))*Zo,this.translate=[n.e,n.f],this.scale=[r,u],this.skew=u?Math.atan2(i,u)*Zo:0}function Fr(n,t){return n[0]*t[0]+n[1]*t[1]}function Hr(n){var t=Math.sqrt(Fr(n,n));return t&&(n[0]/=t,n[1]/=t),t}function Or(n,t,e){return n[0]+=e*t[0],n[1]+=e*t[1],n}function Ir(n){return n.length?n.pop()+",":""}function Yr(n,t,e,r){if(n[0]!==t[0]||n[1]!==t[1]){var i=e.push("translate(",null,",",null,")");r.push({i:i-4,x:yr(n[0],t[0])},{i:i-2,x:yr(n[1],t[1])})}else(t[0]||t[1])&&e.push("translate("+t+")")}function Zr(n,t,e,r){n!==t?(n-t>180?t+=360:t-n>180&&(n+=360),r.push({i:e.push(Ir(e)+"rotate(",null,")")-2,x:yr(n,t)})):t&&e.push(Ir(e)+"rotate("+t+")")}function Vr(n,t,e,r){n!==t?r.push({i:e.push(Ir(e)+"skewX(",null,")")-2,x:yr(n,t)}):t&&e.push(Ir(e)+"skewX("+t+")")}function Xr(n,t,e,r){if(n[0]!==t[0]||n[1]!==t[1]){var i=e.push(Ir(e)+"scale(",null,",",null,")");r.push({i:i-4,x:yr(n[0],t[0])},{i:i-2,x:yr(n[1],t[1])})}else 1===t[0]&&1===t[1]||e.push(Ir(e)+"scale("+t+")")}function $r(n,t){var e=[],r=[];return n=ao.transform(n),t=ao.transform(t),Yr(n.translate,t.translate,e,r),Zr(n.rotate,t.rotate,e,r),Vr(n.skew,t.skew,e,r),Xr(n.scale,t.scale,e,r),n=t=null,function(n){for(var t,i=-1,u=r.length;++i<u;)e[(t=r[i]).i]=t.x(n);return e.join("")}}function Br(n,t){return t=(t-=n=+n)||1/t,function(e){return(e-n)/t}}function Wr(n,t){return t=(t-=n=+n)||1/t,function(e){return Math.max(0,Math.min(1,(e-n)/t))}}function Jr(n){for(var t=n.source,e=n.target,r=Kr(t,e),i=[t];t!==r;)t=t.parent,i.push(t);for(var u=i.length;e!==r;)i.splice(u,0,e),e=e.parent;return i}function Gr(n){for(var t=[],e=n.parent;null!=e;)t.push(n),n=e,e=e.parent;return t.push(n),t}function Kr(n,t){if(n===t)return n;for(var e=Gr(n),r=Gr(t),i=e.pop(),u=r.pop(),o=null;i===u;)o=i,i=e.pop(),u=r.pop();return o}function Qr(n){n.fixed|=2}function ni(n){n.fixed&=-7}function ti(n){n.fixed|=4,n.px=n.x,n.py=n.y}function ei(n){n.fixed&=-5}function ri(n,t,e){var r=0,i=0;if(n.charge=0,!n.leaf)for(var u,o=n.nodes,a=o.length,l=-1;++l<a;)u=o[l],null!=u&&(ri(u,t,e),n.charge+=u.charge,r+=u.charge*u.cx,i+=u.charge*u.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var c=t*e[n.point.index];n.charge+=n.pointCharge=c,r+=c*n.point.x,i+=c*n.point.y}n.cx=r/n.charge,n.cy=i/n.charge}function ii(n,t){return ao.rebind(n,t,"sort","children","value"),n.nodes=n,n.links=fi,n}function ui(n,t){for(var e=[n];null!=(n=e.pop());)if(t(n),(i=n.children)&&(r=i.length))for(var r,i;--r>=0;)e.push(i[r])}function oi(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(u=n.children)&&(i=u.length))for(var i,u,o=-1;++o<i;)e.push(u[o]);for(;null!=(n=r.pop());)t(n)}function ai(n){return n.children}function li(n){return n.value}function ci(n,t){return t.value-n.value}function fi(n){return ao.merge(n.map(function(n){return(n.children||[]).map(function(t){return{source:n,target:t}})}))}function si(n){return n.x}function hi(n){return n.y}function pi(n,t,e){n.y0=t,n.y=e}function gi(n){return ao.range(n.length)}function vi(n){for(var t=-1,e=n[0].length,r=[];++t<e;)r[t]=0;return r}function di(n){for(var t,e=1,r=0,i=n[0][1],u=n.length;u>e;++e)(t=n[e][1])>i&&(r=e,i=t);return r}function yi(n){return n.reduce(mi,0)}function mi(n,t){return n+t[1]}function Mi(n,t){return xi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function xi(n,t){for(var e=-1,r=+n[0],i=(n[1]-r)/t,u=[];++e<=t;)u[e]=i*e+r;return u}function bi(n){return[ao.min(n),ao.max(n)]}function _i(n,t){return n.value-t.value}function wi(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function Si(n,t){n._pack_next=t,t._pack_prev=n}function ki(n,t){var e=t.x-n.x,r=t.y-n.y,i=n.r+t.r;return.999*i*i>e*e+r*r}function Ni(n){function t(n){f=Math.min(n.x-n.r,f),s=Math.max(n.x+n.r,s),h=Math.min(n.y-n.r,h),p=Math.max(n.y+n.r,p)}if((e=n.children)&&(c=e.length)){var e,r,i,u,o,a,l,c,f=1/0,s=-(1/0),h=1/0,p=-(1/0);if(e.forEach(Ei),r=e[0],r.x=-r.r,r.y=0,t(r),c>1&&(i=e[1],i.x=i.r,i.y=0,t(i),c>2))for(u=e[2],zi(r,i,u),t(u),wi(r,u),r._pack_prev=u,wi(u,i),i=r._pack_next,o=3;c>o;o++){zi(r,i,u=e[o]);var g=0,v=1,d=1;for(a=i._pack_next;a!==i;a=a._pack_next,v++)if(ki(a,u)){g=1;break}if(1==g)for(l=r._pack_prev;l!==a._pack_prev&&!ki(l,u);l=l._pack_prev,d++);g?(d>v||v==d&&i.r<r.r?Si(r,i=a):Si(r=l,i),o--):(wi(r,u),i=u,t(u))}var y=(f+s)/2,m=(h+p)/2,M=0;for(o=0;c>o;o++)u=e[o],u.x-=y,u.y-=m,M=Math.max(M,u.r+Math.sqrt(u.x*u.x+u.y*u.y));n.r=M,e.forEach(Ai)}}function Ei(n){n._pack_next=n._pack_prev=n}function Ai(n){delete n._pack_next,delete n._pack_prev}function Ci(n,t,e,r){var i=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,i)for(var u=-1,o=i.length;++u<o;)Ci(i[u],t,e,r)}function zi(n,t,e){var r=n.r+e.r,i=t.x-n.x,u=t.y-n.y;if(r&&(i||u)){var o=t.r+e.r,a=i*i+u*u;o*=o,r*=r;var l=.5+(r-o)/(2*a),c=Math.sqrt(Math.max(0,2*o*(r+a)-(r-=a)*r-o*o))/(2*a);e.x=n.x+l*i+c*u,e.y=n.y+l*u-c*i}else e.x=n.x+r,e.y=n.y}function Li(n,t){return n.parent==t.parent?1:2}function qi(n){var t=n.children;return t.length?t[0]:n.t}function Ti(n){var t,e=n.children;return(t=e.length)?e[t-1]:n.t}function Ri(n,t,e){var r=e/(t.i-n.i);t.c-=r,t.s+=e,n.c+=r,t.z+=e,t.m+=e}function Di(n){for(var t,e=0,r=0,i=n.children,u=i.length;--u>=0;)t=i[u],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function Pi(n,t,e){return n.a.parent===t.parent?n.a:e}function Ui(n){return 1+ao.max(n,function(n){return n.y})}function ji(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Fi(n){var t=n.children;return t&&t.length?Fi(t[0]):n}function Hi(n){var t,e=n.children;return e&&(t=e.length)?Hi(e[t-1]):n}function Oi(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Ii(n,t){var e=n.x+t[3],r=n.y+t[0],i=n.dx-t[1]-t[3],u=n.dy-t[0]-t[2];return 0>i&&(e+=i/2,i=0),0>u&&(r+=u/2,u=0),{x:e,y:r,dx:i,dy:u}}function Yi(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Zi(n){return n.rangeExtent?n.rangeExtent():Yi(n.range())}function Vi(n,t,e,r){var i=e(n[0],n[1]),u=r(t[0],t[1]);return function(n){return u(i(n))}}function Xi(n,t){var e,r=0,i=n.length-1,u=n[r],o=n[i];return u>o&&(e=r,r=i,i=e,e=u,u=o,o=e),n[r]=t.floor(u),n[i]=t.ceil(o),n}function $i(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:Sl}function Bi(n,t,e,r){var i=[],u=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++o<=a;)i.push(e(n[o-1],n[o])),u.push(r(t[o-1],t[o]));return function(t){var e=ao.bisect(n,t,1,a)-1;return u[e](i[e](t))}}function Wi(n,t,e,r){function i(){var i=Math.min(n.length,t.length)>2?Bi:Vi,l=r?Wr:Br;return o=i(n,t,l,e),a=i(t,n,l,Mr),u}function u(n){return o(n)}var o,a;return u.invert=function(n){return a(n)},u.domain=function(t){return arguments.length?(n=t.map(Number),i()):n},u.range=function(n){return arguments.length?(t=n,i()):t},u.rangeRound=function(n){return u.range(n).interpolate(Ur)},u.clamp=function(n){return arguments.length?(r=n,i()):r},u.interpolate=function(n){return arguments.length?(e=n,i()):e},u.ticks=function(t){return Qi(n,t)},u.tickFormat=function(t,e){return nu(n,t,e)},u.nice=function(t){return Gi(n,t),i()},u.copy=function(){return Wi(n,t,e,r)},i()}function Ji(n,t){return ao.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Gi(n,t){return Xi(n,$i(Ki(n,t)[2])),Xi(n,$i(Ki(n,t)[2])),n}function Ki(n,t){null==t&&(t=10);var e=Yi(n),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),u=t/r*i;return.15>=u?i*=10:.35>=u?i*=5:.75>=u&&(i*=2),e[0]=Math.ceil(e[0]/i)*i,e[1]=Math.floor(e[1]/i)*i+.5*i,e[2]=i,e}function Qi(n,t){return ao.range.apply(ao,Ki(n,t))}function nu(n,t,e){var r=Ki(n,t);if(e){var i=ha.exec(e);if(i.shift(),"s"===i[8]){var u=ao.formatPrefix(Math.max(xo(r[0]),xo(r[1])));return i[7]||(i[7]="."+tu(u.scale(r[2]))),i[8]="f",e=ao.format(i.join("")),function(n){return e(u.scale(n))+u.symbol}}i[7]||(i[7]="."+eu(i[8],r)),e=i.join("")}else e=",."+tu(r[2])+"f";return ao.format(e)}function tu(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function eu(n,t){var e=tu(t[2]);return n in kl?Math.abs(e-tu(Math.max(xo(t[0]),xo(t[1]))))+ +("e"!==n):e-2*("%"===n)}function ru(n,t,e,r){function i(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function u(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(i(t))}return o.invert=function(t){return u(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(i)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(i)),o):t},o.nice=function(){var t=Xi(r.map(i),e?Math:El);return n.domain(t),r=t.map(u),o},o.ticks=function(){var n=Yi(r),o=[],a=n[0],l=n[1],c=Math.floor(i(a)),f=Math.ceil(i(l)),s=t%1?2:t;if(isFinite(f-c)){if(e){for(;f>c;c++)for(var h=1;s>h;h++)o.push(u(c)*h);o.push(u(c))}else for(o.push(u(c));c++<f;)for(var h=s-1;h>0;h--)o.push(u(c)*h);for(c=0;o[c]<a;c++);for(f=o.length;o[f-1]>l;f--);o=o.slice(c,f)}return o},o.tickFormat=function(n,e){if(!arguments.length)return Nl;arguments.length<2?e=Nl:"function"!=typeof e&&(e=ao.format(e));var r=Math.max(1,t*n/o.ticks().length);return function(n){var o=n/u(Math.round(i(n)));return t-.5>o*t&&(o*=t),r>=o?e(n):""}},o.copy=function(){return ru(n.copy(),t,e,r)},Ji(o,n)}function iu(n,t,e){function r(t){return n(i(t))}var i=uu(t),u=uu(1/t);return r.invert=function(t){return u(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(i)),r):e},r.ticks=function(n){return Qi(e,n)},r.tickFormat=function(n,t){return nu(e,n,t)},r.nice=function(n){return r.domain(Gi(e,n))},r.exponent=function(o){return arguments.length?(i=uu(t=o),u=uu(1/t),n.domain(e.map(i)),r):t},r.copy=function(){return iu(n.copy(),t,e)},Ji(r,n)}function uu(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function ou(n,t){function e(e){return u[((i.get(e)||("range"===t.t?i.set(e,n.push(e)):NaN))-1)%u.length]}function r(t,e){return ao.range(n.length).map(function(n){return t+e*n})}var i,u,o;return e.domain=function(r){if(!arguments.length)return n;n=[],i=new c;for(var u,o=-1,a=r.length;++o<a;)i.has(u=r[o])||i.set(u,n.push(u));return e[t.t].apply(e,t.a)},e.range=function(n){return arguments.length?(u=n,o=0,t={t:"range",a:arguments},e):u},e.rangePoints=function(i,a){arguments.length<2&&(a=0);var l=i[0],c=i[1],f=n.length<2?(l=(l+c)/2,0):(c-l)/(n.length-1+a);return u=r(l+f*a/2,f),o=0,t={t:"rangePoints",a:arguments},e},e.rangeRoundPoints=function(i,a){arguments.length<2&&(a=0);var l=i[0],c=i[1],f=n.length<2?(l=c=Math.round((l+c)/2),0):(c-l)/(n.length-1+a)|0;return u=r(l+Math.round(f*a/2+(c-l-(n.length-1+a)*f)/2),f),o=0,t={t:"rangeRoundPoints",a:arguments},e},e.rangeBands=function(i,a,l){arguments.length<2&&(a=0),arguments.length<3&&(l=a);var c=i[1]<i[0],f=i[c-0],s=i[1-c],h=(s-f)/(n.length-a+2*l);return u=r(f+h*l,h),c&&u.reverse(),o=h*(1-a),t={t:"rangeBands",a:arguments},e},e.rangeRoundBands=function(i,a,l){arguments.length<2&&(a=0),arguments.length<3&&(l=a);var c=i[1]<i[0],f=i[c-0],s=i[1-c],h=Math.floor((s-f)/(n.length-a+2*l));return u=r(f+Math.round((s-f-(n.length-a)*h)/2),h),c&&u.reverse(),o=Math.round(h*(1-a)),t={t:"rangeRoundBands",a:arguments},e},e.rangeBand=function(){return o},e.rangeExtent=function(){return Yi(t.a[0])},e.copy=function(){return ou(n,t)},e.domain(n)}function au(n,t){function u(){var e=0,r=t.length;for(a=[];++e<r;)a[e-1]=ao.quantile(n,e/r);return o}function o(n){return isNaN(n=+n)?void 0:t[ao.bisect(a,n)]}var a;return o.domain=function(t){return arguments.length?(n=t.map(r).filter(i).sort(e),u()):n},o.range=function(n){return arguments.length?(t=n,u()):t},o.quantiles=function(){return a},o.invertExtent=function(e){return e=t.indexOf(e),0>e?[NaN,NaN]:[e>0?a[e-1]:n[0],e<a.length?a[e]:n[n.length-1]]},o.copy=function(){return au(n,t)},u()}function lu(n,t,e){function r(t){return e[Math.max(0,Math.min(o,Math.floor(u*(t-n))))]}function i(){return u=e.length/(t-n),o=e.length-1,r}var u,o;return r.domain=function(e){return arguments.length?(n=+e[0],t=+e[e.length-1],i()):[n,t]},r.range=function(n){return arguments.length?(e=n,i()):e},r.invertExtent=function(t){return t=e.indexOf(t),t=0>t?NaN:t/u+n,[t,t+1/u]},r.copy=function(){return lu(n,t,e)},i()}function cu(n,t){function e(e){return e>=e?t[ao.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return cu(n,t)},e}function fu(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return Qi(n,t)},t.tickFormat=function(t,e){return nu(n,t,e)},t.copy=function(){return fu(n)},t}function su(){return 0}function hu(n){return n.innerRadius}function pu(n){return n.outerRadius}function gu(n){return n.startAngle}function vu(n){return n.endAngle}function du(n){return n&&n.padAngle}function yu(n,t,e,r){return(n-e)*t-(t-r)*n>0?0:1}function mu(n,t,e,r,i){var u=n[0]-t[0],o=n[1]-t[1],a=(i?r:-r)/Math.sqrt(u*u+o*o),l=a*o,c=-a*u,f=n[0]+l,s=n[1]+c,h=t[0]+l,p=t[1]+c,g=(f+h)/2,v=(s+p)/2,d=h-f,y=p-s,m=d*d+y*y,M=e-r,x=f*p-h*s,b=(0>y?-1:1)*Math.sqrt(Math.max(0,M*M*m-x*x)),_=(x*y-d*b)/m,w=(-x*d-y*b)/m,S=(x*y+d*b)/m,k=(-x*d+y*b)/m,N=_-g,E=w-v,A=S-g,C=k-v;return N*N+E*E>A*A+C*C&&(_=S,w=k),[[_-l,w-c],[_*e/M,w*e/M]]}function Mu(n){function t(t){function o(){c.push("M",u(n(f),a))}for(var l,c=[],f=[],s=-1,h=t.length,p=En(e),g=En(r);++s<h;)i.call(this,l=t[s],s)?f.push([+p.call(this,l,s),+g.call(this,l,s)]):f.length&&(o(),f=[]);return f.length&&o(),c.length?c.join(""):null}var e=Ce,r=ze,i=zt,u=xu,o=u.key,a=.7;return t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.defined=function(n){return arguments.length?(i=n,t):i},t.interpolate=function(n){return arguments.length?(o="function"==typeof n?u=n:(u=Tl.get(n)||xu).key,t):o},t.tension=function(n){return arguments.length?(a=n,t):a},t}function xu(n){return n.length>1?n.join("L"):n+"Z"}function bu(n){return n.join("L")+"Z"}function _u(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t<e;)i.push("H",(r[0]+(r=n[t])[0])/2,"V",r[1]);return e>1&&i.push("H",r[0]),i.join("")}function wu(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t<e;)i.push("V",(r=n[t])[1],"H",r[0]);return i.join("")}function Su(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t<e;)i.push("H",(r=n[t])[0],"V",r[1]);return i.join("")}function ku(n,t){return n.length<4?xu(n):n[1]+Au(n.slice(1,-1),Cu(n,t))}function Nu(n,t){return n.length<3?bu(n):n[0]+Au((n.push(n[0]),n),Cu([n[n.length-2]].concat(n,[n[1]]),t))}function Eu(n,t){return n.length<3?xu(n):n[0]+Au(n,Cu(n,t))}function Au(n,t){if(t.length<1||n.length!=t.length&&n.length!=t.length+2)return xu(n);var e=n.length!=t.length,r="",i=n[0],u=n[1],o=t[0],a=o,l=1;if(e&&(r+="Q"+(u[0]-2*o[0]/3)+","+(u[1]-2*o[1]/3)+","+u[0]+","+u[1],i=n[1],l=2),t.length>1){a=t[1],u=n[l],l++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(u[0]-a[0])+","+(u[1]-a[1])+","+u[0]+","+u[1];for(var c=2;c<t.length;c++,l++)u=n[l],a=t[c],r+="S"+(u[0]-a[0])+","+(u[1]-a[1])+","+u[0]+","+u[1]}if(e){var f=n[l];r+="Q"+(u[0]+2*a[0]/3)+","+(u[1]+2*a[1]/3)+","+f[0]+","+f[1]}return r}function Cu(n,t){for(var e,r=[],i=(1-t)/2,u=n[0],o=n[1],a=1,l=n.length;++a<l;)e=u,u=o,o=n[a],r.push([i*(o[0]-e[0]),i*(o[1]-e[1])]);return r}function zu(n){if(n.length<3)return xu(n);var t=1,e=n.length,r=n[0],i=r[0],u=r[1],o=[i,i,i,(r=n[1])[0]],a=[u,u,u,r[1]],l=[i,",",u,"L",Ru(Pl,o),",",Ru(Pl,a)];for(n.push(n[e-1]);++t<=e;)r=n[t],o.shift(),o.push(r[0]),a.shift(),a.push(r[1]),Du(l,o,a);return n.pop(),l.push("L",r),l.join("")}function Lu(n){if(n.length<4)return xu(n);for(var t,e=[],r=-1,i=n.length,u=[0],o=[0];++r<3;)t=n[r],u.push(t[0]),o.push(t[1]);for(e.push(Ru(Pl,u)+","+Ru(Pl,o)),--r;++r<i;)t=n[r],u.shift(),u.push(t[0]),o.shift(),o.push(t[1]),Du(e,u,o);return e.join("")}function qu(n){for(var t,e,r=-1,i=n.length,u=i+4,o=[],a=[];++r<4;)e=n[r%i],o.push(e[0]),a.push(e[1]);for(t=[Ru(Pl,o),",",Ru(Pl,a)],--r;++r<u;)e=n[r%i],o.shift(),o.push(e[0]),a.shift(),a.push(e[1]),Du(t,o,a);return t.join("")}function Tu(n,t){var e=n.length-1;if(e)for(var r,i,u=n[0][0],o=n[0][1],a=n[e][0]-u,l=n[e][1]-o,c=-1;++c<=e;)r=n[c],i=c/e,r[0]=t*r[0]+(1-t)*(u+i*a),r[1]=t*r[1]+(1-t)*(o+i*l);return zu(n)}function Ru(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function Du(n,t,e){n.push("C",Ru(Rl,t),",",Ru(Rl,e),",",Ru(Dl,t),",",Ru(Dl,e),",",Ru(Pl,t),",",Ru(Pl,e))}function Pu(n,t){return(t[1]-n[1])/(t[0]-n[0])}function Uu(n){for(var t=0,e=n.length-1,r=[],i=n[0],u=n[1],o=r[0]=Pu(i,u);++t<e;)r[t]=(o+(o=Pu(i=u,u=n[t+1])))/2;return r[t]=o,r}function ju(n){for(var t,e,r,i,u=[],o=Uu(n),a=-1,l=n.length-1;++a<l;)t=Pu(n[a],n[a+1]),xo(t)<Uo?o[a]=o[a+1]=0:(e=o[a]/t,r=o[a+1]/t,i=e*e+r*r,i>9&&(i=3*t/Math.sqrt(i),o[a]=i*e,o[a+1]=i*r));for(a=-1;++a<=l;)i=(n[Math.min(l,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),u.push([i||0,o[a]*i||0]);return u}function Fu(n){return n.length<3?xu(n):n[0]+Au(n,ju(n))}function Hu(n){for(var t,e,r,i=-1,u=n.length;++i<u;)t=n[i],e=t[0],r=t[1]-Io,t[0]=e*Math.cos(r),t[1]=e*Math.sin(r);return n}function Ou(n){function t(t){function l(){v.push("M",a(n(y),s),f,c(n(d.reverse()),s),"Z")}for(var h,p,g,v=[],d=[],y=[],m=-1,M=t.length,x=En(e),b=En(i),_=e===r?function(){
return p}:En(r),w=i===u?function(){return g}:En(u);++m<M;)o.call(this,h=t[m],m)?(d.push([p=+x.call(this,h,m),g=+b.call(this,h,m)]),y.push([+_.call(this,h,m),+w.call(this,h,m)])):d.length&&(l(),d=[],y=[]);return d.length&&l(),v.length?v.join(""):null}var e=Ce,r=Ce,i=0,u=ze,o=zt,a=xu,l=a.key,c=a,f="L",s=.7;return t.x=function(n){return arguments.length?(e=r=n,t):r},t.x0=function(n){return arguments.length?(e=n,t):e},t.x1=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(i=u=n,t):u},t.y0=function(n){return arguments.length?(i=n,t):i},t.y1=function(n){return arguments.length?(u=n,t):u},t.defined=function(n){return arguments.length?(o=n,t):o},t.interpolate=function(n){return arguments.length?(l="function"==typeof n?a=n:(a=Tl.get(n)||xu).key,c=a.reverse||a,f=a.closed?"M":"L",t):l},t.tension=function(n){return arguments.length?(s=n,t):s},t}function Iu(n){return n.radius}function Yu(n){return[n.x,n.y]}function Zu(n){return function(){var t=n.apply(this,arguments),e=t[0],r=t[1]-Io;return[e*Math.cos(r),e*Math.sin(r)]}}function Vu(){return 64}function Xu(){return"circle"}function $u(n){var t=Math.sqrt(n/Fo);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+-t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function Bu(n){return function(){var t,e,r;(t=this[n])&&(r=t[e=t.active])&&(r.timer.c=null,r.timer.t=NaN,--t.count?delete t[e]:delete this[n],t.active+=.5,r.event&&r.event.interrupt.call(this,this.__data__,r.index))}}function Wu(n,t,e){return ko(n,Yl),n.namespace=t,n.id=e,n}function Ju(n,t,e,r){var i=n.id,u=n.namespace;return Y(n,"function"==typeof e?function(n,o,a){n[u][i].tween.set(t,r(e.call(n,n.__data__,o,a)))}:(e=r(e),function(n){n[u][i].tween.set(t,e)}))}function Gu(n){return null==n&&(n=""),function(){this.textContent=n}}function Ku(n){return null==n?"__transition__":"__transition_"+n+"__"}function Qu(n,t,e,r,i){function u(n){var t=v.delay;return f.t=t+l,n>=t?o(n-t):void(f.c=o)}function o(e){var i=g.active,u=g[i];u&&(u.timer.c=null,u.timer.t=NaN,--g.count,delete g[i],u.event&&u.event.interrupt.call(n,n.__data__,u.index));for(var o in g)if(r>+o){var c=g[o];c.timer.c=null,c.timer.t=NaN,--g.count,delete g[o]}f.c=a,qn(function(){return f.c&&a(e||1)&&(f.c=null,f.t=NaN),1},0,l),g.active=r,v.event&&v.event.start.call(n,n.__data__,t),p=[],v.tween.forEach(function(e,r){(r=r.call(n,n.__data__,t))&&p.push(r)}),h=v.ease,s=v.duration}function a(i){for(var u=i/s,o=h(u),a=p.length;a>0;)p[--a].call(n,o);return u>=1?(v.event&&v.event.end.call(n,n.__data__,t),--g.count?delete g[r]:delete n[e],1):void 0}var l,f,s,h,p,g=n[e]||(n[e]={active:0,count:0}),v=g[r];v||(l=i.time,f=qn(u,0,l),v=g[r]={tween:new c,time:l,timer:f,delay:i.delay,duration:i.duration,ease:i.ease,index:t},i=null,++g.count)}function no(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function to(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function eo(n){return n.toISOString()}function ro(n,t,e){function r(t){return n(t)}function i(n,e){var r=n[1]-n[0],i=r/e,u=ao.bisect(Kl,i);return u==Kl.length?[t.year,Ki(n.map(function(n){return n/31536e6}),e)[2]]:u?t[i/Kl[u-1]<Kl[u]/i?u-1:u]:[tc,Ki(n,e)[2]]}return r.invert=function(t){return io(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain(t),r):n.domain().map(io)},r.nice=function(n,t){function e(e){return!isNaN(e)&&!n.range(e,io(+e+1),t).length}var u=r.domain(),o=Yi(u),a=null==n?i(o,10):"number"==typeof n&&i(o,n);return a&&(n=a[0],t=a[1]),r.domain(Xi(u,t>1?{floor:function(t){for(;e(t=n.floor(t));)t=io(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=io(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Yi(r.domain()),u=null==n?i(e,10):"number"==typeof n?i(e,n):!n.range&&[{range:n},t];return u&&(n=u[0],t=u[1]),n.range(e[0],io(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return ro(n.copy(),t,e)},Ji(r,n)}function io(n){return new Date(n)}function uo(n){return JSON.parse(n.responseText)}function oo(n){var t=fo.createRange();return t.selectNode(fo.body),t.createContextualFragment(n.responseText)}var ao={version:"3.5.17"},lo=[].slice,co=function(n){return lo.call(n)},fo=this.document;if(fo)try{co(fo.documentElement.childNodes)[0].nodeType}catch(so){co=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}if(Date.now||(Date.now=function(){return+new Date}),fo)try{fo.createElement("DIV").style.setProperty("opacity",0,"")}catch(ho){var po=this.Element.prototype,go=po.setAttribute,vo=po.setAttributeNS,yo=this.CSSStyleDeclaration.prototype,mo=yo.setProperty;po.setAttribute=function(n,t){go.call(this,n,t+"")},po.setAttributeNS=function(n,t,e){vo.call(this,n,t,e+"")},yo.setProperty=function(n,t,e){mo.call(this,n,t+"",e)}}ao.ascending=e,ao.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:NaN},ao.min=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i<u;)if(null!=(r=n[i])&&r>=r){e=r;break}for(;++i<u;)null!=(r=n[i])&&e>r&&(e=r)}else{for(;++i<u;)if(null!=(r=t.call(n,n[i],i))&&r>=r){e=r;break}for(;++i<u;)null!=(r=t.call(n,n[i],i))&&e>r&&(e=r)}return e},ao.max=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i<u;)if(null!=(r=n[i])&&r>=r){e=r;break}for(;++i<u;)null!=(r=n[i])&&r>e&&(e=r)}else{for(;++i<u;)if(null!=(r=t.call(n,n[i],i))&&r>=r){e=r;break}for(;++i<u;)null!=(r=t.call(n,n[i],i))&&r>e&&(e=r)}return e},ao.extent=function(n,t){var e,r,i,u=-1,o=n.length;if(1===arguments.length){for(;++u<o;)if(null!=(r=n[u])&&r>=r){e=i=r;break}for(;++u<o;)null!=(r=n[u])&&(e>r&&(e=r),r>i&&(i=r))}else{for(;++u<o;)if(null!=(r=t.call(n,n[u],u))&&r>=r){e=i=r;break}for(;++u<o;)null!=(r=t.call(n,n[u],u))&&(e>r&&(e=r),r>i&&(i=r))}return[e,i]},ao.sum=function(n,t){var e,r=0,u=n.length,o=-1;if(1===arguments.length)for(;++o<u;)i(e=+n[o])&&(r+=e);else for(;++o<u;)i(e=+t.call(n,n[o],o))&&(r+=e);return r},ao.mean=function(n,t){var e,u=0,o=n.length,a=-1,l=o;if(1===arguments.length)for(;++a<o;)i(e=r(n[a]))?u+=e:--l;else for(;++a<o;)i(e=r(t.call(n,n[a],a)))?u+=e:--l;return l?u/l:void 0},ao.quantile=function(n,t){var e=(n.length-1)*t+1,r=Math.floor(e),i=+n[r-1],u=e-r;return u?i+u*(n[r]-i):i},ao.median=function(n,t){var u,o=[],a=n.length,l=-1;if(1===arguments.length)for(;++l<a;)i(u=r(n[l]))&&o.push(u);else for(;++l<a;)i(u=r(t.call(n,n[l],l)))&&o.push(u);return o.length?ao.quantile(o.sort(e),.5):void 0},ao.variance=function(n,t){var e,u,o=n.length,a=0,l=0,c=-1,f=0;if(1===arguments.length)for(;++c<o;)i(e=r(n[c]))&&(u=e-a,a+=u/++f,l+=u*(e-a));else for(;++c<o;)i(e=r(t.call(n,n[c],c)))&&(u=e-a,a+=u/++f,l+=u*(e-a));return f>1?l/(f-1):void 0},ao.deviation=function(){var n=ao.variance.apply(this,arguments);return n?Math.sqrt(n):n};var Mo=u(e);ao.bisectLeft=Mo.left,ao.bisect=ao.bisectRight=Mo.right,ao.bisector=function(n){return u(1===n.length?function(t,r){return e(n(t),r)}:n)},ao.shuffle=function(n,t,e){(u=arguments.length)<3&&(e=n.length,2>u&&(t=0));for(var r,i,u=e-t;u;)i=Math.random()*u--|0,r=n[u+t],n[u+t]=n[i+t],n[i+t]=r;return n},ao.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},ao.pairs=function(n){for(var t,e=0,r=n.length-1,i=n[0],u=new Array(0>r?0:r);r>e;)u[e]=[t=i,i=n[++e]];return u},ao.transpose=function(n){if(!(i=n.length))return[];for(var t=-1,e=ao.min(n,o),r=new Array(e);++t<e;)for(var i,u=-1,a=r[t]=new Array(i);++u<i;)a[u]=n[u][t];return r},ao.zip=function(){return ao.transpose(arguments)},ao.keys=function(n){var t=[];for(var e in n)t.push(e);return t},ao.values=function(n){var t=[];for(var e in n)t.push(n[e]);return t},ao.entries=function(n){var t=[];for(var e in n)t.push({key:e,value:n[e]});return t},ao.merge=function(n){for(var t,e,r,i=n.length,u=-1,o=0;++u<i;)o+=n[u].length;for(e=new Array(o);--i>=0;)for(r=n[i],t=r.length;--t>=0;)e[--o]=r[t];return e};var xo=Math.abs;ao.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),(t-n)/e===1/0)throw new Error("infinite range");var r,i=[],u=a(xo(e)),o=-1;if(n*=u,t*=u,e*=u,0>e)for(;(r=n+e*++o)>t;)i.push(r/u);else for(;(r=n+e*++o)<t;)i.push(r/u);return i},ao.map=function(n,t){var e=new c;if(n instanceof c)n.forEach(function(n,t){e.set(n,t)});else if(Array.isArray(n)){var r,i=-1,u=n.length;if(1===arguments.length)for(;++i<u;)e.set(i,n[i]);else for(;++i<u;)e.set(t.call(n,r=n[i],i),r)}else for(var o in n)e.set(o,n[o]);return e};var bo="__proto__",_o="\x00";l(c,{has:h,get:function(n){return this._[f(n)]},set:function(n,t){return this._[f(n)]=t},remove:p,keys:g,values:function(){var n=[];for(var t in this._)n.push(this._[t]);return n},entries:function(){var n=[];for(var t in this._)n.push({key:s(t),value:this._[t]});return n},size:v,empty:d,forEach:function(n){for(var t in this._)n.call(this,s(t),this._[t])}}),ao.nest=function(){function n(t,o,a){if(a>=u.length)return r?r.call(i,o):e?o.sort(e):o;for(var l,f,s,h,p=-1,g=o.length,v=u[a++],d=new c;++p<g;)(h=d.get(l=v(f=o[p])))?h.push(f):d.set(l,[f]);return t?(f=t(),s=function(e,r){f.set(e,n(t,r,a))}):(f={},s=function(e,r){f[e]=n(t,r,a)}),d.forEach(s),f}function t(n,e){if(e>=u.length)return n;var r=[],i=o[e++];return n.forEach(function(n,i){r.push({key:n,values:t(i,e)})}),i?r.sort(function(n,t){return i(n.key,t.key)}):r}var e,r,i={},u=[],o=[];return i.map=function(t,e){return n(e,t,0)},i.entries=function(e){return t(n(ao.map,e,0),0)},i.key=function(n){return u.push(n),i},i.sortKeys=function(n){return o[u.length-1]=n,i},i.sortValues=function(n){return e=n,i},i.rollup=function(n){return r=n,i},i},ao.set=function(n){var t=new y;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},l(y,{has:h,add:function(n){return this._[f(n+="")]=!0,n},remove:p,values:g,size:v,empty:d,forEach:function(n){for(var t in this._)n.call(this,s(t))}}),ao.behavior={},ao.rebind=function(n,t){for(var e,r=1,i=arguments.length;++r<i;)n[e=arguments[r]]=M(n,t,t[e]);return n};var wo=["webkit","ms","moz","Moz","o","O"];ao.dispatch=function(){for(var n=new _,t=-1,e=arguments.length;++t<e;)n[arguments[t]]=w(n);return n},_.prototype.on=function(n,t){var e=n.indexOf("."),r="";if(e>=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},ao.event=null,ao.requote=function(n){return n.replace(So,"\\$&")};var So=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ko={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},No=function(n,t){return t.querySelector(n)},Eo=function(n,t){return t.querySelectorAll(n)},Ao=function(n,t){var e=n.matches||n[x(n,"matchesSelector")];return(Ao=function(n,t){return e.call(n,t)})(n,t)};"function"==typeof Sizzle&&(No=function(n,t){return Sizzle(n,t)[0]||null},Eo=Sizzle,Ao=Sizzle.matchesSelector),ao.selection=function(){return ao.select(fo.documentElement)};var Co=ao.selection.prototype=[];Co.select=function(n){var t,e,r,i,u=[];n=A(n);for(var o=-1,a=this.length;++o<a;){u.push(t=[]),t.parentNode=(r=this[o]).parentNode;for(var l=-1,c=r.length;++l<c;)(i=r[l])?(t.push(e=n.call(i,i.__data__,l,o)),e&&"__data__"in i&&(e.__data__=i.__data__)):t.push(null)}return E(u)},Co.selectAll=function(n){var t,e,r=[];n=C(n);for(var i=-1,u=this.length;++i<u;)for(var o=this[i],a=-1,l=o.length;++a<l;)(e=o[a])&&(r.push(t=co(n.call(e,e.__data__,a,i))),t.parentNode=e);return E(r)};var zo="http://www.w3.org/1999/xhtml",Lo={svg:"http://www.w3.org/2000/svg",xhtml:zo,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};ao.ns={prefix:Lo,qualify:function(n){var t=n.indexOf(":"),e=n;return t>=0&&"xmlns"!==(e=n.slice(0,t))&&(n=n.slice(t+1)),Lo.hasOwnProperty(e)?{space:Lo[e],local:n}:n}},Co.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=ao.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(z(t,n[t]));return this}return this.each(z(n,t))},Co.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=T(n)).length,i=-1;if(t=e.classList){for(;++i<r;)if(!t.contains(n[i]))return!1}else for(t=e.getAttribute("class");++i<r;)if(!q(n[i]).test(t))return!1;return!0}for(t in n)this.each(R(t,n[t]));return this}return this.each(R(n,t))},Co.style=function(n,e,r){var i=arguments.length;if(3>i){if("string"!=typeof n){2>i&&(e="");for(r in n)this.each(P(r,n[r],e));return this}if(2>i){var u=this.node();return t(u).getComputedStyle(u,null).getPropertyValue(n)}r=""}return this.each(P(n,e,r))},Co.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(U(t,n[t]));return this}return this.each(U(n,t))},Co.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},Co.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},Co.append=function(n){return n=j(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},Co.insert=function(n,t){return n=j(n),t=A(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},Co.remove=function(){return this.each(F)},Co.data=function(n,t){function e(n,e){var r,i,u,o=n.length,s=e.length,h=Math.min(o,s),p=new Array(s),g=new Array(s),v=new Array(o);if(t){var d,y=new c,m=new Array(o);for(r=-1;++r<o;)(i=n[r])&&(y.has(d=t.call(i,i.__data__,r))?v[r]=i:y.set(d,i),m[r]=d);for(r=-1;++r<s;)(i=y.get(d=t.call(e,u=e[r],r)))?i!==!0&&(p[r]=i,i.__data__=u):g[r]=H(u),y.set(d,!0);for(r=-1;++r<o;)r in m&&y.get(m[r])!==!0&&(v[r]=n[r])}else{for(r=-1;++r<h;)i=n[r],u=e[r],i?(i.__data__=u,p[r]=i):g[r]=H(u);for(;s>r;++r)g[r]=H(e[r]);for(;o>r;++r)v[r]=n[r]}g.update=p,g.parentNode=p.parentNode=v.parentNode=n.parentNode,a.push(g),l.push(p),f.push(v)}var r,i,u=-1,o=this.length;if(!arguments.length){for(n=new Array(o=(r=this[0]).length);++u<o;)(i=r[u])&&(n[u]=i.__data__);return n}var a=Z([]),l=E([]),f=E([]);if("function"==typeof n)for(;++u<o;)e(r=this[u],n.call(r,r.parentNode.__data__,u));else for(;++u<o;)e(r=this[u],n);return l.enter=function(){return a},l.exit=function(){return f},l},Co.datum=function(n){return arguments.length?this.property("__data__",n):this.property("__data__")},Co.filter=function(n){var t,e,r,i=[];"function"!=typeof n&&(n=O(n));for(var u=0,o=this.length;o>u;u++){i.push(t=[]),t.parentNode=(e=this[u]).parentNode;for(var a=0,l=e.length;l>a;a++)(r=e[a])&&n.call(r,r.__data__,a,u)&&t.push(r)}return E(i)},Co.order=function(){for(var n=-1,t=this.length;++n<t;)for(var e,r=this[n],i=r.length-1,u=r[i];--i>=0;)(e=r[i])&&(u&&u!==e.nextSibling&&u.parentNode.insertBefore(e,u),u=e);return this},Co.sort=function(n){n=I.apply(this,arguments);for(var t=-1,e=this.length;++t<e;)this[t].sort(n);return this.order()},Co.each=function(n){return Y(this,function(t,e,r){n.call(t,t.__data__,e,r)})},Co.call=function(n){var t=co(arguments);return n.apply(t[0]=this,t),this},Co.empty=function(){return!this.node()},Co.node=function(){for(var n=0,t=this.length;t>n;n++)for(var e=this[n],r=0,i=e.length;i>r;r++){var u=e[r];if(u)return u}return null},Co.size=function(){var n=0;return Y(this,function(){++n}),n};var qo=[];ao.selection.enter=Z,ao.selection.enter.prototype=qo,qo.append=Co.append,qo.empty=Co.empty,qo.node=Co.node,qo.call=Co.call,qo.size=Co.size,qo.select=function(n){for(var t,e,r,i,u,o=[],a=-1,l=this.length;++a<l;){r=(i=this[a]).update,o.push(t=[]),t.parentNode=i.parentNode;for(var c=-1,f=i.length;++c<f;)(u=i[c])?(t.push(r[c]=e=n.call(i.parentNode,u.__data__,c,a)),e.__data__=u.__data__):t.push(null)}return E(o)},qo.insert=function(n,t){return arguments.length<2&&(t=V(this)),Co.insert.call(this,n,t)},ao.select=function(t){var e;return"string"==typeof t?(e=[No(t,fo)],e.parentNode=fo.documentElement):(e=[t],e.parentNode=n(t)),E([e])},ao.selectAll=function(n){var t;return"string"==typeof n?(t=co(Eo(n,fo)),t.parentNode=fo.documentElement):(t=co(n),t.parentNode=null),E([t])},Co.on=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(X(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(X(n,t,e))};var To=ao.map({mouseenter:"mouseover",mouseleave:"mouseout"});fo&&To.forEach(function(n){"on"+n in fo&&To.remove(n)});var Ro,Do=0;ao.mouse=function(n){return J(n,k())};var Po=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;ao.touch=function(n,t,e){if(arguments.length<3&&(e=t,t=k().changedTouches),t)for(var r,i=0,u=t.length;u>i;++i)if((r=t[i]).identifier===e)return J(n,r)},ao.behavior.drag=function(){function n(){this.on("mousedown.drag",u).on("touchstart.drag",o)}function e(n,t,e,u,o){return function(){function a(){var n,e,r=t(h,v);r&&(n=r[0]-M[0],e=r[1]-M[1],g|=n|e,M=r,p({type:"drag",x:r[0]+c[0],y:r[1]+c[1],dx:n,dy:e}))}function l(){t(h,v)&&(y.on(u+d,null).on(o+d,null),m(g),p({type:"dragend"}))}var c,f=this,s=ao.event.target.correspondingElement||ao.event.target,h=f.parentNode,p=r.of(f,arguments),g=0,v=n(),d=".drag"+(null==v?"":"-"+v),y=ao.select(e(s)).on(u+d,a).on(o+d,l),m=W(s),M=t(h,v);i?(c=i.apply(f,arguments),c=[c.x-M[0],c.y-M[1]]):c=[0,0],p({type:"dragstart"})}}var r=N(n,"drag","dragstart","dragend"),i=null,u=e(b,ao.mouse,t,"mousemove","mouseup"),o=e(G,ao.touch,m,"touchmove","touchend");return n.origin=function(t){return arguments.length?(i=t,n):i},ao.rebind(n,r,"on")},ao.touches=function(n,t){return arguments.length<2&&(t=k().touches),t?co(t).map(function(t){var e=J(n,t);return e.identifier=t.identifier,e}):[]};var Uo=1e-6,jo=Uo*Uo,Fo=Math.PI,Ho=2*Fo,Oo=Ho-Uo,Io=Fo/2,Yo=Fo/180,Zo=180/Fo,Vo=Math.SQRT2,Xo=2,$o=4;ao.interpolateZoom=function(n,t){var e,r,i=n[0],u=n[1],o=n[2],a=t[0],l=t[1],c=t[2],f=a-i,s=l-u,h=f*f+s*s;if(jo>h)r=Math.log(c/o)/Vo,e=function(n){return[i+n*f,u+n*s,o*Math.exp(Vo*n*r)]};else{var p=Math.sqrt(h),g=(c*c-o*o+$o*h)/(2*o*Xo*p),v=(c*c-o*o-$o*h)/(2*c*Xo*p),d=Math.log(Math.sqrt(g*g+1)-g),y=Math.log(Math.sqrt(v*v+1)-v);r=(y-d)/Vo,e=function(n){var t=n*r,e=rn(d),a=o/(Xo*p)*(e*un(Vo*t+d)-en(d));return[i+a*f,u+a*s,o*e/rn(Vo*t+d)]}}return e.duration=1e3*r,e},ao.behavior.zoom=function(){function n(n){n.on(L,s).on(Wo+".zoom",p).on("dblclick.zoom",g).on(R,h)}function e(n){return[(n[0]-k.x)/k.k,(n[1]-k.y)/k.k]}function r(n){return[n[0]*k.k+k.x,n[1]*k.k+k.y]}function i(n){k.k=Math.max(A[0],Math.min(A[1],n))}function u(n,t){t=r(t),k.x+=n[0]-t[0],k.y+=n[1]-t[1]}function o(t,e,r,o){t.__chart__={x:k.x,y:k.y,k:k.k},i(Math.pow(2,o)),u(d=e,r),t=ao.select(t),C>0&&(t=t.transition().duration(C)),t.call(n.event)}function a(){b&&b.domain(x.range().map(function(n){return(n-k.x)/k.k}).map(x.invert)),w&&w.domain(_.range().map(function(n){return(n-k.y)/k.k}).map(_.invert))}function l(n){z++||n({type:"zoomstart"})}function c(n){a(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function f(n){--z||(n({type:"zoomend"}),d=null)}function s(){function n(){a=1,u(ao.mouse(i),h),c(o)}function r(){s.on(q,null).on(T,null),p(a),f(o)}var i=this,o=D.of(i,arguments),a=0,s=ao.select(t(i)).on(q,n).on(T,r),h=e(ao.mouse(i)),p=W(i);Il.call(i),l(o)}function h(){function n(){var n=ao.touches(g);return p=k.k,n.forEach(function(n){n.identifier in d&&(d[n.identifier]=e(n))}),n}function t(){var t=ao.event.target;ao.select(t).on(x,r).on(b,a),_.push(t);for(var e=ao.event.changedTouches,i=0,u=e.length;u>i;++i)d[e[i].identifier]=null;var l=n(),c=Date.now();if(1===l.length){if(500>c-M){var f=l[0];o(g,f,d[f.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),S()}M=c}else if(l.length>1){var f=l[0],s=l[1],h=f[0]-s[0],p=f[1]-s[1];y=h*h+p*p}}function r(){var n,t,e,r,o=ao.touches(g);Il.call(g);for(var a=0,l=o.length;l>a;++a,r=null)if(e=o[a],r=d[e.identifier]){if(t)break;n=e,t=r}if(r){var f=(f=e[0]-n[0])*f+(f=e[1]-n[1])*f,s=y&&Math.sqrt(f/y);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+r[0])/2,(t[1]+r[1])/2],i(s*p)}M=null,u(n,t),c(v)}function a(){if(ao.event.touches.length){for(var t=ao.event.changedTouches,e=0,r=t.length;r>e;++e)delete d[t[e].identifier];for(var i in d)return void n()}ao.selectAll(_).on(m,null),w.on(L,s).on(R,h),N(),f(v)}var p,g=this,v=D.of(g,arguments),d={},y=0,m=".zoom-"+ao.event.changedTouches[0].identifier,x="touchmove"+m,b="touchend"+m,_=[],w=ao.select(g),N=W(g);t(),l(v),w.on(L,null).on(R,t)}function p(){var n=D.of(this,arguments);m?clearTimeout(m):(Il.call(this),v=e(d=y||ao.mouse(this)),l(n)),m=setTimeout(function(){m=null,f(n)},50),S(),i(Math.pow(2,.002*Bo())*k.k),u(d,v),c(n)}function g(){var n=ao.mouse(this),t=Math.log(k.k)/Math.LN2;o(this,n,e(n),ao.event.shiftKey?Math.ceil(t)-1:Math.floor(t)+1)}var v,d,y,m,M,x,b,_,w,k={x:0,y:0,k:1},E=[960,500],A=Jo,C=250,z=0,L="mousedown.zoom",q="mousemove.zoom",T="mouseup.zoom",R="touchstart.zoom",D=N(n,"zoomstart","zoom","zoomend");return Wo||(Wo="onwheel"in fo?(Bo=function(){return-ao.event.deltaY*(ao.event.deltaMode?120:1)},"wheel"):"onmousewheel"in fo?(Bo=function(){return ao.event.wheelDelta},"mousewheel"):(Bo=function(){return-ao.event.detail},"MozMousePixelScroll")),n.event=function(n){n.each(function(){var n=D.of(this,arguments),t=k;Hl?ao.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},l(n)}).tween("zoom:zoom",function(){var e=E[0],r=E[1],i=d?d[0]:e/2,u=d?d[1]:r/2,o=ao.interpolateZoom([(i-k.x)/k.k,(u-k.y)/k.k,e/k.k],[(i-t.x)/t.k,(u-t.y)/t.k,e/t.k]);return function(t){var r=o(t),a=e/r[2];this.__chart__=k={x:i-r[0]*a,y:u-r[1]*a,k:a},c(n)}}).each("interrupt.zoom",function(){f(n)}).each("end.zoom",function(){f(n)}):(this.__chart__=k,l(n),c(n),f(n))})},n.translate=function(t){return arguments.length?(k={x:+t[0],y:+t[1],k:k.k},a(),n):[k.x,k.y]},n.scale=function(t){return arguments.length?(k={x:k.x,y:k.y,k:null},i(+t),a(),n):k.k},n.scaleExtent=function(t){return arguments.length?(A=null==t?Jo:[+t[0],+t[1]],n):A},n.center=function(t){return arguments.length?(y=t&&[+t[0],+t[1]],n):y},n.size=function(t){return arguments.length?(E=t&&[+t[0],+t[1]],n):E},n.duration=function(t){return arguments.length?(C=+t,n):C},n.x=function(t){return arguments.length?(b=t,x=t.copy(),k={x:0,y:0,k:1},n):b},n.y=function(t){return arguments.length?(w=t,_=t.copy(),k={x:0,y:0,k:1},n):w},ao.rebind(n,D,"on")};var Bo,Wo,Jo=[0,1/0];ao.color=an,an.prototype.toString=function(){return this.rgb()+""},ao.hsl=ln;var Go=ln.prototype=new an;Go.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new ln(this.h,this.s,this.l/n)},Go.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new ln(this.h,this.s,n*this.l)},Go.rgb=function(){return cn(this.h,this.s,this.l)},ao.hcl=fn;var Ko=fn.prototype=new an;Ko.brighter=function(n){return new fn(this.h,this.c,Math.min(100,this.l+Qo*(arguments.length?n:1)))},Ko.darker=function(n){return new fn(this.h,this.c,Math.max(0,this.l-Qo*(arguments.length?n:1)))},Ko.rgb=function(){return sn(this.h,this.c,this.l).rgb()},ao.lab=hn;var Qo=18,na=.95047,ta=1,ea=1.08883,ra=hn.prototype=new an;ra.brighter=function(n){return new hn(Math.min(100,this.l+Qo*(arguments.length?n:1)),this.a,this.b)},ra.darker=function(n){return new hn(Math.max(0,this.l-Qo*(arguments.length?n:1)),this.a,this.b)},ra.rgb=function(){return pn(this.l,this.a,this.b)},ao.rgb=mn;var ia=mn.prototype=new an;ia.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,i=30;return t||e||r?(t&&i>t&&(t=i),e&&i>e&&(e=i),r&&i>r&&(r=i),new mn(Math.min(255,t/n),Math.min(255,e/n),Math.min(255,r/n))):new mn(i,i,i)},ia.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new mn(n*this.r,n*this.g,n*this.b)},ia.hsl=function(){return wn(this.r,this.g,this.b)},ia.toString=function(){return"#"+bn(this.r)+bn(this.g)+bn(this.b)};var ua=ao.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});ua.forEach(function(n,t){ua.set(n,Mn(t))}),ao.functor=En,ao.xhr=An(m),ao.dsv=function(n,t){function e(n,e,u){arguments.length<3&&(u=e,e=null);var o=Cn(n,t,null==e?r:i(e),u);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:i(n)):e},o}function r(n){return e.parse(n.responseText)}function i(n){return function(t){return e.parse(t.responseText,n)}}function u(t){return t.map(o).join(n)}function o(n){return a.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var a=new RegExp('["'+n+"\n]"),l=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var i=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(i(n),e)}:i})},e.parseRows=function(n,t){function e(){if(f>=c)return o;if(i)return i=!1,u;var t=f;if(34===n.charCodeAt(t)){for(var e=t;e++<c;)if(34===n.charCodeAt(e)){if(34!==n.charCodeAt(e+1))break;++e}f=e+2;var r=n.charCodeAt(e+1);return 13===r?(i=!0,10===n.charCodeAt(e+2)&&++f):10===r&&(i=!0),n.slice(t+1,e).replace(/""/g,'"')}for(;c>f;){var r=n.charCodeAt(f++),a=1;if(10===r)i=!0;else if(13===r)i=!0,10===n.charCodeAt(f)&&(++f,++a);else if(r!==l)continue;return n.slice(t,f-a)}return n.slice(t)}for(var r,i,u={},o={},a=[],c=n.length,f=0,s=0;(r=e())!==o;){for(var h=[];r!==u&&r!==o;)h.push(r),r=e();t&&null==(h=t(h,s++))||a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new y,i=[];return t.forEach(function(n){for(var t in n)r.has(t)||i.push(r.add(t))}),[i.map(o).join(n)].concat(t.map(function(t){return i.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(u).join("\n")},e},ao.csv=ao.dsv(",","text/csv"),ao.tsv=ao.dsv("	","text/tab-separated-values");var oa,aa,la,ca,fa=this[x(this,"requestAnimationFrame")]||function(n){setTimeout(n,17)};ao.timer=function(){qn.apply(this,arguments)},ao.timer.flush=function(){Rn(),Dn()},ao.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var sa=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Un);ao.formatPrefix=function(n,t){var e=0;return(n=+n)&&(0>n&&(n*=-1),t&&(n=ao.round(n,Pn(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),sa[8+e/3]};var ha=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,pa=ao.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=ao.round(n,Pn(n,t))).toFixed(Math.max(0,Math.min(20,Pn(n*(1+1e-15),t))))}}),ga=ao.time={},va=Date;Hn.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){da.setUTCDate.apply(this._,arguments)},setDay:function(){da.setUTCDay.apply(this._,arguments)},setFullYear:function(){da.setUTCFullYear.apply(this._,arguments)},setHours:function(){da.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){da.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){da.setUTCMinutes.apply(this._,arguments)},setMonth:function(){da.setUTCMonth.apply(this._,arguments)},setSeconds:function(){da.setUTCSeconds.apply(this._,arguments)},setTime:function(){da.setTime.apply(this._,arguments)}};var da=Date.prototype;ga.year=On(function(n){return n=ga.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),ga.years=ga.year.range,ga.years.utc=ga.year.utc.range,ga.day=On(function(n){var t=new va(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),ga.days=ga.day.range,ga.days.utc=ga.day.utc.range,ga.dayOfYear=function(n){var t=ga.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=ga[n]=On(function(n){return(n=ga.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=ga.year(n).getDay();return Math.floor((ga.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});ga[n+"s"]=e.range,ga[n+"s"].utc=e.utc.range,ga[n+"OfYear"]=function(n){var e=ga.year(n).getDay();return Math.floor((ga.dayOfYear(n)+(e+t)%7)/7)}}),ga.week=ga.sunday,ga.weeks=ga.sunday.range,ga.weeks.utc=ga.sunday.utc.range,ga.weekOfYear=ga.sundayOfYear;var ya={"-":"",_:" ",0:"0"},ma=/^\s*\d+/,Ma=/^%/;ao.locale=function(n){return{numberFormat:jn(n),timeFormat:Yn(n)}};var xa=ao.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});ao.format=xa.numberFormat,ao.geo={},ft.prototype={s:0,t:0,add:function(n){st(n,this.t,ba),st(ba.s,this.s,this),this.s?this.t+=ba.t:this.s=ba.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var ba=new ft;ao.geo.stream=function(n,t){n&&_a.hasOwnProperty(n.type)?_a[n.type](n,t):ht(n,t)};var _a={Feature:function(n,t){ht(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,i=e.length;++r<i;)ht(e[r].geometry,t)}},wa={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var e=n.coordinates,r=-1,i=e.length;++r<i;)n=e[r],t.point(n[0],n[1],n[2])},LineString:function(n,t){pt(n.coordinates,t,0)},MultiLineString:function(n,t){for(var e=n.coordinates,r=-1,i=e.length;++r<i;)pt(e[r],t,0)},Polygon:function(n,t){gt(n.coordinates,t)},MultiPolygon:function(n,t){for(var e=n.coordinates,r=-1,i=e.length;++r<i;)gt(e[r],t)},GeometryCollection:function(n,t){for(var e=n.geometries,r=-1,i=e.length;++r<i;)ht(e[r],t)}};ao.geo.area=function(n){return Sa=0,ao.geo.stream(n,Na),Sa};var Sa,ka=new ft,Na={sphere:function(){Sa+=4*Fo},point:b,lineStart:b,lineEnd:b,polygonStart:function(){ka.reset(),Na.lineStart=vt},polygonEnd:function(){var n=2*ka;Sa+=0>n?4*Fo+n:n,Na.lineStart=Na.lineEnd=Na.point=b}};ao.geo.bounds=function(){function n(n,t){M.push(x=[f=n,h=n]),s>t&&(s=t),t>p&&(p=t)}function t(t,e){var r=dt([t*Yo,e*Yo]);if(y){var i=mt(y,r),u=[i[1],-i[0],0],o=mt(u,i);bt(o),o=_t(o);var l=t-g,c=l>0?1:-1,v=o[0]*Zo*c,d=xo(l)>180;if(d^(v>c*g&&c*t>v)){var m=o[1]*Zo;m>p&&(p=m)}else if(v=(v+360)%360-180,d^(v>c*g&&c*t>v)){var m=-o[1]*Zo;s>m&&(s=m)}else s>e&&(s=e),e>p&&(p=e);d?g>t?a(f,t)>a(f,h)&&(h=t):a(t,h)>a(f,h)&&(f=t):h>=f?(f>t&&(f=t),t>h&&(h=t)):t>g?a(f,t)>a(f,h)&&(h=t):a(t,h)>a(f,h)&&(f=t)}else n(t,e);y=r,g=t}function e(){b.point=t}function r(){x[0]=f,x[1]=h,b.point=n,y=null}function i(n,e){if(y){var r=n-g;m+=xo(r)>180?r+(r>0?360:-360):r}else v=n,d=e;Na.point(n,e),t(n,e)}function u(){Na.lineStart()}function o(){i(v,d),Na.lineEnd(),xo(m)>Uo&&(f=-(h=180)),x[0]=f,x[1]=h,y=null}function a(n,t){return(t-=n)<0?t+360:t}function l(n,t){return n[0]-t[0]}function c(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var f,s,h,p,g,v,d,y,m,M,x,b={point:n,lineStart:e,lineEnd:r,polygonStart:function(){b.point=i,b.lineStart=u,b.lineEnd=o,m=0,Na.polygonStart()},polygonEnd:function(){Na.polygonEnd(),b.point=n,b.lineStart=e,b.lineEnd=r,0>ka?(f=-(h=180),s=-(p=90)):m>Uo?p=90:-Uo>m&&(s=-90),x[0]=f,x[1]=h}};return function(n){p=h=-(f=s=1/0),M=[],ao.geo.stream(n,b);var t=M.length;if(t){M.sort(l);for(var e,r=1,i=M[0],u=[i];t>r;++r)e=M[r],c(e[0],i)||c(e[1],i)?(a(i[0],e[1])>a(i[0],i[1])&&(i[1]=e[1]),a(e[0],i[1])>a(i[0],i[1])&&(i[0]=e[0])):u.push(i=e);for(var o,e,g=-(1/0),t=u.length-1,r=0,i=u[t];t>=r;i=e,++r)e=u[r],(o=a(i[1],e[0]))>g&&(g=o,f=e[0],h=i[1])}return M=x=null,f===1/0||s===1/0?[[NaN,NaN],[NaN,NaN]]:[[f,s],[h,p]]}}(),ao.geo.centroid=function(n){Ea=Aa=Ca=za=La=qa=Ta=Ra=Da=Pa=Ua=0,ao.geo.stream(n,ja);var t=Da,e=Pa,r=Ua,i=t*t+e*e+r*r;return jo>i&&(t=qa,e=Ta,r=Ra,Uo>Aa&&(t=Ca,e=za,r=La),i=t*t+e*e+r*r,jo>i)?[NaN,NaN]:[Math.atan2(e,t)*Zo,tn(r/Math.sqrt(i))*Zo]};var Ea,Aa,Ca,za,La,qa,Ta,Ra,Da,Pa,Ua,ja={sphere:b,point:St,lineStart:Nt,lineEnd:Et,polygonStart:function(){ja.lineStart=At},polygonEnd:function(){ja.lineStart=Nt}},Fa=Rt(zt,jt,Ht,[-Fo,-Fo/2]),Ha=1e9;ao.geo.clipExtent=function(){var n,t,e,r,i,u,o={stream:function(n){return i&&(i.valid=!1),i=u(n),i.valid=!0,i},extent:function(a){return arguments.length?(u=Zt(n=+a[0][0],t=+a[0][1],e=+a[1][0],r=+a[1][1]),i&&(i.valid=!1,i=null),o):[[n,t],[e,r]]}};return o.extent([[0,0],[960,500]])},(ao.geo.conicEqualArea=function(){return Vt(Xt)}).raw=Xt,ao.geo.albers=function(){return ao.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ao.geo.albersUsa=function(){function n(n){var u=n[0],o=n[1];return t=null,e(u,o),t||(r(u,o),t)||i(u,o),t}var t,e,r,i,u=ao.geo.albers(),o=ao.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=ao.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=u.scale(),e=u.translate(),r=(n[0]-e[0])/t,i=(n[1]-e[1])/t;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?o:i>=.166&&.234>i&&r>=-.214&&-.115>r?a:u).invert(n)},n.stream=function(n){var t=u.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,i){t.point(n,i),e.point(n,i),r.point(n,i)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(u.precision(t),o.precision(t),a.precision(t),n):u.precision()},n.scale=function(t){return arguments.length?(u.scale(t),o.scale(.35*t),a.scale(t),n.translate(u.translate())):u.scale()},n.translate=function(t){if(!arguments.length)return u.translate();var c=u.scale(),f=+t[0],s=+t[1];return e=u.translate(t).clipExtent([[f-.455*c,s-.238*c],[f+.455*c,s+.238*c]]).stream(l).point,r=o.translate([f-.307*c,s+.201*c]).clipExtent([[f-.425*c+Uo,s+.12*c+Uo],[f-.214*c-Uo,s+.234*c-Uo]]).stream(l).point,i=a.translate([f-.205*c,s+.212*c]).clipExtent([[f-.214*c+Uo,s+.166*c+Uo],[f-.115*c-Uo,s+.234*c-Uo]]).stream(l).point,n},n.scale(1070)};var Oa,Ia,Ya,Za,Va,Xa,$a={point:b,lineStart:b,lineEnd:b,polygonStart:function(){Ia=0,$a.lineStart=$t},polygonEnd:function(){$a.lineStart=$a.lineEnd=$a.point=b,Oa+=xo(Ia/2)}},Ba={point:Bt,lineStart:b,lineEnd:b,polygonStart:b,polygonEnd:b},Wa={point:Gt,lineStart:Kt,lineEnd:Qt,polygonStart:function(){Wa.lineStart=ne},polygonEnd:function(){Wa.point=Gt,Wa.lineStart=Kt,Wa.lineEnd=Qt}};ao.geo.path=function(){function n(n){return n&&("function"==typeof a&&u.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=i(u)),ao.geo.stream(n,o)),u.result()}function t(){return o=null,n}var e,r,i,u,o,a=4.5;return n.area=function(n){return Oa=0,ao.geo.stream(n,i($a)),Oa},n.centroid=function(n){return Ca=za=La=qa=Ta=Ra=Da=Pa=Ua=0,ao.geo.stream(n,i(Wa)),Ua?[Da/Ua,Pa/Ua]:Ra?[qa/Ra,Ta/Ra]:La?[Ca/La,za/La]:[NaN,NaN]},n.bounds=function(n){return Va=Xa=-(Ya=Za=1/0),ao.geo.stream(n,i(Ba)),[[Ya,Za],[Va,Xa]]},n.projection=function(n){return arguments.length?(i=(e=n)?n.stream||re(n):m,t()):e},n.context=function(n){return arguments.length?(u=null==(r=n)?new Wt:new te(n),"function"!=typeof a&&u.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(u.pointRadius(+t),+t),n):a},n.projection(ao.geo.albersUsa()).context(null)},ao.geo.transform=function(n){return{stream:function(t){var e=new ie(t);for(var r in n)e[r]=n[r];return e}}},ie.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ao.geo.projection=oe,ao.geo.projectionMutator=ae,(ao.geo.equirectangular=function(){return oe(ce)}).raw=ce.invert=ce,ao.geo.rotation=function(n){function t(t){return t=n(t[0]*Yo,t[1]*Yo),t[0]*=Zo,t[1]*=Zo,t}return n=se(n[0]%360*Yo,n[1]*Yo,n.length>2?n[2]*Yo:0),t.invert=function(t){return t=n.invert(t[0]*Yo,t[1]*Yo),t[0]*=Zo,t[1]*=Zo,t},t},fe.invert=ce,ao.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=se(-n[0]*Yo,-n[1]*Yo,0).invert,i=[];return e(null,null,1,{point:function(n,e){i.push(n=t(n,e)),n[0]*=Zo,n[1]*=Zo}}),{type:"Polygon",coordinates:[i]}}var t,e,r=[0,0],i=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=ve((t=+r)*Yo,i*Yo),n):t},n.precision=function(r){return arguments.length?(e=ve(t*Yo,(i=+r)*Yo),n):i},n.angle(90)},ao.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Yo,i=n[1]*Yo,u=t[1]*Yo,o=Math.sin(r),a=Math.cos(r),l=Math.sin(i),c=Math.cos(i),f=Math.sin(u),s=Math.cos(u);return Math.atan2(Math.sqrt((e=s*o)*e+(e=c*f-l*s*a)*e),l*f+c*s*a)},ao.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return ao.range(Math.ceil(u/d)*d,i,d).map(h).concat(ao.range(Math.ceil(c/y)*y,l,y).map(p)).concat(ao.range(Math.ceil(r/g)*g,e,g).filter(function(n){return xo(n%d)>Uo}).map(f)).concat(ao.range(Math.ceil(a/v)*v,o,v).filter(function(n){return xo(n%y)>Uo}).map(s))}var e,r,i,u,o,a,l,c,f,s,h,p,g=10,v=g,d=90,y=360,m=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(u).concat(p(l).slice(1),h(i).reverse().slice(1),p(c).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(u=+t[0][0],i=+t[1][0],c=+t[0][1],l=+t[1][1],u>i&&(t=u,u=i,i=t),c>l&&(t=c,c=l,l=t),n.precision(m)):[[u,c],[i,l]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(m)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],y=+t[1],n):[d,y]},n.minorStep=function(t){return arguments.length?(g=+t[0],v=+t[1],n):[g,v]},n.precision=function(t){return arguments.length?(m=+t,f=ye(a,o,90),s=me(r,e,m),h=ye(c,l,90),p=me(u,i,m),n):m},n.majorExtent([[-180,-90+Uo],[180,90-Uo]]).minorExtent([[-180,-80-Uo],[180,80+Uo]])},ao.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||i.apply(this,arguments)]}}var t,e,r=Me,i=xe;return n.distance=function(){return ao.geo.distance(t||r.apply(this,arguments),e||i.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,n):i},n.precision=function(){return arguments.length?n:0},n},ao.geo.interpolate=function(n,t){return be(n[0]*Yo,n[1]*Yo,t[0]*Yo,t[1]*Yo)},ao.geo.length=function(n){return Ja=0,ao.geo.stream(n,Ga),Ja};var Ja,Ga={sphere:b,point:b,lineStart:_e,lineEnd:b,polygonStart:b,polygonEnd:b},Ka=we(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(ao.geo.azimuthalEqualArea=function(){return oe(Ka)}).raw=Ka;var Qa=we(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},m);(ao.geo.azimuthalEquidistant=function(){return oe(Qa)}).raw=Qa,(ao.geo.conicConformal=function(){return Vt(Se)}).raw=Se,(ao.geo.conicEquidistant=function(){return Vt(ke)}).raw=ke;var nl=we(function(n){return 1/n},Math.atan);(ao.geo.gnomonic=function(){return oe(nl)}).raw=nl,Ne.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Io]},(ao.geo.mercator=function(){return Ee(Ne)}).raw=Ne;var tl=we(function(){return 1},Math.asin);(ao.geo.orthographic=function(){return oe(tl)}).raw=tl;var el=we(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(ao.geo.stereographic=function(){return oe(el)}).raw=el,Ae.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Io]},(ao.geo.transverseMercator=function(){var n=Ee(Ae),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Ae,ao.geom={},ao.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,i=En(e),u=En(r),o=n.length,a=[],l=[];for(t=0;o>t;t++)a.push([+i.call(this,n[t],t),+u.call(this,n[t],t),t]);for(a.sort(qe),t=0;o>t;t++)l.push([a[t][0],-a[t][1]]);var c=Le(a),f=Le(l),s=f[0]===c[0],h=f[f.length-1]===c[c.length-1],p=[];for(t=c.length-1;t>=0;--t)p.push(n[a[c[t]][2]]);for(t=+s;t<f.length-h;++t)p.push(n[a[f[t]][2]]);return p}var e=Ce,r=ze;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t)},ao.geom.polygon=function(n){return ko(n,rl),n};var rl=ao.geom.polygon.prototype=[];rl.area=function(){for(var n,t=-1,e=this.length,r=this[e-1],i=0;++t<e;)n=r,r=this[t],i+=n[1]*r[0]-n[0]*r[1];return.5*i},rl.centroid=function(n){var t,e,r=-1,i=this.length,u=0,o=0,a=this[i-1];for(arguments.length||(n=-1/(6*this.area()));++r<i;)t=a,a=this[r],e=t[0]*a[1]-a[0]*t[1],u+=(t[0]+a[0])*e,o+=(t[1]+a[1])*e;return[u*n,o*n]},rl.clip=function(n){for(var t,e,r,i,u,o,a=De(n),l=-1,c=this.length-De(this),f=this[c-1];++l<c;){for(t=n.slice(),n.length=0,i=this[l],u=t[(r=t.length-a)-1],e=-1;++e<r;)o=t[e],Te(o,f,i)?(Te(u,f,i)||n.push(Re(u,o,f,i)),n.push(o)):Te(u,f,i)&&n.push(Re(u,o,f,i)),u=o;a&&n.push(n[0]),f=i}return n};var il,ul,ol,al,ll,cl=[],fl=[];Ye.prototype.prepare=function(){for(var n,t=this.edges,e=t.length;e--;)n=t[e].edge,n.b&&n.a||t.splice(e,1);return t.sort(Ve),t.length},tr.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},er.prototype={insert:function(n,t){var e,r,i;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=or(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)r=e.U,e===r.L?(i=r.R,i&&i.C?(e.C=i.C=!1,r.C=!0,n=r):(n===e.R&&(ir(this,e),n=e,e=n.U),e.C=!1,r.C=!0,ur(this,r))):(i=r.L,i&&i.C?(e.C=i.C=!1,r.C=!0,n=r):(n===e.L&&(ur(this,e),n=e,e=n.U),e.C=!1,r.C=!0,ir(this,r))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t,e,r,i=n.U,u=n.L,o=n.R;if(e=u?o?or(o):u:o,i?i.L===n?i.L=e:i.R=e:this._=e,u&&o?(r=e.C,e.C=n.C,e.L=u,u.U=e,e!==o?(i=e.U,e.U=n.U,n=e.R,i.L=n,e.R=o,o.U=e):(e.U=i,i=e,n=e.R)):(r=n.C,n=e),n&&(n.U=i),!r){if(n&&n.C)return void(n.C=!1);do{if(n===this._)break;if(n===i.L){if(t=i.R,t.C&&(t.C=!1,i.C=!0,ir(this,i),t=i.R),t.L&&t.L.C||t.R&&t.R.C){t.R&&t.R.C||(t.L.C=!1,t.C=!0,ur(this,t),t=i.R),t.C=i.C,i.C=t.R.C=!1,ir(this,i),n=this._;break}}else if(t=i.L,t.C&&(t.C=!1,i.C=!0,ur(this,i),t=i.L),t.L&&t.L.C||t.R&&t.R.C){t.L&&t.L.C||(t.R.C=!1,t.C=!0,ir(this,t),t=i.L),t.C=i.C,i.C=t.L.C=!1,ur(this,i),n=this._;break}t.C=!0,n=i,i=i.U}while(!n.C);n&&(n.C=!1)}}},ao.geom.voronoi=function(n){function t(n){var t=new Array(n.length),r=a[0][0],i=a[0][1],u=a[1][0],o=a[1][1];return ar(e(n),a).cells.forEach(function(e,a){var l=e.edges,c=e.site,f=t[a]=l.length?l.map(function(n){var t=n.start();return[t.x,t.y]}):c.x>=r&&c.x<=u&&c.y>=i&&c.y<=o?[[r,o],[u,o],[u,i],[r,i]]:[];f.point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(u(n,t)/Uo)*Uo,y:Math.round(o(n,t)/Uo)*Uo,i:t}})}var r=Ce,i=ze,u=r,o=i,a=sl;return n?t(n):(t.links=function(n){return ar(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return ar(e(n)).cells.forEach(function(e,r){for(var i,u,o=e.site,a=e.edges.sort(Ve),l=-1,c=a.length,f=a[c-1].edge,s=f.l===o?f.r:f.l;++l<c;)i=f,u=s,f=a[l].edge,s=f.l===o?f.r:f.l,r<u.i&&r<s.i&&cr(o,u,s)<0&&t.push([n[r],n[u.i],n[s.i]])}),t},t.x=function(n){return arguments.length?(u=En(r=n),t):r},t.y=function(n){return arguments.length?(o=En(i=n),t):i},t.clipExtent=function(n){return arguments.length?(a=null==n?sl:n,t):a===sl?null:a},t.size=function(n){return arguments.length?t.clipExtent(n&&[[0,0],n]):a===sl?null:a&&a[1]},t)};var sl=[[-1e6,-1e6],[1e6,1e6]];ao.geom.delaunay=function(n){return ao.geom.voronoi().triangles(n)},ao.geom.quadtree=function(n,t,e,r,i){function u(n){function u(n,t,e,r,i,u,o,a){if(!isNaN(e)&&!isNaN(r))if(n.leaf){var l=n.x,f=n.y;if(null!=l)if(xo(l-e)+xo(f-r)<.01)c(n,t,e,r,i,u,o,a);else{var s=n.point;n.x=n.y=n.point=null,c(n,s,l,f,i,u,o,a),c(n,t,e,r,i,u,o,a)}else n.x=e,n.y=r,n.point=t}else c(n,t,e,r,i,u,o,a)}function c(n,t,e,r,i,o,a,l){var c=.5*(i+a),f=.5*(o+l),s=e>=c,h=r>=f,p=h<<1|s;n.leaf=!1,n=n.nodes[p]||(n.nodes[p]=hr()),s?i=c:a=c,h?o=f:l=f,u(n,t,e,r,i,o,a,l)}var f,s,h,p,g,v,d,y,m,M=En(a),x=En(l);if(null!=t)v=t,d=e,y=r,m=i;else if(y=m=-(v=d=1/0),s=[],h=[],g=n.length,o)for(p=0;g>p;++p)f=n[p],f.x<v&&(v=f.x),f.y<d&&(d=f.y),f.x>y&&(y=f.x),f.y>m&&(m=f.y),s.push(f.x),h.push(f.y);else for(p=0;g>p;++p){var b=+M(f=n[p],p),_=+x(f,p);v>b&&(v=b),d>_&&(d=_),b>y&&(y=b),_>m&&(m=_),s.push(b),h.push(_)}var w=y-v,S=m-d;w>S?m=d+w:y=v+S;var k=hr();if(k.add=function(n){u(k,n,+M(n,++p),+x(n,p),v,d,y,m)},k.visit=function(n){pr(n,k,v,d,y,m)},k.find=function(n){return gr(k,n[0],n[1],v,d,y,m)},p=-1,null==t){for(;++p<g;)u(k,n[p],s[p],h[p],v,d,y,m);--p}else n.forEach(k.add);return s=h=n=f=null,k}var o,a=Ce,l=ze;return(o=arguments.length)?(a=fr,l=sr,3===o&&(i=e,r=t,e=t=0),u(n)):(u.x=function(n){return arguments.length?(a=n,u):a},u.y=function(n){return arguments.length?(l=n,u):l},u.extent=function(n){return arguments.length?(null==n?t=e=r=i=null:(t=+n[0][0],e=+n[0][1],r=+n[1][0],i=+n[1][1]),u):null==t?null:[[t,e],[r,i]]},u.size=function(n){return arguments.length?(null==n?t=e=r=i=null:(t=e=0,r=+n[0],i=+n[1]),u):null==t?null:[r-t,i-e]},u)},ao.interpolateRgb=vr,ao.interpolateObject=dr,ao.interpolateNumber=yr,ao.interpolateString=mr;var hl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pl=new RegExp(hl.source,"g");ao.interpolate=Mr,ao.interpolators=[function(n,t){var e=typeof t;return("string"===e?ua.has(t.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(t)?vr:mr:t instanceof an?vr:Array.isArray(t)?xr:"object"===e&&isNaN(t)?dr:yr)(n,t)}],ao.interpolateArray=xr;var gl=function(){return m},vl=ao.map({linear:gl,poly:Er,quad:function(){return Sr},cubic:function(){return kr},sin:function(){return Ar},exp:function(){return Cr},circle:function(){return zr},elastic:Lr,back:qr,bounce:function(){return Tr}}),dl=ao.map({"in":m,out:_r,"in-out":wr,"out-in":function(n){return wr(_r(n))}});ao.ease=function(n){var t=n.indexOf("-"),e=t>=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=vl.get(e)||gl,r=dl.get(r)||m,br(r(e.apply(null,lo.call(arguments,1))))},ao.interpolateHcl=Rr,ao.interpolateHsl=Dr,ao.interpolateLab=Pr,ao.interpolateRound=Ur,ao.transform=function(n){var t=fo.createElementNS(ao.ns.prefix.svg,"g");return(ao.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new jr(e?e.matrix:yl)})(n)},jr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var yl={a:1,b:0,c:0,d:1,e:0,f:0};ao.interpolateTransform=$r,ao.layout={},ao.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e<r;)t.push(Jr(n[e]));return t}},ao.layout.chord=function(){function n(){var n,c,s,h,p,g={},v=[],d=ao.range(u),y=[];for(e=[],r=[],n=0,h=-1;++h<u;){for(c=0,p=-1;++p<u;)c+=i[h][p];v.push(c),y.push(ao.range(u)),n+=c}for(o&&d.sort(function(n,t){return o(v[n],v[t])}),a&&y.forEach(function(n,t){n.sort(function(n,e){return a(i[t][n],i[t][e])})}),n=(Ho-f*u)/n,c=0,h=-1;++h<u;){for(s=c,p=-1;++p<u;){var m=d[h],M=y[m][p],x=i[m][M],b=c,_=c+=x*n;g[m+"-"+M]={index:m,subindex:M,startAngle:b,endAngle:_,value:x}}r[m]={index:m,startAngle:s,endAngle:c,value:v[m]},c+=f}for(h=-1;++h<u;)for(p=h-1;++p<u;){var w=g[h+"-"+p],S=g[p+"-"+h];(w.value||S.value)&&e.push(w.value<S.value?{source:S,target:w}:{source:w,target:S})}l&&t()}function t(){e.sort(function(n,t){return l((n.source.value+n.target.value)/2,(t.source.value+t.target.value)/2)})}var e,r,i,u,o,a,l,c={},f=0;return c.matrix=function(n){return arguments.length?(u=(i=n)&&i.length,e=r=null,c):i},c.padding=function(n){return arguments.length?(f=n,e=r=null,c):f},c.sortGroups=function(n){return arguments.length?(o=n,e=r=null,c):o},c.sortSubgroups=function(n){return arguments.length?(a=n,e=null,c):a},c.sortChords=function(n){return arguments.length?(l=n,e&&t(),c):l},c.chords=function(){return e||n(),e},c.groups=function(){return r||n(),r},c},ao.layout.force=function(){function n(n){return function(t,e,r,i){if(t.point!==n){var u=t.cx-n.x,o=t.cy-n.y,a=i-e,l=u*u+o*o;if(l>a*a/y){if(v>l){var c=t.charge/l;n.px-=u*c,n.py-=o*c}return!0}if(t.point&&l&&v>l){var c=t.pointCharge/l;n.px-=u*c,n.py-=o*c}}return!t.charge}}function t(n){n.px=ao.event.x,n.py=ao.event.y,l.resume()}var e,r,i,u,o,a,l={},c=ao.dispatch("start","tick","end"),f=[1,1],s=.9,h=ml,p=Ml,g=-30,v=xl,d=.1,y=.64,M=[],x=[];return l.tick=function(){if((i*=.99)<.005)return e=null,c.end({type:"end",alpha:i=0}),!0;var t,r,l,h,p,v,y,m,b,_=M.length,w=x.length;for(r=0;w>r;++r)l=x[r],h=l.source,p=l.target,m=p.x-h.x,b=p.y-h.y,(v=m*m+b*b)&&(v=i*o[r]*((v=Math.sqrt(v))-u[r])/v,m*=v,b*=v,p.x-=m*(y=h.weight+p.weight?h.weight/(h.weight+p.weight):.5),p.y-=b*y,h.x+=m*(y=1-y),h.y+=b*y);if((y=i*d)&&(m=f[0]/2,b=f[1]/2,r=-1,y))for(;++r<_;)l=M[r],l.x+=(m-l.x)*y,l.y+=(b-l.y)*y;if(g)for(ri(t=ao.geom.quadtree(M),i,a),r=-1;++r<_;)(l=M[r]).fixed||t.visit(n(l));for(r=-1;++r<_;)l=M[r],l.fixed?(l.x=l.px,l.y=l.py):(l.x-=(l.px-(l.px=l.x))*s,l.y-=(l.py-(l.py=l.y))*s);c.tick({type:"tick",alpha:i})},l.nodes=function(n){return arguments.length?(M=n,l):M},l.links=function(n){return arguments.length?(x=n,l):x},l.size=function(n){return arguments.length?(f=n,l):f},l.linkDistance=function(n){return arguments.length?(h="function"==typeof n?n:+n,l):h},l.distance=l.linkDistance,l.linkStrength=function(n){return arguments.length?(p="function"==typeof n?n:+n,l):p},l.friction=function(n){return arguments.length?(s=+n,l):s},l.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,l):g},l.chargeDistance=function(n){return arguments.length?(v=n*n,l):Math.sqrt(v)},l.gravity=function(n){return arguments.length?(d=+n,l):d},l.theta=function(n){return arguments.length?(y=n*n,l):Math.sqrt(y)},l.alpha=function(n){return arguments.length?(n=+n,i?n>0?i=n:(e.c=null,e.t=NaN,e=null,c.end({type:"end",alpha:i=0})):n>0&&(c.start({type:"start",alpha:i=n}),e=qn(l.tick)),l):i},l.start=function(){function n(n,r){if(!e){for(e=new Array(i),l=0;i>l;++l)e[l]=[];for(l=0;c>l;++l){var u=x[l];e[u.source.index].push(u.target),e[u.target.index].push(u.source)}}for(var o,a=e[t],l=-1,f=a.length;++l<f;)if(!isNaN(o=a[l][n]))return o;return Math.random()*r}var t,e,r,i=M.length,c=x.length,s=f[0],v=f[1];for(t=0;i>t;++t)(r=M[t]).index=t,r.weight=0;for(t=0;c>t;++t)r=x[t],"number"==typeof r.source&&(r.source=M[r.source]),"number"==typeof r.target&&(r.target=M[r.target]),++r.source.weight,++r.target.weight;for(t=0;i>t;++t)r=M[t],isNaN(r.x)&&(r.x=n("x",s)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(u=[],"function"==typeof h)for(t=0;c>t;++t)u[t]=+h.call(this,x[t],t);else for(t=0;c>t;++t)u[t]=h;if(o=[],"function"==typeof p)for(t=0;c>t;++t)o[t]=+p.call(this,x[t],t);else for(t=0;c>t;++t)o[t]=p;if(a=[],"function"==typeof g)for(t=0;i>t;++t)a[t]=+g.call(this,M[t],t);else for(t=0;i>t;++t)a[t]=g;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){return r||(r=ao.behavior.drag().origin(m).on("dragstart.force",Qr).on("drag.force",t).on("dragend.force",ni)),arguments.length?void this.on("mouseover.force",ti).on("mouseout.force",ei).call(r):r},ao.rebind(l,c,"on")};var ml=20,Ml=1,xl=1/0;ao.layout.hierarchy=function(){function n(i){var u,o=[i],a=[];for(i.depth=0;null!=(u=o.pop());)if(a.push(u),(c=e.call(n,u,u.depth))&&(l=c.length)){for(var l,c,f;--l>=0;)o.push(f=c[l]),f.parent=u,f.depth=u.depth+1;r&&(u.value=0),u.children=c}else r&&(u.value=+r.call(n,u,u.depth)||0),delete u.children;return oi(i,function(n){var e,i;t&&(e=n.children)&&e.sort(t),r&&(i=n.parent)&&(i.value+=n.value)}),a}var t=ci,e=ai,r=li;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(ui(t,function(n){n.children&&(n.value=0)}),oi(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},ao.layout.partition=function(){function n(t,e,r,i){var u=t.children;if(t.x=e,t.y=t.depth*i,t.dx=r,t.dy=i,u&&(o=u.length)){var o,a,l,c=-1;for(r=t.value?r/t.value:0;++c<o;)n(a=u[c],e,l=a.value*r,i),e+=l}}function t(n){var e=n.children,r=0;if(e&&(i=e.length))for(var i,u=-1;++u<i;)r=Math.max(r,t(e[u]));return 1+r}function e(e,u){var o=r.call(this,e,u);return n(o[0],0,i[0],i[1]/t(o[0])),o}var r=ao.layout.hierarchy(),i=[1,1];return e.size=function(n){return arguments.length?(i=n,e):i},ii(e,r)},ao.layout.pie=function(){function n(o){var a,l=o.length,c=o.map(function(e,r){return+t.call(n,e,r)}),f=+("function"==typeof r?r.apply(this,arguments):r),s=("function"==typeof i?i.apply(this,arguments):i)-f,h=Math.min(Math.abs(s)/l,+("function"==typeof u?u.apply(this,arguments):u)),p=h*(0>s?-1:1),g=ao.sum(c),v=g?(s-l*p)/g:0,d=ao.range(l),y=[];return null!=e&&d.sort(e===bl?function(n,t){return c[t]-c[n]}:function(n,t){return e(o[n],o[t])}),d.forEach(function(n){y[n]={data:o[n],value:a=c[n],startAngle:f,endAngle:f+=a*v+p,padAngle:h}}),y}var t=Number,e=bl,r=0,i=Ho,u=0;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(i=t,n):i},n.padAngle=function(t){return arguments.length?(u=t,n):u},n};var bl={};ao.layout.stack=function(){function n(a,l){if(!(h=a.length))return a;var c=a.map(function(e,r){return t.call(n,e,r)}),f=c.map(function(t){return t.map(function(t,e){return[u.call(n,t,e),o.call(n,t,e)]})}),s=e.call(n,f,l);c=ao.permute(c,s),f=ao.permute(f,s);var h,p,g,v,d=r.call(n,f,l),y=c[0].length;for(g=0;y>g;++g)for(i.call(n,c[0][g],v=d[g],f[0][g][1]),p=1;h>p;++p)i.call(n,c[p][g],v+=f[p-1][g][1],f[p][g][1]);return a}var t=m,e=gi,r=vi,i=pi,u=si,o=hi;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:_l.get(t)||gi,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:wl.get(t)||vi,n):r},n.x=function(t){return arguments.length?(u=t,n):u},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(i=t,n):i},n};var _l=ao.map({"inside-out":function(n){var t,e,r=n.length,i=n.map(di),u=n.map(yi),o=ao.range(r).sort(function(n,t){return i[n]-i[t]}),a=0,l=0,c=[],f=[];for(t=0;r>t;++t)e=o[t],l>a?(a+=u[e],c.push(e)):(l+=u[e],f.push(e));return f.reverse().concat(c)},reverse:function(n){return ao.range(n.length).reverse()},"default":gi}),wl=ao.map({silhouette:function(n){var t,e,r,i=n.length,u=n[0].length,o=[],a=0,l=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;u>e;++e)l[e]=(a-o[e])/2;return l},wiggle:function(n){var t,e,r,i,u,o,a,l,c,f=n.length,s=n[0],h=s.length,p=[];for(p[0]=l=c=0,e=1;h>e;++e){for(t=0,i=0;f>t;++t)i+=n[t][e][1];for(t=0,u=0,a=s[e][0]-s[e-1][0];f>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;u+=o*n[t][e][1]}p[e]=l-=i?u/i*a:0,c>l&&(c=l)}for(e=0;h>e;++e)p[e]-=c;return p},expand:function(n){var t,e,r,i=n.length,u=n[0].length,o=1/i,a=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];if(r)for(t=0;i>t;t++)n[t][e][1]/=r;else for(t=0;i>t;t++)n[t][e][1]=o}for(e=0;u>e;++e)a[e]=0;return a},zero:vi});ao.layout.histogram=function(){function n(n,u){for(var o,a,l=[],c=n.map(e,this),f=r.call(this,c,u),s=i.call(this,f,c,u),u=-1,h=c.length,p=s.length-1,g=t?1:1/h;++u<p;)o=l[u]=[],o.dx=s[u+1]-(o.x=s[u]),o.y=0;if(p>0)for(u=-1;++u<h;)a=c[u],a>=f[0]&&a<=f[1]&&(o=l[ao.bisect(s,a,1,p)-1],o.y+=g,o.push(n[u]));return l}var t=!0,e=Number,r=bi,i=Mi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=En(t),n):r},n.bins=function(t){return arguments.length?(i="number"==typeof t?function(n){return xi(n,t)}:En(t),n):i},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},ao.layout.pack=function(){function n(n,u){var o=e.call(this,n,u),a=o[0],l=i[0],c=i[1],f=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,oi(a,function(n){n.r=+f(n.value)}),oi(a,Ni),r){var s=r*(t?1:Math.max(2*a.r/l,2*a.r/c))/2;oi(a,function(n){n.r+=s}),oi(a,Ni),oi(a,function(n){n.r-=s})}return Ci(a,l/2,c/2,t?1:1/Math.max(2*a.r/l,2*a.r/c)),o}var t,e=ao.layout.hierarchy().sort(_i),r=0,i=[1,1];return n.size=function(t){return arguments.length?(i=t,n):i},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},ii(n,e)},ao.layout.tree=function(){function n(n,i){var f=o.call(this,n,i),s=f[0],h=t(s);if(oi(h,e),h.parent.m=-h.z,ui(h,r),c)ui(s,u);else{var p=s,g=s,v=s;ui(s,function(n){n.x<p.x&&(p=n),n.x>g.x&&(g=n),n.depth>v.depth&&(v=n)});var d=a(p,g)/2-p.x,y=l[0]/(g.x+a(g,p)/2+d),m=l[1]/(v.depth||1);ui(s,function(n){n.x=(n.x+d)*y,n.y=n.depth*m})}return f}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var i,u=t.children,o=0,a=u.length;a>o;++o)r.push((u[o]=i={_:u[o],parent:t,children:(i=u[o].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=i);return e.children[0]}function e(n){var t=n.children,e=n.parent.children,r=n.i?e[n.i-1]:null;if(t.length){Di(n);var u=(t[0].z+t[t.length-1].z)/2;r?(n.z=r.z+a(n._,r._),n.m=n.z-u):n.z=u}else r&&(n.z=r.z+a(n._,r._));n.parent.A=i(n,r,n.parent.A||e[0])}function r(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function i(n,t,e){if(t){for(var r,i=n,u=n,o=t,l=i.parent.children[0],c=i.m,f=u.m,s=o.m,h=l.m;o=Ti(o),i=qi(i),o&&i;)l=qi(l),u=Ti(u),u.a=n,r=o.z+s-i.z-c+a(o._,i._),r>0&&(Ri(Pi(o,n,e),n,r),c+=r,f+=r),s+=o.m,c+=i.m,h+=l.m,f+=u.m;o&&!Ti(u)&&(u.t=o,u.m+=s-f),i&&!qi(l)&&(l.t=i,l.m+=c-h,e=n)}return e}function u(n){n.x*=l[0],n.y=n.depth*l[1]}var o=ao.layout.hierarchy().sort(null).value(null),a=Li,l=[1,1],c=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(c=null==(l=t)?u:null,n):c?null:l},n.nodeSize=function(t){return arguments.length?(c=null==(l=t)?null:u,n):c?l:null},ii(n,o)},ao.layout.cluster=function(){function n(n,u){var o,a=t.call(this,n,u),l=a[0],c=0;oi(l,function(n){var t=n.children;t&&t.length?(n.x=ji(t),n.y=Ui(t)):(n.x=o?c+=e(n,o):0,n.y=0,o=n)});var f=Fi(l),s=Hi(l),h=f.x-e(f,s)/2,p=s.x+e(s,f)/2;return oi(l,i?function(n){n.x=(n.x-l.x)*r[0],n.y=(l.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(p-h)*r[0],n.y=(1-(l.y?n.y/l.y:1))*r[1]}),a}var t=ao.layout.hierarchy().sort(null).value(null),e=Li,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},ii(n,t)},ao.layout.treemap=function(){function n(n,t){for(var e,r,i=-1,u=n.length;++i<u;)r=(e=n[i]).value*(0>t?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var u=e.children;if(u&&u.length){var o,a,l,c=s(e),f=[],h=u.slice(),g=1/0,v="slice"===p?c.dx:"dice"===p?c.dy:"slice-dice"===p?1&e.depth?c.dy:c.dx:Math.min(c.dx,c.dy);for(n(h,c.dx*c.dy/e.value),f.area=0;(l=h.length)>0;)f.push(o=h[l-1]),f.area+=o.area,"squarify"!==p||(a=r(f,v))<=g?(h.pop(),g=a):(f.area-=f.pop().area,i(f,v,c,!1),v=Math.min(c.dx,c.dy),f.length=f.area=0,g=1/0);f.length&&(i(f,v,c,!0),f.length=f.area=0),u.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var u,o=s(t),a=r.slice(),l=[];for(n(a,o.dx*o.dy/t.value),l.area=0;u=a.pop();)l.push(u),l.area+=u.area,null!=u.z&&(i(l,u.z?o.dx:o.dy,o,!a.length),l.length=l.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,i=0,u=1/0,o=-1,a=n.length;++o<a;)(e=n[o].area)&&(u>e&&(u=e),e>i&&(i=e));return r*=r,t*=t,r?Math.max(t*i*g/r,r/(t*u*g)):1/0}function i(n,t,e,r){var i,u=-1,o=n.length,a=e.x,c=e.y,f=t?l(n.area/t):0;
if(t==e.dx){for((r||f>e.dy)&&(f=e.dy);++u<o;)i=n[u],i.x=a,i.y=c,i.dy=f,a+=i.dx=Math.min(e.x+e.dx-a,f?l(i.area/f):0);i.z=!0,i.dx+=e.x+e.dx-a,e.y+=f,e.dy-=f}else{for((r||f>e.dx)&&(f=e.dx);++u<o;)i=n[u],i.x=a,i.y=c,i.dx=f,c+=i.dy=Math.min(e.y+e.dy-c,f?l(i.area/f):0);i.z=!1,i.dy+=e.y+e.dy-c,e.x+=f,e.dx-=f}}function u(r){var i=o||a(r),u=i[0];return u.x=u.y=0,u.value?(u.dx=c[0],u.dy=c[1]):u.dx=u.dy=0,o&&a.revalue(u),n([u],u.dx*u.dy/u.value),(o?e:t)(u),h&&(o=i),i}var o,a=ao.layout.hierarchy(),l=Math.round,c=[1,1],f=null,s=Oi,h=!1,p="squarify",g=.5*(1+Math.sqrt(5));return u.size=function(n){return arguments.length?(c=n,u):c},u.padding=function(n){function t(t){var e=n.call(u,t,t.depth);return null==e?Oi(t):Ii(t,"number"==typeof e?[e,e,e,e]:e)}function e(t){return Ii(t,n)}if(!arguments.length)return f;var r;return s=null==(f=n)?Oi:"function"==(r=typeof n)?t:"number"===r?(n=[n,n,n,n],e):e,u},u.round=function(n){return arguments.length?(l=n?Math.round:Number,u):l!=Number},u.sticky=function(n){return arguments.length?(h=n,o=null,u):h},u.ratio=function(n){return arguments.length?(g=n,u):g},u.mode=function(n){return arguments.length?(p=n+"",u):p},ii(u,a)},ao.random={normal:function(n,t){var e=arguments.length;return 2>e&&(t=1),1>e&&(n=0),function(){var e,r,i;do e=2*Math.random()-1,r=2*Math.random()-1,i=e*e+r*r;while(!i||i>1);return n+t*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var n=ao.random.normal.apply(ao,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=ao.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},ao.scale={};var Sl={floor:m,ceil:m};ao.scale.linear=function(){return Wi([0,1],[0,1],Mr,!1)};var kl={s:1,g:1,p:1,r:1,e:1};ao.scale.log=function(){return ru(ao.scale.linear().domain([0,1]),10,!0,[1,10])};var Nl=ao.format(".0e"),El={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};ao.scale.pow=function(){return iu(ao.scale.linear(),1,[0,1])},ao.scale.sqrt=function(){return ao.scale.pow().exponent(.5)},ao.scale.ordinal=function(){return ou([],{t:"range",a:[[]]})},ao.scale.category10=function(){return ao.scale.ordinal().range(Al)},ao.scale.category20=function(){return ao.scale.ordinal().range(Cl)},ao.scale.category20b=function(){return ao.scale.ordinal().range(zl)},ao.scale.category20c=function(){return ao.scale.ordinal().range(Ll)};var Al=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(xn),Cl=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(xn),zl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(xn),Ll=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(xn);ao.scale.quantile=function(){return au([],[])},ao.scale.quantize=function(){return lu(0,1,[0,1])},ao.scale.threshold=function(){return cu([.5],[0,1])},ao.scale.identity=function(){return fu([0,1])},ao.svg={},ao.svg.arc=function(){function n(){var n=Math.max(0,+e.apply(this,arguments)),c=Math.max(0,+r.apply(this,arguments)),f=o.apply(this,arguments)-Io,s=a.apply(this,arguments)-Io,h=Math.abs(s-f),p=f>s?0:1;if(n>c&&(g=c,c=n,n=g),h>=Oo)return t(c,p)+(n?t(n,1-p):"")+"Z";var g,v,d,y,m,M,x,b,_,w,S,k,N=0,E=0,A=[];if((y=(+l.apply(this,arguments)||0)/2)&&(d=u===ql?Math.sqrt(n*n+c*c):+u.apply(this,arguments),p||(E*=-1),c&&(E=tn(d/c*Math.sin(y))),n&&(N=tn(d/n*Math.sin(y)))),c){m=c*Math.cos(f+E),M=c*Math.sin(f+E),x=c*Math.cos(s-E),b=c*Math.sin(s-E);var C=Math.abs(s-f-2*E)<=Fo?0:1;if(E&&yu(m,M,x,b)===p^C){var z=(f+s)/2;m=c*Math.cos(z),M=c*Math.sin(z),x=b=null}}else m=M=0;if(n){_=n*Math.cos(s-N),w=n*Math.sin(s-N),S=n*Math.cos(f+N),k=n*Math.sin(f+N);var L=Math.abs(f-s+2*N)<=Fo?0:1;if(N&&yu(_,w,S,k)===1-p^L){var q=(f+s)/2;_=n*Math.cos(q),w=n*Math.sin(q),S=k=null}}else _=w=0;if(h>Uo&&(g=Math.min(Math.abs(c-n)/2,+i.apply(this,arguments)))>.001){v=c>n^p?0:1;var T=g,R=g;if(Fo>h){var D=null==S?[_,w]:null==x?[m,M]:Re([m,M],[S,k],[x,b],[_,w]),P=m-D[0],U=M-D[1],j=x-D[0],F=b-D[1],H=1/Math.sin(Math.acos((P*j+U*F)/(Math.sqrt(P*P+U*U)*Math.sqrt(j*j+F*F)))/2),O=Math.sqrt(D[0]*D[0]+D[1]*D[1]);R=Math.min(g,(n-O)/(H-1)),T=Math.min(g,(c-O)/(H+1))}if(null!=x){var I=mu(null==S?[_,w]:[S,k],[m,M],c,T,p),Y=mu([x,b],[_,w],c,T,p);g===T?A.push("M",I[0],"A",T,",",T," 0 0,",v," ",I[1],"A",c,",",c," 0 ",1-p^yu(I[1][0],I[1][1],Y[1][0],Y[1][1]),",",p," ",Y[1],"A",T,",",T," 0 0,",v," ",Y[0]):A.push("M",I[0],"A",T,",",T," 0 1,",v," ",Y[0])}else A.push("M",m,",",M);if(null!=S){var Z=mu([m,M],[S,k],n,-R,p),V=mu([_,w],null==x?[m,M]:[x,b],n,-R,p);g===R?A.push("L",V[0],"A",R,",",R," 0 0,",v," ",V[1],"A",n,",",n," 0 ",p^yu(V[1][0],V[1][1],Z[1][0],Z[1][1]),",",1-p," ",Z[1],"A",R,",",R," 0 0,",v," ",Z[0]):A.push("L",V[0],"A",R,",",R," 0 0,",v," ",Z[0])}else A.push("L",_,",",w)}else A.push("M",m,",",M),null!=x&&A.push("A",c,",",c," 0 ",C,",",p," ",x,",",b),A.push("L",_,",",w),null!=S&&A.push("A",n,",",n," 0 ",L,",",1-p," ",S,",",k);return A.push("Z"),A.join("")}function t(n,t){return"M0,"+n+"A"+n+","+n+" 0 1,"+t+" 0,"+-n+"A"+n+","+n+" 0 1,"+t+" 0,"+n}var e=hu,r=pu,i=su,u=ql,o=gu,a=vu,l=du;return n.innerRadius=function(t){return arguments.length?(e=En(t),n):e},n.outerRadius=function(t){return arguments.length?(r=En(t),n):r},n.cornerRadius=function(t){return arguments.length?(i=En(t),n):i},n.padRadius=function(t){return arguments.length?(u=t==ql?ql:En(t),n):u},n.startAngle=function(t){return arguments.length?(o=En(t),n):o},n.endAngle=function(t){return arguments.length?(a=En(t),n):a},n.padAngle=function(t){return arguments.length?(l=En(t),n):l},n.centroid=function(){var n=(+e.apply(this,arguments)+ +r.apply(this,arguments))/2,t=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-Io;return[Math.cos(t)*n,Math.sin(t)*n]},n};var ql="auto";ao.svg.line=function(){return Mu(m)};var Tl=ao.map({linear:xu,"linear-closed":bu,step:_u,"step-before":wu,"step-after":Su,basis:zu,"basis-open":Lu,"basis-closed":qu,bundle:Tu,cardinal:Eu,"cardinal-open":ku,"cardinal-closed":Nu,monotone:Fu});Tl.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var Rl=[0,2/3,1/3,0],Dl=[0,1/3,2/3,0],Pl=[0,1/6,2/3,1/6];ao.svg.line.radial=function(){var n=Mu(Hu);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},wu.reverse=Su,Su.reverse=wu,ao.svg.area=function(){return Ou(m)},ao.svg.area.radial=function(){var n=Ou(Hu);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},ao.svg.chord=function(){function n(n,a){var l=t(this,u,n,a),c=t(this,o,n,a);return"M"+l.p0+r(l.r,l.p1,l.a1-l.a0)+(e(l,c)?i(l.r,l.p1,l.r,l.p0):i(l.r,l.p1,c.r,c.p0)+r(c.r,c.p1,c.a1-c.a0)+i(c.r,c.p1,l.r,l.p0))+"Z"}function t(n,t,e,r){var i=t.call(n,e,r),u=a.call(n,i,r),o=l.call(n,i,r)-Io,f=c.call(n,i,r)-Io;return{r:u,a0:o,a1:f,p0:[u*Math.cos(o),u*Math.sin(o)],p1:[u*Math.cos(f),u*Math.sin(f)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>Fo)+",1 "+t}function i(n,t,e,r){return"Q 0,0 "+r}var u=Me,o=xe,a=Iu,l=gu,c=vu;return n.radius=function(t){return arguments.length?(a=En(t),n):a},n.source=function(t){return arguments.length?(u=En(t),n):u},n.target=function(t){return arguments.length?(o=En(t),n):o},n.startAngle=function(t){return arguments.length?(l=En(t),n):l},n.endAngle=function(t){return arguments.length?(c=En(t),n):c},n},ao.svg.diagonal=function(){function n(n,i){var u=t.call(this,n,i),o=e.call(this,n,i),a=(u.y+o.y)/2,l=[u,{x:u.x,y:a},{x:o.x,y:a},o];return l=l.map(r),"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var t=Me,e=xe,r=Yu;return n.source=function(e){return arguments.length?(t=En(e),n):t},n.target=function(t){return arguments.length?(e=En(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},ao.svg.diagonal.radial=function(){var n=ao.svg.diagonal(),t=Yu,e=n.projection;return n.projection=function(n){return arguments.length?e(Zu(t=n)):t},n},ao.svg.symbol=function(){function n(n,r){return(Ul.get(t.call(this,n,r))||$u)(e.call(this,n,r))}var t=Xu,e=Vu;return n.type=function(e){return arguments.length?(t=En(e),n):t},n.size=function(t){return arguments.length?(e=En(t),n):e},n};var Ul=ao.map({circle:$u,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*Fl)),e=t*Fl;return"M0,"+-t+"L"+e+",0 0,"+t+" "+-e+",0Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/jl),e=t*jl/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/jl),e=t*jl/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});ao.svg.symbolTypes=Ul.keys();var jl=Math.sqrt(3),Fl=Math.tan(30*Yo);Co.transition=function(n){for(var t,e,r=Hl||++Zl,i=Ku(n),u=[],o=Ol||{time:Date.now(),ease:Nr,delay:0,duration:250},a=-1,l=this.length;++a<l;){u.push(t=[]);for(var c=this[a],f=-1,s=c.length;++f<s;)(e=c[f])&&Qu(e,f,i,r,o),t.push(e)}return Wu(u,i,r)},Co.interrupt=function(n){return this.each(null==n?Il:Bu(Ku(n)))};var Hl,Ol,Il=Bu(Ku()),Yl=[],Zl=0;Yl.call=Co.call,Yl.empty=Co.empty,Yl.node=Co.node,Yl.size=Co.size,ao.transition=function(n,t){return n&&n.transition?Hl?n.transition(t):n:ao.selection().transition(n)},ao.transition.prototype=Yl,Yl.select=function(n){var t,e,r,i=this.id,u=this.namespace,o=[];n=A(n);for(var a=-1,l=this.length;++a<l;){o.push(t=[]);for(var c=this[a],f=-1,s=c.length;++f<s;)(r=c[f])&&(e=n.call(r,r.__data__,f,a))?("__data__"in r&&(e.__data__=r.__data__),Qu(e,f,u,i,r[u][i]),t.push(e)):t.push(null)}return Wu(o,u,i)},Yl.selectAll=function(n){var t,e,r,i,u,o=this.id,a=this.namespace,l=[];n=C(n);for(var c=-1,f=this.length;++c<f;)for(var s=this[c],h=-1,p=s.length;++h<p;)if(r=s[h]){u=r[a][o],e=n.call(r,r.__data__,h,c),l.push(t=[]);for(var g=-1,v=e.length;++g<v;)(i=e[g])&&Qu(i,g,a,o,u),t.push(i)}return Wu(l,a,o)},Yl.filter=function(n){var t,e,r,i=[];"function"!=typeof n&&(n=O(n));for(var u=0,o=this.length;o>u;u++){i.push(t=[]);for(var e=this[u],a=0,l=e.length;l>a;a++)(r=e[a])&&n.call(r,r.__data__,a,u)&&t.push(r)}return Wu(i,this.namespace,this.id)},Yl.tween=function(n,t){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(n):Y(this,null==t?function(t){t[r][e].tween.remove(n)}:function(i){i[r][e].tween.set(n,t)})},Yl.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function i(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function u(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?$r:Mr,a=ao.ns.qualify(n);return Ju(this,"attr."+n,t,a.local?u:i)},Yl.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(i));return r&&function(n){this.setAttribute(i,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(i.space,i.local));return r&&function(n){this.setAttributeNS(i.space,i.local,r(n))}}var i=ao.ns.qualify(n);return this.tween("attr."+n,i.local?r:e)},Yl.style=function(n,e,r){function i(){this.style.removeProperty(n)}function u(e){return null==e?i:(e+="",function(){var i,u=t(this).getComputedStyle(this,null).getPropertyValue(n);return u!==e&&(i=Mr(u,e),function(t){this.style.setProperty(n,i(t),r)})})}var o=arguments.length;if(3>o){if("string"!=typeof n){2>o&&(e="");for(r in n)this.style(r,n[r],e);return this}r=""}return Ju(this,"style."+n,e,u)},Yl.styleTween=function(n,e,r){function i(i,u){var o=e.call(this,i,u,t(this).getComputedStyle(this,null).getPropertyValue(n));return o&&function(t){this.style.setProperty(n,o(t),r)}}return arguments.length<3&&(r=""),this.tween("style."+n,i)},Yl.text=function(n){return Ju(this,"text",n,Gu)},Yl.remove=function(){var n=this.namespace;return this.each("end.transition",function(){var t;this[n].count<2&&(t=this.parentNode)&&t.removeChild(this)})},Yl.ease=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].ease:("function"!=typeof n&&(n=ao.ease.apply(ao,arguments)),Y(this,function(r){r[e][t].ease=n}))},Yl.delay=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].delay:Y(this,"function"==typeof n?function(r,i,u){r[e][t].delay=+n.call(r,r.__data__,i,u)}:(n=+n,function(r){r[e][t].delay=n}))},Yl.duration=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].duration:Y(this,"function"==typeof n?function(r,i,u){r[e][t].duration=Math.max(1,n.call(r,r.__data__,i,u))}:(n=Math.max(1,n),function(r){r[e][t].duration=n}))},Yl.each=function(n,t){var e=this.id,r=this.namespace;if(arguments.length<2){var i=Ol,u=Hl;try{Hl=e,Y(this,function(t,i,u){Ol=t[r][e],n.call(t,t.__data__,i,u)})}finally{Ol=i,Hl=u}}else Y(this,function(i){var u=i[r][e];(u.event||(u.event=ao.dispatch("start","end","interrupt"))).on(n,t)});return this},Yl.transition=function(){for(var n,t,e,r,i=this.id,u=++Zl,o=this.namespace,a=[],l=0,c=this.length;c>l;l++){a.push(n=[]);for(var t=this[l],f=0,s=t.length;s>f;f++)(e=t[f])&&(r=e[o][i],Qu(e,f,o,u,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),n.push(e)}return Wu(a,o,u)},ao.svg.axis=function(){function n(n){n.each(function(){var n,c=ao.select(this),f=this.__chart__||e,s=this.__chart__=e.copy(),h=null==l?s.ticks?s.ticks.apply(s,a):s.domain():l,p=null==t?s.tickFormat?s.tickFormat.apply(s,a):m:t,g=c.selectAll(".tick").data(h,s),v=g.enter().insert("g",".domain").attr("class","tick").style("opacity",Uo),d=ao.transition(g.exit()).style("opacity",Uo).remove(),y=ao.transition(g.order()).style("opacity",1),M=Math.max(i,0)+o,x=Zi(s),b=c.selectAll(".domain").data([0]),_=(b.enter().append("path").attr("class","domain"),ao.transition(b));v.append("line"),v.append("text");var w,S,k,N,E=v.select("line"),A=y.select("line"),C=g.select("text").text(p),z=v.select("text"),L=y.select("text"),q="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(n=no,w="x",k="y",S="x2",N="y2",C.attr("dy",0>q?"0em":".71em").style("text-anchor","middle"),_.attr("d","M"+x[0]+","+q*u+"V0H"+x[1]+"V"+q*u)):(n=to,w="y",k="x",S="y2",N="x2",C.attr("dy",".32em").style("text-anchor",0>q?"end":"start"),_.attr("d","M"+q*u+","+x[0]+"H0V"+x[1]+"H"+q*u)),E.attr(N,q*i),z.attr(k,q*M),A.attr(S,0).attr(N,q*i),L.attr(w,0).attr(k,q*M),s.rangeBand){var T=s,R=T.rangeBand()/2;f=s=function(n){return T(n)+R}}else f.rangeBand?f=s:d.call(n,s,f);v.call(n,f,s),y.call(n,s,s)})}var t,e=ao.scale.linear(),r=Vl,i=6,u=6,o=3,a=[10],l=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Xl?t+"":Vl,n):r},n.ticks=function(){return arguments.length?(a=co(arguments),n):a},n.tickValues=function(t){return arguments.length?(l=t,n):l},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(i=+t,u=+arguments[e-1],n):i},n.innerTickSize=function(t){return arguments.length?(i=+t,n):i},n.outerTickSize=function(t){return arguments.length?(u=+t,n):u},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var Vl="bottom",Xl={top:1,right:1,bottom:1,left:1};ao.svg.brush=function(){function n(t){t.each(function(){var t=ao.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",u).on("touchstart.brush",u),o=t.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=t.selectAll(".resize").data(v,m);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return $l[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var l,s=ao.transition(t),h=ao.transition(o);c&&(l=Zi(c),h.attr("x",l[0]).attr("width",l[1]-l[0]),r(s)),f&&(l=Zi(f),h.attr("y",l[0]).attr("height",l[1]-l[0]),i(s)),e(s)})}function e(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+s[+/e$/.test(n)]+","+h[+/^s/.test(n)]+")"})}function r(n){n.select(".extent").attr("x",s[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",s[1]-s[0])}function i(n){n.select(".extent").attr("y",h[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function u(){function u(){32==ao.event.keyCode&&(C||(M=null,L[0]-=s[1],L[1]-=h[1],C=2),S())}function v(){32==ao.event.keyCode&&2==C&&(L[0]+=s[1],L[1]+=h[1],C=0,S())}function d(){var n=ao.mouse(b),t=!1;x&&(n[0]+=x[0],n[1]+=x[1]),C||(ao.event.altKey?(M||(M=[(s[0]+s[1])/2,(h[0]+h[1])/2]),L[0]=s[+(n[0]<M[0])],L[1]=h[+(n[1]<M[1])]):M=null),E&&y(n,c,0)&&(r(k),t=!0),A&&y(n,f,1)&&(i(k),t=!0),t&&(e(k),w({type:"brush",mode:C?"move":"resize"}))}function y(n,t,e){var r,i,u=Zi(t),l=u[0],c=u[1],f=L[e],v=e?h:s,d=v[1]-v[0];return C&&(l-=f,c-=d+f),r=(e?g:p)?Math.max(l,Math.min(c,n[e])):n[e],C?i=(r+=f)+d:(M&&(f=Math.max(l,Math.min(c,2*M[e]-r))),r>f?(i=r,r=f):i=f),v[0]!=r||v[1]!=i?(e?a=null:o=null,v[0]=r,v[1]=i,!0):void 0}function m(){d(),k.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),ao.select("body").style("cursor",null),q.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),z(),w({type:"brushend"})}var M,x,b=this,_=ao.select(ao.event.target),w=l.of(b,arguments),k=ao.select(b),N=_.datum(),E=!/^(n|s)$/.test(N)&&c,A=!/^(e|w)$/.test(N)&&f,C=_.classed("extent"),z=W(b),L=ao.mouse(b),q=ao.select(t(b)).on("keydown.brush",u).on("keyup.brush",v);if(ao.event.changedTouches?q.on("touchmove.brush",d).on("touchend.brush",m):q.on("mousemove.brush",d).on("mouseup.brush",m),k.interrupt().selectAll("*").interrupt(),C)L[0]=s[0]-L[0],L[1]=h[0]-L[1];else if(N){var T=+/w$/.test(N),R=+/^n/.test(N);x=[s[1-T]-L[0],h[1-R]-L[1]],L[0]=s[T],L[1]=h[R]}else ao.event.altKey&&(M=L.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),ao.select("body").style("cursor",_.style("cursor")),w({type:"brushstart"}),d()}var o,a,l=N(n,"brushstart","brush","brushend"),c=null,f=null,s=[0,0],h=[0,0],p=!0,g=!0,v=Bl[0];return n.event=function(n){n.each(function(){var n=l.of(this,arguments),t={x:s,y:h,i:o,j:a},e=this.__chart__||t;this.__chart__=t,Hl?ao.select(this).transition().each("start.brush",function(){o=e.i,a=e.j,s=e.x,h=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=xr(s,t.x),r=xr(h,t.y);return o=a=null,function(i){s=t.x=e(i),h=t.y=r(i),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=t.i,a=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,v=Bl[!c<<1|!f],n):c},n.y=function(t){return arguments.length?(f=t,v=Bl[!c<<1|!f],n):f},n.clamp=function(t){return arguments.length?(c&&f?(p=!!t[0],g=!!t[1]):c?p=!!t:f&&(g=!!t),n):c&&f?[p,g]:c?p:f?g:null},n.extent=function(t){var e,r,i,u,l;return arguments.length?(c&&(e=t[0],r=t[1],f&&(e=e[0],r=r[0]),o=[e,r],c.invert&&(e=c(e),r=c(r)),e>r&&(l=e,e=r,r=l),e==s[0]&&r==s[1]||(s=[e,r])),f&&(i=t[0],u=t[1],c&&(i=i[1],u=u[1]),a=[i,u],f.invert&&(i=f(i),u=f(u)),i>u&&(l=i,i=u,u=l),i==h[0]&&u==h[1]||(h=[i,u])),n):(c&&(o?(e=o[0],r=o[1]):(e=s[0],r=s[1],c.invert&&(e=c.invert(e),r=c.invert(r)),e>r&&(l=e,e=r,r=l))),f&&(a?(i=a[0],u=a[1]):(i=h[0],u=h[1],f.invert&&(i=f.invert(i),u=f.invert(u)),i>u&&(l=i,i=u,u=l))),c&&f?[[e,i],[r,u]]:c?[e,r]:f&&[i,u])},n.clear=function(){return n.empty()||(s=[0,0],h=[0,0],o=a=null),n},n.empty=function(){return!!c&&s[0]==s[1]||!!f&&h[0]==h[1]},ao.rebind(n,l,"on")};var $l={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Bl=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Wl=ga.format=xa.timeFormat,Jl=Wl.utc,Gl=Jl("%Y-%m-%dT%H:%M:%S.%LZ");Wl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?eo:Gl,eo.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},eo.toString=Gl.toString,ga.second=On(function(n){return new va(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),ga.seconds=ga.second.range,ga.seconds.utc=ga.second.utc.range,ga.minute=On(function(n){return new va(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),ga.minutes=ga.minute.range,ga.minutes.utc=ga.minute.utc.range,ga.hour=On(function(n){var t=n.getTimezoneOffset()/60;return new va(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),ga.hours=ga.hour.range,ga.hours.utc=ga.hour.utc.range,ga.month=On(function(n){return n=ga.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),ga.months=ga.month.range,ga.months.utc=ga.month.utc.range;var Kl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Ql=[[ga.second,1],[ga.second,5],[ga.second,15],[ga.second,30],[ga.minute,1],[ga.minute,5],[ga.minute,15],[ga.minute,30],[ga.hour,1],[ga.hour,3],[ga.hour,6],[ga.hour,12],[ga.day,1],[ga.day,2],[ga.week,1],[ga.month,1],[ga.month,3],[ga.year,1]],nc=Wl.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",zt]]),tc={range:function(n,t,e){return ao.range(Math.ceil(n/e)*e,+t,e).map(io)},floor:m,ceil:m};Ql.year=ga.year,ga.scale=function(){return ro(ao.scale.linear(),Ql,nc)};var ec=Ql.map(function(n){return[n[0].utc,n[1]]}),rc=Jl.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",zt]]);ec.year=ga.year.utc,ga.scale.utc=function(){return ro(ao.scale.linear(),ec,rc)},ao.text=An(function(n){return n.responseText}),ao.json=function(n,t){return Cn(n,"application/json",uo,t)},ao.html=function(n,t){return Cn(n,"text/html",oo,t)},ao.xml=An(function(n){return n.responseXML}),"function"==typeof define&&define.amd?(this.d3=ao,define(ao)):"object"==typeof module&&module.exports?module.exports=ao:this.d3=ao}();!function(e){function t(a){if(n[a])return n[a].exports;var o=n[a]={i:a,l:!1,exports:{}};return e[a].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=45)}([function(e,t,n){"use strict";e.exports=n(48)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=n(49);Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return a(r).default}});var i=n(31);Object.defineProperty(t,"once",{enumerable:!0,get:function(){return a(i).default}});var l=n(32);Object.defineProperty(t,"memoize",{enumerable:!0,get:function(){return a(l).default}});var s=n(85);Object.defineProperty(t,"flatten",{enumerable:!0,get:function(){return a(s).default}});var u=n(92);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var c=n(93);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})});var d=n(94);Object.defineProperty(t,"ReactInvokeBridge",{enumerable:!0,get:function(){return a(d).default}});t.equal=function e(t,n){if(t===n)return!0;var a=Array.isArray(t),r=Array.isArray(n),i=void 0;if(a&&r){if(t.length!==n.length)return!1;for(i=0;i<t.length;i++)if(!e(t[i],n[i]))return!1;return!0}if(a!=r)return!1;if(t&&n&&"object"===(void 0===t?"undefined":o(t))&&"object"===(void 0===n?"undefined":o(n))){var l=Object.keys(t);if(l.length!==Object.keys(n).length)return!1;var s=t instanceof Date,u=n instanceof Date;if(s&&u)return t.getTime()==n.getTime();if(s!=u)return!1;var c=t instanceof RegExp,d=n instanceof RegExp;if(c&&d)return t.toString()==n.toString();if(c!=d)return!1;for(i=0;i<l.length;i++)if(!Object.prototype.hasOwnProperty.call(n,l[i]))return!1;for(i=0;i<l.length;i++)if(!e(t[l[i]],n[l[i]]))return!1;return!0}return!1},t.humanize=function(e){var t=navigator.language||navigator.userLanguage||"en",n=new Date,a=new Date(e),r=n.getTime(),i=a.getTime();if(isNaN(i))return"Invalid Date";if(i>r)return"From the Future";if("object"!==("undefined"==typeof Intl?"undefined":o(Intl))||"function"!=typeof Intl.DateTimeFormat)return a.getHours()+":"+a.getMinutes()+" "+a.toLocaleDateString();if(i>r-1728e5){var l=new Date(Date.now()-864e5),s=a.getMonth()+"-"+a.getDate(),u=n.getMonth()+"-"+n.getDate(),c=l.getMonth()+"-"+l.getDate(),d=new Intl.DateTimeFormat(t,{minute:"numeric",hour:"numeric"}).format(a);if(s===u)return d+" Today";if(s===c)return d+" Yesterday"}return new Intl.DateTimeFormat(t,{minute:"numeric",hour:"numeric",day:"numeric",month:"short",year:a.getFullYear()===n.getFullYear()?void 0:"numeric"}).format(a)},t.rect=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.x,a=void 0===n?0:n,o=t.y,r=void 0===o?0:o,i=e.getClientRects();if(!i.length)return{x:0,y:0,width:0,height:0};var l=Array.from(i).reduce(function(e,t){return e.left=Math.min(e.left,t.left),e.top=Math.min(e.top,t.top),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right),e},{left:1/0,top:1/0,bottom:-1/0,right:-1/0});return{x:window.scrollX+l.left+a,y:window.scrollY+l.top+r,width:Math.abs(l.right-l.left),height:Math.abs(l.bottom-l.top)}}},function(e,t,n){(function(t){!function(t,n){e.exports=n()}(0,function(){"use strict";function e(e,t){return t={exports:{}},e(t,t.exports),t.exports}var n=function(e){var t=e.id,n=e.viewBox,a=e.content;this.id=t,this.viewBox=n,this.content=a};n.prototype.stringify=function(){return this.content},n.prototype.toString=function(){return this.stringify()},n.prototype.destroy=function(){var e=this;["id","viewBox","content"].forEach(function(t){return delete e[t]})};var a=function(e){var t=!!document.importNode,n=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement;return t?document.importNode(n,!0):n},o=("undefined"!=typeof window?window:void 0!==t||"undefined"!=typeof self&&self,e(function(e,t){!function(t,n){e.exports=n()}(0,function(){function e(e){return e&&"object"==typeof e&&"[object RegExp]"!==Object.prototype.toString.call(e)&&"[object Date]"!==Object.prototype.toString.call(e)}function t(e){return Array.isArray(e)?[]:{}}function n(n,a){return a&&!0===a.clone&&e(n)?r(t(n),n,a):n}function a(t,a,o){var i=t.slice();return a.forEach(function(a,l){void 0===i[l]?i[l]=n(a,o):e(a)?i[l]=r(t[l],a,o):-1===t.indexOf(a)&&i.push(n(a,o))}),i}function o(t,a,o){var i={};return e(t)&&Object.keys(t).forEach(function(e){i[e]=n(t[e],o)}),Object.keys(a).forEach(function(l){e(a[l])&&t[l]?i[l]=r(t[l],a[l],o):i[l]=n(a[l],o)}),i}function r(e,t,r){var i=Array.isArray(t),l=r||{arrayMerge:a},s=l.arrayMerge||a;return i?Array.isArray(e)?s(e,t,r):n(t,r):o(e,t,r)}return r.all=function(e,t){if(!Array.isArray(e)||e.length<2)throw new Error("first argument should be an array with at least two elements");return e.reduce(function(e,n){return r(e,n,t)})},r})})),r=e(function(e,t){var n={svg:{name:"xmlns",uri:"http://www.w3.org/2000/svg"},xlink:{name:"xmlns:xlink",uri:"http://www.w3.org/1999/xlink"}};t.default=n,e.exports=t.default}),i=function(e){return Object.keys(e).map(function(t){return t+'="'+e[t].toString().replace(/"/g,"&quot;")+'"'}).join(" ")},l=r.svg,s=r.xlink,u={};u[l.name]=l.uri,u[s.name]=s.uri;var c=function(e,t){void 0===e&&(e="");var n=o(u,t||{});return"<svg "+i(n)+">"+e+"</svg>"};return function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={isMounted:{}};return n.isMounted.get=function(){return!!this.node},t.createFromExistingNode=function(e){return new t({id:e.getAttribute("id"),viewBox:e.getAttribute("viewBox"),content:e.outerHTML})},t.prototype.destroy=function(){this.isMounted&&this.unmount(),e.prototype.destroy.call(this)},t.prototype.mount=function(e){if(this.isMounted)return this.node;var t="string"==typeof e?document.querySelector(e):e,n=this.render();return this.node=n,t.appendChild(n),n},t.prototype.render=function(){var e=this.stringify();return a(c(e)).childNodes[0]},t.prototype.unmount=function(){this.node.parentNode.removeChild(this.node)},Object.defineProperties(t.prototype,n),t}(n)})}).call(t,n(22))},function(e,t,n){(function(t){!function(t,n){e.exports=n()}(0,function(){"use strict";function e(e,t){return t={exports:{}},e(t,t.exports),t.exports}function n(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).map(function(e){e(n)}),(e["*"]||[]).map(function(e){e(t,n)})}}}function a(e,t){return w(e).reduce(function(e,n){if(!n.attributes)return e;var a=w(n.attributes),o=t?a.filter(t):a;return e.concat(o)},[])}function o(e){return e.replace(j,function(e){return"%"+e[0].charCodeAt(0).toString(16).toUpperCase()})}function r(e,t,n){return w(e).forEach(function(e){var a=e.getAttribute(N);if(a&&0===a.indexOf(t)){var o=a.replace(t,n);e.setAttributeNS(L,N,o)}}),e}var i=("undefined"!=typeof window?window:void 0!==t||"undefined"!=typeof self&&self,e(function(e,t){!function(t,n){e.exports=n()}(0,function(){function e(e){return e&&"object"==typeof e&&"[object RegExp]"!==Object.prototype.toString.call(e)&&"[object Date]"!==Object.prototype.toString.call(e)}function t(e){return Array.isArray(e)?[]:{}}function n(n,a){return a&&!0===a.clone&&e(n)?r(t(n),n,a):n}function a(t,a,o){var i=t.slice();return a.forEach(function(a,l){void 0===i[l]?i[l]=n(a,o):e(a)?i[l]=r(t[l],a,o):-1===t.indexOf(a)&&i.push(n(a,o))}),i}function o(t,a,o){var i={};return e(t)&&Object.keys(t).forEach(function(e){i[e]=n(t[e],o)}),Object.keys(a).forEach(function(l){e(a[l])&&t[l]?i[l]=r(t[l],a[l],o):i[l]=n(a[l],o)}),i}function r(e,t,r){var i=Array.isArray(t),l=r||{arrayMerge:a},s=l.arrayMerge||a;return i?Array.isArray(e)?s(e,t,r):n(t,r):o(e,t,r)}return r.all=function(e,t){if(!Array.isArray(e)||e.length<2)throw new Error("first argument should be an array with at least two elements");return e.reduce(function(e,n){return r(e,n,t)})},r})})),l=e(function(e,t){var n={svg:{name:"xmlns",uri:"http://www.w3.org/2000/svg"},xlink:{name:"xmlns:xlink",uri:"http://www.w3.org/1999/xlink"}};t.default=n,e.exports=t.default}),s=function(e){return Object.keys(e).map(function(t){return t+'="'+e[t].toString().replace(/"/g,"&quot;")+'"'}).join(" ")},u=l.svg,c=l.xlink,d={};d[u.name]=u.uri,d[c.name]=c.uri;var p,f=function(e,t){void 0===e&&(e="");var n=i(d,t||{});return"<svg "+s(n)+">"+e+"</svg>"},m=l.svg,h=l.xlink,v={attrs:(p={style:["position: absolute","width: 0","height: 0"].join("; ")},p[m.name]=m.uri,p[h.name]=h.uri,p)},g=function(e){this.config=i(v,e||{}),this.symbols=[]};g.prototype.add=function(e){var t=this,n=t.symbols,a=this.find(e.id);return a?(n[n.indexOf(a)]=e,!1):(n.push(e),!0)},g.prototype.remove=function(e){var t=this,n=t.symbols,a=this.find(e);return!!a&&(n.splice(n.indexOf(a),1),a.destroy(),!0)},g.prototype.find=function(e){return this.symbols.filter(function(t){return t.id===e})[0]||null},g.prototype.has=function(e){return null!==this.find(e)},g.prototype.stringify=function(){var e=this.config,t=e.attrs,n=this.symbols.map(function(e){return e.stringify()}).join("");return f(n,t)},g.prototype.toString=function(){return this.stringify()},g.prototype.destroy=function(){this.symbols.forEach(function(e){return e.destroy()})};var y=function(e){var t=e.id,n=e.viewBox,a=e.content;this.id=t,this.viewBox=n,this.content=a};y.prototype.stringify=function(){return this.content},y.prototype.toString=function(){return this.stringify()},y.prototype.destroy=function(){var e=this;["id","viewBox","content"].forEach(function(t){return delete e[t]})};var b,x=function(e){var t=!!document.importNode,n=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement;return t?document.importNode(n,!0):n},_=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={isMounted:{}};return n.isMounted.get=function(){return!!this.node},t.createFromExistingNode=function(e){return new t({id:e.getAttribute("id"),viewBox:e.getAttribute("viewBox"),content:e.outerHTML})},t.prototype.destroy=function(){this.isMounted&&this.unmount(),e.prototype.destroy.call(this)},t.prototype.mount=function(e){if(this.isMounted)return this.node;var t="string"==typeof e?document.querySelector(e):e,n=this.render();return this.node=n,t.appendChild(n),n},t.prototype.render=function(){var e=this.stringify();return x(f(e)).childNodes[0]},t.prototype.unmount=function(){this.node.parentNode.removeChild(this.node)},Object.defineProperties(t.prototype,n),t}(y),k={autoConfigure:!0,mountTo:"body",syncUrlsWithBaseTag:!1,listenLocationChangeEvent:!0,locationChangeEvent:"locationChange",locationChangeAngularEmitter:!1,usagesToUpdate:"use[*|href]",moveGradientsOutsideSymbol:!1},w=function(e){return Array.prototype.slice.call(e,0)},C=navigator.userAgent,E={isChrome:/chrome/i.test(C),isFirefox:/firefox/i.test(C),isIE:/msie/i.test(C)||/trident/i.test(C),isEdge:/edge/i.test(C)},T=function(e,t){var n=document.createEvent("CustomEvent");n.initCustomEvent(e,!1,!1,t),window.dispatchEvent(n)},O=function(e){var t=[];return w(e.querySelectorAll("style")).forEach(function(e){e.textContent+="",t.push(e)}),t},S=function(e){return(e||window.location.href).split("#")[0]},P=function(e){angular.module("ng").run(["$rootScope",function(t){t.$on("$locationChangeSuccess",function(t,n,a){T(e,{oldUrl:a,newUrl:n})})}])},M=function(e,t){return void 0===t&&(t="linearGradient, radialGradient, pattern"),w(e.querySelectorAll("symbol")).forEach(function(e){w(e.querySelectorAll(t)).forEach(function(t){e.parentNode.insertBefore(t,e)})}),e},L=l.xlink.uri,N="xlink:href",j=/[{}|\\\^\[\]`"<>]/g,A=["clipPath","colorProfile","src","cursor","fill","filter","marker","markerStart","markerMid","markerEnd","mask","stroke","style"],D=A.map(function(e){return"["+e+"]"}).join(","),R=function(e,t,n,i){var l=o(n),s=o(i);a(e.querySelectorAll(D),function(e){var t=e.localName,n=e.value;return-1!==A.indexOf(t)&&-1!==n.indexOf("url("+l)}).forEach(function(e){return e.value=e.value.replace(l,s)}),r(t,l,s)},I={MOUNT:"mount",SYMBOL_MOUNT:"symbol_mount"},F=function(e){function t(t){var a=this;void 0===t&&(t={}),e.call(this,i(k,t));var o=n();this._emitter=o,this.node=null;var r=this,l=r.config;if(l.autoConfigure&&this._autoConfigure(t),l.syncUrlsWithBaseTag){var s=document.getElementsByTagName("base")[0].getAttribute("href");o.on(I.MOUNT,function(){return a.updateUrls("#",s)})}var u=this._handleLocationChange.bind(this);this._handleLocationChange=u,l.listenLocationChangeEvent&&window.addEventListener(l.locationChangeEvent,u),l.locationChangeAngularEmitter&&P(l.locationChangeEvent),o.on(I.MOUNT,function(e){l.moveGradientsOutsideSymbol&&M(e)}),o.on(I.SYMBOL_MOUNT,function(e){l.moveGradientsOutsideSymbol&&M(e.parentNode),(E.isIE||E.isEdge)&&O(e)})}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var a={isMounted:{}};return a.isMounted.get=function(){return!!this.node},t.prototype._autoConfigure=function(e){var t=this,n=t.config;void 0===e.syncUrlsWithBaseTag&&(n.syncUrlsWithBaseTag=void 0!==document.getElementsByTagName("base")[0]),void 0===e.locationChangeAngularEmitter&&(n.locationChangeAngularEmitter="angular"in window),void 0===e.moveGradientsOutsideSymbol&&(n.moveGradientsOutsideSymbol=E.isFirefox)},t.prototype._handleLocationChange=function(e){var t=e.detail,n=t.oldUrl,a=t.newUrl;this.updateUrls(n,a)},t.prototype.add=function(t){var n=this,a=e.prototype.add.call(this,t);return this.isMounted&&a&&(t.mount(n.node),this._emitter.emit(I.SYMBOL_MOUNT,t.node)),a},t.prototype.attach=function(e){var t=this,n=this;if(n.isMounted)return n.node;var a="string"==typeof e?document.querySelector(e):e;return n.node=a,this.symbols.forEach(function(e){e.mount(n.node),t._emitter.emit(I.SYMBOL_MOUNT,e.node)}),w(a.querySelectorAll("symbol")).forEach(function(e){var t=_.createFromExistingNode(e);t.node=e,n.add(t)}),this._emitter.emit(I.MOUNT,a),a},t.prototype.destroy=function(){var e=this,t=e.config,n=e.symbols,a=e._emitter;n.forEach(function(e){return e.destroy()}),a.off("*"),window.removeEventListener(t.locationChangeEvent,this._handleLocationChange),this.isMounted&&this.unmount()},t.prototype.mount=function(e,t){void 0===e&&(e=this.config.mountTo),void 0===t&&(t=!1);var n=this;if(n.isMounted)return n.node;var a="string"==typeof e?document.querySelector(e):e,o=n.render();return this.node=o,t&&a.childNodes[0]?a.insertBefore(o,a.childNodes[0]):a.appendChild(o),this._emitter.emit(I.MOUNT,o),o},t.prototype.render=function(){return x(this.stringify())},t.prototype.unmount=function(){this.node.parentNode.removeChild(this.node)},t.prototype.updateUrls=function(e,t){if(!this.isMounted)return!1;var n=document.querySelectorAll(this.config.usagesToUpdate);return R(this.node,n,S(e)+"#",S(t)+"#"),!0},Object.defineProperties(t.prototype,a),t}(g),U=e(function(e){/*!
  * domready (c) Dustin Diaz 2014 - License MIT
  */
!function(t,n){e.exports=function(){var e,t=[],n=document,a=n.documentElement.doScroll,o=(a?/^loaded|^c/:/^loaded|^i|^c/).test(n.readyState);return o||n.addEventListener("DOMContentLoaded",e=function(){for(n.removeEventListener("DOMContentLoaded",e),o=1;e=t.shift();)e()}),function(e){o?setTimeout(e,0):t.push(e)}}()}()}),z=!!window.__SVG_SPRITE__;z?b=window.__SVG_SPRITE__:(b=new F({attrs:{id:"__SVG_SPRITE_NODE__"}}),window.__SVG_SPRITE__=b);var B=function(){var e=document.getElementById("__SVG_SPRITE_NODE__");e?b.attach(e):b.mount(document.body,!0)};return document.body?B():U(B),b})}).call(t,n(22))},function(e,t){function n(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var r=a(o);return[n].concat(o.sources.map(function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"})).concat([r]).join("\n")}return[n].join("\n")}function a(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var a=n(t,e);return t[2]?"@media "+t[2]+"{"+a+"}":a}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var a={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(a[r]=!0)}for(o=0;o<e.length;o++){var i=e[o];"number"==typeof i[0]&&a[i[0]]||(n&&!i[2]?i[2]=n:n&&(i[2]="("+i[2]+") and ("+n+")"),t.push(i))}},t}},function(e,t,n){function a(e,t){for(var n=0;n<e.length;n++){var a=e[n],o=m[a.id];if(o){o.refs++;for(var r=0;r<o.parts.length;r++)o.parts[r](a.parts[r]);for(;r<a.parts.length;r++)o.parts.push(c(a.parts[r],t))}else{for(var i=[],r=0;r<a.parts.length;r++)i.push(c(a.parts[r],t));m[a.id]={id:a.id,refs:1,parts:i}}}}function o(e,t){for(var n=[],a={},o=0;o<e.length;o++){var r=e[o],i=t.base?r[0]+t.base:r[0],l=r[1],s=r[2],u=r[3],c={css:l,media:s,sourceMap:u};a[i]?a[i].parts.push(c):n.push(a[i]={id:i,parts:[c]})}return n}function r(e,t){var n=v(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var a=b[b.length-1];if("top"===e.insertAt)a?a.nextSibling?n.insertBefore(t,a.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),b.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=v(e.insertInto+" "+e.insertAt.before);n.insertBefore(t,o)}}function i(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=b.indexOf(e);t>=0&&b.splice(t,1)}function l(e){var t=document.createElement("style");return e.attrs.type="text/css",u(t,e.attrs),r(e,t),t}function s(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",u(t,e.attrs),r(e,t),t}function u(e,t){Object.keys(t).forEach(function(n){e.setAttribute(n,t[n])})}function c(e,t){var n,a,o,r;if(t.transform&&e.css){if(!(r=t.transform(e.css)))return function(){};e.css=r}if(t.singleton){var u=y++;n=g||(g=l(t)),a=d.bind(null,n,u,!1),o=d.bind(null,n,u,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=s(t),a=f.bind(null,n,t),o=function(){i(n),n.href&&URL.revokeObjectURL(n.href)}):(n=l(t),a=p.bind(null,n),o=function(){i(n)});return a(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;a(e=t)}else o()}}function d(e,t,n,a){var o=n?"":a.css;if(e.styleSheet)e.styleSheet.cssText=_(t,o);else{var r=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(r,i[t]):e.appendChild(r)}}function p(e,t){var n=t.css,a=t.media;if(a&&e.setAttribute("media",a),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function f(e,t,n){var a=n.css,o=n.sourceMap,r=void 0===t.convertToAbsoluteUrls&&o;(t.convertToAbsoluteUrls||r)&&(a=x(a)),o&&(a+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var i=new Blob([a],{type:"text/css"}),l=e.href;e.href=URL.createObjectURL(i),l&&URL.revokeObjectURL(l)}var m={},h=function(e){var t;return function(){return void 0===t&&(t=e.apply(this,arguments)),t}}(function(){return window&&document&&document.all&&!window.atob}),v=function(e){var t={};return function(n){if(void 0===t[n]){var a=e.call(this,n);if(a instanceof window.HTMLIFrameElement)try{a=a.contentDocument.head}catch(e){a=null}t[n]=a}return t[n]}}(function(e){return document.querySelector(e)}),g=null,y=0,b=[],x=n(108);e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");t=t||{},t.attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||(t.singleton=h()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=o(e,t);return a(n,t),function(e){for(var r=[],i=0;i<n.length;i++){var l=n[i],s=m[l.id];s.refs--,r.push(s)}if(e){a(o(e,t),t)}for(var i=0;i<r.length;i++){var s=r[i];if(0===s.refs){for(var u=0;u<s.parts.length;u++)s.parts[u]();delete m[s.id]}}}};var _=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()},function(e,t,n){"use strict";function a(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},r=n(0),i=function(e){return e&&e.__esModule?e:{default:e}}(r),l=function(e){var t=e.svg,n=e.color,r=a(e,["svg","color"]),l=n?{fill:n}:null;return i.default.createElement("svg",o({viewBox:t.viewBox,style:l},r),i.default.createElement("use",{xlinkHref:"#"+t.id}))};t.default=l},function(e,t,n){var a,o;!function(r,i){"use strict";a=i,void 0!==(o="function"==typeof a?a.call(t,n,t,e):a)&&(e.exports=o)}(0,function(){"use strict";function e(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function t(t){return"debug"===t&&(t="log"),typeof console!==l&&(void 0!==console[t]?e(console,t):void 0!==console.log?e(console,"log"):i)}function n(e,t){for(var n=0;n<s.length;n++){var a=s[n];this[a]=n<e?i:this.methodFactory(a,e,t)}this.log=this.debug}function a(e,t,a){return function(){typeof console!==l&&(n.call(this,t,a),this[e].apply(this,arguments))}}function o(e,n,o){return t(e)||a.apply(this,arguments)}function r(e,t,a){function r(e){var t=(s[e]||"silent").toUpperCase();if(typeof window!==l){try{return void(window.localStorage[d]=t)}catch(e){}try{window.document.cookie=encodeURIComponent(d)+"="+t+";"}catch(e){}}}function i(){var e;if(typeof window!==l){try{e=window.localStorage[d]}catch(e){}if(typeof e===l)try{var t=window.document.cookie,n=t.indexOf(encodeURIComponent(d)+"=");-1!==n&&(e=/^([^;]+)/.exec(t.slice(n))[1])}catch(e){}return void 0===c.levels[e]&&(e=void 0),e}}var u,c=this,d="loglevel";e&&(d+=":"+e),c.name=e,c.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},c.methodFactory=a||o,c.getLevel=function(){return u},c.setLevel=function(t,a){if("string"==typeof t&&void 0!==c.levels[t.toUpperCase()]&&(t=c.levels[t.toUpperCase()]),!("number"==typeof t&&t>=0&&t<=c.levels.SILENT))throw"log.setLevel() called with invalid level: "+t;if(u=t,!1!==a&&r(t),n.call(c,t,e),typeof console===l&&t<c.levels.SILENT)return"No console available for logging"},c.setDefaultLevel=function(e){i()||c.setLevel(e,!1)},c.enableAll=function(e){c.setLevel(c.levels.TRACE,e)},c.disableAll=function(e){c.setLevel(c.levels.SILENT,e)};var p=i();null==p&&(p=null==t?"WARN":t),c.setLevel(p,!1)}var i=function(){},l="undefined",s=["trace","debug","info","warn","error"],u=new r,c={};u.getLogger=function(e){if("string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=c[e];return t||(t=c[e]=new r(e,u.getLevel(),u.methodFactory)),t};var d=typeof window!==l?window.log:void 0;return u.noConflict=function(){return typeof window!==l&&window.log===u&&(window.log=d),u},u.getLoggers=function(){return c},u})},function(e,t,n){var a=n(107);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.AvatarGroup=void 0;var o=n(0),r=a(o),i=n(1),l=n(167),s=n(168),u=a(s),c=function(e){var t=e.initial,n=e.color,a=e.photoUrl,o=e.className,s=e.onMouseOver,c=e.onMouseOut,d=e.onClick;return r.default.createElement("div",{onMouseOver:s,onMouseOut:c,onClick:d,className:(0,i.css)(u.default.avatar,o&&o),"data-initial":t,style:{backgroundColor:n}},a&&r.default.createElement("div",{className:u.default.photo,style:{backgroundImage:"url("+(0,l.platformPhotoUrl)(a)+")"}}))};t.default=c;t.AvatarGroup=function(e){var t=e.className,n=e.children;return r.default.createElement("div",{className:(0,i.css)(u.default.group,t&&t)},r.default.Children.map(n,function(e){return r.default.createElement("div",{className:u.default.wrapper},e)}))}},function(e,t,n){"use strict";function a(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(e){console.error(e)}}a(),e.exports=n(96)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.provideTemplatesContext=t.TemplatesContext=void 0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},o=n(0),r=function(e){return e&&e.__esModule?e:{default:e}}(o),i=t.TemplatesContext=r.default.createContext({});t.provideTemplatesContext=function(e){return function(t){return r.default.createElement(i.Consumer,null,function(n){return r.default.createElement(e,a({},n,t))})}}},function(e,t,n){e.exports=n(162)()},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(10),d=n(1),p=n(177),f=a(p),m=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.container=document.createElement("div"),n}return i(t,e),l(t,[{key:"updatePosition",value:function(){if(this.tooltipRef){var e=this.props.rect,t=this.tooltipRef,n=t.clientWidth,a=t.clientHeight,o=window,r=o.innerWidth,i=(o.innerHeight,o.scrollY),l=e.x+e.width/2-n/2,s=Math.min(Math.max(l,4),r-4-n),u=e.y-a-i-10;u>=4?(u+=i,this.arrowRef.classList.remove(f.default.flipped)):(u=e.y+e.height+10,this.arrowRef.classList.add(f.default.flipped)),this.tooltipRef.style.top=Math.round(u)+"px",this.tooltipRef.style.left=Math.round(s)+"px",s!==l&&(this.arrowRef.style.left="calc(50% + "+Math.round(l-s-6)+"px)")}}},{key:"componentDidUpdate",value:function(e){(0,d.equal)(e.rect,this.props.rect)||this.updatePosition()}},{key:"componentDidMount",value:function(){document.body.appendChild(this.container),this.updatePosition()}},{key:"componentWillUnmount",value:function(){document.body.removeChild(this.container)}},{key:"render",value:function(){var e=this,t=this.props,n=t.children,a=t.className;return(0,c.createPortal)(u.default.createElement("div",{ref:function(t){e.tooltipRef=t},className:(0,d.css)(f.default.tooltip,a&&a)},u.default.createElement("div",{ref:function(t){e.arrowRef=t},className:f.default.arrow}),n),this.container)}}]),t}(s.Component);t.default=m},function(e,t){function n(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=n},function(e,t,n){var a=n(51),o="object"==typeof self&&self&&self.Object===Object&&self,r=a||o||Function("return this")();e.exports=r},function(e,t,n){var a=n(33),o=a(Object,"create");e.exports=o},function(e,t,n){function a(e,t){for(var n=e.length;n--;)if(o(e[n][0],t))return n;return-1}var o=n(75);e.exports=a},function(e,t,n){function a(e,t){var n=e.__data__;return o(t)?n["string"==typeof t?"string":"hash"]:n.map}var o=n(81);e.exports=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={DEFAULT_CACHE_TIMEOUT:300,CREATE_TIMEOUT_SECONDS:10,WAIT_TO_SYNC_ON_INIT_SECONDS:5,COMMUNITY_SITE_URL:"https://evernote.com/templates",COMMUNITY_SITE_URL_NO_UPSELL:"https://evernote.com/templates?referrer=client",UPSELL_PAGE_URL:"https://evernote.com/get-started",INTERNAL_UPSELL_URI:"evernote://show-tiers/premium?offerCode=templates",THUMBNAILS_AVAILABLE_SINCE:153256e7}},function(e,t,n){var a=n(181);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){"use strict";function a(e){return function(){return e}}var o=function(){};o.thatReturns=a,o.thatReturnsFalse=a(!1),o.thatReturnsTrue=a(!0),o.thatReturnsNull=a(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){function a(e){return null==e?void 0===e?s:l:u&&u in Object(e)?r(e):i(e)}var o=n(24),r=n(53),i=n(54),l="[object Null]",s="[object Undefined]",u=o?o.toStringTag:void 0;e.exports=a},function(e,t,n){var a=n(15),o=a.Symbol;e.exports=o},function(e,t){function n(e){return null!=e&&"object"==typeof e}e.exports=n},function(e,t,n){var a=n(191);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),o=null,r=a.ReactInvokeBridge.get("menu");r.then(function(e){o=e});var i=function(){return r},l=function(e){return o&&o.create(e)},s=function(e){return o&&o.isOpen(e)},u=function(e){return o&&o.dismiss(e)},c=l;Object.assign(c,{setup:i,create:l,isOpen:s,dismiss:u}),t.default=c},function(e,t,n){"use strict";function a(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
var o=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(e){a[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},a)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,l,s=a(e),u=1;u<arguments.length;u++){n=Object(arguments[u]);for(var c in n)r.call(n,c)&&(s[c]=n[c]);if(o){l=o(n);for(var d=0;d<l.length;d++)i.call(n,l[d])&&(s[l[d]]=n[l[d]])}}return s}},function(e,t,n){"use strict";var a={};e.exports=a},function(e,t,n){function a(e){if("number"==typeof e)return e;if(r(e))return i;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var n=u.test(e);return n||c.test(e)?d(e.slice(2),n?2:8):s.test(e)?i:+e}var o=n(14),r=n(52),i=NaN,l=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt;e.exports=a},function(e,t,n){function a(e){return o(2,e)}var o=n(55);e.exports=a},function(e,t,n){function a(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(r);var n=function(){var a=arguments,o=t?t.apply(this,a):a[0],r=n.cache;if(r.has(o))return r.get(o);var i=e.apply(this,a);return n.cache=r.set(o,i)||r,i};return n.cache=new(a.Cache||o),n}var o=n(58),r="Expected a function";a.Cache=o,e.exports=a},function(e,t,n){function a(e,t){var n=r(e,t);return o(n)?n:void 0}var o=n(62),r=n(67);e.exports=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"AYb-5",use:"AYb-5-usage",viewBox:"0 0 16 16",content:'<symbol viewBox="0 0 16 16" id="AYb-5">\n    <g stroke="none" fill-rule="evenodd">\n        <path transform="translate(8.142136, 8.142136) rotate(-45.000000) translate(-14.142136, -14.142136) " d="M15.1421356,13.1421356 L23.1421356,13.1421356 C23.6944204,13.1421356 24.1421356,13.5898509 24.1421356,14.1421356 C24.1421356,14.6944204 23.6944204,15.1421356 23.1421356,15.1421356 L15.1421356,15.1421356 L15.1421356,23.1421356 C15.1421356,23.6944204 14.6944204,24.1421356 14.1421356,24.1421356 C13.5898509,24.1421356 13.1421356,23.6944204 13.1421356,23.1421356 L13.1421356,15.1421356 L5.14213562,15.1421356 C4.58985087,15.1421356 4.14213562,14.6944204 4.14213562,14.1421356 C4.14213562,13.5898509 4.58985087,13.1421356 5.14213562,13.1421356 L13.1421356,13.1421356 L13.1421356,5.14213562 C13.1421356,4.58985087 13.5898509,4.14213562 14.1421356,4.14213562 C14.6944204,4.14213562 15.1421356,4.58985087 15.1421356,5.14213562 L15.1421356,13.1421356 Z" />\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var r,i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(122),u=function(e){return e&&e.__esModule?e:{default:e}}(s),c={version:3,stores:(r={},o(r,"items","id"),o(r,"settings","key"),o(r,"thumbnails","id"),r)},d=function(){function e(t){a(this,e),this.dbName=t}return l(e,[{key:"getDB",value:function(){var e=this;return this.db?Promise.resolve(this.db):(0,u.default)(this.dbName,c,function(t){return delete e.db}).then(function(t){return e.db=t,t})}},{key:"getCollection",value:function(){return this.getDB().then(function(e){return e.getAll("items")}).then(function(e){var t=[],n={};return e.forEach(function(e){"0"===e.id?n=e:t.push(e)}),delete n.id,n.items=t,n})}},{key:"getItem",value:function(e){return this.getDB().then(function(t){return t.getItem("items",e)})}},{key:"setCollection",value:function(e){return this.getDB().then(function(t){return t.run("items",function(t){t.clear();var n=e.items,a=i({},e,{id:"0"});delete a.items,t.add(a),n.forEach(function(e){return t.add(e)})})})}},{key:"setItem",value:function(e,t){return this.getDB().then(function(n){return n.setItem("items",e,t)})}},{key:"removeAll",value:function(){this.getDB().then(function(e){return Promise.all([e.removeAll("items"),e.removeAll("thumbnails")])})}},{key:"removeItem",value:function(e){this.getDB().then(function(t){return t.removeItem("thumbnails",e),t.removeItem("items",e)})}},{key:"setSetting",value:function(e,t){return this.getDB().then(function(n){return n.setItem("settings",e,{key:e,value:t})})}},{key:"getSetting",value:function(e,t){return this.getDB().then(function(t){return t.getItem("settings",e)}).then(function(e){return e?e.value:t})}},{key:"setThumbnail",value:function(e,t,n){return this.getDB().then(function(a){return a.setItem("thumbnails",e,{id:e,thumbnail:t,size:n})})}},{key:"getThumbnail",value:function(e,t){return this.getDB().then(function(t){return t.getItem("thumbnails",e)}).then(function(e){return e||t})}}],[{key:"getStorage",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"template",a=t+"."+n;return e.cache[a]||(e.cache[a]=new e(a)),e.cache[a]}}]),e}();t.default=d,d.cache={}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),c=n(7),d=a(c),p=n(19),f=a(p),m="https://templates.svc.www.evernote.com",h="https://templates.svc.stage.evernote.com",v="stage.evernote.com",g=".evernote.com",y=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.fast=!0,n}return l(t,e),t}(Error),b=function(e){function t(e,n,a){r(this,t);var o=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a));return o.persistent=!0,o.code=e,o.limit=n,o}return l(t,e),t}(y),x=function(){function e(t,n,a){r(this,e),this.endPoint=t,this.authToken=n.authToken,this.serviceHost=n.serviceHost,this.shardID=n.shardID,this.userName=n.userName,this.noteGUID=a.guid,this._maxAge=f.default.DEFAULT_CACHE_TIMEOUT,this.failureFromConnectivity=!1,this.log=d.default.getLogger("template.network"),this.loadedFromEvernoteCom=location.hostname.endsWith(g),this.credentials=this.loadedFromEvernoteCom?"include":void 0,this.endPoint||(this.endPoint=this.serviceHost===v?h:m),this.retryCounts={}}return u(e,[{key:"_getRetryDelay",value:function(e,t){var n=Date.now(),a=e+t,o=this.retryCounts[a]||{count:0},r=o.count,i=o.lastReq||n;o.lastReq=n,this.retryCounts[a]=o;var l=0===r?0:Math.min(6e4,100*Math.pow(2,r));return Math.max(0,l-(n-i))}},{key:"_requestFailure",value:function(e,t){var n=e+t,a=this.retryCounts[n]||{count:0};a.count+=1,this.retryCounts[n]=a}},{key:"_requestSuccess",value:function(e,t){var n=e+t;delete this.retryCounts[n]}},{key:"_requestArray",value:function(e,t,n){return this._request(e,t,n,!0)}},{key:"_request",value:function(e,t,n,a){var o=this,r=this._getRetryDelay(e,t);return new Promise(function(i,l){r>0&&o.log.debug("delaying request "+e+" "+t+" by "+r+"ms"),setTimeout(function(){window.navigator.onLine?i(o._tryRequest(e,t,n,!a)):(o.failureFromConnectivity=!0,o._requestFailure(e,t),l(new y("Connection is offline")))},r)})}},{key:"_tryRequest",value:function(e,t,n,a){var o=this;this.log.debug("service request: "+e+" "+t+" ("+n.templateDescription+")");var r,i={"Content-Type":"application/json"},l={authToken:this.loadedFromEvernoteCom?void 0:this.authToken,shardID:this.shardID,userName:this.userName,noteGUID:this.noteGUID};"GET"===e||"HEAD"===e?i["x-en-template"]=JSON.stringify(l):r=JSON.stringify(s({},l,n));var u;return fetch(this.endPoint+"/template/v2/"+t,{credentials:this.credentials,method:e,headers:i,body:r}).catch(function(n){throw o._requestFailure(e,t),n}).then(function(e){return u=e,u.status>=200&&u.status<300&&n.isImage?u.blob().then(function(e){return{blob:e,text:void 0}}):u.text().then(function(e){return{blob:void 0,text:e}})}).then(function(r){var i=r.text,l=r.blob;if(o.failureFromConnectivity=!1,u.status>=200&&u.status<300){if(o._requestSuccess(e,t),n.canSetMaxAge&&o._parseCacheControl(u),"OK"===i)return[{guid:n.guid}];if(l instanceof Blob)return l;var s=JSON.parse(i);return a?s:s instanceof Array?s:[s]}try{var c=JSON.parse(i);if(c.err)throw o._requestFailure(e,t),new b(c.code,c.limit,c.err)}catch(e){if(e.persistent)throw e}return o.failureFromConnectivity=!0,o._requestFailure(e,t),Promise.reject(new Error(u.status+" - "+i))}).catch(function(n){throw o.log.error("fetch error: ",e,t,n),n})}},{key:"_parseCacheControl",value:function(e){var t=e.headers.get("cache-control");if(t){var n={};t.split(",").map(function(e){return e.trim()}).forEach(function(e){var t=e.indexOf("=");if(t>-1){var a=e.slice(0,t),o=e.slice(t+1);n[a]=o}else n[e]=!0}),n["max-age"]&&(this._maxAge=parseInt(n["max-age"],10)||f.default.DEFAULT_CACHE_TIMEOUT,this.log.debug("maxAge set to "+this._maxAge))}}},{key:"_requestOne",value:function(e,t,n){return this._requestArray(e,t,n).then(function(e){return e[0]})}},{key:"createTemplate",value:function(e,t){return this._requestOne("POST",e.guid,{guid:e.guid||"",templateDescription:e.description,access:e.access})}},{key:"updateTemplate",value:function(e,t){return this._requestOne("PUT",e.guid,{guid:e.guid,templateDescription:e.description})}},{key:"listOneTemplatePage",value:function(e,t,n,a,o){return void 0!==n&&void 0!==a||(n="",a=""),e=e||"-",t=t||"-",this._request("GET",["-",e,t,n,a].join("/"),{guid:"-",canSetMaxAge:!0})}},{key:"listTemplates",value:function(e,t){var n=this,a=0,r="-";e=e||"-";var i=[];return function l(){return n.listOneTemplatePage(e,r,a,10,t).then(function(e){return a=e.nextOffsetStart,r=e.reqId,i.push.apply(i,o(e.templates)),a>-1?l():i})}()}},{key:"getTemplate",value:function(e,t){return this._request("GET",e+"/-",{guid:e,canSetMaxAge:!0}).then(function(e){return e.templates&&e.templates[0]})}},{key:"removeTemplate",value:function(e,t){return this._requestArray("DELETE",e,{guid:e})}},{key:"applyTemplate",value:function(e,t){return this._request("POST","stat/"+e+"/usage",{guid:e})}},{key:"updateNote",value:function(e){this.noteGUID=e}},{key:"getThumbnail",value:function(e,t){return this._request("GET","thumbnail/"+t+"/"+e,{guid:e,isImage:!0})}},{key:"maxAge",get:function(){return this._maxAge}}]),e}();t.default=x},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=function(){function e(){a(this,e),this.observer={}}return r(e,[{key:"on",value:function(e,t,n,a){this.observer[e]=this.observer[e]||[],this.observer[e].push(o({callback:t,context:n},a))}},{key:"once",value:function(e,t,n){return this.on(e,t,n,{once:!0})}},{key:"off",value:function(e,t,n){var a=this.observer[e];if(a)for(var o=0;o<a.length;o++){var r=a[o];if(r.callback===t&&r.context===n)return void a.splice(o,1)}}},{key:"trigger",value:function(e){var t=this.observer[e];if(t){for(var n=arguments.length,a=Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];for(var r=0;r<t.length;r++){var i=t[r];i.callback.apply(i.context,a)}for(var l=t.length-1;l>=0;l--){t[l].once&&t.splice(l,1)}}}}]),e}();t.default=i},function(e,t,n){function a(e,t,n){var a=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||o)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var l=0;l<16;++l)t[a+l]=i[l];return t||r(i)}var o=n(124),r=n(125);e.exports=a},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),c=a(u),d=n(6),p=a(d),f=n(166),m=a(f),h=n(1),v=n(183),g=a(v),y=n(20),b=a(y),x=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleLayout=n.handleLayout.bind(n),n.handleActivationClick=n.handleActivationClick.bind(n),n.handleBubbleClick=n.handleBubbleClick.bind(n),n.handleResolveClick=n.handleResolveClick.bind(n),n.handleReopenClick=n.handleReopenClick.bind(n),n}return i(t,e),s(t,[{key:"handleActivationClick",value:function(e){var t=this.props,n=t.id;t.active||EN.execCommand("comment",{action:"highlight",threadId:n})}},{key:"handleBubbleClick",value:function(e){this.props.collapsed||this.props.compact||(e.preventDefault(),e.stopPropagation(),EN.execCommand("comment",{action:"collapse"}))}},{key:"handleResolveClick",value:function(e){e.stopPropagation(),EN.execCommand("comment",{action:"resolve",threadId:this.props.id})}},{key:"handleReopenClick",value:function(e){e.stopPropagation(),EN.execCommand("comment",{action:"reopen",threadId:this.props.id})}},{key:"handleLayout",value:function(){this.elementRef&&this.props.floating&&this.props.updateHeight({height:this.elementRef.clientHeight,id:this.props.id})}},{key:"componentDidMount",value:function(){this.handleLayout()}},{key:"componentDidUpdate",value:function(e){e.active===this.props.active&&e.collapsed===this.props.collapsed&&e.compact===this.props.compact&&e.comments===this.props.comments&&e.readonly===this.props.readonly||this.handleLayout()}},{key:"render",value:function(){var e=this,t=this.props,n=t.comments,a=t.top,o=t.id,r=t.active,i=t.collapsed,s=t.compact,u=t.user,d=t.readonly,f=t.floating,v=t.archive,y=(0,h.css)(b.default.thread,r&&!v&&b.default.active,i&&b.default.collapsed,s&&b.default.compact,f&&b.default.floating),x=v?null:{top:a},_=null,k=null,w=null,C=!1;return i||s||(k=n.map(function(t){return t.editing&&(C=!0),c.default.createElement(m.default,l({},t,{editable:!v&&t.editable,key:t.id,threadId:o,onLayout:e.handleLayout}))}),w=u&&!C&&!d&&r&&!v&&c.default.createElement(m.default,{initial:u.initial,name:u.name,color:u.color,threadId:o,onLayout:this.handleLayout,initiater:0===n.length,creating:!0})),v?_=c.default.createElement("div",{className:b.default.toolbar},n[0].selectedText&&c.default.createElement("div",{className:b.default.highlight},c.default.createElement("span",null,n[0].selectedText)),n[0].resolved&&null!=a&&c.default.createElement("button",{className:b.default.reopen,onClick:this.handleReopenClick},"Unresolve")):n.length>0&&(_=c.default.createElement("div",{className:b.default.toolbar},!i&&!s&&r&&c.default.createElement("button",{className:b.default.resolve,onClick:this.handleResolveClick},"Resolve"),c.default.createElement("button",{className:b.default.bubble,"data-count":n.length,onClick:this.handleBubbleClick},c.default.createElement(p.default,{svg:g.default})))),c.default.createElement("div",{className:y,style:x,ref:function(t){e.elementRef=t},onClick:this.handleActivationClick},_,k,w)}}]),t}(u.PureComponent);t.default=x,x.defaultProps={collapsed:!1,compact:!1,active:!1,readonly:!1,floating:!1,archive:!1,user:null,comments:[]}},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.TokenKind=void 0;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),r=n(172),i=function(e){return e&&e.__esModule?e:{default:e}}(r),l="<SOF>",s=(t.TokenKind={SOF:l,EOF:"<EOF>",MARK_CODE:"`",MARK_CODEBLOCK:"Codeblock",MARK_STRIKE_THROUGH:"~",MARK_BOLD:"*",MARK_ITALIC:"_",MARK_MENTION:"Mention",TEXT:"Text",NEW_LINE:"\n"},function(){function e(t){a(this,e),this.source=t,this.lastToken=new i.default(l,0,0),this.token=this.lastToken}return o(e,[{key:"advance",value:function(){var e=this.lastToken=this.token;return"<EOF>"!==e.kind&&(e=e.next=u(this,e),this.token=e),e}}]),e}());t.default=s;var u=function(e,t){if(t.next)return t.next.prev=t,t.next;var n=e.source,a=n.length,o=!1,r=null,l=t.end;if(l>=a)return new i.default("<EOF>",a,a,null,t);for(;l<a;){var s=n.charCodeAt(l);switch(s){case 160:if(64===n.charCodeAt(l+1)){r=c(n,l,!0);break}case 64:r=c(n,l);break;case 42:case 95:case 96:case 126:r=d(n,l,s);break;case 10:r=new i.default("\n",l,l+1,{text:"\n"})}if(r)break;l+=1,o=!0}if(o){var u={text:n.slice(t.end,l)};return new i.default("Text",t.end,l,u,t,r)}return r.prev=t,r},c=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!n&&t>0&&!p(e.charCodeAt(t-1)))return null;for(var a=t+1;a<e.length;){var o=e.charCodeAt(a);if(n&&160===o){a+=1;break}if(f(o)){n&&(a=-1);break}a+=1}if(-1===a)return null;var r={user:null,decorated:n,text:n?e.slice(t+2,a-1):e.slice(t+1,a)};return new i.default("Mention",t,a,r)},d=function(e,t,n){var a=96===n&&96===e.charCodeAt(t+1)&&96===e.charCodeAt(t+2)?3:1,o=0===t,r=t>=e.length-a;if(o||(o=m(e.charCodeAt(t-1))),r||(r=h(e.charCodeAt(t+a))),!o&&!r)return null;var l=a>1?"```":e.charAt(t),s=a>1?"Codeblock":l,u={ahead:o,behind:r,text:l};return new i.default(s,t,t+a,u)},p=function(e){switch(e){case 9:case 10:case 32:case 42:case 40:case 47:case 91:case 95:case 123:return!0}return!1},f=function(e){switch(e){case 9:case 10:case 32:case 33:case 34:case 39:case 41:case 42:case 44:case 46:case 47:case 58:case 59:case 93:case 96:case 125:case 126:return!0}return!1},m=function(e){switch(e){case 9:case 10:case 32:case 33:case 34:case 35:case 36:case 37:case 39:case 40:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 61:case 63:case 91:case 94:case 95:case 96:case 123:case 126:return!0}return!1},h=function(e){switch(e){case 9:case 10:case 32:case 33:case 34:case 35:case 36:case 37:case 39:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 93:case 94:case 95:case 96:case 125:case 126:return!0}return!1}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},r=n(0),i=a(r),l=n(9),s=a(l),u=n(13),c=a(u),d=n(179),p=a(d),f=function(e){var t=e.user,n=e.rect;return i.default.createElement(c.default,{rect:n,className:p.default.tooltip},i.default.createElement(s.default,o({className:p.default.avatar},t)),i.default.createElement("span",{className:p.default.title},t.name,t.title&&i.default.createElement("span",{className:p.default.dim},"• "+t.title)),t.email&&i.default.createElement("span",{className:p.default.subtitle},t.email))};t.default=f},function(e,t,n){var a=n(218);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){var a=n(225);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){var a=n(261);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){"use strict";n(46),n(160)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(47),u=a(s),c=n(157),d=a(c),p=n(7),f=a(p),m=n(159),h=a(m),v={ce:function(){return window.uno.api.ce},templatemanager:function(){return new u.default},platformcapabilities:function(){return new d.default}},g={user:!0,note:!0,env:!0},y={setup:["html","enml","rte.html","rte.enml","user.authToken","user.businessAuthToken","template.html","note.title"],yjs:["connector.authToken","connector.businessAuthToken"],ec_content:["content"],ec_inserthtml:[],ec_inserttext:[],ec_paste:["value"],ec_updatetoken:[],qcv_content:["value","cryptInfo"],"qcv_rte.content":["value","cryptInfo"],qcv_copy:["plain","html"],qcv_cut:["plain","html"],ec_crypt:["decrypt.plainText"],noti_encrypt:["plainText"],qcv_stats:["firstLine"]},b={OFF:"SILENT",SEVERE:"ERROR",WARNING:"WARN",INFO:"INFO",CONFIG:"DEBUG",FINE:"TRACE",FINER:"TRACE",FINEST:"TRACE",ALL:"TRACE"},x=function(){function e(){var t=this;o(this,e),this.registry={},this.runCommands={},this.queries={},this.interceptExecCommands={},this.activeApp=null,this.listeners={},this.config=null,this.notify=this.bindNotify("ce"),this.notifyAsync=this.bindNotifyAsync("ce"),this._proxyProps(this,"ce",["getVersion","logs","getLogs","getLogLevel","enablePrint","disablePrint","getBuildPath"]),document.addEventListener("DOMContentLoaded",function(){return t.init()})}return l(e,[{key:"initLogs",value:function(){var e=void 0;try{e=goog.debug.RelativeTimeProvider.getDefaultInstance().relativeTimeStart_}catch(t){e=Date.now()}var t="",n=this.registry;h.default.reg(f.default),h.default.apply(f.default,{format:function(e,n,a){return t=" ["+a+"] ["+n+"]"},nameFormatter:function(e){return e||"uno"},timestampFormatter:function(t){var n=(+t-e)/1e3+"s";return n.length<8?("        "+n).slice(-8):n}});var a=f.default.methodFactory;f.default.methodFactory=function(e,o,r){var i=a(e,o,r);return function(){for(var e=arguments.length,a=Array(e),o=0;o<e;o++)a[o]=arguments[o];if(i.apply(void 0,a),n.ce){var r=t+" "+a.join(" ");n.ce.logs.cache.push({formattedText:r,level:{}})}}},this.log=f.default.getLogger("uno.mediator")}},{key:"setLogLevel",value:function(e){this.registry.ce&&this.registry.ce.setLogLevel(e),f.default.setLevel(b[e])}},{key:"init",value:function(){var e=this;this.initLogs(),Object.keys(v).forEach(function(t){var n=v[t](),a=e.register(t,n);n.init(a)}),setTimeout(function(){e._notify("ready")||setTimeout(function(){e._notify("ready")},100)})}},{key:"assert",value:function(e,t){if(!e)throw new Error("Assert failed: "+t)}},{key:"_apply",value:function(e,t,n){var a=this,o=t[e];return o&&"function"==typeof o.forEach&&o.forEach(function(e){a.assert(!(e in n)),n[e]=t.name}),n}},{key:"register",value:function(e,t){var n=this;return this.assert(!t.appType||-1!==["normal","background"].indexOf(t.appType)),this.assert("function"==typeof t.setup),this.assert("function"==typeof t.cleanup),this.assert("function"==typeof t.activate),this.assert("function"==typeof t.deactivate),this.assert("function"==typeof t.run),this.assert("function"==typeof t.query),this.registry[e]=t,t.appType=t.appType||"normal",t.name=e,t.enabled=!1,this._apply("runCommands",t,this.runCommands),this._apply("queries",t,this.queries),"background"===t.appType&&this._apply("execCommands",t,this.interceptExecCommands),t.listenTo&&"function"==typeof t.listenTo.forEach&&t.notify&&t.listenTo.forEach(function(e){n.listeners[e]=n.listeners[e]||[],n.listeners[e].push(t.notify)}),{notify:this.bindNotify(e),notifyAsync:this.bindNotifyAsync(e),trigger:this.bindTrigger(e)}}},{key:"activate",value:function(e,t){var n=this;if(this.lockDefaultApp&&this.activeApp)return this._notify("activateapp",{app:e,payload:t}),!1;this.assert(e in this.registry,"unknown app to activate: "+e);var a=this.registry[e];this.assert(a.enabled,"a disabled app cannot be activated: "+e),this.assert("background"!==a.appType,"background apps cannot be activated: "+e);var o=this.activeApp;return this.activeApp=e,!1!==a.activate()?(Object.keys(this.registry).forEach(function(t){t!==e&&(n.activeApp=t,n.registry[t].deactivate(),n.activeApp=e)}),t&&this.execCommand("activateapp",t),!0):(this.activeApp=o,!1)}},{key:"isActive",value:function(e){return this.activeApp===e}},{key:"run",value:function(e){var t=this.runCommands[e]||this.runCommands["*"];this.assert(t,"no app registered to handle command "+e);var n=this.registry[t];this.assert(n.enabled,"a disabled app cannot accept commands: "+t+"::"+e);for(var a=arguments.length,o=Array(a>1?a-1:0),r=1;r<a;r++)o[r-1]=arguments[r];return!!n.run.apply(n,[e].concat(o))}},{key:"query",value:function(e){var t=this.queries[e]||this.queries["*"];this.assert(t,"no app registered to handle query "+e);var n=this.registry[t];this.assert(n.enabled,"a disabled app cannot accept queries: "+t+"::"+e);for(var a=arguments.length,o=Array(a>1?a-1:0),r=1;r<a;r++)o[r-1]=arguments[r];var i=n.query.apply(n,[e].concat(o));return i instanceof Promise?i:Promise.resolve(i)}},{key:"setup",value:function(e){var t=this;e="string"==typeof e?JSON.parse(e):e,this.log.info("EN.setup("+JSON.stringify(this.filterLogObject("setup",e),null,2)+")"),this.config=e;var n=e.defaultApp||"ce";this.assert(n in this.registry,"unknown app to make default: "+n);var a=e.enabledApps||[];return Object.keys(this.registry).filter(function(e){return-1!==a.indexOf(e)||"background"===t.registry[e].appType||e===n}).forEach(function(e){t.registry[e].enabled=t._setup(e)}),a.filter(function(e){return!t.isEnabled(e)}).forEach(function(e){t.log.warn("Could not setup app specified in enabledApps list: "+e)}),this.lockDefaultApp=!!e.lockDefaultApp,this.activate(n),this._notifyAsync("setupDone",{module:"document"}),this.log.info("EN.setup returning: true\n\n\n"),!0}},{key:"cleanup",value:function(e){var t=this;return this.log.info("EN.cleanup()"),Object.keys(this.registry).filter(function(e){return t.registry[e].enabled}).forEach(function(e){return t._cleanup(e)}),this.log.info("EN.cleanup returning: true\n\n\n"),!0}},{key:"_setup",value:function(e){var t=this,n=this.registry[e],a={};Object.keys(this.config).forEach(function(o){var r=t.config[o];o===e?Object.keys(r).forEach(function(e){a[e]=r[e]}):(o in g||n.config&&o in n.config||"ce"===e)&&(a[o]=r)});var o=n.setup(a);return o||(this.log.warn("Could not setup app "+e),this.disableApp(e)),!!o}},{key:"_cleanup",value:function(e){this.registry[e].cleanup()}},{key:"enableApp",value:function(e,t){if(!1===t)return this.disableApp(e);this.assert(e in this.registry,"unknown app to enable: "+e);var n=this.registry[e];if(!n.enabled){var a=this._setup(e);return n.enabled=a,a}return!1}},{key:"disableApp",value:function(e){this.assert(e in this.registry,"unknown app to disable: "+e);var t=this.registry[e];return!!t.enabled&&(this._cleanup(e),t.enabled=!1,!0)}},{key:"isEnabled",value:function(e){return this.assert(e in this.registry,"isEnabled: unknown app: "+e),this.registry[e].enabled}},{key:"whenAppEnabled",value:function(e,t){var n=this;return function(){return n.isEnabled(e)?t.apply(this,arguments):void 0}}},{key:"execCommand",value:function(e,t,n){var a=this;if(this._logCommand("EN.execCommand",e,this.filterLogObject("ec_"+e,t),n),t=this._valueToObject(t),n=this._valueToObject(n),"activateapp"===e)return t.forEach(function(e){return e.execCommand&&a.execCommand(e.execCommand,e.value)}),!0;var o=this.interceptExecCommands[e]||this.activeApp,r=this.registry[o],i=r&&r.execCommand&&r.execCommand(e,t,n);return this.log.info("EN.execCommand '"+e+"' returning: "+i+"\n\n\n"),i}},{key:"queryCommandEnabled",value:function(e,t){this._logCommand("EN.queryCommandEnabled",e,t),t=this._valueToObject(t);var n=this.interceptExecCommands[e]||this.activeApp,a=this.registry[n],o=a&&a.queryCommandEnabled&&a.queryCommandEnabled(e,t);return this.log.info("EN.queryCommandEnabled '"+e+"' returning: "+o+"\n\n\n"),o}},{key:"queryCommandValue",value:function(e,t){this._logCommand("EN.queryCommandValue",e,t),t=this._valueToObject(t);var n=this.interceptExecCommands[e]||this.activeApp,a=this.registry[n],o=a&&a.queryCommandValue&&a.queryCommandValue(e,t);return this.log.info("EN.queryCommandValue '"+e+"' returning: "+this.filterLogObject("qcv_"+e,o)+"\n\n\n"),o}},{key:"queryCommandState",value:function(e,t){this._logCommand("EN.queryCommandState",e,t),t=this._valueToObject(t);var n=this.interceptExecCommands[e]||this.activeApp,a=this.registry[n],o=a&&a.queryCommandState&&a.queryCommandState(e,t);return this.log.info("EN.queryCommandState '"+e+"' returning: "+o+"\n\n\n"),o}},{key:"_valueToObject",value:function(e){if("string"==typeof e&&e.length>0&&("{"===e[0]||"["===e[0]))try{return JSON.parse(e)}catch(e){this.log.info(e.stack||e)}return e}},{key:"listenTo",value:function(e,t){this.listeners[e]=this.listeners[e]||[],this.listeners[e].push(t)}},{key:"trigger",value:function(e,t){this.listeners[e]&&this.listeners[e].forEach(function(n){return n(e,t)})}},{key:"_notify",value:function(e,t){this.log.info("NOTIFICATION : "+e+(void 0!==t?" : "+JSON.stringify(this.filterLogObject("noti_"+e,t),null,2):"")+"\n\n\n"),t=t||{},t.version=t.version||"1.0",this.trigger(e,t);var n=window.Evernote,a=window.evernoteClient,o=window.noteEditor;return n&&n.handleJavascriptEvent?(n.handleJavascriptEvent(e,JSON.stringify({name:e,info:t})),!0):a&&a.postNotification?(a.postNotification(e,JSON.stringify(t)),!0):o&&o.handleJavascriptEvent?(o.handleJavascriptEvent(e,JSON.stringify(t)||null),!0):!(!a||!a.handleNotificationInfo)&&(a.handleNotificationInfo(e,JSON.parse(JSON.stringify(t))),!0)}},{key:"_notifyAsync",value:function(e,t){var n=this;setTimeout(function(){return n._notify(e,t)})}},{key:"bindNotify",value:function(e){var t=this;return function(n,a){e!==t.activeApp&&"background"!==t.registry[e].appType||t._notify(n,a)}}},{key:"bindNotifyAsync",value:function(e){var t=this;return function(n,a){e!==t.activeApp&&"background"!==t.registry[e].appType||setTimeout(function(){e===t.activeApp&&t._notify(n,a)})}}},{key:"bindTrigger",value:function(e){var t=this;return function(n,a){e!==t.activeApp&&"background"!==t.registry[e].appType||t.trigger(n,a)}}},{key:"fireUpAndroid",value:function(){var e=window.noteEditor;document&&document.body?e&&e.onWebViewLoaded?e.onWebViewLoaded():this.log.error("Native did not set up `noteEditor` correctly"):(DEBUG&&this.log.warn("Will wait another while until document.body is ready"),setTimeout(this.fireUpAndroid,100))}},{key:"convertEvernoteLinkToPublicLink",value:function(e){var t=window.androidUtils;return t&&t.convertEvernoteLinkToPublicLink?t.convertEvernoteLinkToPublicLink(e):e}},{key:"setupCopyHandler",value:function(){}},{key:"_proxyProps",value:function(e,t,n){var a=this,o={};n.forEach(function(e){o[e]={get:function(){return a.registry[t][e]}}}),Object.defineProperties(e,o)}},{key:"_filterFields",value:function(e,t){var n=this;if(0===t.length)return"#removed#";try{var a="string"==typeof e?JSON.parse(e):i({},e);return t.forEach(function(e){if(a[e])a[e]="#removed#";else if(e.indexOf(".")>-1){var t=e.split(".");e=t.shift(),a[e]=n._filterFields(a[e],[t.join(".")])}}),"string"==typeof e?JSON.stringify(a,null,2):a}catch(e){return"#removed#"}}},{key:"filterLogObject",value:function(e,t){return!y[e]||localStorage&&localStorage.ce_logAll?t:this._filterFields(t,y[e])}},{key:"_logCommand",value:function(e,t,n,a){var o=e+"('"+t+"'";void 0===n?o+=void 0===a?"":", undefined, "+a:(n&&"object"===(void 0===n?"undefined":r(n))?n=JSON.stringify(n,null,2):"string"!=typeof n||/^[{[]/.test(n)||/^(true|false|[.0-9]+)$/.test(n)||(n="'"+n.replace(/'/g,"\\'")+"'"),a&&"object"===(void 0===a?"undefined":r(a))&&(a=JSON.stringify(a,null,2)),o+=", "+n+(void 0===a?"":", "+a)),o+=")",f.default.info(o)}}]),e}();t.default=x;window.EN=new x},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=n(0),l=(a(i),n(7)),s=a(l),u=n(1),c=n(95),d=a(c),p=n(121),f=a(p),m=n(126),h=n(127),v=a(h),g=n(128),y=a(g),b=n(156),x=n(19),_=a(x),k=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d.default;o(this,e),this.active=!1,this.log=s.default.getLogger("templatemanager"),this.i18n=new v.default(y.default),this.render=t,this.runCommands=["template-create","template-remove","template-prepopulate","template-apply","template-update","template-setting","template-close","template-updatenote"],this.queries=["template-list","template-content","template-search","template-setting"],this.config={realtime:!0,templates:!0,rte:!0},this.notify=this.notifyAsync=this.trigger=function(){},this.decorateTemplates=this.decorateTemplates.bind(this),this.searchTemplates=(0,u.debounce)(this.searchTemplates.bind(this),1500,{trailing:!0}),this.openCommunitySite=this.openCommunitySite.bind(this),this.openUpsellPage=this.openUpsellPage.bind(this),this.getTemplateCreateErrorMessageKey=this.getTemplateCreateErrorMessageKey.bind(this),this.htmlCache={},this.contextActions={openCommunitySite:this.openCommunitySite,openUpsellPage:this.openUpsellPage}}return r(e,[{key:"createTemplate",value:function(e,t){var n=this,a=void 0;return this.store.createTemplate(e,t).then(function(e){var t=e.item,o=e.createPromise;return a=t,EN.run("toast",{type:"template-create",messageText:n.i18n.t("Creating template…"),timeout:_.default.CREATE_TIMEOUT_SECONDS}),o}).then(function(){EN.run("toast",{type:"template-create",messageText:n.i18n.t("Template created from note"),actionText:n.i18n.t("Undo"),actionCallback:function(){return n.store.removeTemplate(a.guid).then(function(){EN.run("toast",{type:"template-create-remove",messageText:n.i18n.t("Template removed")})})}})}).catch(function(e){var t=n.getTemplateCreateErrorMessageKey(e);EN.run("toast",{type:"template-create",messageText:n.i18n.t(t,{LIMIT:e.limit||100})})})}},{key:"getTemplateCreateErrorMessageKey",value:function(e){return e.connectivityError?"Unable to save. Check your connection and try again later":101===e.code?"You've reached the limit of 100 templates":"Unable to save this note's content as a template"}},{key:"removeTemplate",value:function(e){var t=this;return EN.activate("templatemanager"),this.store.removeTemplate(e).then(function(){EN.run("toast",{type:"template-delete",messageText:t.i18n.t("Template deleted")})})}},{key:"updateTemplate",value:function(e){var t=this;return this.store.updateTemplate(e.guid,e.description,e.access).then(function(){EN.run("toast",{type:"template-update",messageText:t.i18n.t("Template updated")})})}},{key:"applyTemplate",value:function(e){var t=this;if("string"!=typeof e)return!1;if(!EN.isActive("ce"))return EN.activate("ce",[{execCommand:"applytemplate",value:{guid:e}}]),!0;var n="true"===EN.queryCommandValue("active");return EN.execCommand("active",!1),EN.query("template-content",{id:e,fast:!0}).then(function(a){return EN.execCommand("content",{content:a.content,type:"enml",allowUndo:!0,editableOnly:!1}),n&&EN.execCommand("active",!0),EN.execCommand("focus"),EN.run("toast",{type:"template-apply",messageText:t.i18n.t("Note created from template"),actionText:t.i18n.t("Undo"),actionCallback:function(){EN.execCommand("undo")}}),t.store.applyTemplate(e),!0})}},{key:"decorateTemplates",value:function(e){var t=this;return e.forEach(function(e){if(!e.access){var n=(e.ids_allowed_to_fetch||"").split(",");e.access=n.includes("-1")?"public":1===n.length?"private":"business"}e.mine=e.created_by_id+""===t.userID,"public"===e.access&&"​"===e.description[0]&&(e.sample=!0)}),e}},{key:"searchTemplates",value:function(e){return this.store.searchTemplates(e&&e.query)}},{key:"renderApp",value:function(){this.render({active:this.active,marginInfo:this.marginInfo,i18n:this.i18n,client:this.client,accountType:this.accountType,actions:this.contextActions,isLocked:EN.lockDefaultApp})}},{key:"closeApp",value:function(){EN.activate("ce")}},{key:"updateNote",value:function(e){return this.store.updateNote(e),!0}},{key:"openCommunitySite",value:function(e){e&&e.preventDefault&&e.preventDefault(),this.notifyAsync("openLink",{href:"ios"===this.client||"android"===this.client||"mac"===this.client?_.default.COMMUNITY_SITE_URL_NO_UPSELL:_.default.COMMUNITY_SITE_URL,module:"templatemanager",kind:"community-templates",sharing:!1})}},{key:"openUpsellPage",value:function(e){e&&e.preventDefault&&e.preventDefault(),this.notifyAsync("openLink",{href:"ios"===this.client||"android"===this.client||"mac"===this.client?_.default.INTERNAL_UPSELL_URI:_.default.UPSELL_PAGE_URL,module:"templatemanager",kind:"templates-upsell",sharing:!1})}},{key:"init",value:function(e){this.notify=e.notify,this.notifyAsync=e.notifyAsync,this.trigger=e.trigger}},{key:"setup",value:function(e){try{var t=e.user||JSON.parse(localStorage.demoUserObject||"null"),n=e.note||JSON.parse(localStorage.demoNoteObject||"null"),a=e.templates||e.realtime||{};if(!(a.enabled||uno&&uno.featureflags&&uno.featureflags.read("templates")))return!1;if(this.client=e.env&&e.env.client||uno.env.getClient(),this.accountType=e.user&&e.user.accountType,e.rte&&e.rte.locale&&this.i18n.setLocale(e.rte.locale),this.marginInfo=(0,b.processMargin)(e.env&&e.env.margin)||(0,b.getDefaultMargin)(),t&&n)return this.store=new f.default(a.url,t,n,this.client),this.store.on("change",function(e){EN.trigger("templateChanged",e)}),this.store.on("sync.start",function(){return document.body.classList.add("syncing")}),this.store.on("sync.stop",function(){return document.body.classList.remove("syncing")}),this.userID=t.userID+"",!0}catch(e){this.log.error("setup failed",e)}return!1}},{key:"cleanup",value:function(){this.deactivate(),this.renderApp()}},{key:"activate",value:function(){return!!this.active||(this.active=!0,this.notifyAsync("fullsize",{action:"open",sender:"templatemanager"}),(0,m.updateViewportSettings)(1,1,1,!0),this.store.activateSync(),this.renderApp(),!0)}},{key:"deactivate",value:function(){this.active&&(this.active=!1,this.notify("fullsize",{action:"close",sender:"templatemanager"}),this.store.deactivateSync(),this.renderApp(),(0,m.updateViewportSettings)())}},{key:"execCommand",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];switch(e){case"fullsize":return!0;case"margin":return this.marginInfo=b.processMargin.apply(void 0,n)||this.marginInfo,this.renderApp(),!0;case"copy":case"cut":return!1;case"paste":var o=n[0]&&n[0].values;if(o){var r=o.find(function(e){return"text/plain"===e.type}),i=o.find(function(e){return"text/html"===e.type}),l=r.value||i.value&&function(e){var t=document.createElement("div");return t.innerHTML=e,t.textContent}(i.value),s=document.activeElement;return s!==document.getSelection().focusNode&&s.setSelectionRange(s.selectionStart,s.selectionEnd),document.execCommand("inserttext",!0,l),!0}return!1;default:return!1}}},{key:"queryCommandValue",value:function(e){switch(e){case"copy":case"cut":var t=document.getSelection().toString();return"cut"===e&&document.execCommand("delete"),{resources:[],plain:t};default:return!1}}},{key:"queryCommandEnabled",value:function(e){switch(e){case"margin":case"copy":case"cut":return!0;case"paste":return document.activeElement&&!!document.activeElement.select;default:return!1}}},{key:"run",value:function(e,t){switch(e){case"template-create":return this.createTemplate(t.title,t.access);case"template-remove":return this.removeTemplate(t.guid);case"template-prepopulate":return this.store.prepopulate();case"template-apply":return this.applyTemplate(t.template&&t.template.guid);case"template-update":return this.updateTemplate(t.template);case"template-setting":return this.store.setSetting(t.key,t.value);case"template-close":return this.closeApp();case"template-updatenote":return this.updateNote(t.guid);default:return!1}}},{key:"query",value:function(e,t){switch(e){case"template-list":return this.store.listTemplates(t&&t.forceRefresh,t&&t.noSync).then(this.decorateTemplates);case"template-content":return this.store.getTemplate(t.id,t.fast);case"template-search":return this.searchTemplates(t);case"template-setting":return this.store&&this.store.getSetting(t.key,t.defaultValue);default:return Promise.reject("unknown query "+e)}}}]),e}();t.default=k},function(e,t,n){"use strict";function a(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,a=0;a<t;a++)n+="&args[]="+encodeURIComponent(arguments[a+1]);throw t=Error(n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."),t.name="Invariant Violation",t.framesToPop=1,t}function o(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||M}function r(){}function i(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||M}function l(e,t,n){var a=void 0,o={},r=null,i=null;if(null!=t)for(a in void 0!==t.ref&&(i=t.ref),void 0!==t.key&&(r=""+t.key),t)j.call(t,a)&&!A.hasOwnProperty(a)&&(o[a]=t[a]);var l=arguments.length-2;if(1===l)o.children=n;else if(1<l){for(var s=Array(l),u=0;u<l;u++)s[u]=arguments[u+2];o.children=s}if(e&&e.defaultProps)for(a in l=e.defaultProps)void 0===o[a]&&(o[a]=l[a]);return{$$typeof:_,type:e,key:r,ref:i,props:o,_owner:N.current}}function s(e){return"object"==typeof e&&null!==e&&e.$$typeof===_}function u(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}function c(e,t,n,a){if(R.length){var o=R.pop();return o.result=e,o.keyPrefix=t,o.func=n,o.context=a,o.count=0,o}return{result:e,keyPrefix:t,func:n,context:a,count:0}}function d(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>R.length&&R.push(e)}function p(e,t,n,o){var r=typeof e;"undefined"!==r&&"boolean"!==r||(e=null);var i=!1;if(null===e)i=!0;else switch(r){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case _:case k:i=!0}}if(i)return n(o,e,""===t?"."+f(e,0):t),1;if(i=0,t=""===t?".":t+":",Array.isArray(e))for(var l=0;l<e.length;l++){r=e[l];var s=t+f(r,l);i+=p(r,s,n,o)}else if(null===e||void 0===e?s=null:(s=P&&e[P]||e["@@iterator"],s="function"==typeof s?s:null),"function"==typeof s)for(e=s.call(e),l=0;!(r=e.next()).done;)r=r.value,s=t+f(r,l++),i+=p(r,s,n,o);else"object"===r&&(n=""+e,a("31","[object Object]"===n?"object with keys {"+Object.keys(e).join(", ")+"}":n,""));return i}function f(e,t){return"object"==typeof e&&null!==e&&null!=e.key?u(e.key):t.toString(36)}function m(e,t){e.func.call(e.context,t,e.count++)}function h(e,t,n){var a=e.result,o=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?v(e,a,n,b.thatReturnsArgument):null!=e&&(s(e)&&(t=o+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(D,"$&/")+"/")+n,e={$$typeof:_,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}),a.push(e))}function v(e,t,n,a,o){var r="";null!=n&&(r=(""+n).replace(D,"$&/")+"/"),t=c(t,r,a,o),null==e||p(e,"",h,t),d(t)}/** @license React v16.3.0
 * react.production.min.js
 *
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var g=n(28),y=n(29),b=n(21),x="function"==typeof Symbol&&Symbol.for,_=x?Symbol.for("react.element"):60103,k=x?Symbol.for("react.portal"):60106,w=x?Symbol.for("react.fragment"):60107,C=x?Symbol.for("react.strict_mode"):60108,E=x?Symbol.for("react.provider"):60109,T=x?Symbol.for("react.context"):60110,O=x?Symbol.for("react.async_mode"):60111,S=x?Symbol.for("react.forward_ref"):60112,P="function"==typeof Symbol&&Symbol.iterator,M={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}};o.prototype.isReactComponent={},o.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&a("85"),this.updater.enqueueSetState(this,e,t,"setState")},o.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},r.prototype=o.prototype;var L=i.prototype=new r;L.constructor=i,g(L,o.prototype),L.isPureReactComponent=!0;var N={current:null},j=Object.prototype.hasOwnProperty,A={key:!0,ref:!0,__self:!0,__source:!0},D=/\/+/g,R=[],I={Children:{map:function(e,t,n){if(null==e)return e;var a=[];return v(e,a,null,t,n),a},forEach:function(e,t,n){if(null==e)return e;t=c(null,null,t,n),null==e||p(e,"",m,t),d(t)},count:function(e){return null==e?0:p(e,"",b.thatReturnsNull,null)},toArray:function(e){var t=[];return v(e,t,null,b.thatReturnsArgument),t},only:function(e){return s(e)||a("143"),e}},createRef:function(){return{current:null}},Component:o,PureComponent:i,createContext:function(e,t){return void 0===t&&(t=null),e={$$typeof:T,_calculateChangedBits:t,_defaultValue:e,_currentValue:e,_changedBits:0,Provider:null,Consumer:null},e.Provider={$$typeof:E,context:e},e.Consumer=e},forwardRef:function(e){return{$$typeof:S,render:e}},Fragment:w,StrictMode:C,unstable_AsyncMode:O,createElement:l,cloneElement:function(e,t,n){var a=void 0,o=g({},e.props),r=e.key,i=e.ref,l=e._owner;if(null!=t){void 0!==t.ref&&(i=t.ref,l=N.current),void 0!==t.key&&(r=""+t.key);var s=void 0;e.type&&e.type.defaultProps&&(s=e.type.defaultProps);for(a in t)j.call(t,a)&&!A.hasOwnProperty(a)&&(o[a]=void 0===t[a]&&void 0!==s?s[a]:t[a])}if(1===(a=arguments.length-2))o.children=n;else if(1<a){s=Array(a);for(var u=0;u<a;u++)s[u]=arguments[u+2];o.children=s}return{$$typeof:_,type:e.type,key:r,ref:i,props:o,_owner:l}},createFactory:function(e){var t=l.bind(null,e);return t.type=e,t},isValidElement:s,version:"16.3.0",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:N,assign:g}},F=Object.freeze({default:I}),U=F&&I||F;e.exports=U.default?U.default:U},function(e,t,n){function a(e,t,n){function a(t){var n=y,a=b;return y=b=void 0,C=t,_=e.apply(a,n)}function c(e){return C=e,k=setTimeout(f,t),E?a(e):_}function d(e){var n=e-w,a=e-C,o=t-n;return T?u(o,x-a):o}function p(e){var n=e-w,a=e-C;return void 0===w||n>=t||n<0||T&&a>=x}function f(){var e=r();if(p(e))return m(e);k=setTimeout(f,d(e))}function m(e){return k=void 0,O&&y?a(e):(y=b=void 0,_)}function h(){void 0!==k&&clearTimeout(k),C=0,y=w=b=k=void 0}function v(){return void 0===k?_:m(r())}function g(){var e=r(),n=p(e);if(y=arguments,b=this,w=e,n){if(void 0===k)return c(w);if(T)return k=setTimeout(f,t),a(w)}return void 0===k&&(k=setTimeout(f,t)),_}var y,b,x,_,k,w,C=0,E=!1,T=!1,O=!0;if("function"!=typeof e)throw new TypeError(l);return t=i(t)||0,o(n)&&(E=!!n.leading,T="maxWait"in n,x=T?s(i(n.maxWait)||0,t):x,O="trailing"in n?!!n.trailing:O),g.cancel=h,g.flush=v,g}var o=n(14),r=n(50),i=n(30),l="Expected a function",s=Math.max,u=Math.min;e.exports=a},function(e,t,n){var a=n(15),o=function(){return a.Date.now()};e.exports=o},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(t,n(22))},function(e,t,n){function a(e){return"symbol"==typeof e||r(e)&&o(e)==i}var o=n(23),r=n(25),i="[object Symbol]";e.exports=a},function(e,t,n){function a(e){var t=i.call(e,s),n=e[s];try{e[s]=void 0;var a=!0}catch(e){}var o=l.call(e);return a&&(t?e[s]=n:delete e[s]),o}var o=n(24),r=Object.prototype,i=r.hasOwnProperty,l=r.toString,s=o?o.toStringTag:void 0;e.exports=a},function(e,t){function n(e){return o.call(e)}var a=Object.prototype,o=a.toString;e.exports=n},function(e,t,n){function a(e,t){var n;if("function"!=typeof t)throw new TypeError(r);return e=o(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var o=n(56),r="Expected a function";e.exports=a},function(e,t,n){function a(e){var t=o(e),n=t%1;return t===t?n?t-n:t:0}var o=n(57);e.exports=a},function(e,t,n){function a(e){if(!e)return 0===e?e:0;if((e=o(e))===r||e===-r){return(e<0?-1:1)*i}return e===e?e:0}var o=n(30),r=1/0,i=1.7976931348623157e308;e.exports=a},function(e,t,n){function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}var o=n(59),r=n(80),i=n(82),l=n(83),s=n(84);a.prototype.clear=o,a.prototype.delete=r,a.prototype.get=i,a.prototype.has=l,a.prototype.set=s,e.exports=a},function(e,t,n){function a(){this.size=0,this.__data__={hash:new o,map:new(i||r),string:new o}}var o=n(60),r=n(72),i=n(79);e.exports=a},function(e,t,n){function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}var o=n(61),r=n(68),i=n(69),l=n(70),s=n(71);a.prototype.clear=o,a.prototype.delete=r,a.prototype.get=i,a.prototype.has=l,a.prototype.set=s,e.exports=a},function(e,t,n){function a(){this.__data__=o?o(null):{},this.size=0}var o=n(16);e.exports=a},function(e,t,n){function a(e){return!(!i(e)||r(e))&&(o(e)?m:u).test(l(e))}var o=n(63),r=n(64),i=n(14),l=n(66),s=/[\\^$.*+?()[\]{}|]/g,u=/^\[object .+?Constructor\]$/,c=Function.prototype,d=Object.prototype,p=c.toString,f=d.hasOwnProperty,m=RegExp("^"+p.call(f).replace(s,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=a},function(e,t,n){function a(e){if(!r(e))return!1;var t=o(e);return t==l||t==s||t==i||t==u}var o=n(23),r=n(14),i="[object AsyncFunction]",l="[object Function]",s="[object GeneratorFunction]",u="[object Proxy]";e.exports=a},function(e,t,n){function a(e){return!!r&&r in e}var o=n(65),r=function(){var e=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();e.exports=a},function(e,t,n){var a=n(15),o=a["__core-js_shared__"];e.exports=o},function(e,t){function n(e){if(null!=e){try{return o.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var a=Function.prototype,o=a.toString;e.exports=n},function(e,t){function n(e,t){return null==e?void 0:e[t]}e.exports=n},function(e,t){function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}e.exports=n},function(e,t,n){function a(e){var t=this.__data__;if(o){var n=t[e];return n===r?void 0:n}return l.call(t,e)?t[e]:void 0}var o=n(16),r="__lodash_hash_undefined__",i=Object.prototype,l=i.hasOwnProperty;e.exports=a},function(e,t,n){function a(e){var t=this.__data__;return o?void 0!==t[e]:i.call(t,e)}var o=n(16),r=Object.prototype,i=r.hasOwnProperty;e.exports=a},function(e,t,n){function a(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=o&&void 0===t?r:t,this}var o=n(16),r="__lodash_hash_undefined__";e.exports=a},function(e,t,n){function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}var o=n(73),r=n(74),i=n(76),l=n(77),s=n(78);a.prototype.clear=o,a.prototype.delete=r,a.prototype.get=i,a.prototype.has=l,a.prototype.set=s,e.exports=a},function(e,t){function n(){this.__data__=[],this.size=0}e.exports=n},function(e,t,n){function a(e){var t=this.__data__,n=o(t,e);return!(n<0)&&(n==t.length-1?t.pop():i.call(t,n,1),--this.size,!0)}var o=n(17),r=Array.prototype,i=r.splice;e.exports=a},function(e,t){function n(e,t){return e===t||e!==e&&t!==t}e.exports=n},function(e,t,n){function a(e){var t=this.__data__,n=o(t,e);return n<0?void 0:t[n][1]}var o=n(17);e.exports=a},function(e,t,n){function a(e){return o(this.__data__,e)>-1}var o=n(17);e.exports=a},function(e,t,n){function a(e,t){var n=this.__data__,a=o(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this}var o=n(17);e.exports=a},function(e,t,n){var a=n(33),o=n(15),r=a(o,"Map");e.exports=r},function(e,t,n){function a(e){var t=o(this,e).delete(e);return this.size-=t?1:0,t}var o=n(18);e.exports=a},function(e,t){function n(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}e.exports=n},function(e,t,n){function a(e){return o(this,e).get(e)}var o=n(18);e.exports=a},function(e,t,n){function a(e){return o(this,e).has(e)}var o=n(18);e.exports=a},function(e,t,n){function a(e,t){var n=o(this,e),a=n.size;return n.set(e,t),this.size+=n.size==a?0:1,this}var o=n(18);e.exports=a},function(e,t,n){function a(e){return(null==e?0:e.length)?o(e,1):[]}var o=n(86);e.exports=a},function(e,t,n){function a(e,t,n,i,l){var s=-1,u=e.length;for(n||(n=r),l||(l=[]);++s<u;){var c=e[s];t>0&&n(c)?t>1?a(c,t-1,n,i,l):o(l,c):i||(l[l.length]=c)}return l}var o=n(87),r=n(88);e.exports=a},function(e,t){function n(e,t){for(var n=-1,a=t.length,o=e.length;++n<a;)e[o+n]=t[n];return e}e.exports=n},function(e,t,n){function a(e){return i(e)||r(e)||!!(l&&e&&e[l])}var o=n(24),r=n(89),i=n(91),l=o?o.isConcatSpreadable:void 0;e.exports=a},function(e,t,n){var a=n(90),o=n(25),r=Object.prototype,i=r.hasOwnProperty,l=r.propertyIsEnumerable,s=a(function(){return arguments}())?a:function(e){return o(e)&&i.call(e,"callee")&&!l.call(e,"callee")};e.exports=s},function(e,t,n){function a(e){return r(e)&&o(e)==i}var o=n(23),r=n(25),i="[object Arguments]";e.exports=a},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.getDocumentHeight=t.getFocusableElements=t.cssTimeToMs=t.getPrefixedStyle=t.setPrefixedStyle=t.prefixedProperty=t.getTransitionEvent=t.css=t.flattenDeep=void 0;var r=n(31),i=a(r),l=n(32),s=a(l),u=t.flattenDeep=function e(t){return t.reduce(function(t,n){return t.concat(Array.isArray(n)?e(n):n)},[])},c=(t.css=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return u(t).filter(Boolean).join(" ")},t.getTransitionEvent=(0,i.default)(function(){return{transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"}[c("transition")]}),t.prefixedProperty=(0,s.default)(function(e){if("string"!=typeof e)return null;var t=e.substring(0,1).toUpperCase()+e.substring(1),n=[e,"O"+t,"Moz"+t,"Webkit"+t],a=document.createElement("div");return n.find(function(e){return void 0!==a.style[e]})||null})),d=(t.setPrefixedStyle=function(e,t,n){return e.style[c(t)]=n},t.getPrefixedStyle=function(e,t){return getComputedStyle(e)[c(t)]},/^([-+]?[0-9]+(?:\.[0-9]+)?)(m?s)$/);t.cssTimeToMs=function(e){if("string"!=typeof e)return null;var t=d.exec(e);return!t||t.length<3?null:parseFloat(t[1])*("s"===t[2]?1e3:1)},t.getFocusableElements=function(e){return[].concat(o(e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')))},t.getDocumentHeight=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)}},function(e,t,n){"use strict";function a(e){return e.match(c)}function o(e){return e.match(d)}function r(e){return e.match(p)}function i(e){var t=d.exec(e);if(d.lastIndex=0,t.length<4)return!1;var n=t[1],a=t[2],o=t[3];return"#"+n+n+a+a+o+o}function l(e){if(e>=255)return"ff";if(e<=0)return"00";var t=e.toString(16);return t.length<2?"0"+t:t}function s(e){var t=p.exec(e);if(p.lastIndex=0,t.length<4)return!1;var n=parseInt(t[1],10),a=parseInt(t[2],10),o=parseInt(t[3],10);return"#"+l(n)+l(a)+l(o)}function u(e){return"string"!=typeof e?e:a(e)?e:o(e)?i(e):r(e)?s(e):e}Object.defineProperty(t,"__esModule",{value:!0}),t.isFullHexString=a,t.isShortHexString=o,t.isRgbString=r,t.shortHexToFullHexString=i,t.rgbToHexString=s,t.normalizeColorString=u;var c=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i,d=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,p=/^rgba?\((\d+)\,\s?(\d+)\,\s?(\d+)(?:\,\s?([\d\.]+)\s?)?\)$/},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a={},o=function(){var e={},t=new Promise(function(t,n){e.isHandled=!1,e.resolve=function(){for(var n=arguments.length,a=Array(n),o=0;o<n;o++)a[o]=arguments[o];e.isHandled=!0,t.call.apply(t,[null].concat(a))},e.reject=function(){for(var t=arguments.length,a=Array(t),o=0;o<t;o++)a[o]=arguments[o];e.isHandled=!0,n.call.apply(n,[null].concat(a))}});return e.promise=t,e},r={get:function(e){return void 0===a[e]&&(a[e]=o()),a[e].promise},mount:function(e,t){(void 0===a[e]||a[e].isHandled)&&(a[e]=o()),a[e].resolve(t)},unmount:function(e){(void 0===a[e]||a[e].isHandled)&&(a[e]=o()),a[e].reject("Component id "+e+" has been unmounted from ReactInvokeBridge")}};t.default=r},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),r=a(o),i=n(10),l=n(1),s=n(103),u=a(s),c=n(8),d=a(c),p=n(11),f=null,m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.isLocked,n=e.active,a=e.marginInfo,o=e.i18n,s=e.client,c=e.accountType,m=e.actions,h="android"===s||"ios"===s;if(f||(f=document.createElement("en-templatemanager"),document.body.appendChild(f)),f.className=(0,l.css)(d.default.tmroot,t&&d.default.locked),a&&a.appMargin&&Object.keys(a.appMargin).forEach(function(e){f.style[e]=a.appMargin[e]}),t){var v=0;a&&void 0!==a.appHeightOffset&&(v=a.appHeightOffset),f.style.minHeight=(0,l.getDocumentHeight)()+v+"px"}(0,i.render)(r.default.createElement(p.TemplatesContext.Provider,{value:{active:n,marginInfo:a,i18n:o,client:s,isMobile:h,accountType:c,contextActions:m}},r.default.createElement(u.default,{key:"templatemanager"})),f)};t.default=m},function(e,t,n){"use strict";function a(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,a=0;a<t;a++)n+="&args[]="+encodeURIComponent(arguments[a+1]);throw t=Error(n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."),t.name="Invariant Violation",t.framesToPop=1,t}function o(e,t,n,a,o,r,i,l,s){this._hasCaughtError=!1,this._caughtError=null;var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(e){this._caughtError=e,this._hasCaughtError=!0}}function r(){if(gn._hasRethrowError){var e=gn._rethrowError;throw gn._rethrowError=null,gn._hasRethrowError=!1,e}}function i(){if(yn)for(var e in bn){var t=bn[e],n=yn.indexOf(e);if(-1<n||a("96",e),!xn[n]){t.extractEvents||a("97",e),xn[n]=t,n=t.eventTypes;for(var o in n){var r=void 0,i=n[o],s=t,u=o;_n.hasOwnProperty(u)&&a("99",u),_n[u]=i;var c=i.phasedRegistrationNames;if(c){for(r in c)c.hasOwnProperty(r)&&l(c[r],s,u);r=!0}else i.registrationName?(l(i.registrationName,s,u),r=!0):r=!1;r||a("98",o,e)}}}}function l(e,t,n){kn[e]&&a("100",e),kn[e]=t,wn[e]=t.eventTypes[n].dependencies}function s(e){yn&&a("101"),yn=Array.prototype.slice.call(e),i()}function u(e){var t,n=!1;for(t in e)if(e.hasOwnProperty(t)){var o=e[t];bn.hasOwnProperty(t)&&bn[t]===o||(bn[t]&&a("102",t),bn[t]=o,n=!0)}n&&i()}function c(e,t,n,a){t=e.type||"unknown-event",e.currentTarget=On(a),gn.invokeGuardedCallbackAndCatchFirstError(t,n,void 0,e),e.currentTarget=null}function d(e,t){return null==t&&a("30"),null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function p(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}function f(e,t){if(e){var n=e._dispatchListeners,a=e._dispatchInstances;if(Array.isArray(n))for(var o=0;o<n.length&&!e.isPropagationStopped();o++)c(e,t,n[o],a[o]);else n&&c(e,t,n,a);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}function m(e){return f(e,!0)}function h(e){return f(e,!1)}function v(e,t){var n=e.stateNode;if(!n)return null;var o=En(n);if(!o)return null;n=o[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":(o=!o.disabled)||(e=e.type,o=!("button"===e||"input"===e||"select"===e||"textarea"===e)),e=!o;break e;default:e=!1}return e?null:(n&&"function"!=typeof n&&a("231",t,typeof n),n)}function g(e,t){null!==e&&(Sn=d(Sn,e)),e=Sn,Sn=null,e&&(t?p(e,m):p(e,h),Sn&&a("95"),gn.rethrowCaughtError())}function y(e,t,n,a){for(var o=null,r=0;r<xn.length;r++){var i=xn[r];i&&(i=i.extractEvents(e,t,n,a))&&(o=d(o,i))}g(o,!1)}function b(e){if(e[Nn])return e[Nn];for(;!e[Nn];){if(!e.parentNode)return null;e=e.parentNode}return e=e[Nn],5===e.tag||6===e.tag?e:null}function x(e){if(5===e.tag||6===e.tag)return e.stateNode;a("33")}function _(e){return e[jn]||null}function k(e){do{e=e.return}while(e&&5!==e.tag);return e||null}function w(e,t,n){for(var a=[];e;)a.push(e),e=k(e);for(e=a.length;0<e--;)t(a[e],"captured",n);for(e=0;e<a.length;e++)t(a[e],"bubbled",n)}function C(e,t,n){(t=v(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=d(n._dispatchListeners,t),n._dispatchInstances=d(n._dispatchInstances,e))}function E(e){e&&e.dispatchConfig.phasedRegistrationNames&&w(e._targetInst,C,e)}function T(e){if(e&&e.dispatchConfig.phasedRegistrationNames){var t=e._targetInst;t=t?k(t):null,w(t,C,e)}}function O(e,t,n){e&&n&&n.dispatchConfig.registrationName&&(t=v(e,n.dispatchConfig.registrationName))&&(n._dispatchListeners=d(n._dispatchListeners,t),n._dispatchInstances=d(n._dispatchInstances,e))}function S(e){e&&e.dispatchConfig.registrationName&&O(e._targetInst,null,e)}function P(e){p(e,E)}function M(e,t,n,a){if(n&&a)e:{for(var o=n,r=a,i=0,l=o;l;l=k(l))i++;l=0;for(var s=r;s;s=k(s))l++;for(;0<i-l;)o=k(o),i--;for(;0<l-i;)r=k(r),l--;for(;i--;){if(o===r||o===r.alternate)break e;o=k(o),r=k(r)}o=null}else o=null;for(r=o,o=[];n&&n!==r&&(null===(i=n.alternate)||i!==r);)o.push(n),n=k(n);for(n=[];a&&a!==r&&(null===(i=a.alternate)||i!==r);)n.push(a),a=k(a);for(a=0;a<o.length;a++)O(o[a],"bubbled",e);for(e=n.length;0<e--;)O(n[e],"captured",t)}function L(){return!Rn&&cn.canUseDOM&&(Rn="textContent"in document.documentElement?"textContent":"innerText"),Rn}function N(){if(In._fallbackText)return In._fallbackText;var e,t,n=In._startText,a=n.length,o=j(),r=o.length;for(e=0;e<a&&n[e]===o[e];e++);var i=a-e;for(t=1;t<=i&&n[a-t]===o[r-t];t++);return In._fallbackText=o.slice(e,1<t?1-t:void 0),In._fallbackText}function j(){return"value"in In._root?In._root.value:In._root[L()]}function A(e,t,n,a){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n,e=this.constructor.Interface;for(var o in e)e.hasOwnProperty(o)&&((t=e[o])?this[o]=t(n):"target"===o?this.target=a:this[o]=n[o]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?pn.thatReturnsTrue:pn.thatReturnsFalse,this.isPropagationStopped=pn.thatReturnsFalse,this}function D(e,t,n,a){if(this.eventPool.length){var o=this.eventPool.pop();return this.call(o,e,t,n,a),o}return new this(e,t,n,a)}function R(e){e instanceof this||a("223"),e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function I(e){e.eventPool=[],e.getPooled=D,e.release=R}function F(e,t){switch(e){case"topKeyUp":return-1!==Vn.indexOf(t.keyCode);case"topKeyDown":return 229!==t.keyCode;case"topKeyPress":case"topMouseDown":case"topBlur":return!0;default:return!1}}function U(e){return e=e.detail,"object"==typeof e&&"data"in e?e.data:null}function z(e,t){switch(e){case"topCompositionEnd":return U(t);case"topKeyPress":return 32!==t.which?null:(Qn=!0,Zn);case"topTextInput":return e=t.data,e===Zn&&Qn?null:e;default:return null}}function B(e,t){if(Gn)return"topCompositionEnd"===e||!Hn&&F(e,t)?(e=N(),In._root=null,In._startText=null,In._fallbackText=null,Gn=!1,e):null;switch(e){case"topPaste":return null;case"topKeyPress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"topCompositionEnd":return qn?null:t.data;default:return null}}function V(e){if(e=Tn(e)){Jn&&"function"==typeof Jn.restoreControlledState||a("194");var t=En(e.stateNode);Jn.restoreControlledState(e.stateNode,e.type,t)}}function H(e){$n?ea?ea.push(e):ea=[e]:$n=e}function K(){return null!==$n||null!==ea}function W(){if($n){var e=$n,t=ea;if(ea=$n=null,V(e),t)for(e=0;e<t.length;e++)V(t[e])}}function q(e,t){return e(t)}function Z(e,t,n){return e(t,n)}function Y(){}function Q(e,t){if(aa)return e(t);aa=!0;try{return q(e,t)}finally{aa=!1,K()&&(Y(),W())}}function G(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!oa[e.type]:"textarea"===t}function X(e){return e=e.target||window,e.correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}function J(e,t){return!(!cn.canUseDOM||t&&!("addEventListener"in document))&&(e="on"+e,t=e in document,t||(t=document.createElement("div"),t.setAttribute(e,"return;"),t="function"==typeof t[e]),t)}function $(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function ee(e){var t=$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),a=""+e[t];if(!e.hasOwnProperty(t)&&"function"==typeof n.get&&"function"==typeof n.set)return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.get.call(this)},set:function(e){a=""+e,n.set.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(e){a=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}function te(e){e._valueTracker||(e._valueTracker=ee(e))}function ne(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=$(e)?e.checked?"true":"false":e.value),(e=a)!==n&&(t.setValue(e),!0)}function ae(e){return null===e||void 0===e?null:(e=ga&&e[ga]||e["@@iterator"],"function"==typeof e?e:null)}function oe(e){if("function"==typeof(e=e.type))return e.displayName||e.name;if("string"==typeof e)return e;switch(e){case da:return"ReactFragment";case ca:return"ReactPortal";case sa:return"ReactCall";case ua:return"ReactReturn"}return null}function re(e){var t="";do{e:switch(e.tag){case 0:case 1:case 2:case 5:var n=e._debugOwner,a=e._debugSource,o=oe(e),r=null;n&&(r=oe(n)),n=a,o="\n    in "+(o||"Unknown")+(n?" (at "+n.fileName.replace(/^.*[\\\/]/,"")+":"+n.lineNumber+")":r?" (created by "+r+")":"");break e;default:o=""}t+=o,e=e.return}while(e);return t}function ie(e){return!!xa.hasOwnProperty(e)||!ba.hasOwnProperty(e)&&(ya.test(e)?xa[e]=!0:(ba[e]=!0,!1))}function le(e,t,n,a){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!a&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}function se(e,t,n,a){if(null===t||void 0===t||le(e,t,n,a))return!0;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function ue(e,t,n,a,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=a,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t}function ce(e){return e[1].toUpperCase()}function de(e,t,n,a){var o=_a.hasOwnProperty(t)?_a[t]:null;(null!==o?0===o.type:!a&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(se(t,n,o,a)&&(n=null),a||null===o?ie(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=null===n?3!==o.type&&"":n:(t=o.attributeName,a=o.attributeNamespace,null===n?e.removeAttribute(t):(o=o.type,n=3===o||4===o&&!0===n?"":""+n,a?e.setAttributeNS(a,t,n):e.setAttribute(t,n))))}function pe(e,t){var n=t.checked;return dn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function fe(e,t){var n=null==t.defaultValue?"":t.defaultValue,a=null!=t.checked?t.checked:t.defaultChecked;n=ye(null!=t.value?t.value:n),e._wrapperState={initialChecked:a,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function me(e,t){null!=(t=t.checked)&&de(e,"checked",t,!1)}function he(e,t){me(e,t);var n=ye(t.value);null!=n&&("number"===t.type?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n)),t.hasOwnProperty("value")?ge(e,t.type,n):t.hasOwnProperty("defaultValue")&&ge(e,t.type,ye(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function ve(e,t){(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue"))&&(""===e.value&&(e.value=""+e._wrapperState.initialValue),e.defaultValue=""+e._wrapperState.initialValue),t=e.name,""!==t&&(e.name=""),e.defaultChecked=!e.defaultChecked,e.defaultChecked=!e.defaultChecked,""!==t&&(e.name=t)}function ge(e,t,n){"number"===t&&e.ownerDocument.activeElement===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}function ye(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function be(e,t,n){return e=A.getPooled(wa.change,e,t,n),e.type="change",H(n),P(e),e}function xe(e){g(e,!1)}function _e(e){if(ne(x(e)))return e}function ke(e,t){if("topChange"===e)return t}function we(){Ca&&(Ca.detachEvent("onpropertychange",Ce),Ea=Ca=null)}function Ce(e){"value"===e.propertyName&&_e(Ea)&&(e=be(Ea,e,X(e)),Q(xe,e))}function Ee(e,t,n){"topFocus"===e?(we(),Ca=t,Ea=n,Ca.attachEvent("onpropertychange",Ce)):"topBlur"===e&&we()}function Te(e){if("topSelectionChange"===e||"topKeyUp"===e||"topKeyDown"===e)return _e(Ea)}function Oe(e,t){if("topClick"===e)return _e(t)}function Se(e,t){if("topInput"===e||"topChange"===e)return _e(t)}function Pe(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Pa[e])&&!!t[e]}function Me(){return Pe}function Le(e){var t=e;if(e.alternate)for(;t.return;)t=t.return;else{if(0!=(2&t.effectTag))return 1;for(;t.return;)if(t=t.return,0!=(2&t.effectTag))return 1}return 3===t.tag?2:3}function Ne(e){return!!(e=e._reactInternalFiber)&&2===Le(e)}function je(e){2!==Le(e)&&a("188")}function Ae(e){var t=e.alternate;if(!t)return t=Le(e),3===t&&a("188"),1===t?null:e;for(var n=e,o=t;;){var r=n.return,i=r?r.alternate:null;if(!r||!i)break;if(r.child===i.child){for(var l=r.child;l;){if(l===n)return je(r),e;if(l===o)return je(r),t;l=l.sibling}a("188")}if(n.return!==o.return)n=r,o=i;else{l=!1;for(var s=r.child;s;){if(s===n){l=!0,n=r,o=i;break}if(s===o){l=!0,o=r,n=i;break}s=s.sibling}if(!l){for(s=i.child;s;){if(s===n){l=!0,n=i,o=r;break}if(s===o){l=!0,o=i,n=r;break}s=s.sibling}l||a("189")}}n.alternate!==o&&a("190")}return 3!==n.tag&&a("188"),n.stateNode.current===n?e:t}function De(e){if(!(e=Ae(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function Re(e){if(!(e=Ae(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child&&4!==t.tag)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function Ie(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function Fe(e,t){var n=e[0].toUpperCase()+e.slice(1),a="on"+n;n="top"+n,t={phasedRegistrationNames:{bubbled:a,captured:a+"Capture"},dependencies:[n],isInteractive:t},Ha[e]=t,Ka[n]=t}function Ue(e){var t=e.targetInst;do{if(!t){e.ancestors.push(t);break}var n;for(n=t;n.return;)n=n.return;if(!(n=3!==n.tag?null:n.stateNode.containerInfo))break;e.ancestors.push(t),t=b(n)}while(t);for(n=0;n<e.ancestors.length;n++)t=e.ancestors[n],y(e.topLevelType,t,e.nativeEvent,X(e.nativeEvent))}function ze(e){Ya=!!e}function Be(e,t,n){if(!n)return null;e=(qa(e)?He:Ke).bind(null,e),n.addEventListener(t,e,!1)}function Ve(e,t,n){if(!n)return null;e=(qa(e)?He:Ke).bind(null,e),n.addEventListener(t,e,!0)}function He(e,t){Z(Ke,e,t)}function Ke(e,t){if(Ya){var n=X(t);if(n=b(n),null!==n&&"number"==typeof n.tag&&2!==Le(n)&&(n=null),Za.length){var a=Za.pop();a.topLevelType=e,a.nativeEvent=t,a.targetInst=n,e=a}else e={topLevelType:e,nativeEvent:t,targetInst:n,ancestors:[]};try{Q(Ue,e)}finally{e.topLevelType=null,e.nativeEvent=null,e.targetInst=null,e.ancestors.length=0,10>Za.length&&Za.push(e)}}}function We(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n["ms"+e]="MS"+t,n["O"+e]="o"+t.toLowerCase(),n}function qe(e){if(Xa[e])return Xa[e];if(!Ga[e])return e;var t,n=Ga[e];for(t in n)if(n.hasOwnProperty(t)&&t in Ja)return Xa[e]=n[t];return e}function Ze(e){return Object.prototype.hasOwnProperty.call(e,ao)||(e[ao]=no++,to[e[ao]]={}),to[e[ao]]}function Ye(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Qe(e,t){var n=Ye(e);e=0;for(var a;n;){if(3===n.nodeType){if(a=e+n.textContent.length,e<=t&&a>=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ye(n)}}function Ge(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&"text"===e.type||"textarea"===t||"true"===e.contentEditable)}function Xe(e,t){if(uo||null==io||io!==fn())return null;var n=io;return"selectionStart"in n&&Ge(n)?n={start:n.selectionStart,end:n.selectionEnd}:window.getSelection?(n=window.getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}):n=void 0,so&&mn(so,n)?null:(so=n,e=A.getPooled(ro.select,lo,e,t),e.type="select",e.target=io,P(e),e)}function Je(e,t,n,a){this.tag=e,this.key=n,this.stateNode=this.type=null,this.sibling=this.child=this.return=null,this.index=0,this.ref=null,this.pendingProps=t,this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.expirationTime=0,this.alternate=null}function $e(e,t,n){var a=e.alternate;return null===a?(a=new Je(e.tag,t,e.key,e.mode),a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.effectTag=0,a.nextEffect=null,a.firstEffect=null,a.lastEffect=null),a.expirationTime=n,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a}function et(e,t,n){var o=e.type,r=e.key;e=e.props;var i=void 0;if("function"==typeof o)i=o.prototype&&o.prototype.isReactComponent?2:0;else if("string"==typeof o)i=5;else switch(o){case da:return tt(e.children,t,n,r);case ha:i=11,t|=3;break;case pa:i=11,t|=2;break;case sa:i=7;break;case ua:i=9;break;default:if("object"==typeof o&&null!==o)switch(o.$$typeof){case fa:i=13;break;case ma:i=12;break;case va:i=14;break;default:if("number"==typeof o.tag)return t=o,t.pendingProps=e,t.expirationTime=n,t;a("130",null==o?o:typeof o,"")}else a("130",null==o?o:typeof o,"")}return t=new Je(i,e,r,t),t.type=o,t.expirationTime=n,t}function tt(e,t,n,a){return e=new Je(10,e,a,t),e.expirationTime=n,e}function nt(e,t,n){return e=new Je(6,e,null,t),e.expirationTime=n,e}function at(e,t,n){return t=new Je(4,null!==e.children?e.children:[],e.key,t),t.expirationTime=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ot(e){return function(t){try{return e(t)}catch(e){}}}function rt(e){if("undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var n=t.inject(e);po=ot(function(e){return t.onCommitFiberRoot(n,e)}),fo=ot(function(e){return t.onCommitFiberUnmount(n,e)})}catch(e){}return!0}function it(e){"function"==typeof po&&po(e)}function lt(e){"function"==typeof fo&&fo(e)}function st(e){return{baseState:e,expirationTime:0,first:null,last:null,callbackList:null,hasForceUpdate:!1,isInitialized:!1,capturedValues:null}}function ut(e,t){null===e.last?e.first=e.last=t:(e.last.next=t,e.last=t),(0===e.expirationTime||e.expirationTime>t.expirationTime)&&(e.expirationTime=t.expirationTime)}function ct(e){mo=ho=null;var t=e.alternate,n=e.updateQueue;null===n&&(n=e.updateQueue=st(null)),null!==t?null===(e=t.updateQueue)&&(e=t.updateQueue=st(null)):e=null,mo=n,ho=e!==n?e:null}function dt(e,t){ct(e),e=mo;var n=ho;null===n?ut(e,t):null===e.last||null===n.last?(ut(e,t),ut(n,t)):(ut(e,t),n.last=t)}function pt(e,t,n,a){return e=e.partialState,"function"==typeof e?e.call(t,n,a):e}function ft(e,t,n,a,o,r){null!==e&&e.updateQueue===n&&(n=t.updateQueue={baseState:n.baseState,expirationTime:n.expirationTime,first:n.first,last:n.last,isInitialized:n.isInitialized,capturedValues:n.capturedValues,callbackList:null,hasForceUpdate:!1}),n.expirationTime=0,n.isInitialized?e=n.baseState:(e=n.baseState=t.memoizedState,n.isInitialized=!0);for(var i=!0,l=n.first,s=!1;null!==l;){var u=l.expirationTime;if(u>r){var c=n.expirationTime;(0===c||c>u)&&(n.expirationTime=u),s||(s=!0,n.baseState=e)}else s||(n.first=l.next,null===n.first&&(n.last=null)),l.isReplace?(e=pt(l,a,e,o),i=!0):(u=pt(l,a,e,o))&&(e=i?dn({},e,u):dn(e,u),i=!1),l.isForced&&(n.hasForceUpdate=!0),null!==l.callback&&(u=n.callbackList,null===u&&(u=n.callbackList=[]),u.push(l)),null!==l.capturedValue&&(u=n.capturedValues,null===u?n.capturedValues=[l.capturedValue]:u.push(l.capturedValue));l=l.next}return null!==n.callbackList?t.effectTag|=32:null!==n.first||n.hasForceUpdate||null!==n.capturedValues||(t.updateQueue=null),s||(n.baseState=e),e}function mt(e,t){var n=e.callbackList;if(null!==n)for(e.callbackList=null,e=0;e<n.length;e++){var o=n[e],r=o.callback;o.callback=null,"function"!=typeof r&&a("191",r),r.call(t)}}function ht(e,t,n,a,o){function r(e,t,n,a,o,r){if(null===t||null!==e.updateQueue&&e.updateQueue.hasForceUpdate)return!0;var i=e.stateNode;return e=e.type,"function"==typeof i.shouldComponentUpdate?i.shouldComponentUpdate(n,o,r):!e.prototype||!e.prototype.isPureReactComponent||(!mn(t,n)||!mn(a,o))}function i(e,t){t.updater=m,e.stateNode=t,t._reactInternalFiber=e}function l(e,t,n,a){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,a),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,a),t.state!==e&&m.enqueueReplaceState(t,t.state,null)}function s(e,t,n,a){if(e=e.type,"function"==typeof e.getDerivedStateFromProps)return e.getDerivedStateFromProps.call(null,n,a)}var u=e.cacheContext,c=e.getMaskedContext,d=e.getUnmaskedContext,p=e.isContextConsumer,f=e.hasContextChanged,m={isMounted:Ne,enqueueSetState:function(e,a,o){e=e._reactInternalFiber,o=void 0===o?null:o;var r=n(e);dt(e,{expirationTime:r,partialState:a,callback:o,isReplace:!1,isForced:!1,capturedValue:null,next:null}),t(e,r)},enqueueReplaceState:function(e,a,o){e=e._reactInternalFiber,o=void 0===o?null:o;var r=n(e);dt(e,{expirationTime:r,partialState:a,callback:o,isReplace:!0,isForced:!1,capturedValue:null,next:null}),t(e,r)},enqueueForceUpdate:function(e,a){e=e._reactInternalFiber,a=void 0===a?null:a;var o=n(e);dt(e,{expirationTime:o,partialState:null,callback:a,isReplace:!1,isForced:!0,capturedValue:null,next:null}),t(e,o)}};return{adoptClassInstance:i,callGetDerivedStateFromProps:s,constructClassInstance:function(e,t){var n=e.type,a=d(e),o=p(e),r=o?c(e,a):vn;n=new n(t,r);var l=null!==n.state&&void 0!==n.state?n.state:null;return i(e,n),e.memoizedState=l,t=s(e,n,t,l),null!==t&&void 0!==t&&(e.memoizedState=dn({},e.memoizedState,t)),o&&u(e,a,r),n},mountClassInstance:function(e,t){var n=e.type,a=e.alternate,o=e.stateNode,r=e.pendingProps,i=d(e);o.props=r,o.state=e.memoizedState,o.refs=vn,o.context=c(e,i),"function"==typeof n.getDerivedStateFromProps||"function"==typeof o.getSnapshotBeforeUpdate||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||(n=o.state,"function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),n!==o.state&&m.enqueueReplaceState(o,o.state,null),null!==(n=e.updateQueue)&&(o.state=ft(a,e,n,o,r,t))),"function"==typeof o.componentDidMount&&(e.effectTag|=4)},resumeMountClassInstance:function(e,t){var n=e.type,i=e.stateNode;i.props=e.memoizedProps,i.state=e.memoizedState;var u=e.memoizedProps,p=e.pendingProps,m=i.context,h=d(e);h=c(e,h),(n="function"==typeof n.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(u!==p||m!==h)&&l(e,i,p,h),m=e.memoizedState,t=null!==e.updateQueue?ft(null,e,e.updateQueue,i,p,t):m;var v=void 0;return u!==p&&(v=s(e,i,p,t)),null!==v&&void 0!==v&&(t=null===t||void 0===t?v:dn({},t,v)),u!==p||m!==t||f()||null!==e.updateQueue&&e.updateQueue.hasForceUpdate?((u=r(e,u,p,m,t,h))?(n||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(e.effectTag|=4)):("function"==typeof i.componentDidMount&&(e.effectTag|=4),a(e,p),o(e,t)),i.props=p,i.state=t,i.context=h,u):("function"==typeof i.componentDidMount&&(e.effectTag|=4),!1)},updateClassInstance:function(e,t,n){var i=t.type,u=t.stateNode;u.props=t.memoizedProps,u.state=t.memoizedState;var p=t.memoizedProps,m=t.pendingProps,h=u.context,v=d(t);v=c(t,v),(i="function"==typeof i.getDerivedStateFromProps||"function"==typeof u.getSnapshotBeforeUpdate)||"function"!=typeof u.UNSAFE_componentWillReceiveProps&&"function"!=typeof u.componentWillReceiveProps||(p!==m||h!==v)&&l(t,u,m,v),h=t.memoizedState,n=null!==t.updateQueue?ft(e,t,t.updateQueue,u,m,n):h;var g=void 0;return p!==m&&(g=s(t,u,m,n)),null!==g&&void 0!==g&&(n=null===n||void 0===n?g:dn({},n,g)),p!==m||h!==n||f()||null!==t.updateQueue&&t.updateQueue.hasForceUpdate?((g=r(t,p,m,h,n,v))?(i||"function"!=typeof u.UNSAFE_componentWillUpdate&&"function"!=typeof u.componentWillUpdate||("function"==typeof u.componentWillUpdate&&u.componentWillUpdate(m,n,v),"function"==typeof u.UNSAFE_componentWillUpdate&&u.UNSAFE_componentWillUpdate(m,n,v)),"function"==typeof u.componentDidUpdate&&(t.effectTag|=4),"function"==typeof u.getSnapshotBeforeUpdate&&(t.effectTag|=2048)):("function"!=typeof u.componentDidUpdate||p===e.memoizedProps&&h===e.memoizedState||(t.effectTag|=4),"function"!=typeof u.getSnapshotBeforeUpdate||p===e.memoizedProps&&h===e.memoizedState||(t.effectTag|=2048),a(t,m),o(t,n)),u.props=m,u.state=n,u.context=v,g):("function"!=typeof u.componentDidUpdate||p===e.memoizedProps&&h===e.memoizedState||(t.effectTag|=4),"function"!=typeof u.getSnapshotBeforeUpdate||p===e.memoizedProps&&h===e.memoizedState||(t.effectTag|=2048),!1)}}}function vt(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){n=n._owner;var o=void 0;n&&(2!==n.tag&&a("110"),o=n.stateNode),o||a("147",e);var r=""+e;return null!==t&&null!==t.ref&&t.ref._stringRef===r?t.ref:(t=function(e){var t=o.refs===vn?o.refs={}:o.refs;null===e?delete t[r]:t[r]=e},t._stringRef=r,t)}"string"!=typeof e&&a("148"),n._owner||a("254",e)}return e}function gt(e,t){"textarea"!==e.type&&a("31","[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t,"")}function yt(e){function t(t,n){if(e){var a=t.lastEffect;null!==a?(a.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.effectTag=8}}function n(n,a){if(!e)return null;for(;null!==a;)t(n,a),a=a.sibling;return null}function o(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function r(e,t,n){return e=$e(e,t,n),e.index=0,e.sibling=null,e}function i(t,n,a){return t.index=a,e?null!==(a=t.alternate)?(a=a.index,a<n?(t.effectTag=2,n):a):(t.effectTag=2,n):n}function l(t){return e&&null===t.alternate&&(t.effectTag=2),t}function s(e,t,n,a){return null===t||6!==t.tag?(t=nt(n,e.mode,a),t.return=e,t):(t=r(t,n,a),t.return=e,t)}function u(e,t,n,a){return null!==t&&t.type===n.type?(a=r(t,n.props,a),a.ref=vt(e,t,n),a.return=e,a):(a=et(n,e.mode,a),a.ref=vt(e,t,n),a.return=e,a)}function c(e,t,n,a){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=at(n,e.mode,a),t.return=e,t):(t=r(t,n.children||[],a),t.return=e,t)}function d(e,t,n,a,o){return null===t||10!==t.tag?(t=tt(n,e.mode,a,o),t.return=e,t):(t=r(t,n,a),t.return=e,t)}function p(e,t,n){if("string"==typeof t||"number"==typeof t)return t=nt(""+t,e.mode,n),t.return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case la:return n=et(t,e.mode,n),n.ref=vt(e,null,t),n.return=e,n;case ca:return t=at(t,e.mode,n),t.return=e,t}if(vo(t)||ae(t))return t=tt(t,e.mode,n,null),t.return=e,t;gt(e,t)}return null}function f(e,t,n,a){var o=null!==t?t.key:null;if("string"==typeof n||"number"==typeof n)return null!==o?null:s(e,t,""+n,a);if("object"==typeof n&&null!==n){switch(n.$$typeof){case la:return n.key===o?n.type===da?d(e,t,n.props.children,a,o):u(e,t,n,a):null;case ca:return n.key===o?c(e,t,n,a):null}if(vo(n)||ae(n))return null!==o?null:d(e,t,n,a,null);gt(e,n)}return null}function m(e,t,n,a,o){if("string"==typeof a||"number"==typeof a)return e=e.get(n)||null,s(t,e,""+a,o);if("object"==typeof a&&null!==a){switch(a.$$typeof){case la:return e=e.get(null===a.key?n:a.key)||null,a.type===da?d(t,e,a.props.children,o,a.key):u(t,e,a,o);case ca:return e=e.get(null===a.key?n:a.key)||null,c(t,e,a,o)}if(vo(a)||ae(a))return e=e.get(n)||null,d(t,e,a,o,null);gt(t,a)}return null}function h(a,r,l,s){for(var u=null,c=null,d=r,h=r=0,v=null;null!==d&&h<l.length;h++){d.index>h?(v=d,d=null):v=d.sibling;var g=f(a,d,l[h],s);if(null===g){null===d&&(d=v);break}e&&d&&null===g.alternate&&t(a,d),r=i(g,r,h),null===c?u=g:c.sibling=g,c=g,d=v}if(h===l.length)return n(a,d),u;if(null===d){for(;h<l.length;h++)(d=p(a,l[h],s))&&(r=i(d,r,h),null===c?u=d:c.sibling=d,c=d);return u}for(d=o(a,d);h<l.length;h++)(v=m(d,a,h,l[h],s))&&(e&&null!==v.alternate&&d.delete(null===v.key?h:v.key),r=i(v,r,h),null===c?u=v:c.sibling=v,c=v);return e&&d.forEach(function(e){return t(a,e)}),u}function v(r,l,s,u){var c=ae(s);"function"!=typeof c&&a("150"),null==(s=c.call(s))&&a("151");for(var d=c=null,h=l,v=l=0,g=null,y=s.next();null!==h&&!y.done;v++,y=s.next()){h.index>v?(g=h,h=null):g=h.sibling;var b=f(r,h,y.value,u);if(null===b){h||(h=g);break}e&&h&&null===b.alternate&&t(r,h),l=i(b,l,v),null===d?c=b:d.sibling=b,d=b,h=g}if(y.done)return n(r,h),c;if(null===h){for(;!y.done;v++,y=s.next())null!==(y=p(r,y.value,u))&&(l=i(y,l,v),null===d?c=y:d.sibling=y,d=y);return c}for(h=o(r,h);!y.done;v++,y=s.next())null!==(y=m(h,r,v,y.value,u))&&(e&&null!==y.alternate&&h.delete(null===y.key?v:y.key),l=i(y,l,v),null===d?c=y:d.sibling=y,d=y);return e&&h.forEach(function(e){return t(r,e)}),c}return function(e,o,i,s){"object"==typeof i&&null!==i&&i.type===da&&null===i.key&&(i=i.props.children);var u="object"==typeof i&&null!==i;if(u)switch(i.$$typeof){case la:e:{var c=i.key;for(u=o;null!==u;){if(u.key===c){if(10===u.tag?i.type===da:u.type===i.type){n(e,u.sibling),o=r(u,i.type===da?i.props.children:i.props,s),o.ref=vt(e,u,i),o.return=e,e=o;break e}n(e,u);break}t(e,u),u=u.sibling}i.type===da?(o=tt(i.props.children,e.mode,s,i.key),o.return=e,e=o):(s=et(i,e.mode,s),s.ref=vt(e,o,i),s.return=e,e=s)}return l(e);case ca:e:{for(u=i.key;null!==o;){if(o.key===u){if(4===o.tag&&o.stateNode.containerInfo===i.containerInfo&&o.stateNode.implementation===i.implementation){n(e,o.sibling),o=r(o,i.children||[],s),o.return=e,e=o;break e}n(e,o);break}t(e,o),o=o.sibling}o=at(i,e.mode,s),o.return=e,e=o}return l(e)}if("string"==typeof i||"number"==typeof i)return i=""+i,null!==o&&6===o.tag?(n(e,o.sibling),o=r(o,i,s)):(n(e,o),o=nt(i,e.mode,s)),o.return=e,e=o,l(e);if(vo(i))return h(e,o,i,s);if(ae(i))return v(e,o,i,s);if(u&&gt(e,i),void 0===i)switch(e.tag){case 2:case 1:s=e.type,a("152",s.displayName||s.name||"Component")}return n(e,o)}}function bt(e,t,n,o,r,i,l){function s(e,t,n){u(e,t,n,t.expirationTime)}function u(e,t,n,a){t.child=null===e?yo(t,null,n,a):go(t,e.child,n,a)}function c(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.effectTag|=128)}function d(e,t,n,a,o,r){if(c(e,t),!n&&!o)return a&&T(t,!1),h(e,t);n=t.stateNode,ra.current=t;var i=o?null:n.render();return t.effectTag|=1,o&&(u(e,t,null,r),t.child=null),u(e,t,i,r),t.memoizedState=n.state,t.memoizedProps=n.props,a&&T(t,!0),t.child}function p(e){var t=e.stateNode;t.pendingContext?E(e,t.pendingContext,t.pendingContext!==t.context):t.context&&E(e,t.context,!1),b(e,t.containerInfo)}function f(e,t,n,a){var o=e.child;for(null!==o&&(o.return=e);null!==o;){switch(o.tag){case 12:var r=0|o.stateNode;if(o.type===t&&0!=(r&n)){for(r=o;null!==r;){var i=r.alternate;if(0===r.expirationTime||r.expirationTime>a)r.expirationTime=a,null!==i&&(0===i.expirationTime||i.expirationTime>a)&&(i.expirationTime=a);else{if(null===i||!(0===i.expirationTime||i.expirationTime>a))break;i.expirationTime=a}r=r.return}r=null}else r=o.child;break;case 13:r=o.type===e.type?null:o.child;break;default:r=o.child}if(null!==r)r.return=o;else for(r=o;null!==r;){if(r===e){r=null;break}if(null!==(o=r.sibling)){r=o;break}r=r.return}o=r}}function m(e,t,n){var a=t.type.context,o=t.pendingProps,r=t.memoizedProps;if(!w()&&r===o)return t.stateNode=0,x(t),h(e,t);var i=o.value;if(t.memoizedProps=o,null===r)i=1073741823;else if(r.value===o.value){if(r.children===o.children)return t.stateNode=0,x(t),h(e,t);i=0}else{var l=r.value;if(l===i&&(0!==l||1/l==1/i)||l!==l&&i!==i){if(r.children===o.children)return t.stateNode=0,x(t),h(e,t);i=0}else if(i="function"==typeof a._calculateChangedBits?a._calculateChangedBits(l,i):1073741823,0===(i|=0)){if(r.children===o.children)return t.stateNode=0,x(t),h(e,t)}else f(t,a,i,n)}return t.stateNode=i,x(t),s(e,t,o.children),t.child}function h(e,t){if(null!==e&&t.child!==e.child&&a("153"),null!==t.child){e=t.child;var n=$e(e,e.pendingProps,e.expirationTime);for(t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,n=n.sibling=$e(e,e.pendingProps,e.expirationTime),n.return=t;n.sibling=null}return t.child}var v=e.shouldSetTextContent,g=e.shouldDeprioritizeSubtree,y=t.pushHostContext,b=t.pushHostContainer,x=o.pushProvider,_=n.getMaskedContext,k=n.getUnmaskedContext,w=n.hasContextChanged,C=n.pushContextProvider,E=n.pushTopLevelContextObject,T=n.invalidateContextProvider,O=r.enterHydrationState,S=r.resetHydrationState,P=r.tryToClaimNextHydratableInstance;e=ht(n,i,l,function(e,t){e.memoizedProps=t},function(e,t){e.memoizedState=t});var M=e.adoptClassInstance,L=e.callGetDerivedStateFromProps,N=e.constructClassInstance,j=e.mountClassInstance,A=e.resumeMountClassInstance,D=e.updateClassInstance;return{beginWork:function(e,t,n){if(0===t.expirationTime||t.expirationTime>n){switch(t.tag){case 3:p(t);break;case 2:C(t);break;case 4:b(t,t.stateNode.containerInfo);break;case 13:x(t)}return null}switch(t.tag){case 0:null!==e&&a("155");var o=t.type,r=t.pendingProps,i=k(t);return i=_(t,i),o=o(r,i),t.effectTag|=1,"object"==typeof o&&null!==o&&"function"==typeof o.render&&void 0===o.$$typeof?(i=t.type,t.tag=2,t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,"function"==typeof i.getDerivedStateFromProps&&null!==(r=L(t,o,r,t.memoizedState))&&void 0!==r&&(t.memoizedState=dn({},t.memoizedState,r)),r=C(t),M(t,o),j(t,n),e=d(e,t,!0,r,!1,n)):(t.tag=1,s(e,t,o),t.memoizedProps=r,e=t.child),e;case 1:return r=t.type,n=t.pendingProps,w()||t.memoizedProps!==n?(o=k(t),o=_(t,o),r=r(n,o),t.effectTag|=1,s(e,t,r),t.memoizedProps=n,e=t.child):e=h(e,t),e;case 2:r=C(t),null===e?null===t.stateNode?(N(t,t.pendingProps),j(t,n),o=!0):o=A(t,n):o=D(e,t,n),i=!1;var l=t.updateQueue;return null!==l&&null!==l.capturedValues&&(i=o=!0),d(e,t,o,r,i,n);case 3:e:if(p(t),null!==(o=t.updateQueue)){if(i=t.memoizedState,r=ft(e,t,o,null,null,n),t.memoizedState=r,null!==(o=t.updateQueue)&&null!==o.capturedValues)o=null;else{if(i===r){S(),e=h(e,t);break e}o=r.element}i=t.stateNode,(null===e||null===e.child)&&i.hydrate&&O(t)?(t.effectTag|=2,t.child=yo(t,null,o,n)):(S(),s(e,t,o)),t.memoizedState=r,e=t.child}else S(),e=h(e,t);return e;case 5:return y(t),null===e&&P(t),r=t.type,l=t.memoizedProps,o=t.pendingProps,i=null!==e?e.memoizedProps:null,w()||l!==o||((l=1&t.mode&&g(r,o))&&(t.expirationTime=1073741823),l&&1073741823===n)?(l=o.children,v(r,o)?l=null:i&&v(r,i)&&(t.effectTag|=16),c(e,t),1073741823!==n&&1&t.mode&&g(r,o)?(t.expirationTime=1073741823,t.memoizedProps=o,e=null):(s(e,t,l),t.memoizedProps=o,e=t.child)):e=h(e,t),e;case 6:return null===e&&P(t),t.memoizedProps=t.pendingProps,null;case 8:t.tag=7;case 7:return r=t.pendingProps,w()||t.memoizedProps!==r||(r=t.memoizedProps),o=r.children,t.stateNode=null===e?yo(t,t.stateNode,o,n):go(t,e.stateNode,o,n),t.memoizedProps=r,t.stateNode;case 9:return null;case 4:return b(t,t.stateNode.containerInfo),r=t.pendingProps,w()||t.memoizedProps!==r?(null===e?t.child=go(t,null,r,n):s(e,t,r),t.memoizedProps=r,e=t.child):e=h(e,t),e;case 14:return n=t.type.render,n=n(t.pendingProps,t.ref),s(e,t,n),t.memoizedProps=n,t.child;case 10:return n=t.pendingProps,w()||t.memoizedProps!==n?(s(e,t,n),t.memoizedProps=n,e=t.child):e=h(e,t),e;case 11:return n=t.pendingProps.children,w()||null!==n&&t.memoizedProps!==n?(s(e,t,n),t.memoizedProps=n,e=t.child):e=h(e,t),e;case 13:return m(e,t,n);case 12:o=t.type,i=t.pendingProps;var u=t.memoizedProps;return r=o._currentValue,l=o._changedBits,w()||0!==l||u!==i?(t.memoizedProps=i,u=i.unstable_observedBits,void 0!==u&&null!==u||(u=1073741823),t.stateNode=u,0!=(l&u)&&f(t,o,l,n),n=i.children,n=n(r),s(e,t,n),e=t.child):e=h(e,t),e;default:a("156")}}}}function xt(e,t,n,o,r){function i(e){e.effectTag|=4}var l=e.createInstance,s=e.createTextInstance,u=e.appendInitialChild,c=e.finalizeInitialChildren,d=e.prepareUpdate,p=e.persistence,f=t.getRootHostContainer,m=t.popHostContext,h=t.getHostContext,v=t.popHostContainer,g=n.popContextProvider,y=n.popTopLevelContextObject,b=o.popProvider,x=r.prepareToHydrateHostInstance,_=r.prepareToHydrateHostTextInstance,k=r.popHydrationState,w=void 0,C=void 0,E=void 0;return e.mutation?(w=function(){},C=function(e,t,n){(t.updateQueue=n)&&i(t)},E=function(e,t,n,a){n!==a&&i(t)}):a(p?"235":"236"),{completeWork:function(e,t,n){var o=t.pendingProps;switch(t.tag){case 1:return null;case 2:return g(t),e=t.stateNode,o=t.updateQueue,null!==o&&null!==o.capturedValues&&(t.effectTag&=-65,"function"==typeof e.componentDidCatch?t.effectTag|=256:o.capturedValues=null),null;case 3:return v(t),y(t),o=t.stateNode,o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),null!==e&&null!==e.child||(k(t),t.effectTag&=-3),w(t),e=t.updateQueue,null!==e&&null!==e.capturedValues&&(t.effectTag|=256),null;case 5:m(t),n=f();var r=t.type;if(null!==e&&null!=t.stateNode){var p=e.memoizedProps,T=t.stateNode,O=h();T=d(T,r,p,o,n,O),C(e,t,T,r,p,o,n,O),e.ref!==t.ref&&(t.effectTag|=128)}else{if(!o)return null===t.stateNode&&a("166"),null;if(e=h(),k(t))x(t,n,e)&&i(t);else{p=l(r,o,n,e,t);e:for(O=t.child;null!==O;){if(5===O.tag||6===O.tag)u(p,O.stateNode);else if(4!==O.tag&&null!==O.child){O.child.return=O,O=O.child;continue}if(O===t)break;for(;null===O.sibling;){if(null===O.return||O.return===t)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}c(p,r,o,n,e)&&i(t),t.stateNode=p}null!==t.ref&&(t.effectTag|=128)}return null;case 6:if(e&&null!=t.stateNode)E(e,t,e.memoizedProps,o);else{if("string"!=typeof o)return null===t.stateNode&&a("166"),null;e=f(),n=h(),k(t)?_(t)&&i(t):t.stateNode=s(o,e,n,t)}return null;case 7:(o=t.memoizedProps)||a("165"),t.tag=8,r=[];e:for((p=t.stateNode)&&(p.return=t);null!==p;){if(5===p.tag||6===p.tag||4===p.tag)a("247");else if(9===p.tag)r.push(p.pendingProps.value);else if(null!==p.child){p.child.return=p,p=p.child;continue}for(;null===p.sibling;){if(null===p.return||p.return===t)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}return p=o.handler,o=p(o.props,r),t.child=go(t,null!==e?e.child:null,o,n),t.child;case 8:return t.tag=7,null;case 9:case 14:case 10:case 11:return null;case 4:return v(t),w(t),null;case 13:return b(t),null;case 12:return null;case 0:a("167");default:a("156")}}}}function _t(e,t,n,a,o){var r=e.popHostContainer,i=e.popHostContext,l=t.popContextProvider,s=t.popTopLevelContextObject,u=n.popProvider;return{throwException:function(e,t,n){t.effectTag|=512,t.firstEffect=t.lastEffect=null,t={value:n,source:t,stack:re(t)};do{switch(e.tag){case 3:return ct(e),e.updateQueue.capturedValues=[t],void(e.effectTag|=1024);case 2:if(n=e.stateNode,0==(64&e.effectTag)&&null!==n&&"function"==typeof n.componentDidCatch&&!o(n)){ct(e),n=e.updateQueue;var a=n.capturedValues;return null===a?n.capturedValues=[t]:a.push(t),void(e.effectTag|=1024)}}e=e.return}while(null!==e)},unwindWork:function(e){switch(e.tag){case 2:l(e);var t=e.effectTag;return 1024&t?(e.effectTag=-1025&t|64,e):null;case 3:return r(e),s(e),t=e.effectTag,1024&t?(e.effectTag=-1025&t|64,e):null;case 5:return i(e),null;case 4:return r(e),null;case 13:return u(e),null;default:return null}},unwindInterruptedWork:function(e){switch(e.tag){case 2:l(e);break;case 3:r(e),s(e);break;case 5:i(e);break;case 4:r(e);break;case 13:u(e)}}}}function kt(e,t){var n=t.source;null===t.stack&&re(n),null!==n&&oe(n),t=t.value,null!==e&&2===e.tag&&oe(e);try{t&&t.suppressReactErrorLogging||console.error(t)}catch(e){e&&e.suppressReactErrorLogging||console.error(e)}}function wt(e,t,n,o,r){function i(e){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){t(e,n)}else n.current=null}function l(e){switch("function"==typeof lt&&lt(e),e.tag){case 2:i(e);var n=e.stateNode;if("function"==typeof n.componentWillUnmount)try{n.props=e.memoizedProps,n.state=e.memoizedState,n.componentWillUnmount()}catch(n){t(e,n)}break;case 5:i(e);break;case 7:s(e.stateNode);break;case 4:p&&c(e)}}function s(e){for(var t=e;;)if(l(t),null===t.child||p&&4===t.tag){if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}else t.child.return=t,t=t.child}function u(e){return 5===e.tag||3===e.tag||4===e.tag}function c(e){for(var t=e,n=!1,o=void 0,r=void 0;;){if(!n){n=t.return;e:for(;;){switch(null===n&&a("160"),n.tag){case 5:o=n.stateNode,r=!1;break e;case 3:case 4:o=n.stateNode.containerInfo,r=!0;break e}n=n.return}n=!0}if(5===t.tag||6===t.tag)s(t),r?k(o,t.stateNode):_(o,t.stateNode);else if(4===t.tag?o=t.stateNode.containerInfo:l(t),null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return;t=t.return,4===t.tag&&(n=!1)}t.sibling.return=t.return,t=t.sibling}}var d=e.getPublicInstance,p=e.mutation;e=e.persistence,p||a(e?"235":"236");var f=p.commitMount,m=p.commitUpdate,h=p.resetTextContent,v=p.commitTextUpdate,g=p.appendChild,y=p.appendChildToContainer,b=p.insertBefore,x=p.insertInContainerBefore,_=p.removeChild,k=p.removeChildFromContainer;return{commitBeforeMutationLifeCycles:function(e,t){switch(t.tag){case 2:if(2048&t.effectTag&&null!==e){var n=e.memoizedProps,o=e.memoizedState;e=t.stateNode,e.props=t.memoizedProps,e.state=t.memoizedState,t=e.getSnapshotBeforeUpdate(n,o),e.__reactInternalSnapshotBeforeUpdate=t}break;case 3:case 5:case 6:case 4:break;default:a("163")}},commitResetTextContent:function(e){h(e.stateNode)},commitPlacement:function(e){e:{for(var t=e.return;null!==t;){if(u(t)){var n=t;break e}t=t.return}a("160"),n=void 0}var o=t=void 0;switch(n.tag){case 5:t=n.stateNode,o=!1;break;case 3:case 4:t=n.stateNode.containerInfo,o=!0;break;default:a("161")}16&n.effectTag&&(h(t),n.effectTag&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||u(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag;){if(2&n.effectTag)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break e}}for(var r=e;;){if(5===r.tag||6===r.tag)n?o?x(t,r.stateNode,n):b(t,r.stateNode,n):o?y(t,r.stateNode):g(t,r.stateNode);else if(4!==r.tag&&null!==r.child){r.child.return=r,r=r.child;continue}if(r===e)break;for(;null===r.sibling;){if(null===r.return||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}},commitDeletion:function(e){c(e),e.return=null,e.child=null,e.alternate&&(e.alternate.child=null,e.alternate.return=null)},commitWork:function(e,t){switch(t.tag){case 2:break;case 5:var n=t.stateNode;if(null!=n){var o=t.memoizedProps;e=null!==e?e.memoizedProps:o;var r=t.type,i=t.updateQueue;t.updateQueue=null,null!==i&&m(n,i,r,e,o,t)}break;case 6:null===t.stateNode&&a("162"),n=t.memoizedProps,v(t.stateNode,null!==e?e.memoizedProps:n,n);break;case 3:break;default:a("163")}},commitLifeCycles:function(e,t,n){switch(n.tag){case 2:if(e=n.stateNode,4&n.effectTag)if(null===t)e.props=n.memoizedProps,e.state=n.memoizedState,e.componentDidMount();else{var o=t.memoizedProps;t=t.memoizedState,e.props=n.memoizedProps,e.state=n.memoizedState,e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}n=n.updateQueue,null!==n&&mt(n,e);break;case 3:if(null!==(t=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 5:e=d(n.child.stateNode);break;case 2:e=n.child.stateNode}mt(t,e)}break;case 5:e=n.stateNode,null===t&&4&n.effectTag&&f(e,n.type,n.memoizedProps,n);break;case 6:case 4:break;default:a("163")}},commitErrorLogging:function(e,t){switch(e.tag){case 2:var n=e.type;t=e.stateNode;var o=e.updateQueue;(null===o||null===o.capturedValues)&&a("264");var i=o.capturedValues;for(o.capturedValues=null,"function"!=typeof n.getDerivedStateFromCatch&&r(t),t.props=e.memoizedProps,t.state=e.memoizedState,n=0;n<i.length;n++){o=i[n];var l=o.value,s=o.stack;kt(e,o),t.componentDidCatch(l,{componentStack:null!==s?s:""})}break;case 3:for(n=e.updateQueue,(null===n||null===n.capturedValues)&&a("264"),i=n.capturedValues,n.capturedValues=null,n=0;n<i.length;n++)o=i[n],kt(e,o),t(o.value);break;default:a("265")}},commitAttachRef:function(e){var t=e.ref;if(null!==t){var n=e.stateNode;switch(e.tag){case 5:e=d(n);break;default:e=n}"function"==typeof t?t(e):t.current=e}},commitDetachRef:function(e){null!==(e=e.ref)&&("function"==typeof e?e(null):e.current=null)}}}function Ct(e,t){function n(e){return e===bo&&a("174"),e}var o=e.getChildHostContext,r=e.getRootHostContext;e=t.createCursor;var i=t.push,l=t.pop,s=e(bo),u=e(bo),c=e(bo);return{getHostContext:function(){return n(s.current)},getRootHostContainer:function(){return n(c.current)},popHostContainer:function(e){l(s,e),l(u,e),l(c,e)},popHostContext:function(e){u.current===e&&(l(s,e),l(u,e))},pushHostContainer:function(e,t){i(c,t,e),t=r(t),i(u,e,e),i(s,t,e)},pushHostContext:function(e){var t=n(c.current),a=n(s.current);t=o(a,e.type,t),a!==t&&(i(u,e,e),i(s,t,e))}}}function Et(e){function t(e,t){var n=new Je(5,null,null,0);n.type="DELETED",n.stateNode=t,n.return=e,n.effectTag=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function n(e,t){switch(e.tag){case 5:return null!==(t=i(t,e.type,e.pendingProps))&&(e.stateNode=t,!0);case 6:return null!==(t=l(t,e.pendingProps))&&(e.stateNode=t,!0);default:return!1}}function o(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag;)e=e.return;p=e}var r=e.shouldSetTextContent;if(!(e=e.hydration))return{enterHydrationState:function(){return!1},resetHydrationState:function(){},tryToClaimNextHydratableInstance:function(){},prepareToHydrateHostInstance:function(){a("175")},prepareToHydrateHostTextInstance:function(){a("176")},popHydrationState:function(){return!1}};var i=e.canHydrateInstance,l=e.canHydrateTextInstance,s=e.getNextHydratableSibling,u=e.getFirstHydratableChild,c=e.hydrateInstance,d=e.hydrateTextInstance,p=null,f=null,m=!1;return{enterHydrationState:function(e){return f=u(e.stateNode.containerInfo),p=e,m=!0},resetHydrationState:function(){f=p=null,m=!1},tryToClaimNextHydratableInstance:function(e){if(m){var a=f;if(a){if(!n(e,a)){if(!(a=s(a))||!n(e,a))return e.effectTag|=2,m=!1,void(p=e);t(p,f)}p=e,f=u(a)}else e.effectTag|=2,m=!1,p=e}},prepareToHydrateHostInstance:function(e,t,n){return t=c(e.stateNode,e.type,e.memoizedProps,t,n,e),e.updateQueue=t,null!==t},prepareToHydrateHostTextInstance:function(e){return d(e.stateNode,e.memoizedProps,e)},popHydrationState:function(e){if(e!==p)return!1;if(!m)return o(e),m=!0,!1;var n=e.type;if(5!==e.tag||"head"!==n&&"body"!==n&&!r(n,e.memoizedProps))for(n=f;n;)t(e,n),n=s(n);return o(e),f=p?s(e.stateNode):null,!0}}}function Tt(e){function t(e,t,n){e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=n}function n(e){return 2===e.tag&&null!=e.type.childContextTypes}function o(e,t){var n=e.stateNode,o=e.type.childContextTypes;if("function"!=typeof n.getChildContext)return t;n=n.getChildContext();for(var r in n)r in o||a("108",oe(e)||"Unknown",r);return dn({},t,n)}var r=e.createCursor,i=e.push,l=e.pop,s=r(vn),u=r(!1),c=vn;return{getUnmaskedContext:function(e){return n(e)?c:s.current},cacheContext:t,getMaskedContext:function(e,n){var a=e.type.contextTypes;if(!a)return vn;var o=e.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===n)return o.__reactInternalMemoizedMaskedChildContext;var r,i={};for(r in a)i[r]=n[r];return o&&t(e,n,i),i},hasContextChanged:function(){return u.current},isContextConsumer:function(e){return 2===e.tag&&null!=e.type.contextTypes},isContextProvider:n,popContextProvider:function(e){n(e)&&(l(u,e),l(s,e))},popTopLevelContextObject:function(e){l(u,e),l(s,e)},pushTopLevelContextObject:function(e,t,n){null!=s.cursor&&a("168"),i(s,t,e),i(u,n,e)},processChildContext:o,pushContextProvider:function(e){if(!n(e))return!1;var t=e.stateNode;return t=t&&t.__reactInternalMemoizedMergedChildContext||vn,c=s.current,i(s,t,e),i(u,u.current,e),!0},invalidateContextProvider:function(e,t){var n=e.stateNode;if(n||a("169"),t){var r=o(e,c);n.__reactInternalMemoizedMergedChildContext=r,l(u,e),l(s,e),i(s,r,e)}else l(u,e);i(u,t,e)},findCurrentUnmaskedContext:function(e){for(2!==Le(e)||2!==e.tag?a("170"):void 0;3!==e.tag;){if(n(e))return e.stateNode.__reactInternalMemoizedMergedChildContext;(e=e.return)||a("171")}return e.stateNode.context}}}function Ot(e){var t=e.createCursor,n=e.push,a=e.pop,o=t(null),r=t(null),i=t(0);return{pushProvider:function(e){var t=e.type.context;n(i,t._changedBits,e),n(r,t._currentValue,e),n(o,e,e),t._currentValue=e.pendingProps.value,t._changedBits=e.stateNode},popProvider:function(e){var t=i.current,n=r.current;a(o,e),a(r,e),a(i,e),e=e.type.context,e._currentValue=n,e._changedBits=t}}}function St(){var e=[],t=-1;return{createCursor:function(e){return{current:e}},isEmpty:function(){return-1===t},pop:function(n){0>t||(n.current=e[t],e[t]=null,t--)},push:function(n,a){t++,e[t]=n.current,n.current=a},checkThatStackIsEmpty:function(){},resetStackAfterFatalErrorInDev:function(){}}}function Pt(e){function t(){if(null!==$)for(var e=$.return;null!==e;)N(e),e=e.return;ee=null,te=0,$=null,oe=!1}function n(e){return null!==ie&&ie.has(e)}function o(e){for(;;){var t=e.alternate,n=e.return,a=e.sibling;if(0==(512&e.effectTag)){t=P(t,e,te);var o=e;if(1073741823===te||1073741823!==o.expirationTime){e:switch(o.tag){case 3:case 2:var r=o.updateQueue;r=null===r?0:r.expirationTime;break e;default:r=0}for(var i=o.child;null!==i;)0!==i.expirationTime&&(0===r||r>i.expirationTime)&&(r=i.expirationTime),i=i.sibling;o.expirationTime=r}if(null!==t)return t;if(null!==n&&0==(512&n.effectTag)&&(null===n.firstEffect&&(n.firstEffect=e.firstEffect),null!==e.lastEffect&&(null!==n.lastEffect&&(n.lastEffect.nextEffect=e.firstEffect),n.lastEffect=e.lastEffect),1<e.effectTag&&(null!==n.lastEffect?n.lastEffect.nextEffect=e:n.firstEffect=e,n.lastEffect=e)),null!==a)return a;if(null===n){oe=!0;break}e=n}else{if(null!==(e=L(e)))return e.effectTag&=2559,e;if(null!==n&&(n.firstEffect=n.lastEffect=null,n.effectTag|=512),null!==a)return a;if(null===n)break;e=n}}return null}function r(e){var t=S(e.alternate,e,te);return null===t&&(t=o(e)),ra.current=null,t}function i(e,n,i){J&&a("243"),J=!0,n===te&&e===ee&&null!==$||(t(),ee=e,te=n,$=$e(ee.current,null,te),e.pendingCommitExpirationTime=0);for(var l=!1;;){try{if(i)for(;null!==$&&!k();)$=r($);else for(;null!==$;)$=r($)}catch(e){if(null===$){l=!0,w(e);break}i=$;var s=i.return;if(null===s){l=!0,w(e);break}M(s,i,e),$=o(i)}break}return J=!1,l||null!==$?null:oe?(e.pendingCommitExpirationTime=n,e.current.alternate):void a("262")}function l(e,t,n,a){e={value:n,source:e,stack:re(e)},dt(t,{expirationTime:a,partialState:null,callback:null,isReplace:!1,isForced:!1,capturedValue:e,next:null}),c(t,a)}function s(e,t){e:{J&&!ae&&a("263");for(var o=e.return;null!==o;){switch(o.tag){case 2:var r=o.stateNode;if("function"==typeof o.type.getDerivedStateFromCatch||"function"==typeof r.componentDidCatch&&!n(r)){l(e,o,t,1),e=void 0;break e}break;case 3:l(e,o,t,1),e=void 0;break e}o=o.return}3===e.tag&&l(e,e,t,1),e=void 0}return e}function u(e){return e=0!==X?X:J?ae?1:te:1&e.mode?_e?10*(1+((d()+50)/10|0)):25*(1+((d()+500)/25|0)):1,_e&&(0===me||e>me)&&(me=e),e}function c(e,n){e:{for(;null!==e;){if((0===e.expirationTime||e.expirationTime>n)&&(e.expirationTime=n),null!==e.alternate&&(0===e.alternate.expirationTime||e.alternate.expirationTime>n)&&(e.alternate.expirationTime=n),null===e.return){if(3!==e.tag){n=void 0;break e}var o=e.stateNode;!J&&0!==te&&n<te&&t(),J&&!ae&&ee===o||m(o,n),Ce>we&&a("185")}e=e.return}n=void 0}return n}function d(){return Q=V()-Z,Y=2+(Q/10|0)}function p(e,t,n,a,o){var r=X;X=1;try{return e(t,n,a,o)}finally{X=r}}function f(e){if(0!==ue){if(e>ue)return;K(ce)}var t=V()-Z;ue=e,ce=H(v,{timeout:10*(e-2)-t})}function m(e,t){if(null===e.nextScheduledRoot)e.remainingExpirationTime=t,null===se?(le=se=e,e.nextScheduledRoot=e):(se=se.nextScheduledRoot=e,se.nextScheduledRoot=le);else{var n=e.remainingExpirationTime;(0===n||t<n)&&(e.remainingExpirationTime=t)}de||(be?xe&&(pe=e,fe=1,x(e,1,!1)):1===t?g():f(t))}function h(){var e=0,t=null;if(null!==se)for(var n=se,o=le;null!==o;){var r=o.remainingExpirationTime;if(0===r){if((null===n||null===se)&&a("244"),o===o.nextScheduledRoot){le=se=o.nextScheduledRoot=null;break}if(o===le)le=r=o.nextScheduledRoot,se.nextScheduledRoot=r,o.nextScheduledRoot=null;else{if(o===se){se=n,se.nextScheduledRoot=le,o.nextScheduledRoot=null;break}n.nextScheduledRoot=o.nextScheduledRoot,o.nextScheduledRoot=null}o=n.nextScheduledRoot}else{if((0===e||r<e)&&(e=r,t=o),o===se)break;n=o,o=o.nextScheduledRoot}}n=pe,null!==n&&n===t&&1===e?Ce++:Ce=0,pe=t,fe=e}function v(e){y(0,!0,e)}function g(){y(1,!1,null)}function y(e,t,n){if(ye=n,h(),t)for(;null!==pe&&0!==fe&&(0===e||e>=fe)&&(!he||d()>=fe);)x(pe,fe,!he),h();else for(;null!==pe&&0!==fe&&(0===e||e>=fe);)x(pe,fe,!1),h();null!==ye&&(ue=0,ce=-1),0!==fe&&f(fe),ye=null,he=!1,b()}function b(){if(Ce=0,null!==ke){var e=ke;ke=null;for(var t=0;t<e.length;t++){var n=e[t];try{n._onComplete()}catch(e){ve||(ve=!0,ge=e)}}}if(ve)throw e=ge,ge=null,ve=!1,e}function x(e,t,n){de&&a("245"),de=!0,n?(n=e.finishedWork,null!==n?_(e,n,t):(e.finishedWork=null,null!==(n=i(e,t,!0))&&(k()?e.finishedWork=n:_(e,n,t)))):(n=e.finishedWork,null!==n?_(e,n,t):(e.finishedWork=null,null!==(n=i(e,t,!1))&&_(e,n,t))),de=!1}function _(e,t,n){var o=e.firstBatch;if(null!==o&&o._expirationTime<=n&&(null===ke?ke=[o]:ke.push(o),o._defer))return e.finishedWork=t,void(e.remainingExpirationTime=0);e.finishedWork=null,ae=J=!0,n=t.stateNode,n.current===t&&a("177"),o=n.pendingCommitExpirationTime,0===o&&a("261"),n.pendingCommitExpirationTime=0;var r=d();if(ra.current=null,1<t.effectTag)if(null!==t.lastEffect){t.lastEffect.nextEffect=t;var i=t.firstEffect}else i=t;else i=t.firstEffect;for(W(n.containerInfo),ne=i;null!==ne;){var l=!1,u=void 0;try{for(;null!==ne;)2048&ne.effectTag&&j(ne.alternate,ne),ne=ne.nextEffect}catch(e){l=!0,u=e}l&&(null===ne&&a("178"),s(ne,u),null!==ne&&(ne=ne.nextEffect))}for(ne=i;null!==ne;){l=!1,u=void 0;try{for(;null!==ne;){var c=ne.effectTag;if(16&c&&A(ne),128&c){var p=ne.alternate;null!==p&&B(p)}switch(14&c){case 2:D(ne),ne.effectTag&=-3;break;case 6:D(ne),ne.effectTag&=-3,I(ne.alternate,ne);break;case 4:I(ne.alternate,ne);break;case 8:R(ne)}ne=ne.nextEffect}}catch(e){l=!0,u=e}l&&(null===ne&&a("178"),s(ne,u),null!==ne&&(ne=ne.nextEffect))}for(q(n.containerInfo),n.current=t,ne=i;null!==ne;){c=!1,p=void 0;try{for(i=n,l=r,u=o;null!==ne;){var f=ne.effectTag;36&f&&F(i,ne.alternate,ne,l,u),256&f&&U(ne,w),128&f&&z(ne);var m=ne.nextEffect;ne.nextEffect=null,ne=m}}catch(e){c=!0,p=e}c&&(null===ne&&a("178"),s(ne,p),null!==ne&&(ne=ne.nextEffect))}J=ae=!1,"function"==typeof it&&it(t.stateNode),t=n.current.expirationTime,0===t&&(ie=null),e.remainingExpirationTime=t}function k(){return!(null===ye||ye.timeRemaining()>Ee)&&(he=!0)}function w(e){null===pe&&a("246"),pe.remainingExpirationTime=0,ve||(ve=!0,ge=e)}var C=St(),E=Ct(e,C),T=Tt(C);C=Ot(C);var O=Et(e),S=bt(e,E,T,C,O,c,u).beginWork,P=xt(e,E,T,C,O).completeWork;E=_t(E,T,C,c,n);var M=E.throwException,L=E.unwindWork,N=E.unwindInterruptedWork;E=wt(e,s,c,u,function(e){null===ie?ie=new Set([e]):ie.add(e)},d);var j=E.commitBeforeMutationLifeCycles,A=E.commitResetTextContent,D=E.commitPlacement,R=E.commitDeletion,I=E.commitWork,F=E.commitLifeCycles,U=E.commitErrorLogging,z=E.commitAttachRef,B=E.commitDetachRef,V=e.now,H=e.scheduleDeferredCallback,K=e.cancelDeferredCallback,W=e.prepareForCommit,q=e.resetAfterCommit,Z=V(),Y=2,Q=Z,G=0,X=0,J=!1,$=null,ee=null,te=0,ne=null,ae=!1,oe=!1,ie=null,le=null,se=null,ue=0,ce=-1,de=!1,pe=null,fe=0,me=0,he=!1,ve=!1,ge=null,ye=null,be=!1,xe=!1,_e=!1,ke=null,we=1e3,Ce=0,Ee=1;return{recalculateCurrentTime:d,computeExpirationForFiber:u,scheduleWork:c,requestWork:m,flushRoot:function(e,t){de&&a("253"),pe=e,fe=t,x(e,t,!1),g(),b()},batchedUpdates:function(e,t){var n=be;be=!0;try{return e(t)}finally{(be=n)||de||g()}},unbatchedUpdates:function(e,t){if(be&&!xe){xe=!0;try{return e(t)}finally{xe=!1}}return e(t)},flushSync:function(e,t){de&&a("187");var n=be;be=!0;try{return p(e,t)}finally{be=n,g()}},flushControlled:function(e){var t=be;be=!0;try{p(e)}finally{(be=t)||de||y(1,!1,null)}},deferredUpdates:function(e){var t=X;X=25*(1+((d()+500)/25|0));try{return e()}finally{X=t}},syncUpdates:p,interactiveUpdates:function(e,t,n){if(_e)return e(t,n);be||de||0===me||(y(me,!1,null),me=0);var a=_e,o=be;be=_e=!0;try{return e(t,n)}finally{_e=a,(be=o)||de||g()}},flushInteractiveUpdates:function(){de||0===me||(y(me,!1,null),me=0)},computeUniqueAsyncExpiration:function(){var e=25*(1+((d()+500)/25|0));return e<=G&&(e=G+1),G=e},legacyContext:T}}function Mt(e){function t(e,t,n,a,o,r){if(a=t.current,n){n=n._reactInternalFiber;var l=s(n);n=u(n)?c(n,l):l}else n=vn;return null===t.context?t.context=n:t.pendingContext=n,t=r,dt(a,{expirationTime:o,partialState:{element:e},callback:void 0===t?null:t,isReplace:!1,isForced:!1,capturedValue:null,next:null}),i(a,o),o}function n(e){return e=De(e),null===e?null:e.stateNode}var a=e.getPublicInstance;e=Pt(e);var o=e.recalculateCurrentTime,r=e.computeExpirationForFiber,i=e.scheduleWork,l=e.legacyContext,s=l.findCurrentUnmaskedContext,u=l.isContextProvider,c=l.processChildContext;return{createContainer:function(e,t,n){return t=new Je(3,null,null,t?3:0),e={current:t,containerInfo:e,pendingChildren:null,pendingCommitExpirationTime:0,finishedWork:null,context:null,pendingContext:null,hydrate:n,remainingExpirationTime:0,firstBatch:null,nextScheduledRoot:null},t.stateNode=e},updateContainer:function(e,n,a,i){var l=n.current,s=o();return l=r(l),t(e,n,a,s,l,i)},updateContainerAtExpirationTime:function(e,n,a,r,i){return t(e,n,a,o(),r,i)},flushRoot:e.flushRoot,requestWork:e.requestWork,computeUniqueAsyncExpiration:e.computeUniqueAsyncExpiration,batchedUpdates:e.batchedUpdates,unbatchedUpdates:e.unbatchedUpdates,deferredUpdates:e.deferredUpdates,syncUpdates:e.syncUpdates,interactiveUpdates:e.interactiveUpdates,flushInteractiveUpdates:e.flushInteractiveUpdates,flushControlled:e.flushControlled,flushSync:e.flushSync,getPublicRootInstance:function(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return a(e.child.stateNode);default:return e.child.stateNode}},findHostInstance:n,findHostInstanceWithNoPortals:function(e){return e=Re(e),null===e?null:e.stateNode},injectIntoDevTools:function(e){var t=e.findFiberByHostInstance;return rt(dn({},e,{findHostInstanceByFiber:function(e){return n(e)},findFiberByHostInstance:function(e){return t?t(e):null}}))}}}function Lt(e,t,n){var a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:ca,key:null==a?null:""+a,children:e,containerInfo:t,implementation:n}}function Nt(e){var t="";return un.Children.forEach(e,function(e){null==e||"string"!=typeof e&&"number"!=typeof e||(t+=e)}),t}function jt(e,t){return e=dn({children:void 0},t),(t=Nt(t.children))&&(e.children=t),e}function At(e,t,n,a){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&a&&(e[n].defaultSelected=!0)}else{for(n=""+n,t=null,o=0;o<e.length;o++){if(e[o].value===n)return e[o].selected=!0,void(a&&(e[o].defaultSelected=!0));null!==t||e[o].disabled||(t=e[o])}null!==t&&(t.selected=!0)}}function Dt(e,t){var n=t.value;e._wrapperState={initialValue:null!=n?n:t.defaultValue,wasMultiple:!!t.multiple}}function Rt(e,t){return null!=t.dangerouslySetInnerHTML&&a("91"),dn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function It(e,t){var n=t.value;null==n&&(n=t.defaultValue,t=t.children,null!=t&&(null!=n&&a("92"),Array.isArray(t)&&(1>=t.length||a("93"),t=t[0]),n=""+t),null==n&&(n="")),e._wrapperState={initialValue:""+n}}function Ft(e,t){var n=t.value;null!=n&&(n=""+n,n!==e.value&&(e.value=n),null==t.defaultValue&&(e.defaultValue=n)),null!=t.defaultValue&&(e.defaultValue=t.defaultValue)}function Ut(e){var t=e.textContent;t===e._wrapperState.initialValue&&(e.value=t)}function zt(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Bt(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?zt(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}function Vt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}function Ht(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var a=0===n.indexOf("--"),o=n,r=t[n];o=null==r||"boolean"==typeof r||""===r?"":a||"number"!=typeof r||0===r||zo.hasOwnProperty(o)&&zo[o]?(""+r).trim():r+"px","float"===n&&(n="cssFloat"),a?e.setProperty(n,o):e[n]=o}}function Kt(e,t,n){t&&(Vo[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML)&&a("137",e,n()),null!=t.dangerouslySetInnerHTML&&(null!=t.children&&a("60"),"object"==typeof t.dangerouslySetInnerHTML&&"__html"in t.dangerouslySetInnerHTML||a("61")),null!=t.style&&"object"!=typeof t.style&&a("62",n()))}function Wt(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function qt(e,t){e=9===e.nodeType||11===e.nodeType?e:e.ownerDocument;var n=Ze(e);t=wn[t];for(var a=0;a<t.length;a++){var o=t[a];n.hasOwnProperty(o)&&n[o]||("topScroll"===o?Ve("topScroll","scroll",e):"topFocus"===o||"topBlur"===o?(Ve("topFocus","focus",e),Ve("topBlur","blur",e),n.topBlur=!0,n.topFocus=!0):"topCancel"===o?(J("cancel",!0)&&Ve("topCancel","cancel",e),n.topCancel=!0):"topClose"===o?(J("close",!0)&&Ve("topClose","close",e),n.topClose=!0):$a.hasOwnProperty(o)&&Be(o,$a[o],e),n[o]=!0)}}function Zt(e,t,n,a){return n=9===n.nodeType?n:n.ownerDocument,a===Ho&&(a=zt(e)),a===Ho?"script"===e?(e=n.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):e="string"==typeof t.is?n.createElement(e,{is:t.is}):n.createElement(e):e=n.createElementNS(a,e),e}function Yt(e,t){return(9===t.nodeType?t:t.ownerDocument).createTextNode(e)}function Qt(e,t,n,a){var o=Wt(t,n);switch(t){case"iframe":case"object":Be("topLoad","load",e);var r=n;break;case"video":case"audio":for(r in eo)eo.hasOwnProperty(r)&&Be(r,eo[r],e);r=n;break;case"source":Be("topError","error",e),r=n;break;case"img":case"image":case"link":Be("topError","error",e),Be("topLoad","load",e),r=n;break;case"form":Be("topReset","reset",e),Be("topSubmit","submit",e),r=n;break;case"details":Be("topToggle","toggle",e),r=n;break;case"input":fe(e,n),r=pe(e,n),Be("topInvalid","invalid",e),qt(a,"onChange");break;case"option":r=jt(e,n);break;case"select":Dt(e,n),r=dn({},n,{value:void 0}),Be("topInvalid","invalid",e),qt(a,"onChange");break;case"textarea":It(e,n),r=Rt(e,n),Be("topInvalid","invalid",e),qt(a,"onChange");break;default:r=n}Kt(t,r,Ko);var i,l=r;for(i in l)if(l.hasOwnProperty(i)){var s=l[i];"style"===i?Ht(e,s,Ko):"dangerouslySetInnerHTML"===i?null!=(s=s?s.__html:void 0)&&Uo(e,s):"children"===i?"string"==typeof s?("textarea"!==t||""!==s)&&Vt(e,s):"number"==typeof s&&Vt(e,""+s):"suppressContentEditableWarning"!==i&&"suppressHydrationWarning"!==i&&"autoFocus"!==i&&(kn.hasOwnProperty(i)?null!=s&&qt(a,i):null!=s&&de(e,i,s,o))}switch(t){case"input":te(e),ve(e,n);break;case"textarea":te(e),Ut(e,n);break;case"option":null!=n.value&&e.setAttribute("value",n.value);break;case"select":e.multiple=!!n.multiple,t=n.value,null!=t?At(e,!!n.multiple,t,!1):null!=n.defaultValue&&At(e,!!n.multiple,n.defaultValue,!0);break;default:"function"==typeof r.onClick&&(e.onclick=pn)}}function Gt(e,t,n,a,o){var r=null;switch(t){case"input":n=pe(e,n),a=pe(e,a),r=[];break;case"option":n=jt(e,n),a=jt(e,a),r=[];break;case"select":n=dn({},n,{value:void 0}),a=dn({},a,{value:void 0}),r=[];break;case"textarea":n=Rt(e,n),a=Rt(e,a),r=[];break;default:"function"!=typeof n.onClick&&"function"==typeof a.onClick&&(e.onclick=pn)}Kt(t,a,Ko),t=e=void 0;var i=null;for(e in n)if(!a.hasOwnProperty(e)&&n.hasOwnProperty(e)&&null!=n[e])if("style"===e){var l=n[e];for(t in l)l.hasOwnProperty(t)&&(i||(i={}),i[t]="")}else"dangerouslySetInnerHTML"!==e&&"children"!==e&&"suppressContentEditableWarning"!==e&&"suppressHydrationWarning"!==e&&"autoFocus"!==e&&(kn.hasOwnProperty(e)?r||(r=[]):(r=r||[]).push(e,null));for(e in a){var s=a[e];if(l=null!=n?n[e]:void 0,a.hasOwnProperty(e)&&s!==l&&(null!=s||null!=l))if("style"===e)if(l){for(t in l)!l.hasOwnProperty(t)||s&&s.hasOwnProperty(t)||(i||(i={}),i[t]="");for(t in s)s.hasOwnProperty(t)&&l[t]!==s[t]&&(i||(i={}),i[t]=s[t])}else i||(r||(r=[]),r.push(e,i)),i=s;else"dangerouslySetInnerHTML"===e?(s=s?s.__html:void 0,l=l?l.__html:void 0,null!=s&&l!==s&&(r=r||[]).push(e,""+s)):"children"===e?l===s||"string"!=typeof s&&"number"!=typeof s||(r=r||[]).push(e,""+s):"suppressContentEditableWarning"!==e&&"suppressHydrationWarning"!==e&&(kn.hasOwnProperty(e)?(null!=s&&qt(o,e),r||l===s||(r=[])):(r=r||[]).push(e,s))}return i&&(r=r||[]).push("style",i),r}function Xt(e,t,n,a,o){"input"===n&&"radio"===o.type&&null!=o.name&&me(e,o),Wt(n,a),a=Wt(n,o);for(var r=0;r<t.length;r+=2){var i=t[r],l=t[r+1];"style"===i?Ht(e,l,Ko):"dangerouslySetInnerHTML"===i?Uo(e,l):"children"===i?Vt(e,l):de(e,i,l,a)}switch(n){case"input":he(e,o);break;case"textarea":Ft(e,o);break;case"select":e._wrapperState.initialValue=void 0,t=e._wrapperState.wasMultiple,e._wrapperState.wasMultiple=!!o.multiple,n=o.value,null!=n?At(e,!!o.multiple,n,!1):t!==!!o.multiple&&(null!=o.defaultValue?At(e,!!o.multiple,o.defaultValue,!0):At(e,!!o.multiple,o.multiple?[]:"",!1))}}function Jt(e,t,n,a,o){switch(t){case"iframe":case"object":Be("topLoad","load",e);break;case"video":case"audio":for(var r in eo)eo.hasOwnProperty(r)&&Be(r,eo[r],e);break;case"source":Be("topError","error",e);break;case"img":case"image":case"link":Be("topError","error",e),Be("topLoad","load",e);break;case"form":Be("topReset","reset",e),Be("topSubmit","submit",e);break;case"details":Be("topToggle","toggle",e);break;case"input":fe(e,n),Be("topInvalid","invalid",e),qt(o,"onChange");break;case"select":Dt(e,n),Be("topInvalid","invalid",e),qt(o,"onChange");break;case"textarea":It(e,n),Be("topInvalid","invalid",e),qt(o,"onChange")}Kt(t,n,Ko),a=null;for(var i in n)n.hasOwnProperty(i)&&(r=n[i],"children"===i?"string"==typeof r?e.textContent!==r&&(a=["children",r]):"number"==typeof r&&e.textContent!==""+r&&(a=["children",""+r]):kn.hasOwnProperty(i)&&null!=r&&qt(o,i));switch(t){case"input":te(e),ve(e,n);break;case"textarea":te(e),Ut(e,n);break;case"select":case"option":break;default:"function"==typeof n.onClick&&(e.onclick=pn)}return a}function $t(e,t){return e.nodeValue!==t}function en(e){this._expirationTime=Yo.computeUniqueAsyncExpiration(),this._root=e,this._callbacks=this._next=null,this._hasChildren=this._didComplete=!1,this._children=null,this._defer=!0}function tn(){this._callbacks=null,this._didCommit=!1,this._onCommit=this._onCommit.bind(this)}function nn(e,t,n){this._internalRoot=Yo.createContainer(e,t,n)}function an(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function on(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function rn(e,t){if(t||(t=e?9===e.nodeType?e.documentElement:e.firstChild:null,t=!(!t||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var n;n=e.lastChild;)e.removeChild(n);return new nn(e,!1,t)}function ln(e,t,n,o,r){an(n)||a("200");var i=n._reactRootContainer;if(i){if("function"==typeof r){var l=r;r=function(){var e=Yo.getPublicRootInstance(i._internalRoot);l.call(e)}}null!=e?i.legacy_renderSubtreeIntoContainer(e,t,r):i.render(t,r)}else{if(i=n._reactRootContainer=rn(n,o),"function"==typeof r){var s=r;r=function(){var e=Yo.getPublicRootInstance(i._internalRoot);s.call(e)}}Yo.unbatchedUpdates(function(){null!=e?i.legacy_renderSubtreeIntoContainer(e,t,r):i.render(t,r)})}return Yo.getPublicRootInstance(i._internalRoot)}function sn(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return an(t)||a("200"),Lt(e,t,null,n)}/** @license React v16.3.0
 * react-dom.production.min.js
 *
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var un=n(0),cn=n(97),dn=n(28),pn=n(21),fn=n(98),mn=n(99),hn=n(100),vn=n(29);un||a("227");var gn={_caughtError:null,_hasCaughtError:!1,_rethrowError:null,_hasRethrowError:!1,invokeGuardedCallback:function(e,t,n,a,r,i,l,s,u){o.apply(gn,arguments)},invokeGuardedCallbackAndCatchFirstError:function(e,t,n,a,o,r,i,l,s){if(gn.invokeGuardedCallback.apply(this,arguments),gn.hasCaughtError()){var u=gn.clearCaughtError();gn._hasRethrowError||(gn._hasRethrowError=!0,gn._rethrowError=u)}},rethrowCaughtError:function(){return r.apply(gn,arguments)},hasCaughtError:function(){return gn._hasCaughtError},clearCaughtError:function(){if(gn._hasCaughtError){var e=gn._caughtError;return gn._caughtError=null,gn._hasCaughtError=!1,e}a("198")}},yn=null,bn={},xn=[],_n={},kn={},wn={},Cn=Object.freeze({plugins:xn,eventNameDispatchConfigs:_n,registrationNameModules:kn,registrationNameDependencies:wn,possibleRegistrationNames:null,injectEventPluginOrder:s,injectEventPluginsByName:u}),En=null,Tn=null,On=null,Sn=null,Pn={injectEventPluginOrder:s,injectEventPluginsByName:u},Mn=Object.freeze({injection:Pn,getListener:v,runEventsInBatch:g,runExtractedEventsInBatch:y}),Ln=Math.random().toString(36).slice(2),Nn="__reactInternalInstance$"+Ln,jn="__reactEventHandlers$"+Ln,An=Object.freeze({precacheFiberNode:function(e,t){t[Nn]=e},getClosestInstanceFromNode:b,getInstanceFromNode:function(e){return e=e[Nn],!e||5!==e.tag&&6!==e.tag?null:e},getNodeFromInstance:x,getFiberCurrentPropsFromNode:_,updateFiberProps:function(e,t){e[jn]=t}}),Dn=Object.freeze({accumulateTwoPhaseDispatches:P,accumulateTwoPhaseDispatchesSkipTarget:function(e){p(e,T)},accumulateEnterLeaveDispatches:M,accumulateDirectDispatches:function(e){p(e,S)}}),Rn=null,In={_root:null,_startText:null,_fallbackText:null},Fn="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" "),Un={type:null,target:null,currentTarget:pn.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};dn(A.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=pn.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=pn.thatReturnsTrue)},persist:function(){this.isPersistent=pn.thatReturnsTrue},isPersistent:pn.thatReturnsFalse,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;for(t=0;t<Fn.length;t++)this[Fn[t]]=null}}),A.Interface=Un,A.extend=function(e){function t(){}function n(){return a.apply(this,arguments)}var a=this;t.prototype=a.prototype;var o=new t;return dn(o,n.prototype),n.prototype=o,n.prototype.constructor=n,n.Interface=dn({},a.Interface,e),n.extend=a.extend,I(n),n},I(A);var zn=A.extend({data:null}),Bn=A.extend({data:null}),Vn=[9,13,27,32],Hn=cn.canUseDOM&&"CompositionEvent"in window,Kn=null;cn.canUseDOM&&"documentMode"in document&&(Kn=document.documentMode);var Wn=cn.canUseDOM&&"TextEvent"in window&&!Kn,qn=cn.canUseDOM&&(!Hn||Kn&&8<Kn&&11>=Kn),Zn=String.fromCharCode(32),Yn={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["topCompositionEnd","topKeyPress","topTextInput","topPaste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"topBlur topCompositionEnd topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"topBlur topCompositionStart topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"topBlur topCompositionUpdate topKeyDown topKeyPress topKeyUp topMouseDown".split(" ")}},Qn=!1,Gn=!1,Xn={eventTypes:Yn,extractEvents:function(e,t,n,a){var o=void 0,r=void 0;if(Hn)e:{switch(e){case"topCompositionStart":o=Yn.compositionStart;break e;case"topCompositionEnd":o=Yn.compositionEnd;break e;case"topCompositionUpdate":o=Yn.compositionUpdate;break e}o=void 0}else Gn?F(e,n)&&(o=Yn.compositionEnd):"topKeyDown"===e&&229===n.keyCode&&(o=Yn.compositionStart);return o?(qn&&(Gn||o!==Yn.compositionStart?o===Yn.compositionEnd&&Gn&&(r=N()):(In._root=a,In._startText=j(),Gn=!0)),o=zn.getPooled(o,t,n,a),r?o.data=r:null!==(r=U(n))&&(o.data=r),P(o),r=o):r=null,(e=Wn?z(e,n):B(e,n))?(t=Bn.getPooled(Yn.beforeInput,t,n,a),t.data=e,P(t)):t=null,null===r?t:null===t?r:[r,t]}},Jn=null,$n=null,ea=null,ta={injectFiberControlledHostComponent:function(e){Jn=e}},na=Object.freeze({injection:ta,enqueueStateRestore:H,needsStateRestore:K,restoreStateIfNeeded:W}),aa=!1,oa={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0},ra=un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ia="function"==typeof Symbol&&Symbol.for,la=ia?Symbol.for("react.element"):60103,sa=ia?Symbol.for("react.call"):60104,ua=ia?Symbol.for("react.return"):60105,ca=ia?Symbol.for("react.portal"):60106,da=ia?Symbol.for("react.fragment"):60107,pa=ia?Symbol.for("react.strict_mode"):60108,fa=ia?Symbol.for("react.provider"):60109,ma=ia?Symbol.for("react.context"):60110,ha=ia?Symbol.for("react.async_mode"):60111,va=ia?Symbol.for("react.forward_ref"):60112,ga="function"==typeof Symbol&&Symbol.iterator,ya=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ba={},xa={},_a={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){_a[e]=new ue(e,0,!1,e,null)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];_a[t]=new ue(t,1,!1,e[1],null)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){_a[e]=new ue(e,2,!1,e.toLowerCase(),null)}),["autoReverse","externalResourcesRequired","preserveAlpha"].forEach(function(e){_a[e]=new ue(e,2,!1,e,null)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){_a[e]=new ue(e,3,!1,e.toLowerCase(),null)}),["checked","multiple","muted","selected"].forEach(function(e){_a[e]=new ue(e,3,!0,e.toLowerCase(),null)}),["capture","download"].forEach(function(e){_a[e]=new ue(e,4,!1,e.toLowerCase(),null)}),["cols","rows","size","span"].forEach(function(e){_a[e]=new ue(e,6,!1,e.toLowerCase(),null)}),["rowSpan","start"].forEach(function(e){_a[e]=new ue(e,5,!1,e.toLowerCase(),null)});var ka=/[\-\:]([a-z])/g;"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ka,ce);_a[t]=new ue(t,1,!1,e,null)}),"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ka,ce);_a[t]=new ue(t,1,!1,e,"http://www.w3.org/1999/xlink")}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ka,ce);_a[t]=new ue(t,1,!1,e,"http://www.w3.org/XML/1998/namespace")}),_a.tabIndex=new ue("tabIndex",1,!1,"tabindex",null);var wa={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"topBlur topChange topClick topFocus topInput topKeyDown topKeyUp topSelectionChange".split(" ")}},Ca=null,Ea=null,Ta=!1;cn.canUseDOM&&(Ta=J("input")&&(!document.documentMode||9<document.documentMode));var Oa={eventTypes:wa,_isInputEventSupported:Ta,extractEvents:function(e,t,n,a){var o=t?x(t):window,r=void 0,i=void 0,l=o.nodeName&&o.nodeName.toLowerCase();if("select"===l||"input"===l&&"file"===o.type?r=ke:G(o)?Ta?r=Se:(r=Te,i=Ee):!(l=o.nodeName)||"input"!==l.toLowerCase()||"checkbox"!==o.type&&"radio"!==o.type||(r=Oe),r&&(r=r(e,t)))return be(r,n,a);i&&i(e,o,t),"topBlur"===e&&null!=t&&(e=t._wrapperState||o._wrapperState)&&e.controlled&&"number"===o.type&&ge(o,"number",o.value)}},Sa=A.extend({view:null,detail:null}),Pa={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"},Ma=Sa.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:Me,button:null,buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)}}),La={mouseEnter:{registrationName:"onMouseEnter",dependencies:["topMouseOut","topMouseOver"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["topMouseOut","topMouseOver"]}},Na={eventTypes:La,extractEvents:function(e,t,n,a){if("topMouseOver"===e&&(n.relatedTarget||n.fromElement)||"topMouseOut"!==e&&"topMouseOver"!==e)return null;var o=a.window===a?a:(o=a.ownerDocument)?o.defaultView||o.parentWindow:window;if("topMouseOut"===e?(e=t,t=(t=n.relatedTarget||n.toElement)?b(t):null):e=null,e===t)return null;var r=null==e?o:x(e);o=null==t?o:x(t);var i=Ma.getPooled(La.mouseLeave,e,n,a);return i.type="mouseleave",i.target=r,i.relatedTarget=o,n=Ma.getPooled(La.mouseEnter,t,n,a),n.type="mouseenter",n.target=o,n.relatedTarget=r,M(i,n,e,t),[i,n]}},ja=A.extend({animationName:null,elapsedTime:null,pseudoElement:null}),Aa=A.extend({clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Da=Sa.extend({relatedTarget:null}),Ra={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ia={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Fa=Sa.extend({key:function(e){if(e.key){var t=Ra[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?(e=Ie(e),13===e?"Enter":String.fromCharCode(e)):"keydown"===e.type||"keyup"===e.type?Ia[e.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:Me,charCode:function(e){return"keypress"===e.type?Ie(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?Ie(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Ua=Ma.extend({dataTransfer:null}),za=Sa.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:Me}),Ba=A.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),Va=Ma.extend({deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null}),Ha={},Ka={};"blur cancel click close contextMenu copy cut doubleClick dragEnd dragStart drop focus input invalid keyDown keyPress keyUp mouseDown mouseUp paste pause play rateChange reset seeked submit touchCancel touchEnd touchStart volumeChange".split(" ").forEach(function(e){Fe(e,!0)}),"abort animationEnd animationIteration animationStart canPlay canPlayThrough drag dragEnter dragExit dragLeave dragOver durationChange emptied encrypted ended error load loadedData loadedMetadata loadStart mouseMove mouseOut mouseOver playing progress scroll seeking stalled suspend timeUpdate toggle touchMove transitionEnd waiting wheel".split(" ").forEach(function(e){Fe(e,!1)});var Wa={eventTypes:Ha,isInteractiveTopLevelEventType:function(e){return void 0!==(e=Ka[e])&&!0===e.isInteractive},extractEvents:function(e,t,n,a){var o=Ka[e];if(!o)return null;switch(e){case"topKeyPress":if(0===Ie(n))return null;case"topKeyDown":case"topKeyUp":e=Fa;break;case"topBlur":case"topFocus":e=Da;break;case"topClick":if(2===n.button)return null;case"topDoubleClick":case"topMouseDown":case"topMouseMove":case"topMouseUp":case"topMouseOut":case"topMouseOver":case"topContextMenu":e=Ma;break;case"topDrag":case"topDragEnd":case"topDragEnter":case"topDragExit":case"topDragLeave":case"topDragOver":case"topDragStart":case"topDrop":e=Ua;break;case"topTouchCancel":case"topTouchEnd":case"topTouchMove":case"topTouchStart":e=za;break;case"topAnimationEnd":case"topAnimationIteration":case"topAnimationStart":e=ja;break;case"topTransitionEnd":e=Ba;break;case"topScroll":e=Sa;break;case"topWheel":e=Va;break;case"topCopy":case"topCut":case"topPaste":e=Aa;break;default:e=A}return t=e.getPooled(o,t,n,a),P(t),t}},qa=Wa.isInteractiveTopLevelEventType,Za=[],Ya=!0,Qa=Object.freeze({get _enabled(){return Ya},setEnabled:ze,isEnabled:function(){return Ya},trapBubbledEvent:Be,trapCapturedEvent:Ve,dispatchEvent:Ke}),Ga={animationend:We("Animation","AnimationEnd"),animationiteration:We("Animation","AnimationIteration"),animationstart:We("Animation","AnimationStart"),transitionend:We("Transition","TransitionEnd")},Xa={},Ja={};cn.canUseDOM&&(Ja=document.createElement("div").style,"AnimationEvent"in window||(delete Ga.animationend.animation,delete Ga.animationiteration.animation,delete Ga.animationstart.animation),"TransitionEvent"in window||delete Ga.transitionend.transition);var $a={topAnimationEnd:qe("animationend"),topAnimationIteration:qe("animationiteration"),topAnimationStart:qe("animationstart"),topBlur:"blur",topCancel:"cancel",topChange:"change",topClick:"click",topClose:"close",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoad:"load",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topScroll:"scroll",topSelectionChange:"selectionchange",topTextInput:"textInput",topToggle:"toggle",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topTransitionEnd:qe("transitionend"),topWheel:"wheel"},eo={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},to={},no=0,ao="_reactListenersID"+(""+Math.random()).slice(2),oo=cn.canUseDOM&&"documentMode"in document&&11>=document.documentMode,ro={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"topBlur topContextMenu topFocus topKeyDown topKeyUp topMouseDown topMouseUp topSelectionChange".split(" ")}},io=null,lo=null,so=null,uo=!1,co={eventTypes:ro,extractEvents:function(e,t,n,a){var o,r=a.window===a?a.document:9===a.nodeType?a:a.ownerDocument;if(!(o=!r)){e:{r=Ze(r),o=wn.onSelect;for(var i=0;i<o.length;i++){var l=o[i];if(!r.hasOwnProperty(l)||!r[l]){r=!1;break e}}r=!0}o=!r}if(o)return null;switch(r=t?x(t):window,e){case"topFocus":(G(r)||"true"===r.contentEditable)&&(io=r,lo=t,so=null);break;case"topBlur":so=lo=io=null;break;case"topMouseDown":uo=!0;break;case"topContextMenu":case"topMouseUp":return uo=!1,Xe(n,a);case"topSelectionChange":if(oo)break;case"topKeyDown":case"topKeyUp":return Xe(n,a)}return null}};Pn.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin TapEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),En=An.getFiberCurrentPropsFromNode,Tn=An.getInstanceFromNode,On=An.getNodeFromInstance,Pn.injectEventPluginsByName({SimpleEventPlugin:Wa,EnterLeaveEventPlugin:Na,ChangeEventPlugin:Oa,SelectEventPlugin:co,BeforeInputEventPlugin:Xn});var po=null,fo=null;new Set;var mo=void 0,ho=void 0,vo=Array.isArray,go=yt(!0),yo=yt(!1),bo={},xo=Object.freeze({default:Mt}),_o=xo&&Mt||xo,ko=_o.default?_o.default:_o,wo="object"==typeof performance&&"function"==typeof performance.now,Co=void 0;Co=wo?function(){return performance.now()}:function(){return Date.now()};var Eo=void 0,To=void 0;if(cn.canUseDOM)if("function"!=typeof requestIdleCallback||"function"!=typeof cancelIdleCallback){var Oo=null,So=!1,Po=-1,Mo=!1,Lo=0,No=33,jo=33,Ao=void 0;Ao=wo?{didTimeout:!1,timeRemaining:function(){var e=Lo-performance.now();return 0<e?e:0}}:{didTimeout:!1,timeRemaining:function(){var e=Lo-Date.now();return 0<e?e:0}};var Do="__reactIdleCallback$"+Math.random().toString(36).slice(2);window.addEventListener("message",function(e){if(e.source===window&&e.data===Do){if(So=!1,e=Co(),0>=Lo-e){if(!(-1!==Po&&Po<=e))return void(Mo||(Mo=!0,requestAnimationFrame(Ro)));Ao.didTimeout=!0}else Ao.didTimeout=!1;Po=-1,e=Oo,Oo=null,null!==e&&e(Ao)}},!1);var Ro=function(e){Mo=!1;var t=e-Lo+jo;t<jo&&No<jo?(8>t&&(t=8),jo=t<No?No:t):No=t,Lo=e+jo,So||(So=!0,window.postMessage(Do,"*"))};Eo=function(e,t){return Oo=e,null!=t&&"number"==typeof t.timeout&&(Po=Co()+t.timeout),Mo||(Mo=!0,requestAnimationFrame(Ro)),0},To=function(){Oo=null,So=!1,Po=-1}}else Eo=window.requestIdleCallback,To=window.cancelIdleCallback;else Eo=function(e){return setTimeout(function(){e({timeRemaining:function(){return 1/0},didTimeout:!1})})},To=function(e){clearTimeout(e)};var Io={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"},Fo=void 0,Uo=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,a,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n)})}:e}(function(e,t){if(e.namespaceURI!==Io.svg||"innerHTML"in e)e.innerHTML=t;else{for(Fo=Fo||document.createElement("div"),Fo.innerHTML="<svg>"+t+"</svg>",t=Fo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}}),zo={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Bo=["Webkit","ms","Moz","O"];Object.keys(zo).forEach(function(e){Bo.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),zo[t]=zo[e]})});var Vo=dn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),Ho=Io.html,Ko=pn.thatReturns(""),Wo=Object.freeze({createElement:Zt,createTextNode:Yt,setInitialProperties:Qt,diffProperties:Gt,updateProperties:Xt,diffHydratedProperties:Jt,diffHydratedText:$t,warnForUnmatchedText:function(){},warnForDeletedHydratableElement:function(){},warnForDeletedHydratableText:function(){},warnForInsertedHydratedElement:function(){},warnForInsertedHydratedText:function(){},restoreControlledState:function(e,t,n){switch(t){case"input":if(he(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var o=n[t];if(o!==e&&o.form===e.form){var r=_(o);r||a("90"),ne(o),he(o,r)}}}break;case"textarea":Ft(e,n);break;case"select":null!=(t=n.value)&&At(e,!!n.multiple,t,!1)}}});ta.injectFiberControlledHostComponent(Wo);var qo=null,Zo=null;en.prototype.render=function(e){this._defer||a("250"),this._hasChildren=!0,this._children=e;var t=this._root._internalRoot,n=this._expirationTime,o=new tn;return Yo.updateContainerAtExpirationTime(e,t,null,n,o._onCommit),o},en.prototype.then=function(e){if(this._didComplete)e();else{var t=this._callbacks;null===t&&(t=this._callbacks=[]),t.push(e)}},en.prototype.commit=function(){var e=this._root._internalRoot,t=e.firstBatch;if(this._defer&&null!==t||a("251"),this._hasChildren){var n=this._expirationTime;if(t!==this){this._hasChildren&&(n=this._expirationTime=t._expirationTime,this.render(this._children));for(var o=null,r=t;r!==this;)o=r,r=r._next;null===o&&a("251"),o._next=r._next,this._next=t,e.firstBatch=this}this._defer=!1,Yo.flushRoot(e,n),t=this._next,this._next=null,t=e.firstBatch=t,null!==t&&t._hasChildren&&t.render(t._children)}else this._next=null,this._defer=!1},en.prototype._onComplete=function(){if(!this._didComplete){this._didComplete=!0;var e=this._callbacks;if(null!==e)for(var t=0;t<e.length;t++)(0,e[t])()}},tn.prototype.then=function(e){if(this._didCommit)e();else{var t=this._callbacks;null===t&&(t=this._callbacks=[]),t.push(e)}},tn.prototype._onCommit=function(){if(!this._didCommit){this._didCommit=!0;var e=this._callbacks;if(null!==e)for(var t=0;t<e.length;t++){var n=e[t];"function"!=typeof n&&a("191",n),n()}}},nn.prototype.render=function(e,t){var n=this._internalRoot,a=new tn;return t=void 0===t?null:t,null!==t&&a.then(t),Yo.updateContainer(e,n,null,a._onCommit),a},nn.prototype.unmount=function(e){var t=this._internalRoot,n=new tn;return e=void 0===e?null:e,null!==e&&n.then(e),Yo.updateContainer(null,t,null,n._onCommit),n},nn.prototype.legacy_renderSubtreeIntoContainer=function(e,t,n){var a=this._internalRoot,o=new tn;return n=void 0===n?null:n,null!==n&&o.then(n),Yo.updateContainer(t,a,e,o._onCommit),o},nn.prototype.createBatch=function(){var e=new en(this),t=e._expirationTime,n=this._internalRoot,a=n.firstBatch;if(null===a)n.firstBatch=e,e._next=null;else{for(n=null;null!==a&&a._expirationTime<=t;)n=a,a=a._next;e._next=a,null!==n&&(n._next=e)}return e};var Yo=ko({getRootHostContext:function(e){var t=e.nodeType;switch(t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Bt(null,"");break;default:t=8===t?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Bt(e,t)}return e},getChildHostContext:function(e,t){return Bt(e,t)},getPublicInstance:function(e){return e},prepareForCommit:function(){qo=Ya;var e=fn();if(Ge(e)){if("selectionStart"in e)var t={start:e.selectionStart,end:e.selectionEnd};else e:{var n=window.getSelection&&window.getSelection();if(n&&0!==n.rangeCount){t=n.anchorNode;var a=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{t.nodeType,o.nodeType}catch(e){t=null;break e}var r=0,i=-1,l=-1,s=0,u=0,c=e,d=null;t:for(;;){for(var p;c!==t||0!==a&&3!==c.nodeType||(i=r+a),c!==o||0!==n&&3!==c.nodeType||(l=r+n),3===c.nodeType&&(r+=c.nodeValue.length),null!==(p=c.firstChild);)d=c,c=p;for(;;){if(c===e)break t;if(d===t&&++s===a&&(i=r),d===o&&++u===n&&(l=r),null!==(p=c.nextSibling))break;c=d,d=c.parentNode}c=p}t=-1===i||-1===l?null:{start:i,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;Zo={focusedElem:e,selectionRange:t},ze(!1)},resetAfterCommit:function(){var e=Zo,t=fn(),n=e.focusedElem,a=e.selectionRange;if(t!==n&&hn(document.documentElement,n)){if(Ge(n))if(t=a.start,e=a.end,void 0===e&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(window.getSelection){t=window.getSelection();var o=n[L()].length;e=Math.min(a.start,o),a=void 0===a.end?e:Math.min(a.end,o),!t.extend&&e>a&&(o=a,a=e,e=o),o=Qe(n,e);var r=Qe(n,a);if(o&&r&&(1!==t.rangeCount||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==r.node||t.focusOffset!==r.offset)){var i=document.createRange();i.setStart(o.node,o.offset),t.removeAllRanges(),e>a?(t.addRange(i),t.extend(r.node,r.offset)):(i.setEnd(r.node,r.offset),t.addRange(i))}}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}Zo=null,ze(qo),qo=null},createInstance:function(e,t,n,a,o){return e=Zt(e,t,n,a),e[Nn]=o,e[jn]=t,e},appendInitialChild:function(e,t){e.appendChild(t)},finalizeInitialChildren:function(e,t,n,a){return Qt(e,t,n,a),on(t,n)},prepareUpdate:function(e,t,n,a,o){return Gt(e,t,n,a,o)},shouldSetTextContent:function(e,t){return"textarea"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&"string"==typeof t.dangerouslySetInnerHTML.__html},shouldDeprioritizeSubtree:function(e,t){return!!t.hidden},createTextInstance:function(e,t,n,a){return e=Yt(e,t),e[Nn]=a,e},now:Co,mutation:{commitMount:function(e,t,n){on(t,n)&&e.focus()},commitUpdate:function(e,t,n,a,o){e[jn]=o,Xt(e,t,n,a,o)},resetTextContent:function(e){Vt(e,"")},commitTextUpdate:function(e,t,n){e.nodeValue=n},appendChild:function(e,t){e.appendChild(t)},appendChildToContainer:function(e,t){8===e.nodeType?e.parentNode.insertBefore(t,e):e.appendChild(t)},insertBefore:function(e,t,n){e.insertBefore(t,n)},insertInContainerBefore:function(e,t,n){8===e.nodeType?e.parentNode.insertBefore(t,n):e.insertBefore(t,n)},removeChild:function(e,t){e.removeChild(t)},removeChildFromContainer:function(e,t){8===e.nodeType?e.parentNode.removeChild(t):e.removeChild(t)}},hydration:{canHydrateInstance:function(e,t){return 1!==e.nodeType||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e},canHydrateTextInstance:function(e,t){return""===t||3!==e.nodeType?null:e},getNextHydratableSibling:function(e){for(e=e.nextSibling;e&&1!==e.nodeType&&3!==e.nodeType;)e=e.nextSibling;return e},getFirstHydratableChild:function(e){for(e=e.firstChild;e&&1!==e.nodeType&&3!==e.nodeType;)e=e.nextSibling;return e},hydrateInstance:function(e,t,n,a,o,r){return e[Nn]=r,e[jn]=n,Jt(e,t,n,o,a)},hydrateTextInstance:function(e,t,n){return e[Nn]=n,$t(e,t)},didNotMatchHydratedContainerTextInstance:function(){},didNotMatchHydratedTextInstance:function(){},didNotHydrateContainerInstance:function(){},didNotHydrateInstance:function(){},didNotFindHydratableContainerInstance:function(){},didNotFindHydratableContainerTextInstance:function(){},didNotFindHydratableInstance:function(){},didNotFindHydratableTextInstance:function(){}},scheduleDeferredCallback:Eo,cancelDeferredCallback:To}),Qo=Yo;q=Qo.batchedUpdates,Z=Qo.interactiveUpdates,Y=Qo.flushInteractiveUpdates;var Go={createPortal:sn,findDOMNode:function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternalFiber;if(t)return Yo.findHostInstance(t);"function"==typeof e.render?a("188"):a("213",Object.keys(e))},hydrate:function(e,t,n){return ln(null,e,t,!0,n)},render:function(e,t,n){return ln(null,e,t,!1,n)},unstable_renderSubtreeIntoContainer:function(e,t,n,o){return(null==e||void 0===e._reactInternalFiber)&&a("38"),ln(e,t,n,!1,o)},unmountComponentAtNode:function(e){return an(e)||a("40"),!!e._reactRootContainer&&(Yo.unbatchedUpdates(function(){ln(null,null,e,!1,function(){e._reactRootContainer=null})}),!0)},unstable_createPortal:function(){return sn.apply(void 0,arguments)},unstable_batchedUpdates:Yo.batchedUpdates,unstable_deferredUpdates:Yo.deferredUpdates,flushSync:Yo.flushSync,unstable_flushControlled:Yo.flushControlled,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{EventPluginHub:Mn,EventPluginRegistry:Cn,EventPropagators:Dn,ReactControlledComponent:na,ReactDOMComponentTree:An,ReactDOMEventListener:Qa},unstable_createRoot:function(e,t){return new nn(e,!0,null!=t&&!0===t.hydrate)}};Yo.injectIntoDevTools({findFiberByHostInstance:b,bundleType:0,version:"16.3.0",rendererPackageName:"react-dom"});var Xo=Object.freeze({default:Go}),Jo=Xo&&Go||Xo;e.exports=Jo.default?Jo.default:Jo},function(e,t,n){"use strict";var a=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:a,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:a&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:a&&!!window.screen,isInWorker:!a};e.exports=o},function(e,t,n){"use strict";function a(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}e.exports=a},function(e,t,n){"use strict";function a(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!==e&&t!==t}function o(e,t){if(a(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(var i=0;i<n.length;i++)if(!r.call(t,n[i])||!a(e[n[i]],t[n[i]]))return!1;return!0}var r=Object.prototype.hasOwnProperty;e.exports=o},function(e,t,n){"use strict";function a(e,t){return!(!e||!t)&&(e===t||!o(e)&&(o(t)?a(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}var o=n(101);e.exports=a},function(e,t,n){"use strict";function a(e){return o(e)&&3==e.nodeType}var o=n(102);e.exports=a},function(e,t,n){"use strict";function a(e){var t=e?e.ownerDocument||e:document,n=t.defaultView||window;return!(!e||!("function"==typeof n.Node?e instanceof n.Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}e.exports=a},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateManagerComponent=t.styleModules=void 0;var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(11),d=n(6),p=a(d),f=n(34),m=a(f),h=n(104),v=a(h),g=n(1),y=n(105),b=a(y),x=n(109),_=a(x),k=n(8),w=a(k),C=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={templates:[],filterText:"",sanityChecksEnabled:!0,searchActive:!1,isInitializing:!0},n.templateManagerElement=null,n.updateTemplates=n.updateTemplates.bind(n),n.refreshTemplates=n.refreshTemplates.bind(n),n.updateFilter=n.updateFilter.bind(n),n.clearSearchField=n.clearSearchField.bind(n),n.applyTemplate=n.applyTemplate.bind(n),n.removeTemplate=n.removeTemplate.bind(n),n.handleKeyPress=n.handleKeyPress.bind(n),n.handleCloseButtonClick=n.handleCloseButtonClick.bind(n),n}return i(t,e),l(t,[{key:"updateTemplates",value:function(){var e=this;EN.query("template-list",{noSync:!0}).then(function(t){return e.setState({templates:t,isInitializing:!1})})}},{key:"refreshTemplates",value:function(e){var t=this;e.shiftKey?EN.run("menu",{xPosition:e.clientX,yPosition:e.clientY,items:[{type:"item",label:"Force Service Refresh",action:function(){return EN.query("template-list",{forceRefresh:!0})}},{type:"item",label:"Client Sanity Checks",value:!!this.state.sanityChecksEnabled,action:function(){t.setState({sanityChecksEnabled:!t.state.sanityChecksEnabled})}}],onClose:function(){t.setState({focused:!1})}}):EN.query("template-list",{forceRefresh:!0})}},{key:"updateFilter",value:function(e){EN.query("template-search",{query:e}),this.setState({filterText:e,searchActive:e.length>0})}},{key:"clearSearchField",value:function(){this.setState({searchActive:!1})}},{key:"applyTemplate",value:function(e){var t=this.state.templates.find(function(t){return t.guid===e});t&&EN.run("template-apply",{template:t})}},{key:"removeTemplate",value:function(e){var t=this.state.templates.find(function(t){return t.guid===e});t&&EN.run("template-remove",{guid:t.guid})}},{key:"focusInput",value:function(){if(!this.templateManagerElement)return!1;if(this.props.isMobile)return!(!document.activeElement||"function"!=typeof document.activeElement.blur)&&(document.activeElement.blur(),!0);var e=(0,g.getFocusableElements)(this.templateManagerElement);return!!e.length&&(e[0].focus(),!0)}},{key:"close",value:function(){EN.run("template-close")}},{key:"handleActivate",value:function(){this.updateTemplates(),this.focusInput()}},{key:"handleKeyPress",value:function(e){27===e.keyCode&&this.close()}},{key:"handleCloseButtonClick",value:function(){this.close()}},{key:"componentDidMount",value:function(){var e=this;EN.listenTo("templateChanged",function(){return e.updateTemplates()}),this.props.active&&this.handleActivate()}},{key:"componentDidUpdate",value:function(e){this.props.active&&!e.active&&this.handleActivate()}},{key:"render",value:function(){var e=this,t=this.props,n=t.active,a=t.marginInfo,o=t.i18n,r=t.client,i=t.isMobile,l=this.state,s=l.templates,c=l.filterText,d=l.sanityChecksEnabled,f=l.searchActive,h=l.isInitializing,y=(0,g.css)("templatemanager",w.default.templatemanager,n&&w.default.active,i?"mobile":"desktop",["windows","mac","web","ios","android"].indexOf(r)>-1&&r),x=a&&a.contentPadding||{},k=u.default.createElement(p.default,{svg:v.default,className:w.default.syncbutton,onClick:this.refreshTemplates}),C=u.default.createElement("div",{className:w.default.topbar},u.default.createElement(b.default,{onChange:this.updateFilter,active:f}),i?k:u.default.createElement("div",{className:w.default.appname},k,o.t("Templates")),i?null:u.default.createElement("div",{className:w.default.appclosewrapper},u.default.createElement("button",{className:w.default.appclose,onClick:this.handleCloseButtonClick},u.default.createElement(p.default,{svg:m.default}))));return u.default.createElement("div",{className:y,ref:function(t){return e.templateManagerElement=t},onKeyDown:this.handleKeyPress},u.default.createElement("div",{style:x},C,u.default.createElement(_.default,{isInitializing:h,templates:s,access:"private",filterText:c,applyTemplate:this.applyTemplate,removeTemplate:this.removeTemplate,sanityChecksEnabled:d,clearSearchField:this.clearSearchField})))}}]),t}(s.Component);t.styleModules=w.default,t.TemplateManagerComponent=C;t.default=(0,c.provideTemplatesContext)(C)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"2m71E",use:"2m71E-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="2m71E">\n    <path transform="translate(3 3)" fill-rule="evenodd" clip-rule="evenodd" d="M0.619995 9.53009C0.279816 9.52478 0.00537109 9.25031 0 8.9101C0.000366211 4.69855 2.94952 1.06244 7.07031 0.192871C10.8382 -0.602234 14.6446 1.1142 16.57 4.35889V2.13013C16.6099 1.81531 16.8777 1.57935 17.195 1.57935C17.5123 1.57935 17.7801 1.81531 17.82 2.13013V5.60016C17.82 5.94806 17.5379 6.2301 17.19 6.2301H13.72C13.4052 6.19025 13.1692 5.92242 13.1692 5.6051C13.1692 5.28784 13.4052 5.02002 13.72 4.9801H15.4657C13.7996 2.22009 10.544 0.767517 7.32416 1.44885C3.79526 2.19562 1.26544 5.3031 1.25 8.9101C1.24454 9.25415 0.964081 9.53015 0.619995 9.53009ZM8.89999 17.8101C5.7363 17.8093 2.84183 16.1349 1.25 13.4647V15.6801C1.24454 16.0241 0.964081 16.3001 0.619995 16.3001C0.279816 16.2947 0.00537109 16.0203 0 15.6801V12.2001C0.00546265 11.8561 0.285919 11.58 0.630005 11.5801H1.08017C1.23611 11.5189 1.40323 11.5228 1.54971 11.5801H4.10001C4.34216 11.5494 4.58026 11.6614 4.71109 11.8674C4.84192 12.0735 4.84192 12.3367 4.71109 12.5427C4.58026 12.7488 4.34216 12.8608 4.10001 12.8301H2.38528C4.05313 15.5309 7.2558 16.9567 10.4365 16.3058C13.9612 15.5845 16.5089 12.5074 16.56 8.9101C16.5999 8.59528 16.8677 8.35931 17.185 8.35931C17.5023 8.35931 17.7701 8.59528 17.81 8.9101C17.799 13.8248 13.8147 17.8046 8.89999 17.8101Z" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateSearchFieldComponent=t.styleModules=void 0;var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(11),d=n(6),p=a(d),f=n(106),m=a(f),h=n(34),v=a(h),g=n(1),y=n(8),b=a(y),x=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={searchText:"",isFocused:!1},n.inputElement=null,n.sendChange=(0,g.debounce)(n.sendChange.bind(n),200,{trailing:!0}),n.handleInput=n.handleInput.bind(n),n.handleFocus=n.handleFocus.bind(n),n.handleBlur=n.handleBlur.bind(n),n.handleClearButtonClick=n.handleClearButtonClick.bind(n),n}return i(t,e),l(t,[{key:"sendChange",value:function(){var e=this.props.onChange,t=this.state.searchText;"function"==typeof e&&e(t)}},{key:"clearField",value:function(){this.inputElement.value="",this.setState({searchText:""}),this.sendChange()}},{key:"handleInput",value:function(e){this.setState({searchText:e.target.value}),this.sendChange()}},{key:"handleFocus",value:function(){this.setState({isFocused:!0})}},{key:"handleBlur",value:function(){this.setState({isFocused:!1})}},{key:"handleClearButtonClick",value:function(){this.clearField(),this.inputElement.focus()}},{key:"componentDidUpdate",value:function(e){e.active&&!this.props.active&&""!==this.state.searchText&&this.clearField()}},{key:"render",value:function(){var e=this,t=this.props.i18n,n=this.state,a=n.searchText,o=n.isFocused,r=(0,g.css)(b.default.searchcontainer,a.length&&b.default.active,o&&b.default.focus);return u.default.createElement("div",{className:r},u.default.createElement(p.default,{className:b.default.searchicon,svg:m.default}),u.default.createElement("input",{className:b.default.searchfield,onChange:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,type:"text",placeholder:t.t("Search templates"),ref:function(t){return e.inputElement=t}}),u.default.createElement(p.default,{className:b.default.clearicon,svg:v.default,onClick:this.handleClearButtonClick}))}}]),t}(s.Component);t.styleModules=b.default,t.TemplateSearchFieldComponent=x;t.default=(0,c.provideTemplatesContext)(x)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"2pQty",use:"2pQty-usage",viewBox:"0 0 14 14",content:'<symbol viewBox="0 0 14 14" id="2pQty">\n    <g stroke="none" fill-rule="evenodd" transform="translate(-1.0, -1.0)">\n        <path d="M14.7430947,13.5740557 L10.9100947,9.73955572 C11.5971654,8.80245935 11.9652265,7.66953223 11.9600947,6.50755572 C11.946985,3.47441147 9.49371664,1.01757444 6.46059465,1.00005572 C5.00907481,0.993488427 3.61521603,1.56771229 2.58953064,2.59480646 C1.56384524,3.62190064 0.991535071,5.01654626 1.00009465,6.46805572 C1.01320436,9.50147611 3.46669652,11.958537 6.50009465,11.9760557 C7.66680484,11.9811124 8.80387114,11.6087552 9.74159465,10.9145557 L9.74559465,10.9115557 L13.5750947,14.7430557 C13.7821435,14.9602692 14.0906604,15.0481921 14.3811096,14.9727584 C14.6715587,14.8973248 14.898302,14.6703873 14.9734871,14.3798737 C15.0486722,14.0893602 14.9604853,13.7809186 14.7430947,13.5740557 L14.7430947,13.5740557 Z M6.49609465,10.8780557 C4.06950871,10.8640967 2.1067469,8.89865842 2.09609465,6.47205572 C2.08954524,5.31099854 2.54743104,4.19550612 3.36782487,3.37389147 C4.1882187,2.55227681 5.30302902,2.09273279 6.46409465,2.09755572 C8.89068059,2.1115147 10.8534424,4.07695301 10.8640947,6.50355572 C10.8706441,7.6646129 10.4127583,8.78010532 9.59236443,9.60171997 C8.7719706,10.4233346 7.65716028,10.8828786 6.49609465,10.8780557 Z" />\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,".y47_Q{z-index:100;position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;overflow:hidden}._3v_Q_,.y47_Q._3bPLb{position:relative;height:100%;background-color:#f8f8f8}._3v_Q_{width:100%;padding:0 0 20px;overflow:auto;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;opacity:0;transition:opacity .2s cubic-bezier(.215,.61,.355,1)}._3v_Q_.desktop{padding-top:60px}._3v_Q_.windows{font-family:Segoe,Helvetica Neue,Helvetica,Arial,sans-serif}._3v_Q_.ios,._3v_Q_.mac,._3v_Q_.web{font-family:SFUIText,-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial,sans-serif}._3v_Q_.android{font-family:Roboto,Helvetica Neue,Helvetica,Arial,sans-serif}._3v_Q_.ios{overflow-y:scroll;-webkit-overflow-scrolling:touch}._3v_Q_._1lZiC{pointer-events:auto;opacity:1}._3fLLd{width:100%;height:60px;padding:16px 20px 14px;display:-webkit-flex;display:flex;-webkit-flex-flow:row nowrap;flex-flow:row nowrap;-webkit-justify-content:space-between;justify-content:space-between;-webkit-align-items:flex-start;align-items:flex-start;background:#fff}.desktop ._3fLLd{z-index:1;position:fixed;left:0;top:0;box-shadow:0 1px 2px rgba(0,0,0,.08)}.mobile ._3fLLd{height:52px;padding:16px 12px 0;background:#f8f8f8}@media only screen and (max-width:400px){.mobile ._3fLLd{padding-left:2%;padding-right:2%}}._3HEAp{-webkit-flex:0 0;flex:0 0;position:relative;padding:0 38px 0 24px;color:#4d4d4d;font-size:18px;font-weight:500;line-height:30px;white-space:nowrap}.windows ._3HEAp{font-weight:300}.Z_ZLb{cursor:pointer;width:38px;height:30px;padding:2px 7px 4px;-webkit-transform-origin:19px 14px;transform-origin:19px 14px;fill:#a6a6a6;transition:all .2s}.Z_ZLb:focus,.Z_ZLb:hover{fill:#737373}.desktop .Z_ZLb{position:absolute;right:0}.mobile .Z_ZLb{-webkit-flex:0 0 46px;flex:0 0 46px;position:relative;width:46px;height:36px;padding:6px 5px 6px 17px;-webkit-transform-origin:29px 18px;transform-origin:29px 18px}.syncing .Z_ZLb{fill:#4a90e2;-webkit-animation:_2i-Wp 1.1s ease-in-out infinite;animation:_2i-Wp 1.1s ease-in-out infinite}@-webkit-keyframes _2i-Wp{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes _2i-Wp{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}._2UyOp{-webkit-flex:0 1 220px;flex:0 1 220px;position:relative;min-width:30px;height:30px}._2UyOp ._1yUYm{cursor:pointer;position:absolute;right:-10px;top:-10px;width:50px;height:50px;padding:15px 15px 16px 16px;background:transparent;border:0;transition:all .2s}._2UyOp ._1yUYm svg{fill:#a6a6a6;transition:all .2s}._2UyOp ._1yUYm:focus,._2UyOp ._1yUYm:hover{outline:none}._2UyOp ._1yUYm:focus svg,._2UyOp ._1yUYm:hover svg{fill:#737373}._3990V{-webkit-flex:0 0 227px;flex:0 0 227px;position:relative;width:227px;height:30px;border-radius:4px;border:1px solid #e6e6e6;background:#fff;transition:border .3s}._3990V ._2b-Mr{pointer-events:none;position:absolute;left:10px;top:7px;width:14px;height:14px;padding:0;fill:#a6a6a6;transition:fill .3s}._3990V ._3VR3X{width:100%;margin:0;padding:5px 34px;color:#333;font-weight:300;font-size:13px;line-height:18px;background:transparent;border:none;outline:none}._3990V ._3VR3X::-webkit-input-placeholder{color:#a6a6a6}._3990V ._3VR3X::placeholder{color:#a6a6a6}._3990V ._2B4rR{cursor:pointer;position:absolute;right:0;top:0;width:34px;height:30px;padding:7px 10px 9px;fill:#737373;opacity:0}._3990V._1lZiC,._3990V._3tw3C{border-color:#66b3da}._3990V._1lZiC ._2B4rR{opacity:1}@media only screen and (max-width:450px){.desktop ._3990V{display:none}}.mobile ._3990V{-webkit-flex-grow:1;flex-grow:1;-webkit-flex-shrink:1;flex-shrink:1;height:36px}.mobile ._3990V ._2b-Mr{left:12px;top:10px;width:16px;height:16px;fill:#9ba0a6}.mobile ._3990V ._3VR3X{padding:0 36px;margin:6px 0;font-size:16px;line-height:22px}.mobile ._3990V ._3VR3X::-webkit-input-placeholder{color:#9ba0a6}.mobile ._3990V ._3VR3X::placeholder{color:#9ba0a6}.windows .mobile ._3990V ._3VR3X{font-family:Segoe,Helvetica Neue,Helvetica,Arial,sans-serif}.ios .mobile ._3990V ._3VR3X,.mac .mobile ._3990V ._3VR3X,.web .mobile ._3990V ._3VR3X{font-family:SFUIText,-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial,sans-serif}.android .mobile ._3990V ._3VR3X{font-family:Roboto,Helvetica Neue,Helvetica,Arial,sans-serif}.mobile ._3990V ._2B4rR{right:0;top:0;width:34px;height:34px;padding:9px 10px 9px 8px}._2gHOL{display:-webkit-flex;display:flex;-webkit-flex-flow:row wrap;flex-flow:row wrap;-webkit-align-items:flex-start;align-items:flex-start;-webkit-justify-content:center;justify-content:center;padding:19px 12px}@supports (display:grid) and (grid-template-columns:repeat(auto-fit,200px)){._2gHOL{-webkit-flex-flow:initial;flex-flow:initial;-webkit-align-items:initial;align-items:initial;display:grid;grid-template-columns:repeat(auto-fit,200px);grid-column-gap:25px;grid-row-gap:35px;padding-top:37px;padding-bottom:37px}}.mobile ._2gHOL{padding:2px 2% 10px}@media only screen and (min-width:400px){.mobile ._2gHOL{padding-left:0;padding-right:0}}@supports (display:grid) and (grid-template-columns:repeat(auto-fill,200px)){.mobile ._2gHOL{grid-template-columns:repeat(auto-fill,44%);grid-column-gap:4%;grid-row-gap:30px;padding:16px 0 20px}@media only screen and (min-width:400px){.mobile ._2gHOL{grid-template-columns:repeat(auto-fill,164px);grid-column-gap:14px;padding-right:14px;padding-left:14px}}}._2sAP1{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;padding:120px 0;color:#666;font-size:14px;line-height:28px;font-weight:300;text-align:center}.mobile ._2sAP1{padding:30px 0}._2sAP1 ._3Ll1j{display:block;max-width:320px;max-height:110px;margin-bottom:64px}._2sAP1 p{max-width:450px;margin:0 0 28px}.mobile ._2sAP1 p{max-width:250px;width:80%}._2sAP1 ._3pll6{margin-bottom:0;color:#333;font-size:18px;font-weight:500}.windows ._2sAP1 ._3pll6{font-weight:300}.ios ._2sAP1 ._3pll6,.mac ._2sAP1 ._3pll6,.web ._2sAP1 ._3pll6{font-weight:600}.android ._2sAP1 ._3pll6{font-weight:500}._2sAP1 ._1CL75{cursor:pointer;color:#00a82d;text-decoration:none;font-weight:500}.windows ._2sAP1 ._1CL75{font-weight:300}.ios ._2sAP1 ._1CL75,.mac ._2sAP1 ._1CL75,.web ._2sAP1 ._1CL75{font-weight:600}.android ._2sAP1 ._1CL75{font-weight:500}.desktop ._2sAP1 ._1CL75:focus,.desktop ._2sAP1 ._1CL75:hover{text-decoration:underline}._2sAP1 .Jtrgc{width:20px;height:20px;margin:4px 5px;vertical-align:middle;fill:#666}._2sAP1 ._2u7Rr{cursor:pointer;padding:9px 23px;margin:0 0 38px;border-radius:4px;color:#00a82d;border:1px solid #00a82d;background-color:rgba(0,168,45,0);transition:all .2s;font-weight:500}.windows ._2sAP1 ._2u7Rr{font-weight:300}.ios ._2sAP1 ._2u7Rr,.mac ._2sAP1 ._2u7Rr,.web ._2sAP1 ._2u7Rr{font-weight:600}.android ._2sAP1 ._2u7Rr{font-weight:500}.desktop ._2sAP1 ._2u7Rr:focus,.desktop ._2sAP1 ._2u7Rr:hover{color:#fff;background-color:#00a82d}._3Mym0{-webkit-flex:0 0 200px;flex:0 0 200px;position:relative;display:-webkit-flex;display:flex;-webkit-flex-flow:column nowrap;flex-flow:column nowrap;-webkit-justify-content:flex-start;justify-content:flex-start;-webkit-align-items:stretch;align-items:stretch;width:200px;height:290px;margin:18px 12px;outline:none;-webkit-transform:translateZ(0);transform:translateZ(0)}@supports (display:grid) and (grid-template-columns:repeat(auto-fit,200px)){._3Mym0{-webkit-flex:initial;flex:initial;margin:0}}.mobile ._3Mym0{-webkit-flex-shrink:1;flex-shrink:1;-webkit-flex-basis:44%;flex-basis:44%;width:44%;max-width:164px;height:240px;margin:15px 2%;border-radius:1px}@media only screen and (min-width:400px){.mobile ._3Mym0{margin-left:7px;margin-right:7px}}@supports (display:grid) and (grid-template-columns:repeat(auto-fit,200px)){.mobile ._3Mym0{width:100%;-webkit-flex-shrink:initial;flex-shrink:1;-webkit-flex-basis:initial;flex-basis:auto;margin:0}}.mobile ._3Mym0._3tw3C ._1lROu,.mobile ._3Mym0:focus ._1lROu,.mobile ._3Mym0:hover ._1lROu{box-shadow:0 0 5px 0 rgba(0,0,0,.22)}._3Mym0._1YVCP{cursor:pointer}._3Mym0._1YVCP ._1DwiG{opacity:0;z-index:0}._3Mym0._1YVCP ._1lROu,._3Mym0._1YVCP .rLTyT{opacity:1}.desktop ._3Mym0._1YVCP._3tw3C ._3bEOW,.desktop ._3Mym0._1YVCP:focus ._3bEOW,.desktop ._3Mym0._1YVCP:hover ._3bEOW{-webkit-transform:translateY(-6px);transform:translateY(-6px);opacity:1}.desktop ._3Mym0._1YVCP._3tw3C ._3bEOW:focus,.desktop ._3Mym0._1YVCP._3tw3C ._3bEOW:hover,.desktop ._3Mym0._1YVCP:focus ._3bEOW:focus,.desktop ._3Mym0._1YVCP:focus ._3bEOW:hover,.desktop ._3Mym0._1YVCP:hover ._3bEOW:focus,.desktop ._3Mym0._1YVCP:hover ._3bEOW:hover{opacity:1}.desktop ._3Mym0._1YVCP._3tw3C ._3bEOW:focus ._1GFGS,.desktop ._3Mym0._1YVCP._3tw3C ._3bEOW:hover ._1GFGS,.desktop ._3Mym0._1YVCP:focus ._3bEOW:focus ._1GFGS,.desktop ._3Mym0._1YVCP:focus ._3bEOW:hover ._1GFGS,.desktop ._3Mym0._1YVCP:hover ._3bEOW:focus ._1GFGS,.desktop ._3Mym0._1YVCP:hover ._3bEOW:hover ._1GFGS{background-color:#737373}.desktop ._3Mym0._1YVCP._3tw3C ._1lROu,.desktop ._3Mym0._1YVCP:focus ._1lROu,.desktop ._3Mym0._1YVCP:hover ._1lROu{box-shadow:0 4px 16px 0 rgba(0,0,0,.1);-webkit-transform:translateY(-6px);transform:translateY(-6px)}._1DwiG{z-index:1;position:absolute;display:block;width:200px;height:234px;fill:#e6e6e6}.mobile ._1DwiG{width:164px;height:192px}._1lROu{position:relative;-webkit-flex:1 0;flex:1 0;overflow:hidden;background:#fff;max-height:234px;border-radius:1px;box-shadow:0 0 4px 0 rgba(0,0,0,.08);transition:all .3s cubic-bezier(.215,.61,.355,1);opacity:0}._1lROu ._3muTk{width:200px;height:234px;background-size:200px;background-repeat:no-repeat}.mobile ._1lROu{max-height:192px}.mobile ._1lROu ._3muTk{width:164px;height:192px;background-size:164px}.rLTyT{-webkit-flex:0 0;flex:0 0;position:relative;padding-top:16px;opacity:0;transition:opacity .3s cubic-bezier(.215,.61,.355,1)}.mobile .rLTyT{padding-top:8px}._2fZL6{display:-webkit-flex;display:flex}._2Hh7E{overflow:hidden;color:#4d4d4d;font-size:14px;font-weight:500;line-height:22px;text-overflow:ellipsis;white-space:nowrap}._2Hh7E.windows{font-weight:300}._2Hh7E.ios,._2Hh7E.mac,._2Hh7E.web{font-weight:600}._2Hh7E.android{font-weight:500}._3Kh4q{padding-top:5px;padding-left:5px;color:#23b456;font-size:11px;font-weight:600;line-height:22px;text-transform:uppercase}._3Kh4q.windows{font-weight:300}._3Kh4q.ios,._3Kh4q.mac,._3Kh4q.web{font-weight:600}._3Kh4q.android{font-weight:500}.mm6CJ{padding-top:3px;color:#a6a6a6;font-size:13px;line-height:15px}._3bEOW{cursor:pointer;position:absolute;right:0;top:0;padding:9px 10px;opacity:0;transition:all .3s cubic-bezier(.215,.61,.355,1)}._3bEOW ._1GFGS{width:24px;height:23px;transition:all .2s;border-radius:4px;fill:#fff;background-color:#a6a6a6}",""]),t.locals={tmroot:"y47_Q",locked:"_3bPLb",templatemanager:"_3v_Q_",active:"_1lZiC",topbar:"_3fLLd",appname:"_3HEAp",syncbutton:"Z_ZLb",spin:"_2i-Wp",appclosewrapper:"_2UyOp",appclose:"_1yUYm",searchcontainer:"_3990V",searchicon:"_2b-Mr",searchfield:"_3VR3X",clearicon:"_2B4rR",focus:"_3tw3C",templatelisting:"_2gHOL",listingmessage:"_2sAP1",emptyillustration:"_3Ll1j",heading:"_3pll6",link:"_1CL75",overflowicon:"Jtrgc",button:"_2u7Rr",item:"_3Mym0",itempreview:"_1lROu",itempreviewready:"_1YVCP",itemskeleton:"_1DwiG",iteminfo:"rLTyT",itemmenubutton:"_3bEOW",inner:"_1GFGS",itempreviewimage:"_3muTk",itemtitleline:"_2fZL6",itemtitle:"_2Hh7E",itemtitlesample:"_3Kh4q",itemdate:"mm6CJ"}},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,a=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(e,t){var o=t.trim().replace(/^"(.*)"$/,function(e,t){return t}).replace(/^'(.*)'$/,function(e,t){return t});if(/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(o))return e;var r;return r=0===o.indexOf("//")?o:0===o.indexOf("/")?n+o:a+o.replace(/^\.\//,""),"url("+JSON.stringify(r)+")"})}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.styleModules=void 0;var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(110),d=a(c),p=n(114),f=a(p),m=n(8),h=a(m),v=n(120),g=function(e,t){return-1!==e.description.toLowerCase().indexOf(t)},y=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state=n.getDerivedState({templates:e.templates,filterText:e.filterText,access:e.access}),n}return i(t,e),l(t,[{key:"getDerivedState",value:function(e){var t=e.templates,n=void 0===t?[]:t,a=e.filterText,o=void 0===a?"":a,r=e.access,i=void 0===r?"private":r,l=o.toLowerCase().trim();return{templates:n.filter(function(e){return e.access===i&&((!e.sample||"public"!==i)&&!(l&&!g(e,l)))}).sort(function(e,t){return e.sample&&!t.sample?1:!e.sample&&t.sample?-1:new Date(t.last_edited_ts)-new Date(e.last_edited_ts)}),isTextFiltered:Boolean(l)}}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.templates,a=t.filterText,o=t.access;e.templates===n&&e.filterText===a&&e.access===o||this.setState(this.getDerivedState({templates:n,filterText:a,access:o}))}},{key:"render",value:function(){var e=this.props,t=e.applyTemplate,n=e.removeTemplate,a=e.sanityChecksEnabled,o=e.clearSearchField,r=e.isInitializing,i=this.state,l=i.templates,s=i.isTextFiltered;return u.default.createElement(u.default.Fragment,null,l.length?u.default.createElement("div",{className:h.default.templatelisting},l.map(function(e){return u.default.createElement(d.default,{key:e.guid,guid:e.guid,title:e.description,access:e.access,mine:e.mine,created:e.created_ts,sample:e.sample,previewImage:e.previewImage||(0,v.getFallbackThumbnail)((0,v.getFallbackVariant)(e.guid)),applyTemplate:t,removeTemplate:n,sanityChecksEnabled:a})})):null,u.default.createElement(f.default,{count:l.length,isInitializing:r,filtered:s,clearSearchField:o}))}}]),t}(s.Component);t.styleModules=h.default;t.default=y},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateItemComponent=t.styleModules=void 0;var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(11),d=n(1),p=n(6),f=a(p),m=n(111),h=a(m),v=n(112),g=a(v),y=n(113),b=a(y),x=n(8),_=a(x),k=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={focused:!1},n.itemElement=null,n.menuButtonElement=null,n.applyTemplate=n.applyTemplate.bind(n),n.editTemplate=n.editTemplate.bind(n),n.deleteTemplate=n.deleteTemplate.bind(n),n.handleKeyPress=n.handleKeyPress.bind(n),n.handleItemClick=n.handleItemClick.bind(n),n.handleMenuButtonClick=n.handleMenuButtonClick.bind(n),n}return i(t,e),l(t,[{key:"applyTemplate",value:function(){var e=this.props,t=e.guid,n=e.applyTemplate;t&&"function"==typeof n&&n(t)}},{key:"editTemplate",value:function(){var e=this.props,t=e.i18n,n=e.client,a=e.guid,o=e.title,r=e.access;a&&EN.query("platform-version-for","formDialog").then(function(e){"1"===e?EN.run("platform-use",{type:"formDialog",payload:{isModal:!0,titleText:"ios"===n?t.t("Rename Template"):t.t("Rename template"),titleIcon:"template",formElements:[{type:"textInput",id:"title",label:t.t("Title"),isRequired:!0,initialValue:o}],submitText:t.t("Save"),cancelText:t.t("Cancel")},callback:function(e){if(e=e||{},"submitted"===e.result){var t=e.values&&e.values.title&&e.values.title.value;t!==o&&EN.run("template-update",{template:{guid:a,description:t||""}})}}}):EN.run("templatedialog","update",{guid:a,title:o,access:r})})}},{key:"deleteTemplate",value:function(){var e=this.props,t=e.i18n,n=e.client,a=e.guid,o=e.title;a&&EN.query("platform-version-for","confirmAlert").then(function(e){if("1"===e){var r="string"==typeof o?o.length>40?o.substring(0,40)+"…":o:"";EN.run("platform-use",{type:"confirmAlert",payload:{titleText:"ios"===n?t.t("Delete Template"):t.t("Delete template"),bodyText:t.t("template-dialogs-delete-info",{TITLE:r}),confirmText:t.t("Delete"),confirmType:"destructive",cancelText:t.t("Cancel")},callback:function(e){e=e||{},"confirmed"===e.result&&EN.run("template-remove",{guid:a})}})}else EN.run("templatedialog","delete",{guid:a,title:o})})}},{key:"showMenu",value:function(e,t){var n=this,a=this.props,o=a.i18n,r=a.client;this.setState({focused:!0}),EN.query("platform-version-for","optionsPopup").then(function(a){if("1"===a){var i=n.itemElement&&n.itemElement.getBoundingClientRect(),l={top:i?Math.round(i.top):0,left:i?Math.round(i.left):0,bottom:i?Math.round(i.bottom):0,right:i?Math.round(i.right):0},s=[];s.push({id:"apply",label:"ios"===r?o.t("Apply Template"):o.t("Apply template"),icon:"note"}),!n.props.mine&&n.props.sanityChecksEnabled||(s.push({id:"rename",label:"ios"===r?o.t("Rename Template"):"android"===r?o.t("Rename template"):o.t("Rename template…"),icon:"edit"}),s.push({id:"delete",label:"ios"===r?o.t("Delete Template"):"android"===r?o.t("Delete template"):o.t("Delete template…"),icon:"delete",type:"destructive"})),EN.run("platform-use",{type:"optionsPopup",payload:{bodyText:"",options:s,cancelText:o.t("Cancel"),originationArea:l},callback:function(e){switch(e=e||{},e.result){case"apply":n.applyTemplate();break;case"rename":n.editTemplate();break;case"delete":n.deleteTemplate()}n.setState({focused:!1})}})}else EN.run("menu",{xPosition:e,yPosition:t,items:[{type:"item",label:"ios"===r?o.t("Apply Template"):o.t("Apply template"),action:n.applyTemplate},{type:"item",label:"ios"===r?o.t("Rename Template"):"android"===r?o.t("Rename template"):o.t("Rename template…"),enabled:n.props.mine||!n.props.sanityChecksEnabled,action:n.editTemplate},{type:"item",label:"ios"===r?o.t("Delete Template"):"android"===r?o.t("Delete template"):o.t("Delete template…"),enabled:n.props.mine||!n.props.sanityChecksEnabled,action:n.deleteTemplate}],onClose:function(){n.setState({focused:!1})}})})}},{key:"handleKeyPress",value:function(e){var t=e.keyCode;if(13===t||32===t)if(this.menuButtonElement){var n=this.menuButtonElement.getBoundingClientRect();this.showMenu(n.left,n.top)}else this.applyTemplate()}},{key:"handleItemClick",value:function(){var e=this.props.client;if("android"===e||"ios"===e){var t=this.itemElement.getBoundingClientRect();this.showMenu(t.left,t.top)}else this.applyTemplate()}},{key:"handleMenuButtonClick",value:function(e){e.stopPropagation(),this.showMenu(e.clientX,e.clientY)}},{key:"render",value:function(){var e=this,t=this.props,n=t.i18n,a=t.isMobile,o=t.title,r=t.created,i=t.sample,l=t.previewImage,s=this.state.focused,c={className:(0,d.css)(_.default.item,s&&_.default.focus,_.default.itempreviewready),onKeyDown:this.handleKeyPress,onClick:this.handleItemClick,tabIndex:"0",ref:function(t){return e.itemElement=t}},p=a?null:u.default.createElement("div",{className:_.default.itemmenubutton,onClick:this.handleMenuButtonClick,ref:function(t){return e.menuButtonElement=t}},u.default.createElement(f.default,{className:_.default.inner,svg:h.default}));return u.default.createElement("div",c,u.default.createElement(f.default,{className:_.default.itemskeleton,svg:a?g.default:b.default}),u.default.createElement("div",{className:_.default.itempreview},u.default.createElement("div",{className:_.default.itempreviewimage,style:{backgroundImage:"url('"+l+"')"}})),u.default.createElement("div",{className:_.default.iteminfo},u.default.createElement("div",{className:_.default.itemtitleline},u.default.createElement("div",{className:_.default.itemtitle},o),i&&u.default.createElement("div",{className:_.default.itemtitlesample},n.t("sample"))),r&&u.default.createElement("div",{className:_.default.itemdate},n.t("Created {DATE}",{DATE:new Date(r).toLocaleDateString()}))),p)}}]),t}(s.Component);t.styleModules=_.default,t.TemplateItemComponent=k;t.default=(0,c.provideTemplatesContext)(k)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"QR_h5",use:"QR_h5-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="QR_h5">\n    <g stroke="none" fill-rule="evenodd" transform="translate(3.5, 7.0)">\n        <path d="M2.73076923,6.46153846 C1.77489178,6.46153846 1,5.68664668 1,4.73076923 C1,3.77489178 1.77489178,3 2.73076923,3 C3.68664668,3 4.46153846,3.77489178 4.46153846,4.73076923 C4.46153846,5.68664668 3.68664668,6.46153846 2.73076923,6.46153846 Z M8.5,6.46153846 C7.54412255,6.46153846 6.76923077,5.68664668 6.76923077,4.73076923 C6.76923077,3.77489178 7.54412255,3 8.5,3 C9.45587745,3 10.2307692,3.77489178 10.2307692,4.73076923 C10.2307692,5.68664668 9.45587745,6.46153846 8.5,6.46153846 Z M14.2692308,6.46153846 C13.3133533,6.46153846 12.5384615,5.68664668 12.5384615,4.73076923 C12.5384615,3.77489178 13.3133533,3 14.2692308,3 C15.2251082,3 16,3.77489178 16,4.73076923 C16,5.68664668 15.2251082,6.46153846 14.2692308,6.46153846 Z" />\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"3D5hz",use:"3D5hz-usage",viewBox:"0 0 218 251",content:'<symbol viewBox="0 0 218 251" id="3D5hz">\n    <path d="M2,0 L216,0 C217.104569,1.54939706e-14 218,0.8954305 218,2 L218,178 C218,179.104569 217.104569,180 216,180 L2,180 C0.8954305,180 1.3527075e-16,179.104569 0,178 L-4.4408921e-16,2 C-5.7935996e-16,0.8954305 0.8954305,2.02906125e-16 2,0 Z M2,193 L158,193 C159.104569,193 160,193.895431 160,195 L160,215 C160,216.104569 159.104569,217 158,217 L2,217 C0.8954305,217 2.09738034e-15,216.104569 0,215 L0,195 C-1.3527075e-16,193.895431 0.8954305,193 2,193 Z M2,227 L208,227 C209.104569,227 210,227.895431 210,229 L210,249 C210,250.104569 209.104569,251 208,251 L2,251 C0.8954305,251 2.09738034e-15,250.104569 0,249 L0,229 C-1.3527075e-16,227.895431 0.8954305,227 2,227 Z" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"1UOTF",use:"1UOTF-usage",viewBox:"0 0 137 158",content:'<symbol viewBox="0 0 137 158" id="1UOTF">\n    <path d="M2.09558824,0 L134.911765,0 C136.016334,-1.58997828e-14 136.911765,0.8954305 136.911765,2 L136.911765,111.267974 C136.911765,112.372543 136.016334,113.267974 134.911765,113.267974 L2.09558824,113.267974 C0.991018736,113.267974 0.0955882353,112.372543 0.0955882353,111.267974 L0.0955882353,2 C0.0955882353,0.8954305 0.991018736,2.02906125e-16 2.09558824,0 Z M2.09558824,121.777778 L107.875,121.777778 C108.979569,121.777778 109.875,122.673208 109.875,123.777778 L109.875,134.69281 C109.875,135.79738 108.979569,136.69281 107.875,136.69281 L2.09558824,136.69281 C0.991018736,136.69281 0.0955882353,135.79738 0.0955882353,134.69281 L0.0955882353,123.777778 C0.0955882353,122.673208 0.991018736,121.777778 2.09558824,121.777778 Z M2.09558824,143.084967 L129.875,143.084967 C130.979569,143.084967 131.875,143.980398 131.875,145.084967 L131.875,156 C131.875,157.104569 130.979569,158 129.875,158 L2.09558824,158 C0.991018736,158 0.0955882353,157.104569 0.0955882353,156 L0.0955882353,145.084967 C0.0955882353,143.980398 0.991018736,143.084967 2.09558824,143.084967 Z" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.i18n,n=e.client,a=e.isMobile,o=e.accountType,r=e.contextActions,l=e.count,u=e.filtered,d=e.clearSearchField;if(e.isInitializing&&!l)return i.default.createElement("div",{className:y.default.listingmessage},i.default.createElement(c.default,null));if(u&&!l)return i.default.createElement("div",{className:y.default.listingmessage},i.default.createElement("p",{className:y.default.heading},t.t("No templates matched your search")),"function"==typeof d?i.default.createElement("p",null,i.default.createElement("span",{className:y.default.link,onClick:d},t.t("Clear search"))):null);var f=r&&"function"==typeof r.openCommunitySite?r.openCommunitySite:function(){},h=void 0;h=a||l?null:i.default.createElement("div",{className:"emptyillustration"});var g=void 0;g=l?i.default.createElement("p",{className:y.default.heading},t.t("Can't find the template you need?")):i.default.createElement("p",{className:y.default.heading},t.t("You haven't saved any templates."));var b=void 0;if("plus"===o||"premium"===o||"business"===o){var x="android"===n?v.default:m.default,_=t.t("Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.").split("{OVERFLOW}");b=i.default.createElement("p",null,_[0]," ",i.default.createElement(p.default,{className:y.default.overflowicon,svg:x})," ",_[1])}else if("basic"===o){var k=r&&"function"==typeof r.openUpsellPage?r.openUpsellPage:function(){},w=(0,s.flatten)(t.t("To create your own templates, upgrade your Evernote account today.").split("<a>").map(function(e){return e.split("</a>")}));b=i.default.createElement("p",null,w[0],i.default.createElement("span",{className:y.default.link,onClick:k},w[1]),w[2])}else b=null;return i.default.createElement("div",{className:y.default.listingmessage},h,g,i.default.createElement("p",null,t.t("Get inspired with these templates from Evernote:")),i.default.createElement("div",{className:y.default.button,onClick:f},t.t("Browse sample templates")),b)}Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateListingMessageComponent=void 0;var r=n(0),i=a(r),l=n(11),s=n(1),u=n(115),c=a(u),d=n(6),p=a(d),f=n(118),m=a(f),h=n(119),v=a(h),g=n(8),y=a(g);t.TemplateListingMessageComponent=o;t.default=(0,l.provideTemplatesContext)(o)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},r=n(0),i=a(r),l=n(116),s=a(l),u=function(e){return i.default.createElement("svg",o({className:s.default.spinner,width:"60px",height:"60px",viewBox:"0 0 66 66",xmlns:"http://www.w3.org/2000/svg"},e),i.default.createElement("circle",{className:s.default.path,fill:"none",strokeWidth:"6",strokeLinecap:"round",cx:"33",cy:"33",r:"30"}))};t.default=u},function(e,t,n){var a=n(117);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"@-webkit-keyframes _3_gFo{0%{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}to{-webkit-transform:rotate(180deg);transform:rotate(180deg)}}@keyframes _3_gFo{0%{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}to{-webkit-transform:rotate(180deg);transform:rotate(180deg)}}@-webkit-keyframes Nzr_s{0%{stroke-dashoffset:187}50%{stroke-dashoffset:46.75;-webkit-transform:rotate(135deg);transform:rotate(135deg)}to{stroke-dashoffset:187;-webkit-transform:rotate(450deg);transform:rotate(450deg)}}@keyframes Nzr_s{0%{stroke-dashoffset:187}50%{stroke-dashoffset:46.75;-webkit-transform:rotate(135deg);transform:rotate(135deg)}to{stroke-dashoffset:187;-webkit-transform:rotate(450deg);transform:rotate(450deg)}}._2zED1{display:-webkit-flex;display:flex;-webkit-flex:0.99;flex:0.99;justify-self:center;-webkit-align-self:center;align-self:center;-webkit-animation:_3_gFo 1s linear infinite;animation:_3_gFo 1s linear infinite}._32-4J{stroke-linecap:butt;stroke-dasharray:187;stroke-dashoffset:0;-webkit-transform-origin:center;transform-origin:center;stroke:#00a82d;-webkit-animation:Nzr_s 1s linear infinite;animation:Nzr_s 1s linear infinite}",""]),t.locals={spinner:"_2zED1",rotator:"_3_gFo",path:"_32-4J",dash:"Nzr_s"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"3snQu",use:"3snQu-usage",viewBox:"0 0 20 20",content:'<symbol viewBox="0 0 20 20" id="3snQu">\n    <g stroke="none" fill-rule="evenodd" transform="translate(-2.0, -0.5)">\n        <path d="M4.25641026,12.5128205 C3.01022928,12.5128205 2,11.5025912 2,10.2564103 C2,9.01022928 3.01022928,8 4.25641026,8 C5.50259123,8 6.51282051,9.01022928 6.51282051,10.2564103 C6.51282051,11.5025912 5.50259123,12.5128205 4.25641026,12.5128205 Z M12,12.5128205 C10.753819,12.5128205 9.74358974,11.5025912 9.74358974,10.2564103 C9.74358974,9.01022928 10.753819,8 12,8 C13.246181,8 14.2564103,9.01022928 14.2564103,10.2564103 C14.2564103,11.5025912 13.246181,12.5128205 12,12.5128205 Z M19.7435897,12.5128205 C18.4974088,12.5128205 17.4871795,11.5025912 17.4871795,10.2564103 C17.4871795,9.01022928 18.4974088,8 19.7435897,8 C20.9897707,8 22,9.01022928 22,10.2564103 C22,11.5025912 20.9897707,12.5128205 19.7435897,12.5128205 Z" />\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"3UNoZ",use:"3UNoZ-usage",viewBox:"0 0 17 17",content:'<symbol viewBox="0 0 17 17" id="3UNoZ">\n    <g stroke="none" fill-rule="evenodd" transform="translate(-3.5, -1.0)">\n        <path d="M12,5.41538462 C11.0030552,5.41538462 10.1948718,4.60720119 10.1948718,3.61025641 C10.1948718,2.61331163 11.0030552,1.80512821 12,1.80512821 C12.9969448,1.80512821 13.8051282,2.61331163 13.8051282,3.61025641 C13.8051282,4.60720119 12.9969448,5.41538462 12,5.41538462 Z M12,11.6102564 C11.0030552,11.6102564 10.1948718,10.802073 10.1948718,9.80512821 C10.1948718,8.80818343 11.0030552,8 12,8 C12.9969448,8 13.8051282,8.80818343 13.8051282,9.80512821 C13.8051282,10.802073 12.9969448,11.6102564 12,11.6102564 Z M12,14.1948718 C12.9969448,14.1948718 13.8051282,15.0030552 13.8051282,16 C13.8051282,16.9969448 12.9969448,17.8051282 12,17.8051282 C11.0030552,17.8051282 10.1948718,16.9969448 10.1948718,16 C10.1948718,15.0030552 11.0030552,14.1948718 12,14.1948718 Z" />\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#CEDC00",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#00A82D";return'<defs><path id="star" d="M24.6332129,19.480124 L25.3574475,21.8066795 C25.4467366,22.0946503 25.702699,22.2873214 25.9904086,22.2873214 L28.3337537,22.2873214 C28.9766359,22.2873214 29.2464876,23.1491621 28.724642,23.544863 L26.829727,24.9826453 C26.5955909,25.1608143 26.4983649,25.4757176 26.587654,25.759545 L27.3118886,28.0861005 C27.510309,28.7283375 26.8079007,29.2607727 26.286055,28.8630001 L24.39114,27.4272896 C24.1570039,27.2491206 23.8415155,27.2491206 23.6073794,27.4272896 L21.7124644,28.8630001 C21.1906187,29.2607727 20.4882104,28.7283375 20.688615,28.0861005 L21.4108653,25.759545 C21.5001545,25.4757176 21.4049127,25.1608143 21.1707766,24.9826453 L19.2758616,23.544863 C18.7540159,23.1491621 19.0218835,22.2873214 19.6667499,22.2873214 L22.0081108,22.2873214 C22.2978046,22.2873214 22.553767,22.0946503 22.6430561,21.8066795 L23.3653065,19.480124 C23.5657111,18.8399587 24.4328083,18.8399587 24.6332129,19.480124"></path><pattern id="star-pattern" x="-8" y="-8" width="33" height="33" patternUnits="userSpaceOnUse"><use fill="'+t+'" transform="translate(-15, -15)" xlink:href="#star"></use><use fill="'+t+'" transform="translate(1.5, 1.5)" xlink:href="#star"></use></pattern></defs><rect fill="'+e+'" x="0" y="0" width="200" height="240"/><rect fill="url(#star-pattern)" x="0" y="0" width="200" height="240"/>'}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#00A82D";return'<defs><pattern id="stripe-pattern" x="0" y="0" width="17" height="17" patternUnits="userSpaceOnUse"><line stroke="'+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#CEDC00")+'" stroke-width="2.0" x1="3" y1="0" x2="3" y2="17"></line></pattern></defs><rect fill="'+e+'" x="0" y="0" width="200" height="240"/><rect fill="url(#stripe-pattern)" transform="translate(0 -200), rotate(45)" x="0" y="0" width="600" height="320"/>'}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#000000",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#00A82D";return'<defs><path id="dot" d="M39,20 C39,22.209507 37.208535,24 35.0017598,24 C32.791465,24 31,22.209507 31,20 C31,17.790493 32.791465,16 35.0017598,16 C37.208535,16 39,17.790493 39,20"></path><pattern id="dot-pattern" x="-8" y="-8" width="31" height="31" patternUnits="userSpaceOnUse"><use fill="'+t+'" transform="translate(-23, -11)" xlink:href="#dot"></use><use fill="'+t+'" transform="translate(-7.5, 4.5)" xlink:href="#dot"></use></pattern></defs><rect fill="'+e+'" x="0" y="0" width="200" height="240"></rect><rect fill="url(#dot-pattern)" x="0" y="0" width="200" height="240"/>'}function i(){return'<rect fill="'+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#000000")+'" x="66" y="71" width="67" height="90"></rect><path fill="#FFFFFF" transform="translate(-1710, -168)" d="M1775,229 L1844,229 C1848.97056,229 1853,233.029437 1853,238 L1853,330 C1853,334.970563 1848.97056,339 1844,339 L1775,339 C1770.02944,339 1766,334.970563 1766,330 L1766,238 C1766,233.029437 1770.02944,229 1775,229 Z M1781.5,293.75 L1837.5,293.75 C1838.88071,293.75 1840,292.630712 1840,291.25 C1840,289.869288 1838.88071,288.75 1837.5,288.75 L1781.5,288.75 C1780.11929,288.75 1779,289.869288 1779,291.25 C1779,292.630712 1780.11929,293.75 1781.5,293.75 Z M1781.5,310.75 L1837.5,310.75 C1838.88071,310.75 1840,309.630712 1840,308.25 C1840,306.869288 1838.88071,305.75 1837.5,305.75 L1781.5,305.75 C1780.11929,305.75 1779,306.869288 1779,308.25 C1779,309.630712 1780.11929,310.75 1781.5,310.75 Z M1782,247 C1780.34315,247 1779,248.343146 1779,250 L1779,273 C1779,274.656854 1780.34315,276 1782,276 L1805,276 C1806.65685,276 1808,274.656854 1808,273 L1808,250 C1808,248.343146 1806.65685,247 1805,247 L1782,247 Z M1785,252 L1802,252 C1802.55228,252 1803,252.447715 1803,253 L1803,270 C1803,270.552285 1802.55228,271 1802,271 L1785,271 C1784.44772,271 1784,270.552285 1784,270 L1784,253 C1784,252.447715 1784.44772,252 1785,252 Z"></path>'}function l(e){return'data:image/svg+xml;utf8,<svg viewBox="0 0 200 240" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">'+e+"</svg>"}function s(e){switch(e%3){case 0:return l(a("#CEDC00","#00A82D")+i("#CEDC00"));case 1:return l(o("#00A82D","#CEDC00")+i("#00A82D"));case 2:return l(r("#000000","#00A82D")+i("#000000"));default:return""}}function u(e){var t=e.charAt(0).toLowerCase();return t>="0"&&t<="9"||t>="a"&&t<="f"?parseInt(t,16)%3:t.charCodeAt(0)%3}Object.defineProperty(t,"__esModule",{value:!0}),t.getFallbackThumbnail=void 0,t.getFallbackVariant=u;var c=n(1);t.getFallbackThumbnail=(0,c.memoize)(s)},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(35),c=a(u),d=n(36),p=a(d),f=n(123),m=a(f),h=n(37),v=a(h),g=n(19),y=a(g),b=n(38),x=a(b),_=n(1),k=function(e){function t(e,n,a,i){o(this,t);var l=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return l.connectivityError=n,l.code=a,l.limit=i,l}return i(t,e),t}(Error),w=function(e){function t(e,n,a,i){o(this,t);var l=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return l.networkClient=new p.default(e,n,a),l.localStore=c.default.getStorage(l.networkClient.endPoint+"/"+n.userID),l.configUser=n,l.configNote=a,l.thumbnailSize="ios"===i||"android"===i?"small":"large",l.thumbnailPromise={},l._scheduleNextRefresh=l._scheduleNextRefresh.bind(l),l.syncEngine=new m.default(l.localStore,l.networkClient,l),l.mappedPreviewImages={},l.emitChange=(0,_.debounce)(function(){return l.trigger("change")},100,{trailing:!0}),l.refreshTimer=setTimeout(function(){return l.sync()},1e3*y.default.WAIT_TO_SYNC_ON_INIT_SECONDS||0),l}return i(t,e),s(t,[{key:"sync",value:function(){this.syncEngine.sync()}},{key:"activateSync",value:function(e){e&&this.syncEngine.forceRefreshOnNextSync(),this.sync(),this.once("sync.stop",this._scheduleNextRefresh)}},{key:"deactivateSync",value:function(){clearTimeout(this.refreshTimer),this.off("sync.stop",this._scheduleNextRefresh)}},{key:"_scheduleNextRefresh",value:function(e){var t=this;clearTimeout(this.refreshTimer),this.refreshTimer=setTimeout(function(){return t.activateSync(!0)},e)}},{key:"getPendingPromise",value:function(e,t){var n=this;return new Promise(function(a,o){var r,i=function(e){clearTimeout(r),e.error?o(new k("failure",n.networkClient.failureFromConnectivity,e.error.code,e.error.limit)):a(e)};n.once(e,i),n.sync(),t&&(r=setTimeout(function(){n.off(e,i),o(new Error("timeout"))},t))})}},{key:"setItemFlag",value:function(e,t,n,a){var o=this;return this.localStore.getItem(e).then(function(r){if(!r||!r.id){if(n)throw new Error("template "+e+" doesn't exist");r={id:e,tmp:!0,item:{}}}return a&&(r.item=l({},r.item,a)),r[t]=Date.now(),o.localStore.setItem(e,r).then(function(){return o.emitChange(),r})})}},{key:"unboxCollection",value:function(e){var t=e.items;return t?t.filter(function(e){return!e.pending_delete&&!e.pending_create}).map(function(e){return e.item}).filter(function(e){return e}):[]}},{key:"decorateCollection",value:function(e){var t=this;return Promise.all(e.map(function(e){return t.decorateItem(e)}))}},{key:"decorateItem",value:function(e){var t=this,n=e.guid;return this.mappedPreviewImages[n]?(e.previewImage=this.mappedPreviewImages[n],Promise.resolve(e)):this.localStore.getThumbnail(n,{}).then(function(a){return t.mappedPreviewImages[n]?(e.previewImage=t.mappedPreviewImages[n],e):t._isBlob(a.thumbnail)?(e.previewImage=URL.createObjectURL(a.thumbnail),e):+new Date(e.created_ts)<y.default.THUMBNAILS_AVAILABLE_SINCE?e:(t.thumbnailPromise[n]||(t.thumbnailPromise[n]=t.networkClient.getThumbnail(n,t.thumbnailSize).then(function(a){delete t.thumbnailPromise[n],t.mappedPreviewImages[n]||(t.localStore.setThumbnail(n,a,t.thumbnailSize),e.previewImage=URL.createObjectURL(a),t.emitChange())}).catch(function(e){})),e)}).then(function(){return e.previewImage&&!t.mappedPreviewImages[n]&&(t.mappedPreviewImages[n]=e.previewImage),e}).catch(function(t){return e})}},{key:"_isBlob",value:function(e){return e instanceof Blob||e&&e.constructor&&"Blob"===e.constructor.name}},{key:"listTemplates",value:function(e,t){var n=this;return e&&this.syncEngine.forceRefreshOnNextSync(),t?this.localStore.getCollection().then(this.unboxCollection).then(function(e){return n.decorateCollection(e)}):this.getPendingPromise("synced",1e4).catch(function(e){return n.localStore.getCollection()}).then(this.unboxCollection).then(function(e){return n.decorateCollection(e)})}},{key:"getTemplate",value:function(e,t){var n=this;return t?this.localStore.getItem(e).then(function(e){return e.item}).then(function(e){return n.decorateItem(e)}):this.setItemFlag(e,"pending_fetch").then(function(e){return n.getPendingPromise(e.id,1e4).then(function(e){return e.item}).then(function(e){return n.decorateItem(e)}).catch(function(){return Promise.resolve(e.item)})})}},{key:"removeTemplate",value:function(e){var t=this;return this.setItemFlag(e,"pending_delete",!0).then(function(){return t.sync()})}},{key:"updateTemplate",value:function(e,t,n){var a=this,o={};return t&&(o.description=t),n&&(o.access=n),this.setItemFlag(e,"pending_update",!0,o).then(function(){return a.sync()})}},{key:"createTemplate",value:function(e,t){var n=this,a=(0,x.default)(),o={id:a,pending_create:Date.now(),item:{guid:a,description:e,created_by_id:this.configUser.userID,created_by_name:this.configUser.displayName,created_ts:(new Date).toISOString(),last_edited_by_id:this.configUser.userID,last_edited_by_name:this.configUser.displayName,last_edited_ts:(new Date).toISOString(),orig_note_guid:this.configNote.guid,access:t}};return this.localStore.setItem(a,o).then(function(){return n.emitChange(),n.sync(),{item:o.item,createPromise:n.getPendingPromise(o.id)}})}},{key:"searchTemplates",value:function(e){return this.networkClient.listTemplates(e,Date.now())}},{key:"applyTemplate",value:function(e){return this.networkClient.applyTemplate(e,Date.now())}},{key:"getSetting",value:function(e,t){return this.localStore&&this.localStore.getSetting(e,t)||t}},{key:"setSetting",value:function(e,t){return this.localStore&&this.localStore.setSetting(e,t)}},{key:"updateNote",value:function(e){this.networkClient.updateNote(e),this.configNote.guid=e}}]),t}(v.default);t.default=w},function(e,t,n){"use strict";function a(e,t){t&&Object.keys(t).forEach(function(n){e.objectStoreNames.contains(n)||e.createObjectStore(n,{keyPath:t[n]})})}function o(e,t,n){var o=t.stores;return new Promise(function(r,i){var l=indexedDB.open(e,t.version);l.onerror=function(){i(new Error(l.error.message))},l.onupgradeneeded=function(){a(l.result,o)},l.onsuccess=function(){var t=l.result;t.onversionchange=function(){t.close(),n(e)},r(t)}}).then(function(e){var t=function(t,n){return e.transaction(t,n).objectStore(t)},n=function(e){return new Promise(function(t,n){var a=e();a instanceof IDBRequest?a.onsuccess=function(e){return t(a.result)}:a.oncomplete=function(e){return t()},a.onerror=n})};return{getAll:function(e){return n(function(){return t(e).getAll()})},getItem:function(e,a){return n(function(){return t(e).get(a)})},setItem:function(e,a,r){return r[o[e]]=a,n(function(){return t(e,"readwrite").put(r)})},removeAll:function(e){return n(function(){return t(e,"readwrite").clear()})},removeItem:function(e,a){return n(function(){return t(e,"readwrite").delete(a)})},run:function(e,a){return n(function(){var n=t(e,"readwrite");return a(n),n.transaction})}}})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=n(7),l=a(i),s=n(35),u=(a(s),n(36)),c=(a(u),n(37)),d=(a(c),n(19)),p=a(d),f=function(){function e(t,n,a){o(this,e),this.localStore=t,this.networkClient=n,this.observer=a,this.log=l.default.getLogger("template.sync"),this.syncing=!1,this.wantsToSync=!1,this.forceRefresh=!1,this.changed=!1,this.pendingCreates=[],this.pendingUpdates=[],this.pendingDeletes=[],this.pendingFetches=[],this.needListFetch=!1}return r(e,[{key:"forceRefreshOnNextSync",value:function(){this.forceRefresh=!0}},{key:"sync",value:function(){var e=this;if(this.syncing)return void(this.wantsToSync=!0);this._startSync(),this.localStore.getCollection().then(function(t){e._populatePendingBuckets(t),e.needListFetch=e._isFullFetchNeeded(t);var n=[];return e._processPendingDeletes(n),e._processPendingCreates(n),e._processPendingUpdates(n),Promise.all(n).then(function(){if(n.length=0,e.needListFetch){var a=e.networkClient.listTemplates(null,t.lastServiceFetch).then(function(n){return e.localStore.getCollection().then(function(a){return t=a,e._applyFetchedCollection(n,t),e.localStore.setCollection(t),e.changed=!0,null})});n.push(a.catch(function(t){return t.persistent?e.log.warn("Persistent error on fetch."):(e.forceRefreshOnNextSync(),e._syncAgainSoon()),Promise.resolve()}))}else e._processPendingFetches(n);return Promise.all(n).then(function(){return e._resolvePendingFetches(t),e._finishSync(t),null}),null}),null}).catch(function(t){e._failSync()})}},{key:"_syncAgainSoon",value:function(){this.nextSyncDelay=1e3,this.sync()}},{key:"_startSync",value:function(){this.syncing=!0,this.wantsToSync=!1,this.nextSyncDelay=0,this.changed=!1,this.pendingCreates.length=0,this.pendingUpdates.length=0,this.pendingDeletes.length=0,this.pendingFetches.length=0,this.needListFetch=!1,this.log.debug("SYNC START"),this.observer.trigger("sync.start")}},{key:"_finishSync",value:function(e){var t=this;this.changed&&this.observer.trigger("change"),this.observer.trigger("sync.stop",this._msToNextRefresh(e)),this.log.debug("SYNC SUCCESS. we know of "+e.items.length+" templates."),this.observer.trigger("synced",e),this.syncing=!1,this.wantsToSync&&setTimeout(function(){return t.sync()},this.nextSyncDelay)}},{key:"_failSync",value:function(){var e=this;this.observer.trigger("sync.stop",this._msToNextRefresh()),this.log.warn("SYNC FAILURE"),this.syncing=!1,this.wantsToSync&&setTimeout(function(){return e.sync()},this.nextSyncDelay)}},{key:"_populatePendingBuckets",value:function(e){var t=this;e.items.forEach(function(e){e.pending_delete?t.pendingDeletes.push(e):e.pending_create?t.pendingCreates.push(e):e.pending_update?t.pendingUpdates.push(e):e.pending_fetch&&t.pendingFetches.push(e)})}},{key:"_isFullFetchNeeded",value:function(e){return!!(this.forceRefresh||!e.lastServiceFetch||Date.now()-e.lastServiceFetch>=1e3*this.networkClient.maxAge)&&(e.lastServiceFetch||(e.lastServiceFetch=0),this.forceRefresh=!1,!0)}},{key:"_msToNextRefresh",value:function(e){var t=1e3*this.networkClient.maxAge;if(!e)return t;var n=Date.now()-e.lastServiceFetch;return Math.max(0,t-n)}},{key:"_processPendingDeletes",value:function(e){var t=this;this.pendingDeletes.length&&this.pendingDeletes.forEach(function(n){if(!n.id)return void t.log.error("abnormal pending delete.");var a=t.networkClient.removeTemplate(n.id,n.pending_delete);e.push(a.catch(function(){return Promise.resolve()})),a.then(function(){t.localStore.removeItem(n.id),t.observer.trigger(n.id,n),t.changed=!0}).catch(function(e){e.persistent&&(t.log.warn("Persistent error on delete - recovering."),t.localStore.removeItem(n.id),t.observer.trigger(n.id,n),t.needListFetch=!0),t._syncAgainSoon()})})}},{key:"_processPendingCreates",value:function(e){var t=this;this.pendingCreates.length&&this.pendingCreates.forEach(function(n){var a=t.networkClient.createTemplate(n.item,n.pending_create);e.push(a.catch(function(){return Promise.resolve()})),a.then(function(e){if(e&&e.created_ts){t.localStore.removeItem(n.id);var a={id:e.guid,lastServiceFetch:Date.now(),item:e};t.localStore.setItem(a.id,a),t.observer.trigger(n.id,a),t.changed=!0}else delete n.pending_create,t.changed=!0,n.pending_fetch=!0,t.pendingFetches.push(n),t.localStore.setItem(n.id,n)}).catch(function(e){var a=Date.now()-n.pending_create;(e.fast||a>1e3*p.default.CREATE_TIMEOUT_SECONDS)&&(t.log.warn("Fast or timeout error on create - recovering. waitTime for create was "+a),t.localStore.removeItem(n.id),t.observer.trigger(n.id,{error:e}),t.needListFetch=!0,t.observer.trigger("change")),t._syncAgainSoon()})})}},{key:"_processPendingUpdates",value:function(e){var t=this;this.pendingUpdates.length&&this.pendingUpdates.forEach(function(n){var a=t.networkClient.updateTemplate(n.item,n.pending_update);e.push(a.catch(function(){return Promise.resolve()})),a.then(function(e){delete n.pending_update,delete n.pending_fetch,n.lastServiceFetch=Date.now(),e&&e.created_ts&&(n.item=e),t.localStore.setItem(n.id,n),t.observer.trigger(n.id,n),t.changed=!0}).catch(function(e){e.persistent&&(t.log.warn("Persistent error on update - recovering."),delete n.pending_update,t.localStore.setItem(n.id,n),t.observer.trigger(n.id,{}),t.needListFetch=!0),t._syncAgainSoon()})})}},{key:"_processPendingFetches",value:function(e){var t=this;this.pendingFetches.length&&this.pendingFetches.forEach(function(n){var a;n.lastServiceFetch&&Date.now()-n.lastServiceFetch<1e3*t.networkClient.maxAge?(delete n.pending_fetch,a=t.localStore.setItem(n.id,n)):a=t.networkClient.getTemplate(n.id,n.lastServiceFetch).then(function(e){return delete n.pending_fetch,n.lastServiceFetch=Date.now(),n.item=e,t.localStore.setItem(n.id,n)}).catch(function(e){e.persistent&&(t.log.warn("Persistent error on fetch - recovering."),delete n.pending_fetch,t.localStore.setItem(n.id,n),t.needListFetch=!0,t.sync())}),e.push(a.catch(function(){return Promise.resolve()}))})}},{key:"_resolvePendingFetches",value:function(e){var t=this;if(this.pendingFetches.length){this.pendingFetches.forEach(function(n){var a=e.items.find(function(e){return e.id===n.id});if(a&&a.pending_fetch&&a.tmp){var o=e.items.indexOf(a);e.items.splice(o,1),a=null}t.observer.trigger(n.id,a||{id:n.id,item:{guid:n.id}})})}}},{key:"_applyFetchedCollection",value:function(e,t){var n=this;t.lastServiceFetch=Date.now(),t.items=t.items.filter(function(e){return e.pending_delete||e.pending_create||e.pending_update||e.pending_fetch}),this.log.debug("full list fetch received "+e.length+" items, to be merged with "+t.items.length+" pending items."),e.forEach(function(e){var a=t.items.find(function(t){return t.id===e.guid});if(a){if(n.log.debug("new item "+e.guid+" already exists. applying carefully"),a.pending_delete)return;if(a.pending_create)delete a.pending_create;else{if(a.pending_update)return;a.pending_fetch&&delete a.pending_fetch}a.lastServiceFetch=t.lastServiceFetch,a.item=e}else t.items.push({id:e.guid,lastServiceFetch:t.lastServiceFetch,item:e})})}}]),e}();t.default=f},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var a=new Uint8Array(16);e.exports=function(){return n(a),a}}else{var o=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}},function(e,t){function n(e,t){var n=t||0,o=a;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}for(var a=[],o=0;o<256;++o)a[o]=(o+256).toString(16).substr(1);e.exports=n},function(e,t,n){"use strict";function a(){var e=document.querySelector('meta[name="viewport"]');return e||(e=document.createElement("meta"),e.name="viewport",document.head.appendChild(e)),e}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e="number"==typeof e?e:1,t="number"==typeof t?t:1,n="number"==typeof n?n:1,a().content="width=device-width, initial-scale="+e+", minimum-scale="+t+", maximum-scale="+n+", user-scalable="+(o?"yes":"no")}Object.defineProperty(t,"__esModule",{value:!0}),t.updateViewportSettings=o},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.customFallbacks=void 0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=n(7),l=function(e){return e&&e.__esModule?e:{default:e}}(i),s="en",u=t.customFallbacks={zh:"zh_CN"},c=function(){function e(t){a(this,e),this.log=l.default.getLogger("template.l10n"),this.translations=t||{},this.activeLocaleStrings={},this.fallbackLocaleStrings=this.translations[s]||{},this.setLocale(s)}return r(e,[{key:"setLocale",value:function(e){if("string"!=typeof e)return void this.log.warn("invalid locale type "+(void 0===e?"undefined":o(e)));u[e]&&(e=u[e]),this.activeLocale=e.replace(/-/g,"_"),this.activeLocaleStrings=this.translations[this.activeLocale],this.activeLocaleStrings&&Object.keys(this.activeLocaleStrings).length||!(this.activeLocale.indexOf("_")>-1)||(this.activeLocale=this.activeLocale.substring(0,this.activeLocale.indexOf("_")),this.activeLocaleStrings=this.translations[this.activeLocale]),this.activeLocaleStrings&&Object.keys(this.activeLocaleStrings).length||(this.log.warn("no strings available for locale "+e+", falling back to "+s),this.activeLocale=s,this.activeLocaleStrings=this.translations[this.activeLocale]),this.activeLocaleStrings||(this.log.error("no strings available. no usable fallback."),this.activeLocaleStrings={})}},{key:"t",value:function(e,t){if("string"!=typeof e)return this.log.error("lookup key must be a string"),"";var n=this.activeLocaleStrings[e];return"string"==typeof n&&""!==n||(this.log.warn("no locale string found for key "+e+", using fallback strings"),n=this.fallbackLocaleStrings[e]),"string"==typeof n&&""!==n||(this.log.warn("no fallback string found for key "+e+", using lookup key as string"),n=e),t&&Object.keys(t).forEach(function(e){n=n.replace(new RegExp("{"+e+"}","g"),t[e])}),n}}]),e}();t.default=c},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(129),r=a(o),i=n(130),l=a(i),s=n(131),u=a(s),c=n(132),d=a(c),p=n(133),f=a(p),m=n(134),h=a(m),v=n(135),g=a(v),y=n(136),b=a(y),x=n(137),_=a(x),k=n(138),w=a(k),C=n(139),E=a(C),T=n(140),O=a(T),S=n(141),P=a(S),M=n(142),L=a(M),N=n(143),j=a(N),A=n(144),D=a(A),R=n(145),I=a(R),F=n(146),U=a(F),z=n(147),B=a(z),V=n(148),H=a(V),K=n(149),W=a(K),q=n(150),Z=a(q),Y=n(151),Q=a(Y),G=n(152),X=a(G),J=n(153),$=a(J),ee=n(154),te=a(ee),ne=n(155),ae=a(ne);t.default={ar:r.default,cs:l.default,da:u.default,de:d.default,en:f.default,es:h.default,fi:g.default,fr:b.default,id:_.default,it:w.default,ja:E.default,ko:O.default,ms:P.default,nl:L.default,no:j.default,pl:D.default,pt_BR:I.default,pt:U.default,ru:B.default,sv:H.default,th:W.default,tr:Z.default,uk:Q.default,vi:X.default,zh_CN:$.default,zh_TW:te.default,en_XA:ae.default}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"إلغاء",Save:"حفظ",Delete:"حذف",Undo:"تراجع",Templates:"القوالب","Search templates":"البحث في القوالب","Created {DATE}":"تاريخ الإنشاء {DATE}",sample:"نموذج","No templates matched your search":"لا توجد قوالب تتطابق مع معايير البحث","Clear search":"مسح البحث","Can't find the template you need?":"ألا يمكنك العثور على القالب الذي تحتاجه؟","You haven't saved any templates.":"لم تحفظ أي قوالب.","Get inspired with these templates from Evernote:":"احصل على أفكار مستوحاة من هذه القوالب من Evernote:","Browse sample templates":"استعرض نماذج القوالب","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"أو احفظ الملاحظات الخاصة بك كقوالب من القائمة {OVERFLOW} أعلى الملاحظة.","To create your own templates, upgrade your Evernote account today.":"لإنشاء قوالبك الخاصة، <a>قم بترقية حساب Evernote</a> اليوم.","Creating template…":"جارٍ إنشاء القالب...","Template failed to save":"فشل حفظ القالب","Template created from note":"تم إنشاء القالب من الملاحظة","Template removed":"تمت إزالة القالب","Template deleted":"تم حذف القالب","Template updated":"تم تحديث القالب","Note created from template":"تم إنشاء الملاحظة من القالب","Unable to save. Check your connection and try again later":"لا يمكن الحفظ. تحقق من الاتصال وحاول مرة أخرى في وقت لاحق","Unable to save this note's content as a template":"يتعذر حفظ محتوى الملاحظة كقالب","You've reached the limit of 100 templates":"لقد وصلت إلى حد 100 قالب","Apply template":"تطبيق القالب","Apply Template":"تطبيق القالب","Rename template":"تغيير اسم القالب","Rename template…":"إعادة تسمية القالب...","Rename Template":"تغيير اسم القالب","Delete template":"حذف القالب","Delete template…":"حذف القالب...","Delete Template":"حذف القالب",Title:"العنوان","Save as template":"حفظ كقالب","Save as Template":"حفظ كقالب","template-dialogs-create-warning":"لن يتم تضمين المرفقات والصور الكبيرة في القالب.","template-dialogs-delete-info":"هل تريد بالتأكيد حذف القالب “{TITLE}”?\\n\\n \n\nلن تتأثر الملاحظة الأصلية أو أي من الملاحظات الأخرى التي تم إنشاؤها استنادًا إلى هذا القالب."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Zrušit",Save:"Uložit",Delete:"Smazat",Undo:"Zpět",Templates:"Šablony","Search templates":"Hledat šablony","Created {DATE}":"Vytvořeno {DATE}",sample:"vzor","No templates matched your search":"Vašemu hledání neodpovídají žádné šablony","Clear search":"Vymazat hledání","Can't find the template you need?":"Nemůžete najít potřebnou šablonu?","You haven't saved any templates.":"Žádné šablony jste si neuložili","Get inspired with these templates from Evernote:":"Nechte se inspirovat těmito šablonami od Evernote:","Browse sample templates":"Procházejte vzorové šablony","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Nebo si uložte své poznámky jako šablony z nabídky {OVERFLOW} v horní části poznámky.","To create your own templates, upgrade your Evernote account today.":"Pokud si chcete vytvářet šablony, <a>přejděte na vyšší verzi účtu Evernote</a>.","Creating template…":"Vytváření šablony...","Template failed to save":"Šablonu se nepodařilo uložit","Template created from note":"Šablona vytvořena z poznámky","Template removed":"Šablona odebrána","Template deleted":"Šablona smazána","Template updated":"Šablona aktualizována","Note created from template":"Šablona vytvořena z poznámky","Unable to save. Check your connection and try again later":"Nelze uložit. Zkontrolujte připojení a zkuste to znovu.","Unable to save this note's content as a template":"Obsah této poznámky nelze uložit jako šablonu","You've reached the limit of 100 templates":"Dosáhli jste limitu 100 šablon","Apply template":"Použít šablonu","Apply Template":"Použít šablonu","Rename template":"Přejmenovat šablonu","Rename template…":"Přejmenovat šablonu…","Rename Template":"Přejmenovat šablonu","Delete template":"Smazat šablonu","Delete template…":"Smazat šablonu…","Delete Template":"Smazat šablonu",Title:"Název","Save as template":"Uložit jako šablonu","Save as Template":"Uložit jako šablonu","template-dialogs-create-warning":"Přílohy a velké obrázky do šablony nebudou zahrnuty.","template-dialogs-delete-info":"Opravdu chcete smazat šablonu „{TITLE}“?\n\nNa původní poznámku a poznámky vytvořené z této šablony to nebude mít vliv."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Annuller",Save:"Gem",Delete:"Slet",Undo:"Fortryd",Templates:"Skabeloner","Search templates":"Søg i skabeloner","Created {DATE}":"Oprettet {DATE}",sample:"eksempel","No templates matched your search":"Ingen skabeloner matchede din søgning","Clear search":"Ryd søgning","Can't find the template you need?":"Kan du ikke finde den skabelon, du har brug for?","You haven't saved any templates.":"Du har ikke gemt nogen skabeloner.","Get inspired with these templates from Evernote:":"Bliv inspireret af disse skabeloner fra Evernote:","Browse sample templates":"Gennemse eksempler på skabeloner","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Eller gem dine egne noter som skabeloner via menuen {OVERFLOW} øverst i noten.","To create your own templates, upgrade your Evernote account today.":"<a>Opgrader din Evernote-konto</a> allerede i dag for at oprette dine egne skabeloner.","Creating template…":"Opretter skabelon...","Template failed to save":"Skabelonen kunne ikke gemmes","Template created from note":"Skabelon oprettet fra note","Template removed":"Skabelon fjernet","Template deleted":"Skabelon slettet","Template updated":"Skabelon opdateret","Note created from template":"Note oprettet fra skabelon","Unable to save. Check your connection and try again later":"Kunne ikke gemme. Tjek din forbindelse og prøv igen senere","Unable to save this note's content as a template":"Kunne ikke gemme denne notes indhold som en skabelon","You've reached the limit of 100 templates":"Du har nået grænsen på 100 skabeloner","Apply template":"Anvend skabelon","Apply Template":"Anvend skabelon","Rename template":"Omdøb skabelon","Rename template…":"Omdøb skabelon…","Rename Template":"Omdøb skabelon","Delete template":"Slet skabelon","Delete template…":"Slet skabelon…","Delete Template":"Slet skabelon",Title:"Titel","Save as template":"Gem som skabelon","Save as Template":"Gem som skabelon","template-dialogs-create-warning":"Vedhæftninger og store billeder vil ikke blive inkluderet i skabelonen.","template-dialogs-delete-info":"Er du sikker på, at du vil slette skabelonen “{TITLE}”?\n\nDen originale note og eventuelle noter, der er oprettet fra denne skabelon, vil ikke blive påvirket."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Abbrechen",Save:"Speichern",Delete:"Löschen",Undo:"Rückgängig",Templates:"Vorlagen","Search templates":"Vorlage suchen","Created {DATE}":"Erstellt am {DATE}",sample:"Beispiel","No templates matched your search":"Keine Vorlage entspricht deiner Suche","Clear search":"Suche löschen","Can't find the template you need?":"Du findest keine geeignete Vorlage?","You haven't saved any templates.":"Du hast noch keine Vorlagen gespeichert.","Get inspired with these templates from Evernote:":"Lass dich durch diese Vorlagen von Evernote inspirieren:","Browse sample templates":"Beispielvorlagen durchsuchen","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Alternativ kannst du das Menü {OVERFLOW} oberhalb der Notiz verwenden, um eigene Notizen als Vorlagen zu speichern.","To create your own templates, upgrade your Evernote account today.":"Um eigene Vorlagen erstellen zu können, musst du <a>dein Evernote-Konto hochstufen</a>.","Creating template…":"Vorlage wird erstellt…","Template failed to save":"Vorlage konnte nicht gespeichert werden","Template created from note":"Vorlage aus Notiz erstellt","Template removed":"Vorlage entfernt","Template deleted":"Vorlage gelöscht","Template updated":"Vorlage geändert","Note created from template":"Notiz aus Vorlage erstellt","Unable to save. Check your connection and try again later":"Speichern nicht möglich. Überprüfe deine Verbindung und versuche es erneut.","Unable to save this note's content as a template":"Inhalt der Notiz konnte nicht als Vorlage gespeichert werden","You've reached the limit of 100 templates":"Du hast das Limit von 100 Vorlagen erreicht","Apply template":"Vorlage anwenden","Apply Template":"Vorlage anwenden","Rename template":"Vorlage umbenennen","Rename template…":"Vorlage umbenennen…","Rename Template":"Vorlage umbenennen","Delete template":"Vorlage löschen","Delete template…":"Vorlage löschen…","Delete Template":"Vorlage löschen",Title:"Titel","Save as template":"Als Vorlage speichern","Save as Template":"Als Vorlage speichern","template-dialogs-create-warning":"Anhänge und große Bilder werden nicht mit in die Vorlage übernommen.","template-dialogs-delete-info":"Möchtest du die Vorlage „{TITLE}“ wirklich löschen?\n\nDie ursprüngliche Notiz und jegliche auf Basis dieser Vorlage erstellten Notizen bleiben davon unberührt."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Cancel",Save:"Save",Delete:"Delete",Undo:"Undo",Templates:"Templates","Search templates":"Search templates","Created {DATE}":"Created {DATE}",sample:"sample","No templates matched your search":"No templates matched your search","Clear search":"Clear search","Can't find the template you need?":"Can't find the template you need?","You haven't saved any templates.":"You haven’t saved any templates.","Get inspired with these templates from Evernote:":"Get inspired with these templates from Evernote:","Browse sample templates":"Browse sample templates","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.","To create your own templates, upgrade your Evernote account today.":"To create your own templates, <a>upgrade your Evernote account</a> today.","Creating template…":"Creating template…","Template failed to save":"Template failed to save","Template created from note":"Template created from note","Template removed":"Template removed","Template deleted":"Template deleted","Template updated":"Template updated","Note created from template":"Note created from template","Unable to save. Check your connection and try again later":"Unable to save. Check your connection and try again later","Unable to save this note's content as a template":"Unable to save this note's content as a template","You've reached the limit of 100 templates":"You've reached the limit of 100 templates","Apply template":"Apply template","Apply Template":"Apply Template","Rename template":"Rename template","Rename template…":"Rename template…","Rename Template":"Rename Template","Delete template":"Delete template","Delete template…":"Delete template…","Delete Template":"Delete Template",Title:"Title","Save as template":"Save as template","Save as Template":"Save as Template","template-dialogs-create-warning":"Attachments and large images will not be included in the template.","template-dialogs-delete-info":"Are you sure you want to delete the template “{TITLE}”?\n\nThe original note and any notes created from this template will not be affected."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Cancelar",Save:"Guardar",Delete:"Eliminar",Undo:"Deshacer",Templates:"Plantillas","Search templates":"Buscar plantillas","Created {DATE}":"Creada el {DATE}",sample:"muestra","No templates matched your search":"Ninguna plantilla coincide con tu búsqueda","Clear search":"Eliminar búsqueda","Can't find the template you need?":"¿No puedes encontrar la plantilla que necesitas?","You haven't saved any templates.":"No has guardado ninguna plantilla.","Get inspired with these templates from Evernote:":"Inspírate con estas plantillas de Evernote:","Browse sample templates":"Consulta plantillas de muestra","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"O guarda tus propias notas como plantillas del menú {OVERFLOW} en la parte superior de la nota.","To create your own templates, upgrade your Evernote account today.":"Para crear tus propias plantillas <a>actualiza tu cuenta de Evernote</a> hoy.","Creating template…":"Creando plantilla...","Template failed to save":"No ha sido posible guardar la plantilla","Template created from note":"Plantilla creada a partir de la nota","Template removed":"Plantilla eliminada","Template deleted":"Plantilla eliminada","Template updated":"Plantilla actualizada","Note created from template":"Nota creada a partir de la plantilla","Unable to save. Check your connection and try again later":"No se puede guardar. Comprueba tu conexión e inténtalo de nuevo más tarde","Unable to save this note's content as a template":"No se puede guardar el contenido de esta nota como una plantilla","You've reached the limit of 100 templates":"Has alcanzado el límite de 100 plantillas.","Apply template":"Aplicar plantilla","Apply Template":"Aplicar Plantilla","Rename template":"Cambiar el nombre de la plantilla","Rename template…":"Cambiar el nombre de la plantilla…","Rename Template":"Cambiar el nombre de la plantilla","Delete template":"Eliminar plantilla","Delete template…":"Eliminar plantilla…","Delete Template":"Eliminar plantilla",Title:"Título","Save as template":"Guardar como plantilla","Save as Template":"Guardar como plantilla","template-dialogs-create-warning":"Los archivos adjuntos y las imágenes grandes no se incluirán en la plantilla.","template-dialogs-delete-info":"¿Estás seguro de que quieres eliminar la plantilla “{TITLE}”?\n\nLa nota original y las notas creadas a partir de esta plantilla no se verán afectadas."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Peruuta",Save:"Tallenna",Delete:"Poista",Undo:"Kumoa",Templates:"Mallit","Search templates":"Hae malleja","Created {DATE}":"Luotu {DATE}",sample:"malli","No templates matched your search":"Mikään malli ei vastannut hakuasi","Clear search":"Tyhjennä haku","Can't find the template you need?":"Etkö löydä tarvitsemaasi mallia?","You haven't saved any templates.":"Et ole tallentanut yhtään mallia.","Get inspired with these templates from Evernote:":"Saa inspiraatio näistä Evernoten malleista:","Browse sample templates":"Selaa malliesimerkkejä","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Voit myös tallentaa omat muistiinpanosi malleina muistiinpanon yläosassa olevasta {OVERFLOW}-valikosta.","To create your own templates, upgrade your Evernote account today.":"<a>Päivitä Evernote-tilisi</a> tänään, jotta voit luoda omat mallisi.","Creating template…":"Luodaan mallia...","Template failed to save":"Mallin tallennus ei onnistunut","Template created from note":"Malli luotu muistiinpanosta","Template removed":"Malli poistettu","Template deleted":"Malli poistettu","Template updated":"Malli päivitetty","Note created from template":"Muistiinpano luotu mallista","Unable to save. Check your connection and try again later":"Tallennus ei onnistu. Tarkista yhteytesi ja yritä uudelleen myöhemmin.","Unable to save this note's content as a template":"Tämän muistiinpanon sisältöä ei voi tallentaa mallina.","You've reached the limit of 100 templates":"100 mallin kiintiö on täynnä","Apply template":"Käytä mallia","Apply Template":"Käytä mallia","Rename template":"Nimeä malli uudelleen","Rename template…":"Nimeä malli uudelleen...","Rename Template":"Nimeä malli uudelleen","Delete template":"Poista malli","Delete template…":"Poista malli...","Delete Template":"Poista malli",Title:"Otsikko","Save as template":"Tallenna mallina","Save as Template":"Tallenna mallina","template-dialogs-create-warning":"Liitteitä ja suuria kuvia ei sisällytetä malliin.","template-dialogs-delete-info":"Haluatko varmasti poistaa mallin “{TITLE}”?\n\nTämä ei vaikuta alkuperäiseen muistiinpanoon tai mihinkään tästä mallista luotuun muistiinpanoon."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Annuler",Save:"Enregistrer",Delete:"Supprimer",Undo:"Annuler",Templates:"Modèles","Search templates":"Rechercher des modèles","Created {DATE}":"Créé le {DATE}",sample:"exemple","No templates matched your search":"Aucun modèle ne correspond à votre recherche.","Clear search":"Effacer la recherche","Can't find the template you need?":"Vous ne trouvez pas le modèle dont vous avez besoin ?","You haven't saved any templates.":"Vous n'avez pas enregistré de modèle.","Get inspired with these templates from Evernote:":"Trouvez l'inspiration avec ces modèles d'Evernote :","Browse sample templates":"Parcourir les exemples de modèles","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Ou enregistrez vos notes sous forme de modèles à partir du menu {OVERFLOW} situé en haut des notes.","To create your own templates, upgrade your Evernote account today.":"Pour créer vos propres modèles, <a>mettez à niveau votre compte Evernote</a> aujourd'hui.","Creating template…":"Création du modèle…","Template failed to save":"Échec de l'enregistrement du modèle","Template created from note":"Modèle créé à partir de la note","Template removed":"Modèle supprimé","Template deleted":"Modèle supprimé","Template updated":"Modèle mis à jour","Note created from template":"Note créée à partir du modèle","Unable to save. Check your connection and try again later":"Échec de l'enregistrement. Vérifiez votre connexion et réessayez ultérieurement.","Unable to save this note's content as a template":"Impossible d'enregistrer le contenu de cette note en tant que modèle","You've reached the limit of 100 templates":"Vous avez atteint la limite de 100 modèles.","Apply template":"Appliquer le modèle","Apply Template":"Appliquer le modèle","Rename template":"Renommer le modèle","Rename template…":"Renommer le modèle…","Rename Template":"Renommer le modèle","Delete template":"Supprimer le modèle","Delete template…":"Supprimer le modèle…","Delete Template":"Supprimer le modèle",Title:"Titre","Save as template":"Enregistrer en tant que modèle","Save as Template":"Enregistrer en tant que modèle","template-dialogs-create-warning":"Les pièces jointes et les images volumineuses ne seront pas incluses dans le modèle.","template-dialogs-delete-info":"Voulez-vous vraiment supprimer le modèle « {TITLE} » ?\n\nLa note originale et les notes créées à partir de ce modèle ne seront pas affectées."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Batal",Save:"Simpan",Delete:"Hapus",Undo:"Undo",Templates:"Kerangka","Search templates":"Cari kerangka","Created {DATE}":"Dibuat {DATE}",sample:"contoh","No templates matched your search":"Tidak ada kerangka yang cocok dengan pencarian Anda","Clear search":"Hapus Pencarian","Can't find the template you need?":"Tidak dapat menemukan template yang Anda butuhkan?","You haven't saved any templates.":"Anda belum menyimpan kerangka apa pun.","Get inspired with these templates from Evernote:":"Dapatkan inspirasi dengan kerangka ini dari Evernote:","Browse sample templates":"Jelajahi contoh kerangka","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Atau simpan catatan Anda sendiri sebagai kerangka dari menu {OVERFLOW} di bagian atas catatan.","To create your own templates, upgrade your Evernote account today.":"Untuk membuat kerangka Anda sendiri, <a>tingkatkan akun Evernote Anda</a> hari ini.","Creating template…":"Membuat kerangka...","Template failed to save":"Kerangka gagal disimpan","Template created from note":"Kerangka dibuat dari catatan","Template removed":"Kerangka dihapus","Template deleted":"Kerangka dihapus","Template updated":"Kerangka diperbarui","Note created from template":"Catatan dibuat dari kerangka","Unable to save. Check your connection and try again later":"Tidak dapat menyimpan. Periksa koneksi Anda dan coba lagi nanti","Unable to save this note's content as a template":"Tidak dapat menyimpan konten catatan ini sebagai kerangka","You've reached the limit of 100 templates":"Anda telah mencapai batas 100 kerangka","Apply template":"Terapkan kerangka","Apply Template":"Terapkan Kerangka","Rename template":"Ubah nama kerangka","Rename template…":"Ubah nama kerangka...","Rename Template":"Ubah Nama Kerangka","Delete template":"Hapus kerangka","Delete template…":"Hapus kerangka...","Delete Template":"Hapus Kerangka",Title:"Judul","Save as template":"Simpan sebagai kerangka","Save as Template":"Simpan sebagai Kerangka","template-dialogs-create-warning":"Lampiran dan gambar besar tidak akan dimasukkan dalam kerangka.","template-dialogs-delete-info":'Anda yakin ingin menghapus kerangka "{TITLE}"?\n\nCatatan asli dan catatan apa pun yang dibuat dari kerangka ini tidak akan terpengaruh.'}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Annulla",Save:"Salva",Delete:"Elimina",Undo:"Annulla",Templates:"Modelli","Search templates":"Cerca tra i modelli","Created {DATE}":"Data creazione: {DATE}",sample:"esempio","No templates matched your search":"Nessun modello corrisponde alla ricerca","Clear search":"Cancella ricerca","Can't find the template you need?":"Non riesci a trovare il modello che ti serve?","You haven't saved any templates.":"Non hai salvato alcun modello","Get inspired with these templates from Evernote:":"Lasciati ispirare da questi modelli di Evernote:","Browse sample templates":"Sfoglia i modelli di esempio","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Oppure, salva le tue note come modelli dal menu {OVERFLOW} in cima alla nota.","To create your own templates, upgrade your Evernote account today.":"Per creare i tuoi modelli, <a>aggiorna oggi stesso il tuo account Evernote</a>.","Creating template…":"Creazione modello…","Template failed to save":"Impossibile salvare il modello","Template created from note":"Modello creato da nota","Template removed":"Modello rimosso","Template deleted":"Modello eliminato","Template updated":"Modello aggiornato","Note created from template":"Nota creata da modello","Unable to save. Check your connection and try again later":"Impossibile salvare. Controlla la connessione e riprova","Unable to save this note's content as a template":"Impossibile salvare i contenuti di questa nota come modelli","You've reached the limit of 100 templates":"You've reached the limit of 100 templates","Apply template":"Applica modello","Apply Template":"Applica modello","Rename template":"Rinomina modello","Rename template…":"Rinomina modello…","Rename Template":"Rinomina modello","Delete template":"Elimina modello","Delete template…":"Elimina modello…","Delete Template":"Elimina modello",Title:"Titolo","Save as template":"Salva come modello","Save as Template":"Salva come modello","template-dialogs-create-warning":"Allegati e immagini di grandi dimensioni non verranno inclusi nel modello.","template-dialogs-delete-info":'Eliminare il modello "{TITLE}"?\n\nLa nota originale e tutte le note create da questo modello resteranno inalterate.'}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"キャンセル",Save:"保存",Delete:"削除",Undo:"取り消す",Templates:"テンプレート","Search templates":"テンプレートを検索する","Created {DATE}":"{DATE}に作成",sample:"サンプル","No templates matched your search":"検索条件に一致するテンプレートがありません","Clear search":"検索条件をクリア","Can't find the template you need?":"必要なテンプレートが見つかりませんか？","You haven't saved any templates.":"保存されたテンプレートはまだありません。","Get inspired with these templates from Evernote:":"Evernote 提供のテンプレートをご活用ください。","Browse sample templates":"テンプレートの見本を表示","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"または、ノート上部の「{OVERFLOW}」メニューから、自分のノートをテンプレートとして保存できます。","To create your own templates, upgrade your Evernote account today.":"<a>Evernote アカウントをアップグレード</a>して、独自のテンプレートを作成しましょう。","Creating template…":"テンプレートを作成中…","Template failed to save":"テンプレートを保存できませんでした","Template created from note":"ノートからテンプレートを作成しました","Template removed":"テンプレートを削除しました","Template deleted":"テンプレートを削除しました","Template updated":"テンプレートを更新しました","Note created from template":"テンプレートからノートを作成しました","Unable to save. Check your connection and try again later":"保存できません。インターネット接続を確認して、再度お試しください。","Unable to save this note's content as a template":"このノートの中身をテンプレートとして保存できません","You've reached the limit of 100 templates":"テンプレートの数が上限の 100 個に達しました。","Apply template":"テンプレートを適用","Apply Template":"テンプレートを適用","Rename template":"テンプレートの名前を変更","Rename template…":"テンプレートの名前を変更…","Rename Template":"テンプレートの名前を変更","Delete template":"テンプレートを削除","Delete template…":"テンプレートを削除…","Delete Template":"テンプレートを削除",Title:"タイトル","Save as template":"テンプレートとして保存","Save as Template":"テンプレートとして保存","template-dialogs-create-warning":"添付ファイルおよび大きな画像は、テンプレートに含まれません。","template-dialogs-delete-info":"テンプレート「{TITLE}」を本当に削除しますか？\n\n元のノート、およびこのテンプレートから作成されたノートには影響ありません。"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"취소",Save:"저장",Delete:"삭제",Undo:"실행 취소",Templates:"템플릿","Search templates":"템플릿 검색","Created {DATE}":"만든 날짜: {DATE}",sample:"샘플","No templates matched your search":"검색과 일치하는 템플릿이 없습니다","Clear search":"검색 지우기","Can't find the template you need?":"필요한 템플릿을 찾을 수 없나요?","You haven't saved any templates.":"저장된 템플릿이 없습니다.","Get inspired with these templates from Evernote:":"Evernote이 제공하는 다음 템플릿에서 영감을 얻으세요:","Browse sample templates":"샘플 템플릿 찾아보기","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"또는 노트 상단의 {OVERFLOW} 메뉴에서 회원님의 노트를 템플릿으로 저장하세요.","To create your own templates, upgrade your Evernote account today.":"나만의 템플릿을 만들려면 오늘 <a>Evernote 계정을 업그레이드하세요</a>.","Creating template…":"템플릿 생성 중…","Template failed to save":"템플릿 저장 실패","Template created from note":"노트로 템플릿 생성 완료","Template removed":"템플릿 제거 완료","Template deleted":"템플릿 삭제 완료","Template updated":"템플릿 업데이트 완료","Note created from template":"템플릿으로 생성된 노트","Unable to save. Check your connection and try again later":"저장할 수 없습니다. 연결을 확인하고 나중에 다시 시도하세요.","Unable to save this note's content as a template":"이 노트의 콘텐츠를 템플릿으로 저장할 수 없습니다","You've reached the limit of 100 templates":"템플릿 100개 제한에 도달했습니다","Apply template":"템플릿 적용","Apply Template":"템플릿 적용","Rename template":"템플릿 이름 바꾸기","Rename template…":"템플릿 이름 바꾸기…","Rename Template":"템플릿 이름 바꾸기","Delete template":"템플릿 삭제","Delete template…":"템플릿 삭제…","Delete Template":"템플릿 삭제",Title:"제목","Save as template":"템플릿으로 저장","Save as Template":"템플릿으로 저장","template-dialogs-create-warning":"첨부파일과 대용량 이미지는 템플릿에 포함되지 않습니다.","template-dialogs-delete-info":"템플릿 “{TITLE}”을 정말 삭제할까요?\n\n원본 노트와 이 템플릿으로 만든 노트는 영향을 받지 않습니다."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Batal",Save:"Simpan",Delete:"Padam",Undo:"Buat asal",Templates:"Templat","Search templates":"Templat carian","Created {DATE}":"Dicipta {DATE}",sample:"sampel","No templates matched your search":"Tiada templat yang sepadan dengan carian anda","Clear search":"Kosongkan carian","Can't find the template you need?":"Tidak menemui templat yang anda perlukan?","You haven't saved any templates.":"Anda belum menyimpan sebarang templat.","Get inspired with these templates from Evernote:":"Dapatkan inspirasi dengan templat ini daripada Evernote:","Browse sample templates":"Semak imbas templat sampel","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Atau simpan nota anda sendiri sebagai templat daripada menu {OVERFLOW} di bahagian atas nota.","To create your own templates, upgrade your Evernote account today.":"Untuk mencipta templat anda sendiri, <a>naik taraf akaun Evernote anda</a> hari ini.","Creating template…":"Mencipta templat...","Template failed to save":"Templat gagal disimpan","Template created from note":"Templat dicipta daripada nota","Template removed":"Templat dialih keluar","Template deleted":"Templat dipadam","Template updated":"Templat dikemas kini","Note created from template":"Nota dicipta daripada templat","Unable to save. Check your connection and try again later":"Tidak dapat menyimpan. Periksa sambungan anda dan cuba lagi kemudian","Unable to save this note's content as a template":"Tidak dapat menyimpan kandungan nota ini sebagai templat","You've reached the limit of 100 templates":"Anda telah mencapai had 100 templat","Apply template":"Gunakan templat","Apply Template":"Gunakan Templat","Rename template":"Namakan semula templat","Rename template…":"Namakan semula templat...","Rename Template":"Namakan Semula Templat","Delete template":"Padam templat","Delete template…":"Padam templat...","Delete Template":"Padam Templat",Title:"Tajuk","Save as template":"Simpan sebagai templat","Save as Template":"Simpan sebagai Templat","template-dialogs-create-warning":"Lampiran dan imej yang besar tidak akan disertakan dalam templat.","template-dialogs-delete-info":'Adakah anda pasti mahu memadamkan templat "{TITLE}"?\n\nNota asal dan sebarang nota yang dibuat daripada templat ini tidak akan dipengaruhi.'}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Annuleer",Save:"Sla op",Delete:"Verwijder",Undo:"Maak ongedaan",Templates:"Sjablonen","Search templates":"Zoek sjablonen","Created {DATE}":"Aangemaakt op {DATE}",sample:"voorbeeld","No templates matched your search":"Er zijn geen sjablonen gevonden overeenkomstig je zoekopdracht","Clear search":"Zoekopdracht wissen","Can't find the template you need?":"Kan je het sjabloon niet vinden dat je nodig hebt?","You haven't saved any templates.":"Je hebt geen sjablonen opgeslagen.","Get inspired with these templates from Evernote:":"Raak geïnspireerd met deze sjablonen van Evernote:","Browse sample templates":"Bekijk voorbeeldsjablonen","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Of sla je eigen notities als sjablonen op uit het {OVERFLOW} menu bovenin de notitie.","To create your own templates, upgrade your Evernote account today.":"<a>Upgrade je Evernote account</a> vandaag om je eigen sjablonen aan te maken.","Creating template…":"Sjabloon aan het maken...","Template failed to save":"Het sjabloon is niet opgeslagen","Template created from note":"Notitie omgezet in sjabloon","Template removed":"Sjabloon verwijderd","Template deleted":"Sjabloon verwijderd","Template updated":"Sjabloon bijgewerkt","Note created from template":"Notitie aangemaakt vanuit sjabloon","Unable to save. Check your connection and try again later":"Kan niet opgeslagen worden. Controleer je internetverbinding en probeer het later opnieuw","Unable to save this note's content as a template":"De content van deze notitie kan niet als sjabloon opgeslagen worden","You've reached the limit of 100 templates":"Je heb je limiet van 100 sjablonen bereikt","Apply template":"Pas sjabloon toe","Apply Template":"Pas sjabloon toe","Rename template":"Wijzig naam sjabloon","Rename template…":"Wijzig naam sjabloon…","Rename Template":"Wijzig naam sjabloon","Delete template":"Verwijder sjabloon","Delete template…":"Verwijder sjabloon…","Delete Template":"Verwijder sjabloon",Title:"Titel","Save as template":"Sla op als sjabloon","Save as Template":"Sla op als sjabloon","template-dialogs-create-warning":"Bijlagen en grote afbeeldingen zijn geen onderdeel van de sjabloon.","template-dialogs-delete-info":'Weet je zeker dat je het sjabloon "{TITLE}" wil verwijderen?\n\nDe originele notitie en notities die vanuit dit sjabloon aangemaakt worden, worden niet beïnvloed.'}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Avbryt",Save:"Lagre",Delete:"Slett",Undo:"Angre",Templates:"Maler","Search templates":"Søk etter maler","Created {DATE}":"Opprettet {DATE}",sample:"eksempel","No templates matched your search":"Ingen maler samsvarte med søket ditt","Clear search":"Slett søk","Can't find the template you need?":"Finner du ikke malen du trenger?","You haven't saved any templates.":"Du har ikke lagret noen maler.","Get inspired with these templates from Evernote:":"Bli inspirert av disse malene fra Evernote:","Browse sample templates":"Bla gjennom eksempelmaler","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Eller lagre dine egne notater som maler fra {OVERFLOW}-menyen øverst i notatet.","To create your own templates, upgrade your Evernote account today.":"For å opprette dine egne maler, <a>oppgrader Evernote-kontoen</a> i dag.","Creating template…":"Oppretter mal…","Template failed to save":"Kunne ikke lagre mal","Template created from note":"Mal opprettet fra notat","Template removed":"Mal fjernet","Template deleted":"Mal slettet","Template updated":"Mal oppdatert","Note created from template":"Notat opprettet fra mal","Unable to save. Check your connection and try again later":"Kunne ikke lagre. Sjekk forbindelsen og prøv på nytt senere","Unable to save this note's content as a template":"Kunne ikke lagre dette notatets innhold som en mal","You've reached the limit of 100 templates":"Du har nådd grensen på 100 maler","Apply template":"Bruk mal","Apply Template":"Bruk mal","Rename template":"Gi nytt navn til mal","Rename template…":"Gi nytt navn til mal…","Rename Template":"Gi nytt navn til mal","Delete template":"Slett mal","Delete template…":"Slett mal…","Delete Template":"Slett mal",Title:"Tittel","Save as template":"Lagre som mal","Save as Template":"Lagre som mal","template-dialogs-create-warning":"Vedlegg og store bilder blir ikke inkludert i malen.","template-dialogs-delete-info":"Er du sikker på at du vil slette malen “{TITLE}”?\n\nDet opprinnelige notatet og alle notater som er opprettet fra denne malen blir ikke påvirket."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Anuluj",Save:"Zapisz",Delete:"Usuń",Undo:"Cofnij",Templates:"Szablony","Search templates":"Znajdź szablon","Created {DATE}":"Data utworzenia: {DATE}",sample:"przykład","No templates matched your search":"Żadne szablony nie pasują do wyszukiwania","Clear search":"Wyczyść wyszukiwanie","Can't find the template you need?":"Nie możesz znaleźć potrzebnego szablonu?","You haven't saved any templates.":"Nie zapisano żadnych szablonów.","Get inspired with these templates from Evernote:":"Zainspiruj się tymi szablonami od Evernote:","Browse sample templates":"Zobacz przykładowe szablony","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Lub zapisz własne notatki jako szablony z menu {OVERFLOW} u góry notatki.","To create your own templates, upgrade your Evernote account today.":"Aby móc tworzyć własne szablony, <a>ulepsz konto Evernote</a> już dziś.","Creating template…":"Tworzenie szablonu...","Template failed to save":"Szablon nie został zapisany","Template created from note":"Utworzono szablon z notatki","Template removed":"Szablon został usunięty","Template deleted":"Szablon został usunięty","Template updated":"Szablon został zaktualizowany","Note created from template":"Utworzono notatkę z szablonu","Unable to save. Check your connection and try again later":"Nie udało się zapisać. Sprawdź połączenie i spróbuj ponownie później","Unable to save this note's content as a template":"Zawartości tej notatki nie udało się zapisać jako szablonu.","You've reached the limit of 100 templates":"Osiągnięto limit 100 szablonów","Apply template":"Zastosuj szablon","Apply Template":"Zastosuj szablon","Rename template":"Zmień nazwę szablonu","Rename template…":"Zmień nazwę szablonu…","Rename Template":"Zmień nazwę szablonu","Delete template":"Usuń szablon","Delete template…":"Usuń szablon…","Delete Template":"Usuń szablon",Title:"Tytuł","Save as template":"Zapisz jako szablon","Save as Template":"Zapisz jako szablon","template-dialogs-create-warning":"Załączniki i duże obrazy nie zostaną uwzględnione w szablonie.","template-dialogs-delete-info":"Czy na pewno chcesz usunąć szablon „{TITLE}”?\n\nNie wpłynie to na oryginalną notatkę i notatki utworzone w oparciu o ten szablon."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Cancelar",Save:"Salvar",Delete:"Excluir",Undo:"Desfazer",Templates:"Modelos","Search templates":"Pesquisar templates","Created {DATE}":"Criado em {DATE}",sample:"amostra","No templates matched your search":"Nenhum template corresponde à sua pesquisa","Clear search":"Limpar pesquisa","Can't find the template you need?":"Não conseguiu encontrar o template que precisa?","You haven't saved any templates.":"Você não salvou nenhum template.","Get inspired with these templates from Evernote:":"Inspire-se com estes templates da Evernote:","Browse sample templates":"Pesquise amostras de templates","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Ou salve suas próprias notas como templates no menu {OVERFLOW} no topo da nota.","To create your own templates, upgrade your Evernote account today.":"Para criar seus próprios templates, <a>faça upgrade da sua conta Evernote</a> hoje.","Creating template…":"Criando template...","Template failed to save":"Falha ao salvar template","Template created from note":"Template criado a partir de nota","Template removed":"Template removido","Template deleted":"Template excluído","Template updated":"Template atualizado","Note created from template":"Nota criada a partir de template","Unable to save. Check your connection and try again later":"Não foi possível salvar. Verifique sua conexão e tente novamente","Unable to save this note's content as a template":"Não foi possível salvar o conteúdo desta nota como template","You've reached the limit of 100 templates":"Você atingiu o limite de 100 templates","Apply template":"Aplicar template","Apply Template":"Aplicar Template","Rename template":"Renomear template","Rename template…":"Renomear template...","Rename Template":"Renomear Template","Delete template":"Excluir template","Delete template…":"Excluir template...","Delete Template":"Excluir Template",Title:"Título","Save as template":"Salvar como template","Save as Template":"Salvar como Template","template-dialogs-create-warning":"Anexos e imagens grandes não serão incluídos no template.","template-dialogs-delete-info":'Tem certeza que deseja excluir o template "{TITLE}"?\n\n\\n\\nA nota original e quaisquer notas criadas deste template não serão afetadas.'}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Cancelar",Save:"Guardar",Delete:"Eliminar",Undo:"Desfazer",Templates:"Modelos","Search templates":"Pesquisar modelos","Created {DATE}":"Criado em {DATE}",sample:"amostra","No templates matched your search":"Não foram encontrados modelos correspondentes na sua pesquisa","Clear search":"Limpar pesquisa","Can't find the template you need?":"Não conseguiu encontrar o modelo de que necessita?","You haven't saved any templates.":"Você não guardou nenhum modelo.","Get inspired with these templates from Evernote:":"Inspire-se com estes modelos do Evernote:","Browse sample templates":"Pesquise amostras de modelos","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Ou guarde as suas próprias notas como modelos no menu {OVERFLOW} existente no topo da nota.","To create your own templates, upgrade your Evernote account today.":"Para criar os seus próprios modelos, <a>faça hoje mesmo o upgrade da sua conta Evernote</a>.","Creating template…":"A criar modelo…","Template failed to save":"Ocorreu um erro ao tentar guardar o modelo","Template created from note":"Modelo criado a partir da nota","Template removed":"Modelo removido","Template deleted":"Modelo eliminado","Template updated":"Modelo atualizado","Note created from template":"Nota criada a partir do modelo","Unable to save. Check your connection and try again later":"Não foi possível guardar. Verifique a sua ligação e tente novamente mais tarde","Unable to save this note's content as a template":"Não é possível guardar o conteúdo desta nota como um modelo","You've reached the limit of 100 templates":"Você atingiu o limite de 100 modelos","Apply template":"Aplicar modelo","Apply Template":"Aplicar modelo","Rename template":"Renomear modelo","Rename template…":"Renomear modelo…","Rename Template":"Renomear modelo","Delete template":"Eliminar modelo","Delete template…":"Eliminar modelo…","Delete Template":"Eliminar modelo",Title:"Título","Save as template":"Guardar como modelo","Save as Template":"Guardar como modelo","template-dialogs-create-warning":"Os anexos e imagens grandes não serão incluídos no modelo.","template-dialogs-delete-info":"Tem certeza que deseja eliminar o modelo “{TITLE}”?\n\nA nota original e quaisquer notas criadas a partir deste modelo não serão afetadas."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Отмена",Save:"Сохранить",Delete:"Удалить",Undo:"Отмена",Templates:"Шаблоны","Search templates":"Поиск шаблонов","Created {DATE}":"Создан {DATE}",sample:"пример","No templates matched your search":"Поиск шаблонов не дал результатов","Clear search":"Очистить поиск","Can't find the template you need?":"Не можете найти нужный шаблон?","You haven't saved any templates.":"Нет сохраненных шаблонов","Get inspired with these templates from Evernote:":"Посмотрите примеры шаблонов из Evernote:","Browse sample templates":"Посмотрите примеры шаблонов","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Или сохранить собственные заметки в качестве шаблонов в меню {OVERFLOW} вверху заметки.","To create your own templates, upgrade your Evernote account today.":"Для создания собственных шаблонов <a>улучшите аккаунт Evernote</a> уже сегодня.","Creating template…":"Создание шаблона…","Template failed to save":"Ошибка при сохранении шаблона","Template created from note":"Шаблон создан из заметки","Template removed":"Шаблон удален","Template deleted":"Шаблон удален","Template updated":"Шаблон обновлен","Note created from template":"Заметка создана по шаблону","Unable to save. Check your connection and try again later":"Не удалось сохранить. Проверьте подключение и повторите попытку","Unable to save this note's content as a template":"Не удалось сохранить содержимое заметки как шаблон","You've reached the limit of 100 templates":"Вы достигли максимального количества шаблонов (100)","Apply template":"Применить шаблон","Apply Template":"Применить шаблон","Rename template":"Переименовать шаблон","Rename template…":"Переименование шаблона…","Rename Template":"Переименовать шаблон","Delete template":"Удалить шаблон","Delete template…":"Удаление шаблона…","Delete Template":"Удалить шаблон",Title:"Название","Save as template":"Сохранить шаблон","Save as Template":"Сохранить шаблон","template-dialogs-create-warning":"Вложенные файлы и большие изображения не сохранятся в шаблоне.","template-dialogs-delete-info":"Вы уверены, что хотите удалить шаблон “{TITLE}”?\n\nОригинал заметки и все заметки, созданные на основе шаблона, не будут затронуты."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Avbryt",Save:"Spara",Delete:"Ta bort",Undo:"Ångra",Templates:"Mallar","Search templates":"Sök efter mallar","Created {DATE}":"Skapat {DATE}",sample:"exempel","No templates matched your search":"Inga mallar matchade din sökning","Clear search":"Rensa sökning","Can't find the template you need?":"Kan du inte hitta mallen du behöver?","You haven't saved any templates.":"Du har inte sparat några mallar.","Get inspired with these templates from Evernote:":"Få inspiration med dessa mallar från Evernote:","Browse sample templates":"Bläddra bland exempel på mallar","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Eller spara dina egna anteckningar som mallar via menyn {OVERFLOW} högst upp i anteckningen.","To create your own templates, upgrade your Evernote account today.":"<a>Uppgradera ditt Evernote-konto</a> om du vill skapa egna mallar.","Creating template…":"Skapar mall…","Template failed to save":"Mallen kunde inte sparas","Template created from note":"Mall skapad av anteckning","Template removed":"Mall borttagen","Template deleted":"Mall raderad","Template updated":"Mall uppdaterad","Note created from template":"Anteckning skapad från mall","Unable to save. Check your connection and try again later":"Det gick inte att spara. Kontrollera din anslutning och försök igen senare","Unable to save this note's content as a template":"Det gick inte att spara anteckningens innehåll som en mall","You've reached the limit of 100 templates":"Du har nått gränsen på 100 mallar","Apply template":"Använd mall","Apply Template":"Använd mall","Rename template":"Byt namn på mall","Rename template…":"Byt namn på mall…","Rename Template":"Byt namn på mall","Delete template":"Radera mall","Delete template…":"Radera mall…","Delete Template":"Radera mall",Title:"Titel","Save as template":"Spara som mall","Save as Template":"Spara som mall","template-dialogs-create-warning":"Bilagor och stora bilder kommer inte att inkluderas i mallen.","template-dialogs-delete-info":"Är du säker på att du vill radera mallen {TITLE}?\n\nDen ursprungliga anteckningen och eventuella anteckningar som skapats med den här mallen påverkas inte."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"ยกเลิก",Save:"บันทึก",Delete:"ลบ",Undo:"เลิกทำ",Templates:"รูปแบบหลัก","Search templates":"ค้นหารูปแบบหลัก","Created {DATE}":"สร้างเมื่อ {DATE}",sample:"ตัวอย่าง","No templates matched your search":"ไม่มีรูปแบบหลักใดที่ตรงกับการค้นหาของคุณ","Clear search":"ล้างการค้นหา","Can't find the template you need?":"ไม่สามารถค้นหารูปแบบหลักที่คุณต้องการได้ใช่ไหม?","You haven't saved any templates.":"คุณไม่ได้บันทึกรูปแบบหลักใด ๆ ไว้","Get inspired with these templates from Evernote:":"สร้างแรงบันดาลใจด้วยรูปแบบหลักเหล่านี้จาก Evernote:","Browse sample templates":"เข้าดูรูปแบบหลักตัวอย่าง","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"หรือเซฟบันทึกของคุณเองให้เป็นรูปแบบหลักจากเมนู {OVERFLOW} ที่อยู่ด้านบนของบันทึก","To create your own templates, upgrade your Evernote account today.":"หากต้องการสร้างรูปแบบหลักของคุณเอง <a>อัพเกรดบัญชี Evernote ของคุณ</a> วันนี้","Creating template…":"กำลังสร้างรูปแบบหลัก…","Template failed to save":"ไม่สามารถบันทึกรูปแบบหลักได้","Template created from note":"รูปแบบหลักที่สร้างจากบันทึก","Template removed":"เอารูปแบบหลักออกแล้ว","Template deleted":"ลบรูปแบบหลักออกแล้ว","Template updated":"อัพเดตรูปแบบหลักแล้ว","Note created from template":"บันทึกที่สร้างจากรูปแบบหลัก","Unable to save. Check your connection and try again later":"ไม่สามารถบันทึกได้ โปรดตรวจสอบการเชื่อมต่อและลองใหม่อีกครั้ง","Unable to save this note's content as a template":"ไม่สามารถบันทึกเนื้อหาของบันทึกนี้ให้เป็นรูปแบบหลักได้","You've reached the limit of 100 templates":"คุณถึงขีดจำกัดของ 100 รูปแบบหลักแล้ว","Apply template":"ใช้รูปแบบหลัก","Apply Template":"ใช้รูปแบบหลัก","Rename template":"ตั้งชื่อใหม่ให้รูปแบบหลัก","Rename template…":"ตั้งชื่อใหม่ให้รูปแบบหลัก…","Rename Template":"ตั้งชื่อใหม่ให้รูปแบบหลัก","Delete template":"ลบรูปแบบหลัก","Delete template…":"ลบรูปแบบหลัก…","Delete Template":"ลบรูปแบบหลัก",Title:"ชื่อเรื่อง","Save as template":"บันทึกเป็นรูปแบบหลัก","Save as Template":"บันทึกเป็นรูปแบบหลัก","template-dialogs-create-warning":"ไฟล์แนบและรูปภาพขนาดใหญ่จะไม่ถูกรวมอยู่ในรูปแบบหลัก","template-dialogs-delete-info":"คุณแน่ใจหรือว่าต้องการลบรูปแบบหลัก “{TITLE}”?\n\nส่วนบันทึกต้นฉบับและบันทึกอื่น ๆ ที่สร้างจากรูปแบบหลักนี้ไม่ได้มีผลกระทบแต่อย่างใด"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"İptal",Save:"Kaydet",Delete:"Sil",Undo:"Geri al",Templates:"Şablonlar","Search templates":"Şablon ara","Created {DATE}":"{DATE} tarihinde oluşturuldu",sample:"örnek","No templates matched your search":"Aramanızla eşleşen şablon yok","Clear search":"Aramayı temizle","Can't find the template you need?":"İhtiyaç duyduğunuz şablonu bulamıyor musunuz?","You haven't saved any templates.":"Herhangi bir şablon kaydetmediniz.","Get inspired with these templates from Evernote:":"Evernote'un bu şablonlarından ilham alın:","Browse sample templates":"Örnek şablonlara göz atın","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Veya notun üst kısmındaki {OVERFLOW} menüsünden kendi notlarınızı şablon olarak kaydedin.","To create your own templates, upgrade your Evernote account today.":"Kendi şablonlarınızı oluşturmak için hemen <a>Evernote hesabınızı yükseltin</a>.","Creating template…":"Şablon oluşturuluyor...","Template failed to save":"Şablon kaydedilemedi","Template created from note":"Nottan şablon oluşturuldu","Template removed":"Şablon kaldırıldı","Template deleted":"Şablon silindi","Template updated":"Şablon güncellendi","Note created from template":"Şablondan not oluşturuldu","Unable to save. Check your connection and try again later":"Kaydedilemiyor. İnternet bağlantınızı kontrol edip, daha sonra yeniden deneyin","Unable to save this note's content as a template":"Bu notun içeriği şablon olarak kaydedilemiyor","You've reached the limit of 100 templates":"100 şablon sınırına ulaştınız","Apply template":"Şablonu uygula","Apply Template":"Şablonu Uygula","Rename template":"Şablonu yeniden adlandır","Rename template…":"Şablonu yeniden adlandır…","Rename Template":"Şablonu Yeniden Adlandır","Delete template":"Şablonu sil","Delete template…":"Şablonu sil…","Delete Template":"Şablonu Sil",Title:"Başlık","Save as template":"Şablon olarak kaydet","Save as Template":"Şablon Olarak Kaydet","template-dialogs-create-warning":"Ekler ve büyük resimler şablona dahil edilmez.","template-dialogs-delete-info":'"{TITLE}" adlı şablonu silmek istediğinizden emin misiniz?\n\nOrijinal not ve bu şablondan oluşturulan notlar etkilenmeyecek.'}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Скасувати",Save:"Зберегти",Delete:"Видалити",Undo:"Скасувати",Templates:"Шаблони","Search templates":"Шукати шаблони","Created {DATE}":"Створено {DATE}",sample:"зразок","No templates matched your search":"Не знайдено шаблонів, які б відповідали пошуковому запиту","Clear search":"Очистити пошук","Can't find the template you need?":"Не можете знайти потрібний шаблон?","You haven't saved any templates.":"Ви не зберегли жодного шаблону.","Get inspired with these templates from Evernote:":"Ось вам приклади шаблонів від Evernote:","Browse sample templates":"Переглянути зразки шаблонів","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Або збережіть свою нотатку як шаблон у меню {OVERFLOW}, що у верхній частині нотатки.","To create your own templates, upgrade your Evernote account today.":"Щоб створювати власні шаблони, перейдіть на <a>вищий тарифний план Evernote</a>.","Creating template…":"Створення шаблону…","Template failed to save":"Не вдалося зберегти шаблон","Template created from note":"Шаблон з нотатки створено","Template removed":"Шаблон вилучено","Template deleted":"Шаблон видалено","Template updated":"Шаблон оновлено","Note created from template":"Нотатку з шаблону створено","Unable to save. Check your connection and try again later":"Не вдалося зберегти. Перевірте підключення та повторіть спробу пізніше","Unable to save this note's content as a template":"Не вдалося зберегти вміст цієї нотатки як шаблон","You've reached the limit of 100 templates":"Досягнуто обмеження у 100 шаблонів","Apply template":"Застосувати шаблон","Apply Template":"Застосувати шаблон","Rename template":"Перейменувати шаблон","Rename template…":"Перейменувати шаблон…","Rename Template":"Перейменувати шаблон","Delete template":"Видалити шаблон","Delete template…":"Видалити шаблон…","Delete Template":"Видалити шаблон",Title:"Заголовок","Save as template":"Зберегти як шаблон","Save as Template":"Зберегти як шаблон","template-dialogs-create-warning":"Вкладення та великі зображення не буде додано до шаблону.","template-dialogs-delete-info":"Справді видалити шаблон «{TITLE}»?\n\nЦя дія не позначиться на оригіналі нотатки та на будь-якій нотатці, створеній із цього шаблону."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"Hủy",Save:"Lưu",Delete:"Xóa",Undo:"Hoàn tác",Templates:"Mẫu","Search templates":"Tìm mẫu","Created {DATE}":"Đã tạo vào {DATE}",sample:"mẫu","No templates matched your search":"Không có mẫu nào phù hợp với lệnh tìm kiếm của bạn","Clear search":"Xóa tìm kiếm","Can't find the template you need?":"Không thể tìm thấy mẫu bạn cần?","You haven't saved any templates.":"Bạn chưa lưu mẫu nào.","Get inspired with these templates from Evernote:":"Có thêm cảm hứng bằng những mẫu này của Evernote:","Browse sample templates":"Duyệt qua các mẫu chọn lọc","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"Hoặc tự lưu ghi chú của bạn thành mẫu trong menu {OVERFLOW} ở phía trên cùng của ghi chú.","To create your own templates, upgrade your Evernote account today.":"Để tự tạo mẫu, hãy <a>nâng cấp tài khoản Evernote của bạn</a> hôm nay.","Creating template…":"Đang tạo mẫu...","Template failed to save":"Không thể lưu mẫu","Template created from note":"Đã tạo mẫu từ ghi chú","Template removed":"Đã xóa mẫu","Template deleted":"Đã xóa mẫu","Template updated":"Đã cập nhật mẫu","Note created from template":"Đã tạo ghi chú từ mẫu","Unable to save. Check your connection and try again later":"Không thể lưu. Hãy kiểm tra kết nối của bạn và thử lại","Unable to save this note's content as a template":"Không thể lưu nội dung của ghi chú này dưới dạng mẫu","You've reached the limit of 100 templates":"You've reached the limit of 100 templates","Apply template":"Áp dụng mẫu","Apply Template":"Áp dụng mẫu","Rename template":"Đổi tên mẫu","Rename template…":"Đổi tên mẫu…","Rename Template":"Đổi tên mẫu","Delete template":"Xóa mẫu","Delete template…":"Xóa mẫu…","Delete Template":"Xóa mẫu",Title:"Tiêu đề","Save as template":"Lưu thành mẫu","Save as Template":"Lưu thành mẫu","template-dialogs-create-warning":"Không thể đưa tệp đính kèm và hình ảnh cỡ lớn vào mẫu.","template-dialogs-delete-info":"Bạn có chắc bạn muốn xóa mẫu “{TITLE}”?\n\nGhi chú ban đầu và mọi ghi chú tạo từ mẫu này sẽ không bị ảnh hưởng."}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"取消",Save:"保存",Delete:"删除",Undo:"撤销",Templates:"模版","Search templates":"搜索模板","Created {DATE}":"已创建 {DATE}",sample:"样例","No templates matched your search":"未找到符合搜索条件的模板","Clear search":"清除搜索","Can't find the template you need?":"无法找到你需要的模板？","You haven't saved any templates.":"尚未保存任何模板。","Get inspired with these templates from Evernote:":"通过 Evernote 的这些模板获得灵感：","Browse sample templates":"浏览示例模板","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"或者通过笔记顶部的 {OVERFLOW} 菜单将自己的笔记保存为模板。","To create your own templates, upgrade your Evernote account today.":"如需创建自己的模板，请立即<a>升级你的 Evernote 帐户</a>。","Creating template…":"正在创建模板…","Template failed to save":"模板保存失败","Template created from note":"已通过笔记创建模板","Template removed":"已移除模板","Template deleted":"已删除模板","Template updated":"已更新模板","Note created from template":"已通过模板创建笔记","Unable to save. Check your connection and try again later":"无法保存。请检查你的网络连接并稍后重试","Unable to save this note's content as a template":"无法将此笔记的内容保存为模板","You've reached the limit of 100 templates":"你已达到 100 个模板的上限","Apply template":"应用模板","Apply Template":"应用模板","Rename template":"重命名模板","Rename template…":"重命名模板…","Rename Template":"重命名模板","Delete template":"删除模板","Delete template…":"删除模板…","Delete Template":"删除模板",Title:"标题","Save as template":"保存为模板","Save as Template":"保存为模板","template-dialogs-create-warning":"模板中将不包含附件和大图片。","template-dialogs-delete-info":"确定要删除模板“{TITLE}”吗?\n\n原始笔记以及通过此模板创建的任何笔记均不会受到影响。"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"取消",Save:"儲存",Delete:"刪除",Undo:"復原",Templates:"範本","Search templates":"搜尋範本","Created {DATE}":"建立日期：{DATE}",sample:"範例","No templates matched your search":"無符合您的搜尋的範本","Clear search":"清除搜尋","Can't find the template you need?":"找不到您要的範本嗎？","You haven't saved any templates.":"您尚未儲存任何範本。","Get inspired with these templates from Evernote:":"參考 Evernote 範本，獲得靈感：","Browse sample templates":"瀏覽範例範本","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"或利用記事頂端的 {OVERFLOW} 選單將您自己的記事存為範本。","To create your own templates, upgrade your Evernote account today.":"如要建立您自己的範本，請<a>立刻升級 Evernote</a>。","Creating template…":"範本建立中...","Template failed to save":"範本儲存失敗","Template created from note":"使用記事建立的範本","Template removed":"範本已移除","Template deleted":"範本已刪除","Template updated":"範本已更新","Note created from template":"已用範本建立新記事","Unable to save. Check your connection and try again later":"無法儲存。請檢查網路連線後，再試一次。","Unable to save this note's content as a template":"無法將此記事內容存為範本","You've reached the limit of 100 templates":"您已達到 100 則範本的限制。","Apply template":"套用範本","Apply Template":"套用範本","Rename template":"重新命名範本","Rename template…":"重新命名範本…","Rename Template":"重新命名範本","Delete template":"刪除範本","Delete template…":"刪除範本…","Delete Template":"刪除範本",Title:"標題","Save as template":"儲存為範本","Save as Template":"儲存為範本","template-dialogs-create-warning":"附檔和大型圖片不會被包含在範本中。","template-dialogs-delete-info":"確定要刪除範本 “{TITLE}” 嗎？\n\n原始記事和任何使用這個範本建立的記事都不會受到任何影響。"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={Cancel:"[Cancel xxxxx]",Save:"[Save xxx]",Delete:"[Delete xxxxx]",Undo:"[Undo xxx]",Templates:"[Templates xxxxxxxx]","Search templates":"[Search templates xxxxxxxxxx]","Created {DATE}":"[Created {DATE} xxxxxxxx]",sample:"[sample xxxxx]","No templates matched your search":"[No templates matched your search xxxxxxxxxx xxxx]","Clear search":"[Clear search xxxxxxx]","Can't find the template you need?":"[Can't find the template you need? xxxxxxxxxx xxxx]","You haven't saved any templates.":"[You haven’t saved any templates. xxxxxxxxxx xxxx]","Get inspired with these templates from Evernote:":"[Get inspired with these templates from Evernote: xxxxxxxxxx xxxxxxxxxx x]","Browse sample templates":"[Browse sample templates xxxxxxxxxx]","Or save your own notes as templates from the {OVERFLOW} menu at the top of the note.":"[Or save your own notes as templates from the {OVERFLOW} menu at the top of the note. xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxx]","To create your own templates, upgrade your Evernote account today.":"[To create your own templates, <a>upgrade your Evernote account</a> today. xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xx]","Creating template…":"[Creating template… xxxxxxxxxx ]","Template failed to save":"[Template failed to save xxxxxxxxxx]","Template created from note":"[Template created from note xxxxxxxxxx x]","Template removed":"[Template removed xxxxxxxxxx]","Template deleted":"[Template deleted xxxxxxxxxx]","Template updated":"[Template updated xxxxxxxxxx]","Note created from template":"[Note created from template xxxxxxxxxx x]","Unable to save. Check your connection and try again later":"[Unable to save. Check your connection and try again later xxxxxxxxxx xxxxxxxxxx xxxxx]","Unable to save this note's content as a template":"[Unable to save this note's content as a template xxxxxxxxxx xxxxxxxxxx x]","You've reached the limit of 100 templates":"[You've reached the limit of 100 templates xxxxxxxxxx xxxxxxxx]","Apply template":"[Apply template xxxxxxxx]","Apply Template":"[Apply Template xxxxxxxx]","Rename template":"[Rename template xxxxxxxxx]","Rename template…":"[Rename template… xxxxxxxxxx]","Rename Template":"[Rename Template xxxxxxxxx]","Delete template":"[Delete template xxxxxxxxx]","Delete template…":"[Delete template… xxxxxxxxxx]","Delete Template":"[Delete Template xxxxxxxxx]",Title:"[Title xxxx]","Save as template":"[Save as template xxxxxxxxxx]","Save as Template":"[Save as Template xxxxxxxxxx]","template-dialogs-create-warning":"[Attachments and large images will not be included in the template. xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx]","template-dialogs-delete-info":"[Are you sure you want to delete the template “{TITLE}”?\n\nThe original note and any notes created from this template will not be affected. xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx x]"}},function(e,t,n){"use strict";function a(){return{contentPadding:{paddingTop:"0",paddingRight:"0",paddingBottom:"0",paddingLeft:"0"},appMargin:{top:"0",right:"0",bottom:"0",left:"0"}}}function o(e,t){var n=void 0;switch(void 0===e?"undefined":i(e)){case"number":n=e+t;break;case"string":n=e.indexOf(t)>-1?e:e+t;break;case"undefined":n=void 0;break;default:n=e}return n}function r(e){if(!e)return!1;var t=e.note||{},n={paddingTop:o(t.top||0,"px"),paddingRight:o(t.right||0,"px"),paddingBottom:o(t.bottom||0,"px"),paddingLeft:o(t.left||0,"px")},a=e.scroll||{},r={top:a.top||0,right:a.right||0,bottom:a.bottom||0,left:a.left||0},i=e.offset||{};isNaN(i.height)||(r.bottom+=parseFloat(i.height)),isNaN(i.width)||(r.right+=parseFloat(i.height));var l=0-r.top-r.bottom;return r.top=o(r.top,"px"),r.right=o(r.right,"px"),r.bottom=o(r.bottom,"px"),r.left=o(r.left,"px"),{contentPadding:n,appMargin:r,appHeightOffset:l}}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.getDefaultMargin=a,t.processMargin=r},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=n(38),l=a(i),s=n(7),u=a(s),c=n(158),d=a(c),p=function(){function e(){var t=this;o(this,e),this.appType="background",this.log=u.default.getLogger("platformcapabilitiesapp"),this.runCommands=["platform-use"],this.queries=["platform-version-for"],this.execCommands=[],this.config={platform:!0},Object.keys(d.default).forEach(function(e){t.execCommands.push(d.default[e].execCommand)}),this.notify=this.notifyAsync=this.trigger=function(){},this.capabilityVersions={},this.pendingCallbacks={}}return r(e,[{key:"use",value:function(e,t,n){var a=(0,l.default)();return this.pendingCallbacks[a]=n,t=t||{},t.correlationId=a,this.notify(d.default[e].notification,t),!0}},{key:"resolveInteraction",value:function(e,t){return void 0!==this.pendingCallbacks[e]&&("function"==typeof this.pendingCallbacks[e]&&this.pendingCallbacks[e](t),delete this.pendingCallbacks[e],!0)}},{key:"versionFor",value:function(e){return this.capabilityVersions[e]}},{key:"cleanup",value:function(){return this.capabilityVersions={},this.pendingCallbacks={},!0}},{key:"activate",value:function(){return!1}},{key:"deactivate",value:function(){return!1}},{key:"init",value:function(e){this.notify=e.notify,this.notifyAsync=e.notifyAsync,this.trigger=e.trigger}},{key:"setup",value:function(e){var t=this;try{var n=e.platform||{};return Object.keys(d.default).forEach(function(e){-1!==d.default[e].versions.indexOf(n[e])?t.capabilityVersions[e]=n[e]:t.capabilityVersions[e]=null}),!0}catch(e){this.log.error("app setup failed",e)}return!1}},{key:"execCommand",value:function(e,t){if(Object.keys(d.default).find(function(t){return e===d.default[t].execCommand})){t=t||{};var n=t.correlationId;return this.resolveInteraction(n,t)}return!1}},{key:"run",value:function(e,t){return"platform-use"===e&&this.use(t.type,t.payload,t.callback)}},{key:"query",value:function(e,t){return"platform-version-for"===e?this.versionFor(t):Promise.reject("unknown query "+e)}}]),e}();t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={confirmAlert:{versions:["1"],notification:"showConfirmAlert",execCommand:"resolveConfirmAlert"},optionsPopup:{versions:["1"],notification:"showOptionsPopup",execCommand:"resolveOptionsPopup"},formDialog:{versions:["1"],notification:"showFormDialog",execCommand:"resolveFormDialog"},actionNotification:{versions:["1"],notification:"showActionNotification",execCommand:"resolveActionNotification"}}},function(e,t,n){var a,o;!function(r,i){a=i,void 0!==(o="function"==typeof a?a.call(t,n,t,e):a)&&(e.exports=o)}(0,function(e){"use strict";var t,n,a=function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(t in arguments[n])Object.prototype.hasOwnProperty.call(arguments[n],t)&&(e[t]=arguments[n][t]);return e},o={template:"[%t] %l:",levelFormatter:function(e){return e.toUpperCase()},nameFormatter:function(e){return e||"root"},timestampFormatter:function(e){return e.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1")},format:void 0},r={},i=function(e){if(!e||!e.getLogger)throw new TypeError("Argument is not a root logger");t=e},l=function(e,n){function i(e,t,n){var a=l(e,t,n),o=r[n]||r[""],i=-1!==o.template.indexOf("%t"),u=-1!==o.template.indexOf("%l"),c=-1!==o.template.indexOf("%n");return function(){for(var t="",l=arguments.length,d=Array(l),p=0;p<l;p++)d[p]=arguments[p];if(s||!r[n]){var f=o.timestampFormatter(new Date),m=o.levelFormatter(e),h=o.nameFormatter(n);o.format?t+=o.format(m,h,f):(t+=o.template,i&&(t=t.replace(/%t/,f)),u&&(t=t.replace(/%l/,m)),c&&(t=t.replace(/%n/,h))),d.length&&"string"==typeof d[0]?d[0]=t+" "+d[0]:d.unshift(t)}a.apply(void 0,d)}}if(!e||!e.setLevel)throw new TypeError("Argument is not a logger");var l=e.methodFactory,s=e.name||"",u=r[s]||r[""]||o;return r[s]||(e.methodFactory=i),n=n||{},n.template&&(n.format=void 0),r[s]=a({},u,n),e.setLevel(e.getLevel()),t||e.warn("It is necessary to call the function reg() of loglevel-plugin-prefix before calling apply. From the next release, it will throw an error. See more: https://github.com/kutuluk/loglevel-plugin-prefix/blob/master/README.md"),e},s={reg:i,apply:l};return e&&(n=e.prefix,s.noConflict=function(){return e.prefix===s&&(e.prefix=n),s}),s})},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var o=function(){function e(e,t){var n=[],a=!0,o=!1,r=void 0;try{for(var i,l=e[Symbol.iterator]();!(a=(i=l.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(e){o=!0,r=e}finally{try{!a&&l.return&&l.return()}finally{if(o)throw r}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},i=n(0),l=a(i),s=n(10),u=n(161),c=a(u),d=n(189),p=a(d),f=n(197),m=a(f),h=n(206),v=a(h),g=n(219),y=n(234),b=a(y),x=n(248),_=a(x),k=n(252),w=a(k),C=n(259),E=null;window.reactRender=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};E||(E=document.createElement("en-components"),document.body.appendChild(E)),(0,s.render)([e.comments&&l.default.createElement(c.default,r({key:"comments"},e.comments)),e.preview&&l.default.createElement(p.default,r({key:"preview"},e.preview)),e.statusbar&&l.default.createElement(m.default,r({key:"realtime"},e.statusbar)),e.aisuggest&&l.default.createElement(v.default,r({key:"aisuggest"},e.aisuggest)),e.popoverMenu&&l.default.createElement(b.default,r({key:"popoverMenu"},e.popoverMenu)),e.placeholder&&l.default.createElement(_.default,r({key:"placeholder"},e.placeholder)),e.templateDialog&&l.default.createElement(w.default,r({key:"templateDialog"},e.templateDialog)),l.default.createElement(g.MenuContainer,{key:"menu"}),l.default.createElement(C.ToastContainer,{key:"toast"})],E)},window.reactInvoke=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];if("string"!=typeof e)return null;var r=e.split("."),i=o(r,2),l=i[0],s=i[1];switch(l){case"toast":return C.toast.call.apply(C.toast,[null].concat(n));case"menu":if(s){if("function"!=typeof g.menu[s])return null;var u;return(u=g.menu[s]).call.apply(u,[null].concat(n))}return g.menu.call.apply(g.menu,[null].concat(n));default:return null}}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),c=a(u),d=n(12),p=a(d),f=n(6),m=a(f),h=n(165),v=a(h),g=n(39),y=a(g),b=n(1),x=n(188),_=a(x),k=n(20),w=a(k),C=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={offsets:{}},n.heights={},n.paddingBottom=0,n.lastActiveId=null,n.lastActiveIndex=-1,n.pendingLayout=!0,n.batchedLayout=!0,n.handleHeightChange=n.handleHeightChange.bind(n),n.handleInsert=n.handleInsert.bind(n),n}return i(t,e),s(t,[{key:"getChildContext",value:function(){return{findMentions:this.props.findMentions}}},{key:"layout",value:function(){var e=this.props,t=e.threads,n=e.collapsed,a=e.compact,o=e.field,r={},i=null,l=null,s=null,u=null,c=null,d=t.findIndex(function(e){return!0===e.active});-1===d&&this.lastActiveIndex>-1&&t.length>0&&(d=Math.min(this.lastActiveIndex,t.length-1)),this.lastActiveIndex=d,d>-1?(i=t[d],s=i.y-12,c=s-(i.active?12:4),u=s+this.heights[i.id]+4,r[i.id]=s,this.lastActiveId=i.id):this.lastActiveId=null;for(var p=d-1;p>=0;p--)i=t[p],l=a||n?26:this.heights[i.id],s=Math.min(i.y-12,c-l),c=s-4,r[i.id]=s;for(var f=d+1;f<t.length;f++)i=t[f],l=a||n?26:this.heights[i.id],s=Math.max(i.y-12,u),u=s+l+4,r[i.id]=s;var m=Math.max(o.scrollHeight-this.paddingBottom,window.innerHeight),h=Math.max(0,u+64-m);h!==this.paddingBottom&&(this.paddingBottom=h,o.style.paddingBottom=h?64+this.paddingBottom+"px":""),this.needsLayout=!1,this.setState({offsets:r})}},{key:"handleHeightChange",value:function(e){var t=e.height,n=e.id,a=this.heights[n]!==t,o=this.lastActiveId!==n;this.heights[n]=t,(a||o)&&(this.batchedLayout?this.needsLayout=!0:this.layout())}},{key:"handleInsert",value:function(e){e.preventDefault(),EN.execCommand("comment")}},{key:"componentWillUpdate",value:function(){this.batchedLayout=!0}},{key:"componentDidUpdate",value:function(e){e.collapsed!==this.props.collapsed&&(this.lastActiveId=null,this.lastActiveIndex=-1),(this.needsLayout||e.threads!==this.props.threads)&&this.layout(),this.batchedLayout=!1}},{key:"componentDidMount",value:function(){this.layout(),this.batchedLayout=!1}},{key:"componentWillUnmount",value:function(){0!==this.paddingBottom&&this.props.field&&(this.props.field.style.paddingBottom="")}},{key:"render",value:function(){var e=this,t=this.props,n=t.threads,a=t.user,o=t.collapsed,r=t.compact,i=t.readonly,s=t.focusY,u=t.archive,d=this.state.offsets,p=s?s-4:0,f=0===n.length?12:o||r?52:260,h=(0,b.css)("commentscontainer",w.default.comments);return c.default.createElement("div",{className:h},!!s&&c.default.createElement("button",{className:w.default.adder,style:{top:p,right:f},onMouseDown:this.handleInsert},c.default.createElement(m.default,{svg:_.default})),n.map(function(t){return c.default.createElement(y.default,l({},t,{key:t.id,user:a,collapsed:o,compact:!t.active&&r,top:d[t.id]||t.y,updateHeight:e.handleHeightChange,readonly:i,floating:!0}))}),u&&c.default.createElement(v.default,l({},u,{user:a})))}}]),t}(u.PureComponent);t.default=C,C.childContextTypes={findMentions:p.default.func}},function(e,t,n){"use strict";var a=n(21),o=n(163),r=n(164);e.exports=function(){function e(e,t,n,a,i,l){l!==r&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=a,n.PropTypes=n,n}},function(e,t,n){"use strict";function a(e,t,n,a,r,i,l,s){if(o(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,a,r,i,l,s],d=0;u=new Error(t.replace(/%s/g,function(){return c[d++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}var o=function(e){};e.exports=a},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),c=a(u),d=n(10),p=n(6),f=a(p),m=n(39),h=a(m),v=(n(1),n(184)),g=a(v),y=n(185),b=a(y),x=n(186),_=a(x),k=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.container=document.createElement("div"),n.handleClose=n.handleClose.bind(n),n}return i(t,e),s(t,[{key:"handleClose",value:function(e){e.target===this.overlayRef&&this.props.close()}},{key:"componentDidMount",value:function(){document.body.appendChild(this.container)}},{key:"componentWillUnmount",value:function(){document.body.removeChild(this.container)}},{key:"render",value:function(){var e=this,t=this.props,n=(t.handleClose,t.threads),a=t.user,o=t.title,r=t.close;return(0,d.createPortal)(c.default.createElement("div",{className:_.default.overlay,onClick:this.handleClose,ref:function(t){e.overlayRef=t}},c.default.createElement("div",{className:_.default.archive},c.default.createElement("div",{className:_.default.header},c.default.createElement("div",{className:_.default.wrapper},c.default.createElement("h1",null,"Comment archive"),c.default.createElement("h2",null,c.default.createElement(f.default,{svg:b.default}),o)),c.default.createElement("button",{className:_.default.btnClose,onClick:r},c.default.createElement(f.default,{svg:g.default}))),c.default.createElement("div",{className:_.default.content},n.map(function(e){return c.default.createElement(h.default,l({},e,{top:e.y,key:e.id,user:a,archive:!0}))})))),this.container)}}]),t}(u.PureComponent);t.default=k},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n={};for(var a in e)t.indexOf(a)>=0||Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=e[a]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),c=a(u),d=n(6),p=a(d),f=n(9),m=a(f),h=n(170),v=a(h),g=n(1),y=n(182),b=a(y),x=n(20),_=a(x),k=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleOptClick=n.handleOptClick.bind(n),n}return l(t,e),s(t,[{key:"handleOptClick",value:function(e){var t=e.target,n=t.getBoundingClientRect();e.stopPropagation(),EN.execCommand("comment",{action:"menu",threadId:this.props.threadId,id:this.props.id,x:n.left+n.width,y:n.top+n.height})}},{key:"render",value:function(){var e=this.props,t=e.name,n=e.initial,a=e.photoUrl,r=e.updated,i=e.editable,l=e.color,s=o(e,["name","initial","photoUrl","updated","editable","color"]),u=s.editing,d=s.creating,f=(0,g.css)(_.default.comment,u&&_.default.edit,d&&_.default.new);return c.default.createElement("div",{className:f},c.default.createElement(m.default,{className:_.default.avatar,initial:n,color:l,photoUrl:a}),!u&&!d&&c.default.createElement("div",{key:"header",className:_.default.header},c.default.createElement("div",{className:_.default.name},t),c.default.createElement("div",{className:_.default.time},(0,g.humanize)(r)),i&&c.default.createElement("button",{className:_.default.options,onClick:this.handleOptClick},c.default.createElement(p.default,{svg:b.default}))),c.default.createElement(v.default,s))}}]),t}(u.PureComponent);t.default=k},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){return"mac"===ed.config.client};t.platformPhotoUrl=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return a()&&ed.config&&ed.config.user.userID?e.replace(/^http?s:\/\/([^\/]+)\/(.*)\/?$/,function(e,t,n){return"enavatar://"+t+"/"+t.replace(/\./g,"")+"/"+ed.config.user.userID+"/"+n+"/3"}):e}},function(e,t,n){var a=n(169);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._22Mq6{width:26px;height:26px;background-color:#aaa;border-radius:50%;overflow:hidden;position:relative;z-index:10;pointer-events:none}._22Mq6:after{content:attr(data-initial);position:absolute;font-size:11px;color:#fff;top:6px;left:0;width:100%;text-align:center}._22Mq6 ._1Sakq{width:100%;height:100%;position:relative;z-index:1;background-size:cover;background-repeat:no-repeat}._3Khuu{-webkit-flex:0 0 auto;flex:0 0 auto;display:-webkit-flex;display:flex;-webkit-flex-direction:row-reverse;flex-direction:row-reverse}._1l4ga{-webkit-flex:0 0 auto;flex:0 0 auto;position:relative;width:24px;height:30px}._1l4ga ._22Mq6{top:0;right:0;position:absolute;width:30px;height:30px;border:2px solid #fff;pointer-events:auto}._1l4ga ._22Mq6:after{left:1px}._1l4ga:last-child{width:30px}._1l4ga:last-child ._22Mq6:after{left:0}",""]),t.locals={avatar:"_22Mq6",photo:"_1Sakq",group:"_3Khuu",wrapper:"_1l4ga"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),c=a(u),d=n(12),p=a(d),f=n(9),m=(a(f),n(171)),h=a(m),v=n(174),g=a(v),y=n(13),b=a(y),x=n(41),_=a(x),k=n(1),w=n(20),C=a(w),E=function(e){function t(e,n){o(this,t);var a=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return a.editingStarted=e.editing||e.creating&&e.initiater,a.content=new h.default(e.text,n.findMentions,C.default),a.state={editText:a.editingStarted?e.text:"",suggestions:null,tooltip:null},a.handleMouseOver=a.handleMouseOver.bind(a),a.handleMouseOut=a.handleMouseOut.bind(a),a.handleMouseDown=a.handleMouseDown.bind(a),a.handleMentionChange=a.handleMentionChange.bind(a),a.handleBlur=a.handleBlur.bind(a),a.handleChange=a.handleChange.bind(a),a.handleSelectionChange=a.handleSelectionChange.bind(a),a.handleKeyDown=a.handleKeyDown.bind(a),a.handleCancel=a.handleCancel.bind(a),a.handleSubmit=a.handleSubmit.bind(a),a}return i(t,e),s(t,[{key:"resizeAndFocusIfNeeded",value:function(){var e=this;(this.editingStarted||this.props.creating)&&this.textareaRef&&T(this.textareaRef),this.editingStarted&&this.textareaRef&&(setTimeout(function(){e.textareaRef&&e.textareaRef.focus()},310),this.editingStarted=!1)}},{key:"selectMention",value:function(e){var t=this.state.suggestions;this.textareaRef&&t&&t.users[e]&&(this.content.setSuggestion(this.textareaRef,t.users[e].username),T(this.textareaRef),this.setState({editText:this.textareaRef.value,suggestions:null}))}},{key:"setChangeWithSuggestions",value:function(e){var t=this.content.getSuggestions(),n=t.length?{users:t,selectedIndex:0,rect:this.content.getMentionRect(this.measureRef,e.getBoundingClientRect().left-59)}:null;this.setState({editText:e.value,suggestions:n,tooltip:null})}},{key:"handleMouseOver",value:function(e){var t=e.target;if(t.dataset&&t.dataset.username){var n={};Object.keys(t.dataset).forEach(function(e){n[e]=t.dataset[e]}),this.setState({tooltip:c.default.createElement(_.default,{rect:(0,k.rect)(t),user:n})})}else if(t.dataset&&t.dataset.tokenStart&&!this.state.suggestions){var a="Several matches for "+t.textContent;this.setState({tooltip:c.default.createElement(b.default,{rect:(0,k.rect)(t)},a)})}}},{key:"handleMouseOut",value:function(){this.state.tooltip&&this.setState({tooltip:null})}},{key:"handleMouseDown",value:function(e){var t=e.target;if(t&&t.dataset&&t.dataset.tokenStart){e.preventDefault();var n=parseInt(t.dataset.tokenStart,10);!isNaN(n)&&this.textareaRef.value.length>=n&&(this.textareaRef.setSelectionRange(n,n),this.setState({tooltip:null}))}}},{key:"handleMentionChange",value:function(e){this.setState({suggestions:l({},this.state.suggestions,{selectedIndex:e})})}},{key:"handleBlur",value:function(){this.setState({suggestions:null})}},{key:"handleChange",value:function(e){var t=e.target;this.content.applyChange(t),T(t),this.setChangeWithSuggestions(t)}},{key:"handleSelectionChange",value:function(){var e=this.textareaRef;e&&document.activeElement===e&&this.content.applySelection(e)&&this.setChangeWithSuggestions(e)}},{key:"handleKeyDown",value:function(e){var t=this.state.suggestions,n=e.keyCode,a=e.metaKey,o=e.ctrlKey;8===n||46===n?this.content.allowDelete(e.target,46===n)||e.preventDefault():t?9===n||13===n?(e.preventDefault(),this.selectMention(t.selectedIndex)):38===n?(e.preventDefault(),t.selectedIndex>0&&this.setState({suggestions:l({},t,{selectedIndex:t.selectedIndex-1})})):40===n&&(e.preventDefault(),t.users.length-1>t.selectedIndex&&this.setState({suggestions:l({},t,{selectedIndex:t.selectedIndex+1})})):(a||o)&&13===n&&(e.preventDefault(),this.handleSubmit())}},{key:"handleCancel",value:function(e){var t=this.props,n=(t.creating,t.editing),a=t.initiater,o=t.id;t.threadId;n?EN.execCommand("comment",{action:"canceledit",id:o}):a?EN.execCommand("comment",{action:"highlight"}):(this.editingStarted=!0,this.content.clear(),this.setState({editText:"",suggestions:null}))}},{key:"handleSubmit",value:function(){var e=this.props,t=e.creating,n=e.editing,a=e.id,o=e.threadId,r=this.content.getRichText();n&&r?EN.execCommand("comment",{action:"edit",id:a,text:r}):n?EN.execCommand("comment",{action:"remove",id:a}):t&&(this.content.clear(),this.setState({editText:"",suggestions:null},function(){EN.execCommand("comment",{action:"insert",threadId:o,text:r})}))}},{key:"componentWillReceiveProps",value:function(e){var t=e.editing,n=e.text;t&&!this.props.editing&&(this.editingStarted=!0,this.content=new h.default(n,this.context.findMentions,C.default),this.setState({editText:this.content.getEditText(),suggestions:null}))}},{key:"componentDidUpdate",value:function(e,t){this.resizeAndFocusIfNeeded();var n=this.props,a=n.editing,o=n.creating;(a||o)&&this.state.editText!==t.editText&&this.props.onLayout(),!a&&!o||e.editing||e.creating||document.addEventListener("selectionchange",this.handleSelectionChange)}},{key:"componentDidMount",value:function(){this.resizeAndFocusIfNeeded(),(this.props.editing||this.props.creating)&&document.addEventListener("selectionchange",this.handleSelectionChange)}},{key:"componentWillUnmount",value:function(){(this.props.editing||this.props.creating)&&document.removeEventListener("selectionchange",this.handleSelectionChange)}},{key:"render",value:function(){var e=this,t=this.props,n=(t.id,t.editing),a=t.creating,o=(t.text,t.initiater),r=this.state,i=r.editText,s=r.tooltip,u=r.suggestions,d=n&&!i?C.default.destroy:C.default.primary,p=n||a,f=n||a&&i,m=p?this.content.getPreview():this.content.getRichText(!1),h=null,v=null;return n&&!i?v="Delete":n?v="Save Changes":a&&(v="Post",h=o?"Add a comment...":"Reply..."),c.default.createElement("div",{className:C.default.wrapper},c.default.createElement("div",{className:C.default.body},c.default.createElement("div",{className:C.default.text,dangerouslySetInnerHTML:{__html:m},onMouseOver:this.handleMouseOver,onMouseOut:this.handleMouseOut,onMouseDown:this.handleMouseDown}),p&&c.default.createElement("textarea",{maxLength:"700",onChange:this.handleChange,onKeyDown:this.handleKeyDown,onBlur:this.handleBlur,placeholder:h,ref:function(t){e.textareaRef=t},value:i}),p&&c.default.createElement("div",{ref:function(t){e.measureRef=t},className:C.default.text},i)),f&&c.default.createElement("div",{className:C.default.controls},c.default.createElement("button",{onClick:this.handleSubmit,className:d},v),c.default.createElement("button",{onClick:this.handleCancel},"Cancel")),u&&c.default.createElement(g.default,l({},u,{onChange:this.handleMentionChange,onSelect:function(t){return e.selectMention(t)}})),s)}}]),t}(u.PureComponent);t.default=E,E.contextTypes={findMentions:p.default.func};var T=function(e){e.style.height="",e.style.height=e.scrollHeight+"px"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),l=n(40),s=a(l),u=n(173),c=a(u),d=n(1),p=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments[1],a=arguments[2];o(this,e),this.matcher_=n,this.renderer_=new c.default(a),this.mentionToken_=null,this.firstToken_=null,this.cache_={},this.selectionStart_=-1,this.selectionEnd_=-1,this.source=null,this.parse(this.preprocess(t)),this.decorateMentions(null,!0,-1,-1)}return i(e,[{key:"clear",value:function(){this.mentionToken_=null,this.firstToken_=null,this.selectionStart_=-1,this.selectionEnd_=-1,this.source=""}},{key:"preprocess",value:function(e){var t=this;return e.replace(/<\/?b>/g,"*").replace(/<\/?em>/g,"_").replace(/<\/?s>/g,"~").replace(/<\/?pre>/g,"```").replace(/<\/?code>/g,"`").replace(/<br\/?>/g,"\n").replace(/\u00a0/g,"").replace(/<span\s(.*?)>(@.*?)<\/span>/g,function(e,n,a){var o=n.trim().split(" ").reduce(function(e,t){var n=t.match(/^data-(.*?)=["'](.*)["']$/);if(n){e[n[1].trim().toLowerCase().replace(/-([a-z])/g,function(e,t){return t.toUpperCase()})]=n[2].trim()}return e},{});return o.username&&(t.cache_[o.username]=o)," "+a+" "}).replace(/<[^>]+?>/g,"").replace(/(?:^[\u0008-\u0013\u0020]+|[\u0008-\u0013\u0020]+$)/g,"")}},{key:"parse",value:function(e){if(this.source!==e){var t=new s.default(e);this.firstToken_=t.token,m(t,l.TokenKind.SOF);do{t.token.kind===l.TokenKind.MARK_MENTION&&h(t.token,this.cache_,this.matcher_)}while(!f(t,l.TokenKind.EOF));m(t,l.TokenKind.EOF),this.source=e,this.selectionStart_=-1,this.selectionEnd_=-1}}},{key:"applyChange",value:function(e){this.parse(e.value);var t=e.selectionStart,n=e.selectionEnd,a=null,o=null,r=null,i=!0;if(-1!==t&&t===n)for(a=this.firstToken_;a=a.next;)a.start<=t&&a.end>=t&&a.kind!==l.TokenKind.EOF?(o=a,a.kind===l.TokenKind.MARK_MENTION&&!a.data.decorated&&Math.max(t,a.start)-Math.min(n,a.end)<=0&&(r=a)):a.kind!==l.TokenKind.MARK_MENTION||a.data.decorated||(i=!0);return!r&&o&&o.kind===l.TokenKind.TEXT&&this.matcher_&&(r=v(o,e,this.matcher_)),this.mentionToken_=r,i&&this.decorateMentions(e),!0}},{key:"applySelection",value:function(e){if(!this.firstToken_)return!1;var t=e.selectionStart,n=e.selectionEnd,a=!1;if(this.selectionStart_===t&&this.selectionEnd_===n)return!1;this.mentionToken_&&(a=!0,this.mentionToken_=null);for(var o=this.firstToken_;o=o.next;)if(o.kind===l.TokenKind.MARK_MENTION&&o.data.decorated&&(o.start<t&&o.end>t&&(t=o.start),o.start<n&&o.end>n)){n=o.end;break}return t===e.selectionStart&&n===e.selectionEnd||(e.value=this.getEditText(),e.setSelectionRange(t,n),a=!0,o.data.user||(this.mentionToken_=o),this.selectionStart_=e.selectionStart,this.selectionEnd_=e.selectionEnd),a}},{key:"allowDelete",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.selectionStart;if(n!==e.selectionEnd)return!0;for(var a=this.firstToken_,o=!0;a=a.next;)a.kind===l.TokenKind.MARK_MENTION&&a.data.decorated&&(t&&a.start===n?(n+=1,o=!1):t||a.end!==n||(n-=1,o=!1));return o||e.setSelectionRange(n,n),o}},{key:"decorateMentions",value:function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.selectionStart,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.selectionEnd,o=this.firstToken_,r=!1,i=[];o=o.next;){var s=o.kind===l.TokenKind.MARK_MENTION,u=o.start<=n&&o.end>=a;if(s&&t&&!u&&!o.data.decorated&&o.data.suggestions.length>0&&(r=!0,i.push(o),o.end<=n&&(n+=2,a+=2),o.data.decorated=!0,o.end+=2),o.next){var c=o.next.end-o.next.start;o.next.start=o.end,o.next.end=o.next.start+c}}return r&&(this.source=this.getEditText(),e&&(e.value=this.source,e.setSelectionRange(n,a),n=e.selectionStart,a=e.selectionEnd)),this.selectionStart_=n,this.selectionEnd_=a,r}},{key:"setSuggestion",value:function(e,t){if(this.mentionToken_){var n=this.mentionToken_,a=n.start+t.length+2;e.value=this.source.substr(0,n.start)+"@"+t+" "+this.source.substr(n.end),e.focus(),e.setSelectionRange(a,a),this.parse(e.value),this.decorateMentions(e)}}},{key:"getSuggestions",value:function(){return this.mentionToken_?this.mentionToken_.data.suggestions:[]}},{key:"getMentionRect",value:function(e,t){var n={x:0,y:0,width:0,height:0};if(!this.mentionToken_)return n;e.innerHTML=this.renderer_.escapeHTML(this.source),this.measureRange_||(this.measureRange_=document.createRange());var a=e.firstChild;return this.measureRange_.setStart(a,this.mentionToken_.start),this.measureRange_.setEnd(a,this.mentionToken_.end),r({},(0,d.rect)(this.measureRange_,t),{x:t})}},{key:"getRichText",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.renderer_.renderRichtText(this.firstToken_);return e?t.replace(/(<br\/?\s?>)+$/,"").replace(/^(<br\/?\s?>)+/,""):t}},{key:"getEditText",value:function(){return this.renderer_.renderEditText(this.firstToken_)}},{key:"getPreview",value:function(){return this.renderer_.renderPreview(this.firstToken_)}}]),e}();t.default=p;var f=function(e,t){var n=e.token.kind===t;return n||e.advance(),n},m=function(e,t){var n=e.token;if(n.kind===t)return e.advance(),n;throw new Error("Parser synax error, expected "+t+", found "+n)},h=function(e,t,n){var a=e.data.text,o=n?n(a):[];e.data.suggestions=[],e.data.user=null,!o.length&&t[a]?e.data.user=t[a]:1===o.length&&o[0].username===a?(e.data.user=o[0],e.data.suggestions=o):o.length>0&&(e.data.suggestions=o)},v=function(e,t,n){var a=t.selectionEnd,o=e.prev;do{if(o.kind===l.TokenKind.MARK_MENTION&&!o.data.decorated&&o.data.suggestions.length>0){var r=t.value.slice(o.start+1,a),i=n(r);if(i.length>0)return o.data.suggestions=i,e.end===a?(o.next.prev=null,o.next=e.next,o.end=a,e.next=null):(e.prev.next=null,o.next&&(o.next.prev=null),e.start=a,o.end=a,e.prev.next=null,e.prev=o,o.next=e),o}}while((o=o.prev)&&o.kind===l.TokenKind.TEXT);return null}},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),r=function(){function e(t,n,o){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;a(this,e),this.kind=t,this.start=n,this.end=o,this.data=r,this.prev=i,this.next=l,this.selected=!1}return o(e,[{key:"toString",value:function(){return this.data?this.kind+' "'+JSON.stringify(this.data)+'"':this.kind}},{key:"inspect",value:function(){return{kind:this.kind,data:this.data,start:this.start,end:this.end}}}]),e}();t.default=r},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),r=n(40),i=function(){function e(t){a(this,e),this.markEndPos_={},this.styles=t}return o(e,[{key:"mentionToHTML_",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=e.data,a=n.text,o=n.user;if(t>=0)return'<span data-token-start="'+t+'"><span></span>@'+a+"</span>";if(o){var r=o.initial,i=o.username,l=o.title,s=o.email,u=o.name,c=o.photoUrl,d={initial:r,username:i,title:l,email:s,name:u},p=Object.keys(d).reduce(function(e,t){return d[t]&&e.push("data-"+t+'="'+d[t]+'"'),e},[]);return c&&p.push('data-photo-url="'+c+'"'),"<span "+p.join(" ")+">@"+a+"</span>"}return"@"+a}},{key:"markToHTML_",value:function(e,t){return e===r.TokenKind.MARK_CODE?t?"<code>":"</code>":e===r.TokenKind.MARK_CODEBLOCK?t?"<pre>":"</pre>":e===r.TokenKind.MARK_STRIKE_THROUGH?t?"<s>":"</s>":e===r.TokenKind.MARK_BOLD?t?"<b>":"</b>":e===r.TokenKind.MARK_ITALIC?t?"<em>":"</em>":(console.error("Invalid mark "+(t?"ahead":"behind")+' "'+e+'"'),"")}},{key:"shouldMarkStart_",value:function(e){var t=e.kind;if(!e.data||!e.data.ahead||t===e.prev.kind||t===e.next.kind)return!1;var n=this.markEndPos_[t];if(n&&n>e.start)return!1;for(var a=e.next;a;){if(a.kind===r.TokenKind.NEW_LINE&&t!==r.TokenKind.MARK_CODEBLOCK)return!1;if(a.kind===t&&a.data.behind)return a.prev.kind!==t&&a.next.kind!==t&&(this.markEndPos_[t]=a.start,!0);a=a.next}return!1}},{key:"shouldMarkEnd_",value:function(e){return this.markEndPos_[e.kind]===e.start&&(this.markEndPos_[e.kind]=null,!0)}},{key:"escapeHTML",value:function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/&amp;([lg]t;)/g,"&$1")}},{key:"renderRichtText",value:function(e){if(!e)return"";this.markEndPos_={};for(var t="";e=e.next;){var n=e,a=n.kind,o=n.data,i=this.markEndPos_[r.TokenKind.MARK_CODE]||this.markEndPos_[r.TokenKind.MARK_CODEBLOCK];!i&&a===r.TokenKind.MARK_MENTION&&o.user?t+=this.mentionToHTML_(e):a===r.TokenKind.MARK_MENTION?t+="@"+o.text:!i&&this.shouldMarkStart_(e)?t+=this.markToHTML_(a,!0):this.shouldMarkEnd_(e)?t+=this.markToHTML_(a,!1):i||a!==r.TokenKind.NEW_LINE?o&&(t+=this.escapeHTML(o.text)):e.prev.kind===r.TokenKind.MARK_CODEBLOCK&&e.prev.data.behind||(t+="<br>")}return t.replace(/\u00a0/g,"").trim()}},{key:"renderEditText",value:function(e){if(!e)return"";for(var t="";e=e.next;)e.kind===r.TokenKind.MARK_MENTION&&e.data.decorated?t+=" @"+e.data.text+" ":e.kind===r.TokenKind.MARK_MENTION?t+="@"+e.data.text:e.data&&(t+=e.data.text);return t}},{key:"renderPreview",value:function(e){if(!e)return"";for(var t="";e=e.next;)e.kind===r.TokenKind.MARK_MENTION&&e.data.decorated&&!e.data.user?t+=this.mentionToHTML_(e,e.start+1):e.kind===r.TokenKind.MARK_MENTION&&e.data.decorated?t+=this.mentionToHTML_(e):e.kind===r.TokenKind.MARK_MENTION?t+="@"+e.data.text:e.data&&(t+=this.escapeHTML(e.data.text));return t}}]),e}();t.default=i},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),c=a(u),d=n(10),p=n(9),f=a(p),m=n(1),h=n(175),v=a(h),g=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.container=document.createElement("div"),n.handleWheel=n.handleWheel.bind(n),n.handleMouseDown=n.handleMouseDown.bind(n),n}return i(t,e),s(t,[{key:"updatePosition",value:function(){if(this.modalRef){var e=this.props.rect,t=this.modalRef,n=(t.clientWidth,t.clientHeight),a=window,o=(a.innerWidth,a.innerHeight),r=a.scrollY,i=e.y+e.height+6-r;i=i+168<=o-4?i+r:e.y-n-6,this.modalRef.style.top=Math.round(i)+"px",this.modalRef.style.left=Math.round(e.x)+"px"}}},{key:"updateScrollTop",value:function(){var e=this.props.selectedIndex;if(this.modalRef||!(e<4)){var t=this.modalRef.scrollTop,n=t+168,a=42*e,o=a+42;a<t?this.modalRef.scrollTop=a:o>n&&(this.modalRef.scrollTop=o-168)}}},{key:"handleChange",value:function(e){e!==this.props.selectedIndex&&this.props.onChange(e)}},{key:"handleMouseDown",value:function(e){e.preventDefault()}},{key:"handleWheel",value:function(e){this.modalRef.scrollTop+=e.deltaY,e.preventDefault()}},{key:"componentDidUpdate",value:function(e){e.selectedIndex!==this.props.selectedIndex&&this.updateScrollTop(),(0,m.equal)(e.rect,this.props.rect)||this.updatePosition()}},{key:"componentDidMount",value:function(){document.body.appendChild(this.container),this.updateScrollTop(),this.updatePosition()}},{key:"componentWillUnmount",value:function(){document.body.removeChild(this.container)}},{key:"render",value:function(){var e=this,t=this.props,n=t.users,a=t.onSelect,o=t.selectedIndex;return(0,d.createPortal)(c.default.createElement("div",{className:v.default.suggestbox,onWheel:this.handleWheel,onMouseDown:this.handleMouseDown,ref:function(t){e.modalRef=t}},n.map(function(t,n){return c.default.createElement("div",{className:(0,m.css)(v.default.cell,o===n&&v.default.selected),key:t.id,onMouseOver:function(){return e.handleChange(n)},onClick:function(){return a(n)}},c.default.createElement(f.default,l({},t,{className:v.default.avatar})),c.default.createElement("div",{className:v.default.title},t.name),c.default.createElement("div",{className:v.default.subtitle},t.email))})),this.container)}}]),t}(u.Component);t.default=g},function(e,t,n){var a=n(176);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._11dkD{position:absolute;width:240px;min-height:42px;max-height:168px;overflow:hidden;overflow-y:auto;background-color:#fff;border-radius:3px;box-shadow:0 0 6px 0 rgba(0,0,0,.3);color:#2a2a2a;z-index:2147480650;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial;font-size:13px}._11dkD ._2NAgT{position:relative;height:42px;cursor:pointer;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center}._11dkD ._2NAgT._8slc3{background-color:#f0f1f1}._11dkD ._16Hpa,._11dkD ._22Tzs{-webkit-flex:0 0 auto;flex:0 0 auto;padding:0 10px 0 40px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._11dkD ._16Hpa{font-size:12px;color:#a0a0a0;font-weight:400}._11dkD ._1FOTw{position:absolute;top:8px;left:8px}",""]),t.locals={suggestbox:"_11dkD",cell:"_2NAgT",selected:"_8slc3",title:"_22Tzs",subtitle:"_16Hpa",avatar:"_1FOTw"}},function(e,t,n){var a=n(178);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._38Nmc{position:absolute;pointer-events:none;z-index:2147480650;background-color:#333;border-radius:4px;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial;font-size:13px;padding:6px 10px;color:#f4f4f4}._38Nmc ._1EVfj{position:absolute;bottom:-6px;width:0;height:0;border-style:solid;border-width:6px 6px 0;border-color:#333 transparent transparent;left:calc(50% - 6px)}._38Nmc ._1EVfj._251if{top:-6px;bottom:auto;border-width:0 6px 6px;border-color:transparent transparent #333}",""]),t.locals={tooltip:"_38Nmc",arrow:"_1EVfj",flipped:"_251if"}},function(e,t,n){var a=n(180);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._2fc7G{height:42px;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center;padding:0}._2fc7G ._2ZVo3,._2fc7G .HJn11{-webkit-flex:0 0 auto;flex:0 0 auto;padding:0 10px 0 40px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#fff}._2fc7G ._2ZVo3 ._2rfVd{color:#c3c3c3;padding-left:4px}._2fc7G .HJn11{font-size:12px;color:#c3c3c3}._2fc7G ._2fxgf{position:absolute;top:8px;left:8px}",""]),t.locals={tooltip:"_2fc7G",title:"_2ZVo3",subtitle:"HJn11",dim:"_2rfVd",avatar:"_2fxgf"}},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,'en-comment.active,en-comment.enabled{border-bottom:2px solid #fee1b3;text-decoration:none}en-comment.active{background:#fee1b3}._22Ze6{position:absolute;top:0;left:0;right:0;bottom:0;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial;color:#333;font-size:13px;overflow:hidden}._22Ze6 button,._22Ze6 textarea{color:inherit;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;margin:0;padding:0;outline:none;background-color:transparent;border:none;-webkit-appearance:none;box-sizing:border-box}._22Ze6 button{cursor:pointer;-webkit-user-select:none;user-select:none}.fullsize ._22Ze6{display:none}button.Cfy3u{position:absolute;top:0;right:12px;width:28px;height:28px;pointer-events:auto;border-radius:5px;opacity:.4;transition:opacity .2s ease-in-out,box-shadow .2s ease-in-out;padding-top:2px;background-color:#fff}button.Cfy3u:hover{opacity:1;box-shadow:0 0 4px 0 rgba(0,0,0,.14)}button.Cfy3u svg{width:24px;height:24px}._153jo{background-color:#fff;border-radius:3px;margin:11px;pointer-events:auto;-webkit-user-select:text;user-select:text;transition:top .3s ease-in-out,right .2s ease-in-out,box-shadow .2s ease-in-out}._153jo._1LSRu{width:240px;position:absolute;right:10px;z-index:100;margin:0}._153jo.EvCrJ,._153jo.s60lX{pointer-events:none;background-color:transparent;transition:top .3s ease-in-out,right .2s ease-in-out}._153jo.EvCrJ .Ca42T,._153jo.s60lX .Ca42T{pointer-events:auto}._153jo.EvCrJ .Ca42T:after{color:#fff}._153jo.EvCrJ .Ca42T svg{fill:#fcb540;stroke:#fcb540}._153jo._PpUO{right:20px;box-shadow:0 1px 7px 0 rgba(0,0,0,.2);z-index:2147480647}._153jo._PpUO .rEobn{-webkit-justify-content:space-between;justify-content:space-between}._153jo .rEobn{display:-webkit-flex;display:flex;-webkit-justify-content:flex-end;justify-content:flex-end;min-height:14px}._153jo ._1mA2F{padding:0 10px;color:#00a82d;height:34px}._153jo ._1mA2F,._153jo ._34BTE{-webkit-flex:0 0 auto;flex:0 0 auto}._153jo ._34BTE{border:1px solid #d1d1d1;color:#666;font-size:13px;padding:0 12px;margin:16px 16px 0 0;height:32px}._153jo .WsfJy{-webkit-flex:1 1 auto;flex:1 1 auto;margin:20px;max-height:48px;overflow:hidden}._153jo .WsfJy span{background-color:#ffebcc}._153jo .Ca42T{-webkit-flex:0 0 auto;flex:0 0 auto;width:32px;height:32px;position:relative;top:5px;right:5px;cursor:pointer}._153jo .Ca42T:after{content:attr(data-count);position:absolute;top:8px;left:.5px;width:100%;text-align:center;font-size:11px;color:#c3c3c3}._153jo .Ca42T svg{fill:none;stroke:#c3c3c3;width:inherit;height:inherit}._1dUdQ{position:relative;padding:2px 0 18px 44px;min-height:44px}._1dUdQ:after{content:"";position:absolute;z-index:5;top:42px;left:23px;bottom:0;width:1px;background-color:#e6e6e6}._1dUdQ:last-child:after,._153jo._PpUO ._1dUdQ:nth-last-child(2):after{content:normal}._1dUdQ._1roSb{border-top:1px solid #ededed;padding-top:12px;padding-bottom:0;top:-1px}._1dUdQ._1roSb:first-child{top:0;border-top:none}._1dUdQ._1qDpx{padding-bottom:0;padding-top:10px;background-color:#fafafa}._1dUdQ._1qDpx:before{content:"";position:absolute;top:0;left:0;width:3px;bottom:0;z-index:15;background-color:#fee1b3}._1dUdQ ._2iWT_{position:absolute;top:8px;left:10px}._1dUdQ .rq6bC{position:relative;padding:2px 36px 4px 0;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap}._1dUdQ ._84rl1{font-weight:700;line-height:16px;padding-right:12px;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._1dUdQ ._84rl1,._1dUdQ .bSCyo{-webkit-flex:0 0 auto;flex:0 0 auto}._1dUdQ .bSCyo{color:#c3c3c3;font-size:12px}._1dUdQ ._3ylUR{position:absolute;top:1px;right:4px;width:24px;height:24px;display:none}._1dUdQ ._3ylUR svg{fill:#c3c3c3;width:inherit;height:inherit}._1dUdQ:hover ._3ylUR{display:block}._1dUdQ span[data-token-start],._1dUdQ span[data-username]{color:#127dbd;position:relative;padding:0 0 1px;background-color:rgba(18,125,189,.06);border-radius:3px;cursor:pointer}._1dUdQ span[data-token-start]:hover,._1dUdQ span[data-username]:hover{background-color:rgba(18,125,189,.15)}._1dUdQ span[data-token-start]:after,._1dUdQ span[data-token-start]:before,._1dUdQ span[data-username]:after,._1dUdQ span[data-username]:before{content:"\\A0"}._1dUdQ span[data-token-start]{background-color:transparent;pointer-events:auto}._1dUdQ span[data-token-start] span{pointer-events:none;position:absolute;display:block;top:0;left:0;right:0;bottom:0;border-radius:inherit;border:1px dotted #127dbd}._1dUdQ span[data-token-start] span:before{content:"?";position:absolute;top:-6px;right:-6px;width:12px;height:12px;background-color:#2d9ee0;font-size:10px;border-radius:50%;color:#fff;font-family:sans-serif;line-height:12px;text-indent:3px}._1dUdQ ._11mG1{padding:0 16px 0 0}._1dUdQ ._7_tu-{position:relative}._1dUdQ ._7_tu- textarea{width:100%;resize:none;line-height:18px;height:18px;position:relative;z-index:2}._1dUdQ ._7_tu- textarea::-webkit-input-placeholder{color:#c3c3c3}._1dUdQ ._7_tu- textarea::placeholder{color:#c3c3c3}._1dUdQ ._1QgWL{line-height:18px;word-break:break-word}._1dUdQ ._1QgWL code,._1dUdQ ._1QgWL pre{tab-size:4;border-radius:3px;font-family:Consolas,monaco,Ubuntu Mono,courier,monospace;font-size:11px}._1dUdQ ._1QgWL code{color:#d72b3f;padding:1px 3px;background-color:#f7f7f9;border:1px solid #e1e1e8}._1dUdQ ._1QgWL pre{white-space:pre-wrap;background:#f9f9f9;border:1px solid rgba(0,0,0,.15);margin:6px 0 3px;padding:4px 8px}._1dUdQ ._1QgWL b code,._1dUdQ ._1QgWL b pre{font-weight:400}._1dUdQ ._1QgWL em code,._1dUdQ ._1QgWL em pre{font-style:normal}._1dUdQ ._1QgWL s code,._1dUdQ ._1QgWL s pre{text-decoration:none}._1dUdQ._1qDpx ._1QgWL,._1dUdQ._1roSb ._1QgWL{pointer-events:none;position:absolute;top:0;left:0;right:0;color:transparent;white-space:pre-wrap}._1dUdQ._1qDpx ._1QgWL:first-child,._1dUdQ._1roSb ._1QgWL:first-child{z-index:3}._1dUdQ._1qDpx ._1QgWL:last-child,._1dUdQ._1roSb ._1QgWL:last-child{z-index:1}._1dUdQ .fLAlf{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:44px;padding:8px 0 12px}._1dUdQ .fLAlf button{-webkit-flex:0 0 auto;flex:0 0 auto;margin-right:14px;color:#aaa}._1dUdQ .fLAlf ._33Mz3{color:#00a82d;font-weight:700}._1dUdQ .fLAlf ._2SMdy{color:#ff5151;font-weight:700}',""]),t.locals={comments:"_22Ze6",adder:"Cfy3u",thread:"_153jo",floating:"_1LSRu",collapsed:"EvCrJ",compact:"s60lX",bubble:"Ca42T",active:"_PpUO",toolbar:"rEobn",resolve:"_1mA2F",reopen:"_34BTE",highlight:"WsfJy",comment:"_1dUdQ",new:"_1roSb",edit:"_1qDpx",avatar:"_2iWT_",header:"rq6bC",name:"_84rl1",time:"bSCyo",options:"_3ylUR",wrapper:"_11mG1",body:"_7_tu-",text:"_1QgWL",controls:"fLAlf",primary:"_33Mz3",destroy:"_2SMdy"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"ise7I",use:"ise7I-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="ise7I">\n  <path d="M7.5,13 C6.67157288,13 6,12.3284271 6,11.5 C6,10.6715729 6.67157288,10 7.5,10 C8.32842712,10 9,10.6715729 9,11.5 C9,12.3284271 8.32842712,13 7.5,13 Z M12.5,13 C11.6715729,13 11,12.3284271 11,11.5 C11,10.6715729 11.6715729,10 12.5,10 C13.3284271,10 14,10.6715729 14,11.5 C14,12.3284271 13.3284271,13 12.5,13 Z M17.5,13 C16.6715729,13 16,12.3284271 16,11.5 C16,10.6715729 16.6715729,10 17.5,10 C18.3284271,10 19,10.6715729 19,11.5 C19,12.3284271 18.3284271,13 17.5,13 Z" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"UJcC_",use:"UJcC_-usage",viewBox:"0 0 32 32",content:'<symbol viewBox="0 0 32 32" id="UJcC_">\n  <path d="M9.97861401,23.8640938 C11.7417413,25.2044152 13.9415355,26 16.3271484,26 C22.1261383,26 26.8271484,21.2989899 26.8271484,15.5 C26.8271484,9.70101013 22.1261383,5 16.3271484,5 C10.5281586,5 5.82714844,9.70101013 5.82714844,15.5 C5.82714844,17.1794923 6.22146275,18.7668876 6.92256379,20.1746583 L5,24.7011719 L9.97861401,23.8640938 Z" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"3IsE-",use:"3IsE--usage",viewBox:"0 0 12 12",content:'<symbol viewBox="0 0 12 12" id="3IsE-">\n    <g id="3IsE-_Final-for-MVP" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n        <g id="3IsE-_Artboard-Copy-11" transform="translate(-1057.000000, -207.000000)" fill="#C3C3C3">\n            <g id="3IsE-_Title-Area" transform="translate(414.000000, 181.000000)">\n                <g id="3IsE-_Close" transform="translate(648.899495, 31.899495) rotate(-315.000000) translate(-648.899495, -31.899495) translate(641.899495, 24.899495)">\n                    <rect id="3IsE-_Rectangle-26" x="6" y="0" width="2" height="14" />\n                    <rect id="3IsE-_Rectangle-26" transform="translate(7.000000, 7.000000) rotate(-90.000000) translate(-7.000000, -7.000000) " x="6" y="0" width="2" height="14" />\n                </g>\n            </g>\n        </g>\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"34UlQ",use:"34UlQ-usage",viewBox:"0 0 12 14",content:'<symbol viewBox="0 0 12 14" id="34UlQ">\n    <g id="34UlQ_Assets" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n        <g id="34UlQ_Artboard" fill="#A0A0A0">\n            <path d="M8.538,13.75 L1.5,13.75 C0.87,13.75 0.384,13.246 0.384,12.634 L0.384,1.366 C0.384,0.754 0.87,0.25 1.5,0.25 L10.5,0.25 C11.13,0.25 11.616,0.754 11.616,1.366 L11.616,10.654 L8.538,13.75 Z M10.5,9.808 L10.5,1.366 L1.5,1.366 L1.5,12.616 L7.692,12.616 L7.692,10.942 C7.692,10.312 8.196,9.808 8.808,9.808 L10.5,9.808 Z M3.192,3.904 L3.192,3.058 L8.808,3.058 L8.808,3.904 L3.192,3.904 Z M3.192,6.154 L3.192,5.308 L8.808,5.308 L8.808,6.154 L3.192,6.154 Z M3.192,8.404 L3.192,7.558 L8.808,7.558 L8.808,8.404 L3.192,8.404 Z M6.558,9.808 L6.558,10.654 L3.192,10.654 L3.192,9.808 L6.558,9.808 Z M8.538,12.346 L10.212,10.654 L8.538,10.654 L8.538,12.346 Z" id="34UlQ_Note_Icon_Comment_History" />\n        </g>\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){var a=n(187);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,".NwQwN{-webkit-flex:1 1 auto;flex:1 1 auto;max-width:680px;height:100%;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;overflow:hidden;background:#fff;border-radius:4px;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial;color:#333;font-size:13px;box-shadow:0 2px 4px 0 rgba(0,0,0,.5)}.NwQwN button,.NwQwN textarea{color:inherit;font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;margin:0;padding:0;outline:none;background-color:transparent;border:none;-webkit-appearance:none;box-sizing:border-box}.NwQwN button{cursor:pointer;-webkit-user-select:none;user-select:none}._3F67E{display:-webkit-flex;display:flex;height:76px;-webkit-align-items:flex-start;align-items:flex-start;border-bottom:1px solid #e4e4e4;-webkit-flex:0 0 auto;flex:0 0 auto}._3F67E ._2tB-c{-webkit-flex:1 1 auto;flex:1 1 auto;padding:16px 0 0 20px}._3F67E h1{font-weight:500;font-size:20px;line-height:22px;margin:0 0 7px}._3F67E h2{font-size:14px;font-weight:400;color:#666;margin:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}._3F67E h2 svg{width:13px;height:13px;margin-right:5px}._3F67E .uekWG{width:30px;height:30px;-webkit-flex:0 0 auto;flex:0 0 auto;padding:9px;margin:16px 15px 0 12px}._3F67E .uekWG:hover{opacity:.7}._2xNIY{-webkit-flex:1 1 auto;flex:1 1 auto;background-color:#f0f1f1;overflow:scroll}.RhAb2{z-index:2147480547;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.4);pointer-events:auto;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;display:-webkit-flex;display:flex;padding:90px 60px}",""]),t.locals={archive:"NwQwN",header:"_3F67E",wrapper:"_2tB-c","btn-close":"uekWG",btnClose:"uekWG",content:"_2xNIY",overlay:"RhAb2"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"1Ejmu",use:"1Ejmu-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="1Ejmu">\n    <g transform="translate(3.000000, 3.000000)" fill="#666666">\n        <path d="M-0.819413277,16.762739 L3.97955612,15.962205 C5.5266647,17.0728542 7.38797437,17.6818182 9.34105857,17.6818182 C14.3985232,17.6818182 18.5,13.6125663 18.5,8.59090909 C18.5,8.10983109 18.4623084,7.63327193 18.3877934,7.1642387 L17.4001792,7.32114027 C17.4664577,7.73832922 17.5,8.16242622 17.5,8.59090909 C17.5,13.0585081 13.8479965,16.6818182 9.34105857,16.6818182 C7.53279169,16.6818182 5.81537718,16.09749 4.40674699,15.0350692 L4.23526252,14.9057317 L0.819413277,15.4755423 L2.13651926,12.3988921 L2.03232517,12.1913202 C1.47572456,11.0824791 1.18211713,9.85800197 1.18211713,8.59090909 C1.18211713,4.1233101 4.83412062,0.5 9.34105857,0.5 C9.85433737,0.5 10.3613051,0.546939794 10.8576375,0.639424924 L11.0408215,-0.343653719 C10.4841477,-0.447382703 9.9158607,-0.5 9.34105857,-0.5 C4.2835939,-0.5 0.182117131,3.56925192 0.182117131,8.59090909 C0.182117131,9.9348049 0.476480421,11.2378669 1.03597896,12.4286969 L-0.819413277,16.762739 Z" fill-rule="nonzero" />\n        <g transform="translate(13.000000, 0.000000)">\n            <rect x="2" y="0" width="1" height="5" />\n            <rect transform="translate(2.500000, 2.500000) rotate(-90.000000) translate(-2.500000, -2.500000) " x="2" y="0" width="1" height="5" />\n        </g>\n        <rect x="5" y="8" width="9" height="1" />\n        <rect x="5" y="11" width="7" height="1" />\n        <rect x="5" y="5" width="7" height="1" />\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(12),d=(a(c),n(6)),p=a(d),f=n(1),m=n(190),h=a(m),v=n(192),g=a(v),y=n(193),b=a(y),x=n(194),_=a(x),k=n(195),w=a(k),C=n(196),E=a(C),T=n(26),O=a(T),S=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),a=e.initialIndex>-1?e.initialIndex:0;e.translucent;return n.updater_=function(e){e===n.state.meta&&n.setState({meta:e})},n.timer_=null,n.dragPoint_=null,n.state={index:a,opaque:!1,active:!1,dragging:!1,navigation:e.items.length>1,meta:null,altKey:!1},n.handleButtonClose=n.handleButtonClose.bind(n),n.handleNext=n.handleNext.bind(n),n.handlePrevious=n.handlePrevious.bind(n),n.handleZoomIn=n.handleZoomIn.bind(n),n.handleZoomOut=n.handleZoomOut.bind(n),n.handleScale=n.handleScale.bind(n),n.handleDragStart=n.handleDragStart.bind(n),n.handleDragStop=n.handleDragStop.bind(n),n.handleDragging=n.handleDragging.bind(n),n.handleMouseOut=n.handleMouseOut.bind(n),n.handleResize=n.handleResize.bind(n),n.handleKeyDown=n.handleKeyDown.bind(n),n.handleKeyUp=n.handleKeyUp.bind(n),n}return i(t,e),l(t,[{key:"appear",value:function(){var e=this,t=this.props,n=t.animated,a=t.isVisibleInView;clearTimeout(this.timer_),this.timer_=setTimeout(function(){var t=e.props.items[e.state.index],o=new g.default(t,e.updater_);n&&a(t)?o.current=o.recalculateOriginTransform(t):n&&(o.opacity=0),e.setState({meta:o,active:!0}),o.startAnimatedChange(o.fit,1)},10)}},{key:"disappear",value:function(){var e=this.props,t=e.animated,n=e.isVisibleInView,a=e.onClose,o=this.state,r=o.opaque,i=o.meta;if(clearTimeout(this.timer_),!t||r)this.props.onClose();else{var l=this.props.items[this.state.index];n(l)?i.startAnimatedChange(i.recalculateOriginTransform(l),1,a):i.startAnimatedChange(i.current,0,a),this.setState({active:!1})}}},{key:"go",value:function(e){var t=this.props,n=t.items,a=t.onChange,o=this.state.index;e!==o&&(e=Math.max(Math.min(n.length-1,e),0),this.setState({dragging:!1,index:e,meta:new g.default(n[e],this.updater_)},function(){a(n[e])}))}},{key:"goNext",value:function(){this.go(this.state.index+1>=this.props.items.length?0:this.state.index+1)}},{key:"goPrevious",value:function(){this.go(0===this.state.index?this.props.items.length-1:this.state.index-1)}},{key:"handleButtonClose",value:function(){this.disappear()}},{key:"handleNext",value:function(){this.goNext()}},{key:"handlePrevious",value:function(){this.goPrevious()}},{key:"handleZoomIn",value:function(){this.state.meta.clickScale(1)}},{key:"handleZoomOut",value:function(){this.state.meta.clickScale(-1)}},{key:"handleKeyDown",value:function(e){if(this.state.active){var t=e.keyCode;18===t?(this.setState({altKey:!0}),e.preventDefault()):27===t?(this.disappear(),e.preventDefault()):39===t||40===t?(this.goNext(),e.preventDefault()):37!==t&&38!==t||(this.goPrevious(),e.preventDefault())}}},{key:"handleKeyUp",value:function(e){this.state.active&&18===e.keyCode&&(this.setState({altKey:!1}),e.preventDefault())}},{key:"handleDragStart",value:function(e){var t=this.state,n=t.active,a=(t.meta,"IMG"===e.target.tagName&&e.target.hasAttribute("data-item"));this.dragPoint_=null,n&&a&&(this.dragPoint_={x:e.clientX,y:e.clientY},e.preventDefault())}},{key:"handleDragging",value:function(e){if(this.dragPoint_){var t=this.state,n=t.dragging,a=t.meta,o=this.dragPoint_,r=o.x,i=o.y,l=e.clientX,s=e.clientY;n&&a.drag(l,s)?this.setState({meta:a}):!n&&Math.sqrt(Math.pow(r-l,2)+Math.pow(i-s,2))>4&&a.startDragging(l,s)&&this.setState({dragging:!0,meta:a})}}},{key:"handleDragStop",value:function(e){e.preventDefault();var t=this.state,n=t.meta,a=t.dragging,o=(t.active,t.altKey),r=e.target.classList.contains(O.default.item),i="IMG"===e.target.tagName&&e.target.hasAttribute("data-item");this.dragPoint_=null,a&&n.stopDragging()?this.setState({dragging:!1,meta:n}):!a&&i&&o?this.handleZoomOut():!a&&i?this.handleZoomIn():!a&&r&&this.disappear()}},{key:"handleMouseOut",value:function(e){var t=this.state,n=t.meta;t.dragging&&!e.relatedTarget&&n.stopDragging()&&this.setState({dragging:!1,meta:n})}},{key:"handleScale",value:function(e){var t=this.state,n=t.active,a=t.dragging,o=t.meta;n&&!a&&o.zoomable&&o.deltaScale(e.deltaY,e.clientX,e.clientY)&&this.setState({meta:o}),e.preventDefault()}},{key:"handleResize",value:function(){this.state.active&&(this.state.meta.resize(),this.state.opaque||this.setState({opaque:!0}))}},{key:"componentDidMount",value:function(){document.body.addEventListener("keydown",this.handleKeyDown),document.body.addEventListener("keyup",this.handleKeyUp),window.addEventListener("mouseout",this.handleMouseOut),window.addEventListener("resize",this.handleResize),this.appear()}},{key:"componentWillUnmount",value:function(){document.body.removeEventListener("keydown",this.handleKeyDown),document.body.removeEventListener("keyup",this.handleKeyUp),window.removeEventListener("mouseout",this.handleMouseOut),window.removeEventListener("resize",this.handleResize)}},{key:"render",value:function(){var e=this.state,t=e.meta,n=e.navigation,a=e.opaque,o=e.active,r=e.dragging,i=e.altKey,l=this.props.animated,s=(0,f.css)("previewcontainer",O.default.preview,t&&l&&O.default.animated,o&&O.default.active,a&&O.default.opaque,!n&&O.default.nonav,r&&O.default.dragging,t&&t.animating&&O.default.animating,t&&t.zoomInEnabled&&!i&&O.default.zoomIn,t&&t.zoomOutEnabled&&i&&O.default.zoomOut);return u.default.createElement("div",{className:s,onWheel:this.handleScale,onMouseDown:this.handleDragStart,onMouseUp:this.handleDragStop,onMouseMove:this.handleDragging},u.default.createElement("div",{className:O.default.toolbar},t&&u.default.createElement(b.default,{zoom:t.current.scale,zoomIn:this.handleZoomIn,zoomInEnabled:t.zoomInEnabled,zoomOut:this.handleZoomOut,zoomOutEnabled:t.zoomOutEnabled}),u.default.createElement("div",{className:O.default.lblTitle},t?t.title:""),u.default.createElement("div",{className:O.default.lblFlex}),u.default.createElement("button",{className:O.default.btnClose,onClick:this.handleButtonClose},u.default.createElement(p.default,{svg:E.default}))),u.default.createElement("button",{className:O.default.btnPrev,onClick:this.handlePrevious},u.default.createElement(p.default,{svg:w.default})),u.default.createElement("button",{className:O.default.btnNext,onClick:this.handleNext},u.default.createElement(p.default,{svg:_.default})),t&&u.default.createElement(h.default,{onAction:this.handleItemAction,onTransitionEnd:t.stopAnimatedChange,animating:t.animating,src:t.src,transform:t.current,opacity:t.opacity,height:t.height,width:t.width,viewportHeight:t.viewportHeight,viewportWidth:t.viewportWidth}))}}]),t}(s.Component);t.default=S,S.defaultProps={animated:!0,translucent:!0,initialIndex:-1,items:[]}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=(n(1),n(26)),d=a(c),p=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.getScalerRef=function(e){n.scalerRef_=e},n.getPositionerRef=function(e){n.positionerRef_=e},n.handleTransitionEnd=n.handleTransitionEnd.bind(n),n}return i(t,e),l(t,[{key:"addTransitionListeners",value:function(){this.scalerRef_&&this.scalerRef_.addEventListener("transitionend",this.handleTransitionEnd),this.positionerRef_&&this.positionerRef_.addEventListener("transitionend",this.handleTransitionEnd)}},{key:"removeTransitionListeners",value:function(){this.scalerRef_&&this.scalerRef_.removeEventListener("transitionend",this.handleTransitionEnd),this.positionerRef_&&this.positionerRef_.removeEventListener("transitionend",this.handleTransitionEnd)}},{key:"handleTransitionEnd",value:function(){this.props.onTransitionEnd()}},{key:"componentDidMount",value:function(){this.props.animating&&this.addTransitionListeners()}},{key:"componentWillUnmount",value:function(){this.props.animating&&this.removeTransitionListeners()}},{key:"componentWillReceiveProps",value:function(e){this.props.animating&&!e.animating?this.removeTransitionListeners():!this.props.animating&&e.animating&&this.addTransitionListeners()}},{key:"render",value:function(){var e=this.props,t=e.src,n=e.opacity,a=e.transform,o=e.height,r=e.width,i=e.viewportWidth,l=e.viewportHeight,s=Math.round(i/2+a.center.x),c=Math.round(l/2+a.center.y),p={transform:"translate3d("+s+"px, "+c+"px, 0)"},f={opacity:n,width:r,height:o,transform:["translate3d(-50%, -50%, 0)","scale("+a.scale+", "+a.scale+")"].join(" ")};return u.default.createElement("div",{className:d.default.item},u.default.createElement("div",{className:d.default.positioner,style:p,ref:this.getPositionerRef},u.default.createElement("div",{className:d.default.scaler,style:f,ref:this.getScalerRef},u.default.createElement("img",{src:t,"data-item":"true"}))))}}]),t}(s.Component);t.default=p},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._1TcIK{top:0;left:0;right:0;bottom:0;position:fixed;z-index:2147481547;pointer-events:auto;font-family:-apple-system,system-ui,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}._1TcIK,._1TcIK button{background-color:transparent}._1TcIK button{border:none;padding:0;outline:none;opacity:0;cursor:pointer}._1TcIK ._3XK_S,._1TcIK .tU194{position:absolute;z-index:6;height:160px;width:80px;padding:63px 30px;left:0;top:calc(50% - 50px)}._1TcIK .tU194{left:auto;right:0}._2VO3s{border-bottom:1px solid #d8d8d8;opacity:0;height:60px;position:absolute;z-index:5;top:0;left:0;right:0;background-color:#f0f0f0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}._2VO3s ._27SiK,._2VO3s .fsMJZ{-webkit-flex:1 1 auto;flex:1 1 auto}._2VO3s ._27SiK{font-size:14px;color:rgba(0,0,0,.5);margin:0 0 0 22px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:calc(50% - 90px)}._2VO3s ._1dR4R{padding:11px;width:40px;height:40px;margin:0 10px;-webkit-flex:0 0 auto;flex:0 0 auto}._1c4ki{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;margin:0 10px;position:absolute;left:calc(50% - 80px)}._1c4ki ._2BLZQ{font-size:14px;text-align:center;width:60px}._1c4ki ._1W9bh,._1c4ki ._2BLZQ,._1c4ki .izh0u{color:rgba(0,0,0,.5);-webkit-flex:0 0 auto;flex:0 0 auto}._1c4ki ._1W9bh,._1c4ki .izh0u{width:40px;height:40px;font-size:20px;opacity:1;transition:opacity .15s ease}._1c4ki ._1W9bh._cOGm,._1c4ki .izh0u._cOGm{opacity:.3;cursor:default}._1xQEF{position:absolute;top:60px;left:0;right:0;bottom:0;z-index:3}._1xQEF ._1KuSQ{height:1px;position:absolute;width:1px;pointer-events:none}._1xQEF .fQHdc{position:relative;pointer-events:none}._1xQEF img{float:left;height:100%;width:100%;pointer-events:auto;cursor:-webkit-grab}._1TcIK._2DDI- ._3XK_S,._1TcIK._2DDI- .tU194{display:none}._1TcIK._3bQ1Z{transition:background-color .2s ease}._1TcIK._3bQ1Z ._1dR4R,._1TcIK._3bQ1Z ._2VO3s,._1TcIK._3bQ1Z ._3XK_S,._1TcIK._3bQ1Z .tU194{transition:opacity .2s ease}._1TcIK._3ZJEv{background-color:hsla(0,0%,94%,.96)}._1TcIK._3ZJEv ._2VO3s{opacity:1}._1TcIK._3ZJEv ._1dR4R,._1TcIK._3ZJEv ._3XK_S,._1TcIK._3ZJEv .tU194{opacity:.3}._1TcIK._3ZJEv ._1dR4R:hover,._1TcIK._3ZJEv ._3XK_S:hover,._1TcIK._3ZJEv .tU194:hover{opacity:.5}._1TcIK.NbzJA ._1xQEF img{cursor:zoom-in}._1TcIK._2zMK3 ._1xQEF img{cursor:zoom-out}._1TcIK._3Xz8C ._1xQEF img{cursor:-webkit-grabbing}._1TcIK._2itHF ._1KuSQ{transition:-webkit-transform .2s ease-out;transition:transform .2s ease-out;transition:transform .2s ease-out,-webkit-transform .2s ease-out}._1TcIK._2itHF .fQHdc{transition:opacity .2s ease-out,-webkit-transform .2s ease-out;transition:transform .2s ease-out,opacity .2s ease-out;transition:transform .2s ease-out,opacity .2s ease-out,-webkit-transform .2s ease-out}._1TcIK._27-e2{background-color:#fff}",""]),t.locals={preview:"_1TcIK","btn-next":"tU194",btnNext:"tU194","btn-prev":"_3XK_S",btnPrev:"_3XK_S",toolbar:"_2VO3s","lbl-flex":"fsMJZ",lblFlex:"fsMJZ","lbl-title":"_27SiK",lblTitle:"_27SiK","btn-close":"_1dR4R",btnClose:"_1dR4R","zoom-control":"_1c4ki",zoomControl:"_1c4ki","lbl-zoom":"_2BLZQ",lblZoom:"_2BLZQ","btn-zoom-in":"_1W9bh",btnZoomIn:"_1W9bh","btn-zoom-out":"izh0u",btnZoomOut:"izh0u",disabled:"_cOGm",item:"_1xQEF",positioner:"_1KuSQ",scaler:"fQHdc",nonav:"_2DDI-",animated:"_3bQ1Z",active:"_3ZJEv","zoom-in":"NbzJA",zoomIn:"NbzJA","zoom-out":"_2zMK3",zoomOut:"_2zMK3",dragging:"_3Xz8C",animating:"_2itHF",opaque:"_27-e2"}},function(e,t,n){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),i=60,l=function(){function e(t,n){a(this,e),this.src=t.getAttribute("src"),this.reference=t.getAttribute("data-reference"),this.height=t.naturalHeight,this.width=t.naturalWidth,this.viewportWidth=window.innerWidth,this.viewportHeight=window.innerHeight-i,this.title=s(t),this.opacity=1,this.paddings={top:30,right:80,bottom:30,left:80},this.drag_={event:null,item:null},this.updater_=n,this.animating_=!1,this.animationSafatyTimer_=null,this.animationCallback_=null,this.fit_=null,this.current=o({},this.fit),this.startAnimatedChange=this.startAnimatedChange.bind(this),this.stopAnimatedChange=this.stopAnimatedChange.bind(this)}return r(e,[{key:"startDragging",value:function(e,t){return!this.drag_.event&&!this.drag_.img&&(this.drag_={event:{x:e,y:t},img:this.current.center},!0)}},{key:"stopDragging",value:function(){return!(!this.drag_.event&&!this.drag_.img)&&(this.drag_={event:null,img:null},this.rebalance(),!0)}},{key:"drag",value:function(e,t){if(!this.drag_.event||!this.drag_.img)return!1;var n=this.drag_.event.x-e,a=this.drag_.event.y-t;return this.current={scale:this.current.scale,center:{x:this.drag_.img.x-n,y:this.drag_.img.y-a}},!0}},{key:"deltaScale",value:function(e,t,n){var a=Math.max(this.fit.scale,Math.min(1,this.current.scale*(1+-e/500))),o=this.current,r=o.scale,i=o.center;return a!==r&&(this.current={scale:a,center:this.recalculateBoundedCenter({scale:a,center:i})},!0)}},{key:"clickScale",value:function(e){if(e>0&&!this.zoomInEnabled||e<0&&!this.zoomOutEnabled)return!1;var t=this.fit.scale,n=this.current,a=n.scale,o=n.center,r=1-t,i=r/4,l=Math.round((a-t)/i+e)*i+t,s=Math.max(t,Math.min(1,l));return this.startAnimatedChange({scale:s,center:this.recalculateBoundedCenter({scale:s,center:o})}),!0}},{key:"recalculateOriginTransform",value:function(e){var t=e.getBoundingClientRect();return{scale:Math.min(t.height/this.height,t.width/this.width),center:{x:t.left+t.width/2-this.viewportWidth/2,y:t.top+t.height/2-this.viewportHeight/2-i}}}},{key:"recalculateBoundedCenter",value:function(e){var t=e.center,n=t.x,a=t.y,o=this.width*e.scale,r=this.height*e.scale;if(this.viewportWidth>o)n=0;else{var i=(o-this.viewportWidth)/2;n=Math.max(-i,Math.min(i,n))}if(this.viewportHeight>r)a=0;else{var l=(r-this.viewportHeight)/2;a=Math.max(-l,Math.min(l,a))}return{x:n,y:a}}},{key:"resize",value:function(){this.viewportWidth=window.innerWidth,this.viewportHeight=window.innerHeight-i;var e=this.fit_.scale,t=this.current.scale;this.fit_=null;var n=this.fit.scale,a=e===t?n:t<n?Math.max(t,n):t,o=this.current.center;this.startAnimatedChange({scale:a,center:this.recalculateBoundedCenter({scale:a,center:o})})}},{key:"rebalance",value:function(){var e=this.recalculateBoundedCenter(this.current),t=this.current.scale<this.fit.scale?this.fit.scale:this.current.scale;e.x===this.current.center.x&&e.y===this.current.center.y&&t===this.current.scale||this.startAnimatedChange({scale:t,center:e})}},{key:"stopAnimatedChange",value:function(){this.animating_&&(this.animating_=!1,this.updater_(this),this.animationCallback_&&this.animationCallback_()),this.animationCallback_=null}},{key:"startAnimatedChange",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;setTimeout(function(){clearTimeout(t.animationSafatyTimer_),t.animationSafatyTimer_=setTimeout(function(){t.stopAnimatedChange()},300),t.animationCallback_=a,t.current=e,t.opacity=n,t.animating_=!0,t.updater_(t)},10)}},{key:"animating",get:function(){return this.animating_}},{key:"zoomable",get:function(){return this.fit.scale<1}},{key:"zoomInEnabled",get:function(){return this.current.scale<1}},{key:"zoomOutEnabled",get:function(){return this.current.scale>this.fit.scale}},{key:"fit",get:function(){if(!this.fit_){var e=this.viewportWidth-this.paddings.left-this.paddings.right,t=this.viewportHeight-this.paddings.top-this.paddings.bottom,n=1;(t<this.height||e<this.width)&&(n=Math.min(t/this.height,e/this.width)),this.fit_={scale:n,center:{x:0,y:0}}}return this.fit_}}],[{key:"ToolbarHeight",get:function(){return i}},{key:"AnimationSafetyInterval",get:function(){return 300}}]),e}();t.default=l;var s=function(e){var t=e.getAttribute("data-title")||e.getAttribute("data-filename")||null;if(t)return t;var n=(e.getAttribute("data-type")||"").match(/\/(jpe?g|png|tiff|bmp|gif)$/);return"Untitled"+(n?"."+n[1]:"")}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),r=a(o),i=n(1),l=n(26),s=a(l),u=function(e){var t=e.zoom,n=e.zoomInEnabled,a=e.zoomIn,o=e.zoomOutEnabled,l=e.zoomOut;return r.default.createElement("div",{className:s.default.zoomControl},r.default.createElement("button",{className:(0,i.css)(s.default.btnZoomIn,!o&&s.default.disabled),onClick:l},"-"),r.default.createElement("span",{className:s.default.lblZoom},(100*t|0)+"%"),r.default.createElement("button",{className:(0,i.css)(s.default.btnZoomIn,!n&&s.default.disabled),onClick:a},"+"))};t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"YCLVq",use:"YCLVq-usage",viewBox:"0 0 20 34",content:'<symbol viewBox="0 0 20 34" id="YCLVq">\n    <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n        <g transform="translate(-19.000000, -13.000000)">\n            <polyline stroke="#000000" stroke-width="3" transform="translate(30.000000, 30.000000) rotate(90.000000) translate(-30.000000, -30.000000) " points="14 38 30.0000003 22 46 38" />\n        </g>\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"-BRGz",use:"-BRGz-usage",viewBox:"0 0 20 34",content:'<symbol viewBox="0 0 20 34" id="-BRGz">\n    <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n        <g transform="translate(-19.000000, -13.000000)">\n            <polyline stroke="#000000" stroke-width="3" transform="translate(30.000000, 30.000000) rotate(-90.000000) translate(-30.000000, -30.000000) " points="14 38 30.0000003 22 46 38" />\n        </g>\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"zUy_u",use:"zUy_u-usage",viewBox:"0 0 18 18",content:'<symbol viewBox="0 0 18 18" id="zUy_u">\n    <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n        <g transform="translate(-11.000000, -11.000000)">\n            <g transform="translate(20.000000, 20.000000) rotate(-135.000000) translate(-20.000000, -20.000000) translate(9.000000, 9.000000)" fill="#000000">\n                <rect x="10" y="-9.05941988e-14" width="2" height="22" />\n                <rect transform="translate(11.000000, 11.000000) rotate(-90.000000) translate(-11.000000, -11.000000) " x="10" y="1.72306613e-13" width="2" height="22" />\n            </g>\n        </g>\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),c=a(u),d=n(12),p=a(d),f=n(9),m=a(f),h=n(6),v=a(h),g=n(13),y=a(g),b=n(41),x=a(b),_=n(1),k=n(198),w=a(k),C=n(199),E=a(C),T=n(200),O=a(T),S=n(201),P=a(S),M=n(202),L=a(M),N=n(203),j=a(N),A=n(204),D=a(A),R=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={collapsed:"true"===localStorage.getItem("statusbarCollapsed"),tooltip:null,tooltipUserId:null,tooltipPinned:!1},n.handleCollapse=n.handleCollapse.bind(n),n.handleVersionMouseDown=n.handleVersionMouseDown.bind(n),n.handleVersionDoubleClick=n.handleVersionDoubleClick.bind(n),n.handleMouseOut=n.handleMouseOut.bind(n),n.handleTooltipDismiss=n.handleTooltipDismiss.bind(n),n}return i(t,e),s(t,[{key:"_renderTooltip",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=function(){return e&&t.setState({tooltip:e,tooltipUserId:n,tooltipPinned:a})};this.state.tooltip?this.setState({tooltip:null,tooltipUserId:null,tooltipPinned:!1},o):o()}},{key:"setGlobalExpandedClass",value:function(e){document.querySelector("en-components").classList.toggle("statusbarvisible",!e)}},{key:"handleMouseOverAction",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:6;this._renderTooltip(c.default.createElement(y.default,{rect:(0,_.rect)(e.target,{y:n})},t))}},{key:"handleVersionMouseDown",value:function(e){if(e.altKey&&e.metaKey)return void e.preventDefault();if(!this.state.tooltipPinned){document.body.addEventListener("mousedown",this.handleTooltipDismiss);var t=c.default.createElement(y.default,{rect:(0,_.rect)(e.target,{y:-3})},c.default.createElement("div",{className:D.default.features},this.props.features.map(function(e,t){var n=e.name,a=e.handler,o=e.checked,r="feature_"+t;return c.default.createElement("div",{key:r},c.default.createElement("input",{type:"checkbox",id:r,defaultChecked:o,onChange:function(e){var t=e.target;return a(t.checked)}}),c.default.createElement("label",{htmlFor:r},n))})));this._renderTooltip(t,null,!0)}}},{key:"handleVersionDoubleClick",value:function(e){var t=this.props.actions;e.altKey&&e.metaKey&&t&&t.debug&&t.debug()}},{key:"handleMouseOverUser",value:function(e,t,n){var a=c.default.createElement(x.default,{rect:(0,_.rect)(e.target),user:n?l({},t,{name:t.name+" (you)"}):t});this._renderTooltip(a,t.id)}},{key:"handleMouseOut",value:function(){this.state.tooltip&&!this.state.tooltipPinned&&this._renderTooltip()}},{key:"handleCollapse",value:function(e){e.preventDefault();var t=!this.state.collapsed;localStorage.setItem("statusbarCollapsed",t),this.setState({collapsed:t}),this.setGlobalExpandedClass(t)}},{key:"handleTooltipDismiss",value:function(e){!this.state.tooltipPinned||e&&e.target.closest("."+D.default.features)||(e&&(e.stopPropagation(),this._renderTooltip()),document.body.removeEventListener("mousedown",this.handleTooltipDismiss))}},{key:"componentWillReceiveProps",value:function(e){var t=e.users,n=void 0===t?[]:t,a=this.state.tooltipUserId;a&&!n.find(function(e){return e.id===a})&&this._renderTooltip()}},{key:"componentDidMount",value:function(){this.setGlobalExpandedClass(this.state.collapsed)}},{key:"componentWillUnmount",value:function(){this.handleTooltipDismiss()}},{key:"renderActions",value:function(){var e=this,t=this.props.actions,n=void 0===t?{}:t;return c.default.createElement("div",{className:D.default.actions},n.archive&&c.default.createElement("div",{onMouseDown:n.archive,onMouseOver:function(t){return e.handleMouseOverAction(t,"Open comment archive")},onMouseOut:this.handleMouseOut,className:D.default.action},c.default.createElement(v.default,{svg:j.default})))}},{key:"renderUsers",value:function(){var e=this,t=this.props.users,n=void 0===t?[]:t;return n.length>0?c.default.createElement(f.AvatarGroup,{className:D.default.avatars},n.map(function(t,a){return c.default.createElement(m.default,l({},t,{key:a,onMouseOver:function(o){return e.handleMouseOverUser(o,t,a===n.length-1)},onMouseOut:e.handleMouseOut}))})):null}},{key:"renderState",value:function(e){var t=this,n=e.svg,a=e.title,o=e.cls;return n?c.default.createElement("div",{className:o,onMouseOver:function(e){return t.handleMouseOverAction(e,a,2)},onMouseOut:this.handleMouseOut},c.default.createElement(v.default,{svg:n})):null}},{key:"render",value:function(){var e=this.props,t=e.actions,n=void 0===t?{}:t,a=e.version,o=e.features,r=this.state,i=r.tooltip,l=r.collapsed,s=(0,_.css)("statusbarcontainer",D.default.realtime,l&&D.default.collapsed);return c.default.createElement("div",{className:s},c.default.createElement("div",{className:D.default.expander,onClick:this.handleCollapse},c.default.createElement("div",{className:D.default.direction})),this.renderActions(),this.renderUsers(),this.renderState(I(this.props)),this.renderState(F(this.props)),c.default.createElement("div",{className:(0,_.css)(D.default.version,o&&D.default.clickable),onMouseDown:this.handleVersionMouseDown,onDoubleClick:n.debug&&this.handleVersionDoubleClick},a),i)}}]),t}(u.PureComponent);t.default=R,R.propTypes={actions:p.default.objectOf(p.default.func),features:p.default.arrayOf(p.default.shape({name:p.default.string.isRequired,handler:p.default.func.isRequired,checked:p.default.bool})),users:p.default.array,version:p.default.string.isRequired,realtime:p.default.bool,loading:p.default.bool,error:p.default.bool,readonly:p.default.bool,dirty:p.default.bool,focus:p.default.bool};var I=function(e){var t=e.loading,n=e.error;if(!e.realtime)return{};var a=(0,_.css)(D.default.status,D.default.rte,t&&!n&&D.default.loading);return n?{cls:a,svg:O.default,title:"Error, note can't connect to the Evernote service"}:t?{cls:a,svg:L.default,title:"Syncing your precious data..."}:{cls:a,svg:P.default,title:"All good! RTE is up and data's been synced"}},F=function(e){var t=e.dirty,n=e.readonly,a=e.focus,o=(0,_.css)(D.default.status,D.default.ce,t&&D.default.dirty,a&&D.default.focus),r=n?E.default:w.default,i=[a&&"focused",t&&"changed",n?"readonly":"editable"].filter(Boolean),l=i.pop();return{cls:o,svg:r,title:"Content is "+(i.length?i.join(", ")+" and "+l:l)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"1n7n8",use:"1n7n8-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="1n7n8">\n    <path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" />\n    <path d="M0 0h24v24H0z" fill="none" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"2urSK",use:"2urSK-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="2urSK">\n    <path d="M0 0h24v24H0z" fill="none" />\n    <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"1dfhb",use:"1dfhb-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="1dfhb">\n    <path d="M8.89949494,17.0968018 C7.10609083,16.0593735 5.89949494,14.120342 5.89949494,11.8994949 C5.89949494,9.67864787 7.10609083,7.73961637 8.89949494,6.70218811 L8.89949494,17.0968018 Z M14.8994949,6.70218811 C16.692899,7.73961637 17.8994949,9.67864787 17.8994949,11.8994949 C17.8994949,14.120342 16.692899,16.0593735 14.8994949,17.0968018 L14.8994949,6.70218811 Z M10.8994949,3.89949494 L12.8994949,3.89949494 L12.8994949,19.8994949 L10.8994949,19.8994949 L10.8994949,3.89949494 Z" fill="#FF776D" transform="translate(11.899495, 11.899495) rotate(-315.000000) translate(-11.899495, -11.899495) " />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"2YX07",use:"2YX07-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="2YX07">\n    <path d="M10.6390873,17.5533009 L10.6213203,17.5710678 L6.02512627,12.9748737 C4.65829124,11.6080387 4.65829124,9.39196129 6.02512627,8.02512627 L6.02512627,8.02512627 L6.02512627,8.02512627 C7.39196129,6.65829124 9.60803871,6.65829124 10.9748737,8.02512627 L10.9748737,8.02512627 L11.5606602,8.6109127 L12.1464466,8.02512627 L12.1464466,8.02512627 C13.5132816,6.65829124 15.7293591,6.65829124 17.0961941,8.02512627 L17.0961941,8.02512627 L17.0961941,8.02512627 C18.4630291,9.39196129 18.4630291,11.6080387 17.0961941,12.9748737 L12.5,17.5710678 L12.482233,17.5533009 L12.267767,17.767767 C11.8772427,18.1582912 11.2440777,18.1582912 10.8535534,17.767767 L10.6390873,17.5533009 Z" fill="#CEDC00" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"1-u9S",use:"1-u9S-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="1-u9S">\n    <path d="M12,6 C15.3137085,6 18,8.6862915 18,12 C18,15.3137085 15.3137085,18 12,18 L12,16 C14.209139,16 16,14.209139 16,12 C16,9.790861 14.209139,8 12,8 C9.790861,8 8,9.790861 8,12 L6,12 C6,8.6862915 8.6862915,6 12,6 Z" fill="#FFD16D" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"2d8uh",use:"2d8uh-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="2d8uh">\n    <path d="M20.54 5.23l-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27zM12 17.5L6.5 12H10v-2h4v2h3.5L12 17.5zM5.12 5l.81-1h12l.94 1H5.12z" />\n    <path d="M0 0h24v24H0z" fill="none" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){var a=n(205);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,'._2LOZo{position:fixed;bottom:0;left:0;right:0;height:44px;background-color:hsla(0,0%,100%,.95);z-index:2147480640;display:-webkit-flex;display:flex;padding:0 14px;-webkit-align-items:center;align-items:center;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial;color:#848484;font-size:12px;transition:box-shadow .3s ease-in-out,-webkit-transform .3s ease-in-out;transition:transform .3s ease-in-out,box-shadow .3s ease-in-out;transition:transform .3s ease-in-out,box-shadow .3s ease-in-out,-webkit-transform .3s ease-in-out;box-shadow:0 0 2px #bbb}._2LOZo._3-_F1{-webkit-transform:translateY(44px);transform:translateY(44px);box-shadow:none}._2LOZo._3-_F1 ._1JgKV:hover ._2MoyB:before{-webkit-transform:rotate(-40deg);transform:rotate(-40deg)}._2LOZo._3-_F1 ._1JgKV:hover ._2MoyB:after{-webkit-transform:rotate(40deg);transform:rotate(40deg)}.fullsize ._2LOZo{display:none}._1JgKV{position:absolute;top:-16px;left:0;right:0;height:16px;pointer-events:auto;cursor:pointer;transition:opacity .2s ease-in-out .1s;opacity:0}._1JgKV:hover{opacity:1}._1JgKV:hover ._2MoyB:before{-webkit-transform:rotate(40deg);transform:rotate(40deg)}._1JgKV:hover ._2MoyB:after{-webkit-transform:rotate(-40deg);transform:rotate(-40deg)}._1JgKV:before{content:"";position:absolute;height:2px;background-color:#00db3b;left:0;right:0;bottom:0}._1JgKV ._2MoyB{position:relative;left:calc(50% - 18px);width:36px;background:none;border:none;color:transparent;height:16px;bottom:0;display:inline-block}._1JgKV ._2MoyB:after,._1JgKV ._2MoyB:before{content:"";background-color:#00db3b;width:8px;border-radius:16px;height:2px;position:absolute;top:6px;opacity:1;transition:-webkit-transform .3s ease-in-out .4s;transition:transform .3s ease-in-out .4s;transition:transform .3s ease-in-out .4s,-webkit-transform .3s ease-in-out .4s;-webkit-transform:rotate(0deg);transform:rotate(0deg)}._1JgKV ._2MoyB:before{left:11px;-webkit-transform-origin:7px 1px;transform-origin:7px 1px}._1JgKV ._2MoyB:after{left:17px;-webkit-transform-origin:1px 1px;transform-origin:1px 1px}.gzuZ4{-webkit-flex:0 0 auto;flex:0 0 auto}.gzuZ4._2pFS5{cursor:pointer;pointer-events:auto}.N_Eru{-webkit-flex:1 0 auto;flex:1 0 auto;padding:0 12px 0 0;display:-webkit-flex;display:flex}.N_Eru ._3581_{-webkit-flex:0 0 auto;flex:0 0 auto;width:36px;height:36px;padding:8px;cursor:pointer;pointer-events:auto}.N_Eru ._3581_:hover{color:#00a82d}.N_Eru ._3581_ svg{pointer-events:none;fill:currentColor;position:relative;top:-1px}._27oOC{padding:0 4px 0 12px}._15ty_{-webkit-flex:0 0 auto;flex:0 0 auto;height:24px;width:30px;padding:0 3px;pointer-events:auto}._15ty_ svg{width:24px;height:24px;pointer-events:none}._15ty_._1b7Xd.XzAK1 svg{-webkit-animation:_36_Zs 1.1s linear infinite;animation:_36_Zs 1.1s linear infinite}._15ty_._9xF5n svg{width:15px;fill:#a9a9a9;opacity:.4}._15ty_._9xF5n._12UL0 svg{fill:#fdcf74}._15ty_._9xF5n._39zTn svg{opacity:1}._2mQjH{padding:2px 2px 2px 0}._2mQjH div{pointer-events:auto;height:24px;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}._2mQjH input[type=checkbox]{-webkit-flex:0 0 auto;flex:0 0 auto;cursor:pointer}._2mQjH label{-webkit-flex:1 0 auto;flex:1 0 auto;margin-left:6px;cursor:pointer}@-webkit-keyframes _36_Zs{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes _36_Zs{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}',""]),t.locals={realtime:"_2LOZo",collapsed:"_3-_F1",expander:"_1JgKV",direction:"_2MoyB",version:"gzuZ4",clickable:"_2pFS5",actions:"N_Eru",action:"_3581_",avatars:"_27oOC",status:"_15ty_",rte:"_1b7Xd",loading:"XzAK1",spin:"_36_Zs",ce:"_9xF5n",dirty:"_12UL0",focus:"_39zTn",features:"_2mQjH"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(1),d=n(207),p=a(d),f=n(42),m=a(f),h=function(e){function t(e){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return i(t,e),l(t,[{key:"render",value:function(){var e=this.props.starData,t=(0,c.css)("aisuggestcontainer",m.default.aisuggest);return e?u.default.createElement("div",{className:t},e.map(function(e,t){return u.default.createElement("div",{key:t},u.default.createElement(p.default,{accepted:e.accepted,data:e.data,domTarget:e.domTarget,top:e.top}))})):null}}]),t}(s.Component);t.default=h},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(6),d=a(c),p=n(208),f=a(p),m=n(1),h=n(214),v=a(h),g=n(216),y=a(g),b=n(217),x=a(b),_=n(42),k=a(_),w=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={tooltip:null,approved:e.accepted,domTarget:e.domTarget},n.closeTooltip=n.closeTooltip.bind(n),n}return i(t,e),l(t,[{key:"closeTooltip",value:function(){this.setState({tooltip:null})}},{key:"setApprovedState",value:function(e){this.setState({approved:e});null!=this.state.domTarget&&(null==e?this.state.domTarget.removeAttribute("data-ai-autosuggest-accepted"):this.state.domTarget.setAttribute("data-ai-autosuggest-accepted",!!e))}},{key:"generateInitials",value:function(e){var t=e.match(/\b\w/g)||[];return t=((t.shift()||"")+(t.pop()||"")).toUpperCase()}},{key:"handleMouseClick",value:function(e){if(null==this.state.tooltip){var t=this.props.data,n={title:"Task Suggestion",name:t.person||"Name Here",position:"Author",email:t.email||"email@website.com",color:(0,v.default)({seed:t.person||t.email||"EVERNOTE",luminosity:"dark"}),initial:t.person?this.generateInitials(t.person):"NA"},a=u.default.createElement(f.default,{starRef:this,rect:(0,m.rect)(e.target,{y:6}),data:n},n.name);this.setState({tooltip:a})}}},{key:"handleMouseOut",value:function(){}},{key:"render",value:function(){var e=this,t=this,n=[k.default.magicStar],a=y.default;return!0===this.state.approved&&(a=x.default,n.push(k.default.approved)),!1!==this.state.approved&&this.props.top>=1?u.default.createElement("div",{style:{top:t.props.top-6},className:n.join(" "),onClick:function(t){return e.handleMouseClick(t)},onMouseOut:function(){return e.handleMouseOut()}},u.default.createElement(d.default,{svg:a}),null!=this.state.tooltip&&this.state.tooltip):null}}]),t}(s.Component);t.default=w},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),u=n(0),c=a(u),d=n(9),p=a(d),f=n(13),m=a(f),h=n(209),v=a(h),g=n(212),y=a(g),b=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.approveClicked=n.approveClicked.bind(n),n.denyClicked=n.denyClicked.bind(n),n}return i(t,e),s(t,[{key:"approveClicked",value:function(){this.props.starRef.closeTooltip(),this.props.starRef.setApprovedState(!0)}},{key:"denyClicked",value:function(){this.props.starRef.closeTooltip(),this.props.starRef.setApprovedState(!1)}},{key:"render",value:function(){var e=this.props,t=e.data,n=e.rect;e.starRef;return c.default.createElement(m.default,{rect:n,className:y.default.tooltip},c.default.createElement("div",{className:y.default.title},t.title,c.default.createElement("span",{className:y.default.emote},"🙌")),c.default.createElement(p.default,l({className:y.default.avatar},t)),c.default.createElement("span",{className:y.default.author},t.name,t.position&&c.default.createElement("span",{className:y.default.dim},"• ",t.position)),t.email&&c.default.createElement("span",{className:y.default.email},t.email),c.default.createElement("div",{className:y.default.buttons},c.default.createElement("div",{className:y.default.accept},"Accept?"),c.default.createElement(v.default,{text:"✓",clickHandler:this.approveClicked}),c.default.createElement(v.default,{text:"✗",clickHandler:this.denyClicked})))}}]),t}(u.Component);t.default=b},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(210),d=a(c),p=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleMouseDown=n.handleMouseDown.bind(n),n}return i(t,e),l(t,[{key:"handleMouseDown",value:function(e){e.preventDefault()}},{key:"render",value:function(){return u.default.createElement("div",{className:d.default.button,onMouseDown:this.handleMouseDown,onClick:this.props.clickHandler},this.props.text)}}]),t}(s.Component);t.default=p},function(e,t,n){var a=n(211);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._3ceWn{display:inline-block;transition:box-shadow .2s ease-in-out;pointer-events:auto;cursor:pointer;padding:4px 8px}._3ceWn:hover{box-shadow:0 0 4px 0 rgba(0,0,0,.18);color:rgba(206,220,0,.8)}._3ceWn:active{background:rgba(0,0,0,.18);color:#cedc00}",""]),t.locals={button:"_3ceWn"}},function(e,t,n){var a=n(213);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._1CoEx{min-height:42px;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center;pointer-events:auto;cursor:default;padding:4px}._1CoEx .kt0xb{font-size:14px;font-variant:small-caps;padding:6px 10px 6px 40px;color:#cedc00}._1CoEx ._3OASj{font-size:20px;margin-left:12px}._1CoEx ._2-otr,._1CoEx .mG3Vw{-webkit-flex:0 0 auto;flex:0 0 auto;padding:0 10px 0 40px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#fff}._1CoEx .mG3Vw ._2_h1B{color:#c3c3c3;padding-left:4px}._1CoEx ._2-otr{font-size:12px;color:#c3c3c3}._1CoEx ._2eibB{position:absolute;top:46px;left:8px}._2KjJ0{margin-top:8px;text-align:right}.YXCoX{position:absolute;bottom:9px;left:45px;font-size:12px;color:#c3c3c3}",""]),t.locals={tooltip:"_1CoEx",title:"kt0xb",emote:"_3OASj",author:"mG3Vw",email:"_2-otr",dim:"_2_h1B",avatar:"_2eibB",buttons:"_2KjJ0",accept:"YXCoX"}},function(e,t,n){(function(e){!function(n,a){var o=a();"object"==typeof e&&e&&e.exports&&(t=e.exports=o),t.randomColor=o}(0,function(){function e(e){var t=r(e.hue),n=s(t);return n<0&&(n=360+n),n}function t(e,t){if("monochrome"===t.hue)return 0;if("random"===t.luminosity)return s([0,100]);var n=i(e),a=n[0],o=n[1];switch(t.luminosity){case"bright":a=55;break;case"dark":a=o-10;break;case"light":o=55}return s([a,o])}function n(e,t,n){var a=o(e,t),r=100;switch(n.luminosity){case"dark":r=a+20;break;case"light":a=(r+a)/2;break;case"random":a=0,r=100}return s([a,r])}function a(e,t){switch(t.format){case"hsvArray":return e;case"hslArray":return f(e);case"hsl":var n=f(e);return"hsl("+n[0]+", "+n[1]+"%, "+n[2]+"%)";case"hsla":var a=f(e),o=t.alpha||Math.random();return"hsla("+a[0]+", "+a[1]+"%, "+a[2]+"%, "+o+")";case"rgbArray":return d(e);case"rgb":return"rgb("+d(e).join(", ")+")";case"rgba":var r=d(e),o=t.alpha||Math.random();return"rgba("+r.join(", ")+", "+o+")";default:return u(e)}}function o(e,t){for(var n=l(e).lowerBounds,a=0;a<n.length-1;a++){var o=n[a][0],r=n[a][1],i=n[a+1][0],s=n[a+1][1];if(t>=o&&t<=i){var u=(s-r)/(i-o);return u*t+(r-u*o)}}return 0}function r(e){if("number"==typeof parseInt(e)){var t=parseInt(e);if(t<360&&t>0)return[t,t]}if("string"==typeof e)if(v[e]){var n=v[e];if(n.hueRange)return n.hueRange}else if(e.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i)){var a=p(e)[0];return[a,a]}return[0,360]}function i(e){return l(e).saturationRange}function l(e){e>=334&&e<=360&&(e-=360);for(var t in v){var n=v[t];if(n.hueRange&&e>=n.hueRange[0]&&e<=n.hueRange[1])return v[t]}return"Color not found"}function s(e){if(null===h)return Math.floor(e[0]+Math.random()*(e[1]+1-e[0]));var t=e[1]||1,n=e[0]||0;h=(9301*h+49297)%233280;var a=h/233280;return Math.floor(n+a*(t-n))}function u(e){function t(e){var t=e.toString(16);return 1==t.length?"0"+t:t}var n=d(e);return"#"+t(n[0])+t(n[1])+t(n[2])}function c(e,t,n){var a=n[0][0],o=n[n.length-1][0],r=n[n.length-1][1],i=n[0][1];v[e]={hueRange:t,lowerBounds:n,saturationRange:[a,o],brightnessRange:[r,i]}}function d(e){var t=e[0];0===t&&(t=1),360===t&&(t=359),t/=360;var n=e[1]/100,a=e[2]/100,o=Math.floor(6*t),r=6*t-o,i=a*(1-n),l=a*(1-r*n),s=a*(1-(1-r)*n),u=256,c=256,d=256;switch(o){case 0:u=a,c=s,d=i;break;case 1:u=l,c=a,d=i;break;case 2:u=i,c=a,d=s;break;case 3:u=i,c=l,d=a;break;case 4:u=s,c=i,d=a;break;case 5:u=a,c=i,d=l}return[Math.floor(255*u),Math.floor(255*c),Math.floor(255*d)]}function p(e){e=e.replace(/^#/,""),e=3===e.length?e.replace(/(.)/g,"$1$1"):e;var t=parseInt(e.substr(0,2),16)/255,n=parseInt(e.substr(2,2),16)/255,a=parseInt(e.substr(4,2),16)/255,o=Math.max(t,n,a),r=o-Math.min(t,n,a),i=o?r/o:0;switch(o){case t:return[(n-a)/r%6*60||0,i,o];case n:return[60*((a-t)/r+2)||0,i,o];case a:return[60*((t-n)/r+4)||0,i,o]}}function f(e){var t=e[0],n=e[1]/100,a=e[2]/100,o=(2-n)*a;return[t,Math.round(n*a/(o<1?o:2-o)*1e4)/100,o/2*100]}function m(e){for(var t=0,n=0;n!==e.length&&!(t>=Number.MAX_SAFE_INTEGER);n++)t+=e.charCodeAt(n);return t}var h=null,v={};!function(){c("monochrome",null,[[0,0],[100,0]]),c("red",[-26,18],[[20,100],[30,92],[40,89],[50,85],[60,78],[70,70],[80,60],[90,55],[100,50]]),c("orange",[19,46],[[20,100],[30,93],[40,88],[50,86],[60,85],[70,70],[100,70]]),c("yellow",[47,62],[[25,100],[40,94],[50,89],[60,86],[70,84],[80,82],[90,80],[100,75]]),c("green",[63,178],[[30,100],[40,90],[50,85],[60,81],[70,74],[80,64],[90,50],[100,40]]),c("blue",[179,257],[[20,100],[30,86],[40,80],[50,74],[60,60],[70,52],[80,44],[90,39],[100,35]]),c("purple",[258,282],[[20,100],[30,87],[40,79],[50,70],[60,65],[70,59],[80,52],[90,45],[100,42]]),c("pink",[283,334],[[20,100],[30,90],[40,86],[60,84],[80,80],[90,75],[100,73]])}();var g=function(o){if(o=o||{},void 0!==o.seed&&null!==o.seed&&o.seed===parseInt(o.seed,10))h=o.seed;else if("string"==typeof o.seed)h=m(o.seed);else{if(void 0!==o.seed&&null!==o.seed)throw new TypeError("The seed value must be an integer or string");h=null}var r,i,l;if(null!==o.count&&void 0!==o.count){var s=o.count,u=[];for(o.count=null;s>u.length;)h&&o.seed&&(o.seed+=1),u.push(g(o));return o.count=s,u}return r=e(o),i=t(r,o),l=n(r,i,o),a([r,i,l],o)};return g})}).call(t,n(215)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"1o9C4",use:"1o9C4-usage",viewBox:"0 0 82 82",content:'<symbol viewBox="0 0 82 82" id="1o9C4">\n    <g id="1o9C4_magic-star" stroke-linecap="round" fill="#FFFFFF" stroke="#000000" stroke-width="4">\n        <g id="1o9C4_Group" transform="translate(4.000000, 5.000000)">\n            <path d="M2.5,1.5 L17.5,16.5" id="1o9C4_Line" />\n            <path d="M21.5,0.5 L36.5,15.5" id="1o9C4_Line" />\n            <polygon id="1o9C4_Star-1" stroke-linejoin="round" transform="translate(47.546507, 46.294079) rotate(27.000000) translate(-47.546507, -46.294079) " points="47.5465066 58.5953289 32.26409 67.3285207 35.8473226 50.0953742 22.8190371 38.259637 40.3160132 36.3421586 47.5465066 20.2940789 54.7769999 36.3421586 72.273976 38.259637 59.2456905 50.0953742 62.8289231 67.3285207 " />\n            <path d="M0.5,18.5 L17.5,35.5" id="1o9C4_Line" />\n        </g>\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"z8EwK",use:"z8EwK-usage",viewBox:"0 0 82 82",content:'<symbol viewBox="0 0 82 82" id="z8EwK">\n    <g id="z8EwK_magic-star-green" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n        <g id="z8EwK_magic-star" stroke-linecap="round" stroke="#CEDC00" stroke-width="4">\n            <g id="z8EwK_Group" transform="translate(4.000000, 5.000000)">\n                <path d="M2.5,1.5 L17.5,16.5" id="z8EwK_Line" />\n                <path d="M21.5,0.5 L36.5,15.5" id="z8EwK_Line" />\n                <polygon id="z8EwK_Star-1" stroke-linejoin="round" transform="translate(47.546507, 46.294079) rotate(27.000000) translate(-47.546507, -46.294079) " points="47.5465066 58.5953289 32.26409 67.3285207 35.8473226 50.0953742 22.8190371 38.259637 40.3160132 36.3421586 47.5465066 20.2940789 54.7769999 36.3421586 72.273976 38.259637 59.2456905 50.0953742 62.8289231 67.3285207 " />\n                <path d="M0.5,18.5 L17.5,35.5" id="z8EwK_Line" />\n            </g>\n        </g>\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._3u1DS{display:block}._3-aAe{position:absolute;top:-100px;left:8px;width:28px;height:28px;cursor:pointer;pointer-events:auto;border-radius:5px;opacity:1;transition:opacity .2s ease-in-out,box-shadow .2s ease-in-out}._3-aAe._6mHQ9{pointer-events:none}._3-aAe._6mHQ9 svg{opacity:1}._3-aAe._6mHQ9:hover{box-shadow:none}._3-aAe._6mHQ9:hover svg{opacity:1}._3-aAe svg{opacity:.25;transition:opacity .2s ease-in-out;width:24px;height:24px;margin:3px 1px 1px 3px}._3-aAe:hover{box-shadow:0 0 4px 0 rgba(0,0,0,.18)}._3-aAe:hover svg{opacity:.5}._3-aAe:active{background:rgba(0,0,0,.18)}@-webkit-keyframes _3fkBl{0%{background:rgba(206,220,0,0)}10%{background:rgba(206,220,0,.4)}80%{background:rgba(206,220,0,.3)}90%{background:rgba(206,220,0,.15)}to{background:rgba(206,220,0,0)}}[data-ai-autosuggest-accepted=true]{-webkit-animation:_3fkBl 5s ease-in-out}",""]),t.locals={aisuggest:"_3u1DS","magic-star":"_3-aAe",magicStar:"_3-aAe",approved:"_6mHQ9","flash-bg-green":"_3fkBl",flashBgGreen:"_3fkBl"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.menu=t.MenuContainer=void 0;var o=n(220),r=a(o),i=n(27),l=a(i);t.MenuContainer=r.default,t.menu=l.default},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(1),d=n(221),p=a(d),f=n(223),m=a(f),h=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={menus:[]},n.counter=0,n.cleanup=n.cleanup.bind(n),n.create=n.create.bind(n),n.dismiss=n.dismiss.bind(n),n}return i(t,e),l(t,[{key:"cleanup",value:function(e){var t=this.state.menus,n=t.find(function(t){return t.id===e});return!!n&&(t.splice(t.indexOf(n),1),this.setState({menus:t}),!0)}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.counter+=1,e.id=this.counter,e.enabled=!0,this.setState({menus:this.state.menus.concat([e])}),e.id}},{key:"isOpen",value:function(e){var t=this.state.menus,n=t.find(function(t){return t.id===e});return!(!n||!n.enabled)}},{key:"dismiss",value:function(e){var t=this.state.menus,n=t.find(function(t){return t.id===e});return!!n&&(n.enabled=!1,this.setState({menus:t}),!0)}},{key:"componentDidMount",value:function(){c.ReactInvokeBridge.mount("menu",this)}},{key:"componentWillUnmount",value:function(){c.ReactInvokeBridge.mount("menu")}},{key:"render",value:function(){var e=this,t=this.state.menus,n=(0,c.css)("menucontainer",p.default.container);return u.default.createElement("div",{className:n},t.map(function(t){var n=t.id,a=t.enabled,o=t.parentMenu,r=t.xPosition,i=t.yPosition,l=t.items,s=t.onClose;return u.default.createElement(m.default,{key:n,id:n,enabled:a,parentMenu:o,xPosition:r,yPosition:i,items:l,onClose:s,dismiss:e.dismiss,cleanup:e.cleanup})}))}}]),t}(s.Component);t.default=h},function(e,t,n){var a=n(222);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._3OXhe{position:absolute;left:0;top:0;right:0;bottom:0;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial;font-size:13px;overflow:hidden}.fullsize ._3OXhe{display:none}",""]),t.locals={container:"_3OXhe"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(1),d=n(27),p=a(d),f=n(224),m=a(f),h=n(226),v=a(h),g=n(231),y=a(g),b=n(43),x=a(b),_=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={enabled:!0,active:!1,focusedItem:null,xPosition:0,yPosition:0,menuHeight:null},n.activeSubmenu=null,n.menuElement=null,n.doAction=n.doAction.bind(n),n.itemIsFocusable=n.itemIsFocusable.bind(n),n.claimFocus=n.claimFocus.bind(n),n.delegateFocus=n.delegateFocus.bind(n),n.onSubmenuOpen=n.onSubmenuOpen.bind(n),n.handleBodyClick=n.handleBodyClick.bind(n),n.handleMenuClick=n.handleMenuClick.bind(n),n.handleContextMenu=n.handleContextMenu.bind(n),n.handleKeyPress=n.handleKeyPress.bind(n),n}return i(t,e),l(t,[{key:"doAction",value:function(e,t,n){var a=this.props,o=a.items,r=a.parentMenu,i=o&&o.length>e&&o[e]||{},l=i.action;"function"==typeof l&&l(t,n),this.closeMenu(!0),void 0!==r&&p.default.dismiss(r)}},{key:"closeMenu",value:function(e){var t=this.props,n=t.id,a=t.onClose;p.default.dismiss(n),"function"==typeof a&&a(e)}},{key:"itemIsFocusable",value:function(e){return(e.enabled||void 0===e.enabled)&&("colorpicker"===e.type||"item"===e.type||"submenu"===e.type)}},{key:"claimFocus",value:function(e){this.setState({focusedItem:e}),this.closeSubmenu()}},{key:"delegateFocus",value:function(e,t){var n=this.props.items,a=(this.state.focusedItem,t>0?1:-1);if(!n||!n.length||"number"!=typeof e)return!1;var o=(e+n.length)%n.length,r=0;do{o+=a,o=(o+n.length)%n.length,r+=1}while(!this.itemIsFocusable(n[o])&&r<n.length);return!!this.itemIsFocusable(n[o])&&(this.claimFocus(o),!0)}},{key:"closeSubmenu",value:function(){this.hasActiveSubmenu()&&(p.default.dismiss(this.activeSubmenu),this.activeSubmenu=null)}},{key:"hasActiveSubmenu",value:function(){if(null===this.activeSubmenu)return!1;var e=p.default.isOpen(this.activeSubmenu);return e||(this.activeSubmenu=null),e}},{key:"onSubmenuOpen",value:function(e){this.hasActiveSubmenu()&&this.activeSubmenu!==e&&this.closeSubmenu(),this.activeSubmenu=e}},{key:"handleEnable",value:function(){var e=this,t=this.props,n=t.parentMenu,a=t.xPosition,o=t.yPosition,r=t.items;void 0===n&&(this.documentOverflowY=document.scrollingElement.style.overflowY,document.scrollingElement.style.overflowY="hidden");var i=this.normalizeMenuPosition(this.menuElement,a,o);i.active=!0,this.setState(i);var l=r.filter(this.itemIsFocusable);this.claimFocus(null),setTimeout(function(){l&&l.length&&e.claimFocus(r.indexOf(l[0]))}),document.body.addEventListener("mousedown",this.handleBodyClick),this.menuElement.addEventListener("mousedown",this.handleMenuClick),document.body.addEventListener("keydown",this.handleKeyPress)}},{key:"normalizeMenuPosition",value:function(e,t,n){var a=t,o=Math.max(n,4),r=window.innerHeight,i=window.innerWidth;e.classList.add(x.default.active);var l=e.getBoundingClientRect();a+l.width+4>i&&(a=Math.max(a-l.width,4));var s=l.height;s+8>r&&(s=r-8),o+s+4>r&&(o=Math.max(r-s-4,4));var u=document.scrollingElement||document.body;return a+=u.scrollLeft,o+=u.scrollTop,e.classList.remove(x.default.active),{xPosition:a,yPosition:o,menuHeight:s!==l.height?s:null}}},{key:"handleDisable",value:function(){var e=this,t=this.props,n=t.cleanup,a=t.id,o=t.parentMenu,r=void 0===o;if(this.setState({enabled:!1}),this.claimFocus(null),r&&(document.scrollingElement.style.overflowY=this.documentOverflowY),document.body.removeEventListener("mousedown",this.handleBodyClick),this.menuElement.removeEventListener("mousedown",this.handleMenuClick),document.body.removeEventListener("keydown",this.handleKeyPress),"function"==typeof n){var i=(0,c.getTransitionEvent)();if(this.menuElement&&i){var l=function t(o){return o.target!==e.menuElement?null:(e.menuElement.removeEventListener(i,t),n(a),!0)};this.menuElement.addEventListener(i,l)}else setTimeout(function(){n(a)},1e3)}}},{key:"handleBodyClick",value:function(e){this.closeMenu()}},{key:"handleMenuClick",value:function(e){e.stopImmediatePropagation()}},{key:"handleContextMenu",value:function(e){e.preventDefault(),e.stopPropagation()}},{key:"handleKeyPress",value:function(e){var t=e.keyCode,n=this.props.parentMenu,a=void 0===n;return a&&e.preventDefault(),!this.hasActiveSubmenu()&&(27===t||!a&&37===t)&&(e.stopImmediatePropagation(),e.stopPropagation(),this.closeMenu(),!0)}},{key:"componentDidMount",value:function(){setTimeout(this.handleEnable.bind(this))}},{key:"componentWillReceiveProps",value:function(e){this.state.enabled&&!1===e.enabled&&this.handleDisable()}},{key:"render",value:function(){var e=this,t=this.state,n=t.enabled,a=t.active,o=t.focusedItem,r=t.xPosition,i=t.yPosition,l=t.menuHeight,s=this.props,d=s.id,p=s.items,f=(0,c.css)(x.default.menu,n&&!a&&x.default.intro,n&&a&&x.default.active),h={left:r,top:i,height:"number"!=typeof l||isNaN(l)?void 0:l},g=void 0;return u.default.createElement("div",{key:d,className:f,style:h,onContextMenu:this.handleContextMenu,ref:function(t){return e.menuElement=t}},p.map(function(t,n){if(void 0!==t.enabled&&!t.enabled)return null;switch(t.type){case"item":return g=t.type,u.default.createElement(v.default,{key:n,id:n,label:t.label,value:t.value,doAction:e.doAction,isFocused:n===o,claimFocus:e.claimFocus,delegateFocus:e.delegateFocus});case"colorpicker":return g=t.type,u.default.createElement(y.default,{key:n,id:n,label:t.label,value:t.value,doAction:e.doAction,isFocused:n===o,claimFocus:e.claimFocus,delegateFocus:e.delegateFocus});case"divider":return"divider"===g||null===g?null:(g=t.type,u.default.createElement(m.default,{key:n}));case"submenu":return g=t.type,u.default.createElement(v.default,{key:n,id:n,label:t.label,value:t.value,isFocused:n===o,claimFocus:e.claimFocus,delegateFocus:e.delegateFocus,parentMenu:d,submenuItems:t.items,onSubmenuOpen:e.onSubmenuOpen});default:return null}}))}}]),t}(s.Component);t.default=_},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(){return i.default.createElement("div",{className:s.default.divider})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var r=n(0),i=a(r),l=n(43),s=a(l)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._3KL1R{z-index:2147483547;cursor:default;position:absolute;padding:10px 0;max-width:280px;height:inherit;overflow-x:hidden;overflow-y:auto;outline:none;font-size:13px;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial;background:#fff;border-radius:3px;box-shadow:0 0 6px 0 rgba(0,0,0,.3);opacity:0;-webkit-transform:translateZ(0);transform:translateZ(0);transition:opacity .2s,-webkit-transform .2s;transition:transform .2s,opacity .2s;transition:transform .2s,opacity .2s,-webkit-transform .2s}._3KL1R::-webkit-scrollbar{-webkit-appearance:none}._3KL1R::-webkit-scrollbar:vertical{width:0}._3KL1R._1myTC{transition:all 0ms!important}._3KL1R._3FpgG{-webkit-transform:translateY(-10px) translateZ(0);transform:translateY(-10px) translateZ(0)}._3KL1R._1dNjk{pointer-events:auto;opacity:1;-webkit-transform:translateY(0) translateZ(0);transform:translateY(0) translateZ(0);transition:opacity .3s cubic-bezier(.215,.61,.355,1),-webkit-transform .3s cubic-bezier(.215,.61,.355,1);transition:transform .3s cubic-bezier(.215,.61,.355,1),opacity .3s cubic-bezier(.215,.61,.355,1);transition:transform .3s cubic-bezier(.215,.61,.355,1),opacity .3s cubic-bezier(.215,.61,.355,1),-webkit-transform .3s cubic-bezier(.215,.61,.355,1)}._3CmzW{width:100%;height:1px;margin:8px 0;background-color:#e4e4e4}",""]),t.locals={menu:"_3KL1R",notransition:"_1myTC",intro:"_3FpgG",active:"_1dNjk",divider:"_3CmzW"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(6),d=a(c),p=n(1),f=n(27),m=a(f),h=n(227),v=a(h),g=n(228),y=a(g),b=n(229),x=a(b),_=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.hoverTimeout=null,n.submenuId=null,n.itemElement=null,n.openSubmenu=n.openSubmenu.bind(n),n.handleHover=n.handleHover.bind(n),n.handleUnhover=n.handleUnhover.bind(n),n.handleClick=n.handleClick.bind(n),n.handleKeyPress=n.handleKeyPress.bind(n),n}return i(t,e),l(t,[{key:"claimFocus",value:function(){var e=this.props,t=e.id,n=e.claimFocus;"function"==typeof n&&n(t)}},{key:"openSubmenu",value:function(){var e=this.props,t=e.submenuItems,n=e.onSubmenuOpen,a=e.parentMenu,o=0,r=0;if(this.itemElement){var i=this.itemElement.getBoundingClientRect();o=i.right,r=i.top-10}null!==this.submenuId&&m.default.isOpen(this.submenuId)&&m.default.dismiss(this.submenuId),this.submenuId=m.default.create({parentMenu:a,xPosition:o,yPosition:r,items:t}),"function"==typeof n&&n(this.submenuId)}},{key:"isSubmenuOpen",value:function(){return this.submenuId&&m.default.isOpen(this.submenuId)}},{key:"handleGainFocus",value:function(){this.itemElement&&this.itemElement.focus(),document.body.addEventListener("keydown",this.handleKeyPress)}},{key:"handleLoseFocus",value:function(){document.body.removeEventListener("keydown",this.handleKeyPress)}},{key:"handleHover",value:function(e){var t=this.props,n=t.isFocused,a=t.submenuItems;n||this.claimFocus(),!a||this.isSubmenuOpen()||this.hoverTimeout||(this.hoverTimeout=window.setTimeout(this.openSubmenu,200))}},{key:"handleUnhover",value:function(e){this.hoverTimeout&&(window.clearTimeout(this.hoverTimeout),this.hoverTimeout=null)}},{key:"handleClick",value:function(e){var t=this.props,n=t.submenuItems,a=t.id,o=t.doAction;n&&!this.isSubmenuOpen()?this.openSubmenu():"function"==typeof o&&o(a)}},{key:"handleKeyPress",value:function(e){var t=e.keyCode,n=e.shiftKey,a=this.props,o=a.submenuItems,r=a.id,i=a.doAction,l=a.delegateFocus,s=this.isSubmenuOpen(),u=!1;return 13===t||32===t?o&&!s?(this.openSubmenu(),u=!0):"function"==typeof i&&(i(r),u=!0):o&&39===t?s||(this.openSubmenu(),u=!0):38===t||n&&9===t?s||"function"!=typeof l||(l(r,-1),u=!0):(40===t||!n&&9===t)&&(s||"function"!=typeof l||(l(r,1),u=!0)),u&&(e.preventDefault(),e.stopImmediatePropagation()),u}},{key:"componentWillUnmount",value:function(){this.hoverTimeout&&window.clearTimeout(this.hoverTimeout),this.handleLoseFocus()}},{key:"componentWillReceiveProps",value:function(e){e.isFocused&&!this.props.isFocused?this.handleGainFocus():!e.isFocused&&this.props.isFocused&&this.handleLoseFocus()}},{key:"render",value:function(){var e=this,t=this.props,n=t.isFocused,a=t.submenuItems,o=t.value,r=(0,p.css)(x.default.item,n&&x.default.focused,a&&x.default.submenu,"boolean"==typeof o&&x.default.option,!0===o&&x.default.checked),i=a?u.default.createElement(d.default,{className:x.default.submenuindicator,svg:v.default}):null,l="boolean"==typeof o?u.default.createElement(d.default,{className:x.default.valueindicator,svg:y.default}):null;return u.default.createElement("div",{className:r,onMouseEnter:this.handleHover,onMouseLeave:this.handleUnhover,onClick:this.handleClick,tabIndex:"-1",ref:function(t){return e.itemElement=t}},l,uno.util.loc.t(this.props.label),i)}}]),t}(s.PureComponent);t.default=_},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"Uf9h_",use:"Uf9h_-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="Uf9h_">\n    <path d="M14.1,12.5C14.7,12 14.7,11.2 14.1,10.6L11.2,8.3C10.5,7.8 10,8 10,8.8L10,14.3C10,15.2 10.5,15.4 11.2,14.9L14.1,12.5Z" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"RMpO4",use:"RMpO4-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="RMpO4">\n    <path d="M15.9,8.3C16.3,7.1 16.9,7.9 17.3,8.3C17.7,8.7 17.7,9.3 17.3,9.7L11.6,15.4C11.2,15.8 10.6,15.8 10.2,15.4L7.3,12.6C6.9,12.2 6.9,11.5 7.3,11.1C7.7,10.8 8.3,10.8 8.7,11.1L10.9,13.3L15.9,8.3Z" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){var a=n(230);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._1rAX_{cursor:pointer;position:relative;height:26px;padding:0 16px;overflow:hidden;outline:none;color:#666;font-weight:600;line-height:26px;white-space:nowrap;text-overflow:ellipsis;background-color:#fff;transition:all .15s}._1rAX_._1-qrD{padding-right:34px}._1rAX_._2MeW-{color:#333;background-color:#f1f1f1}._1rAX_._2MeW- .fCfUq{fill:#333}._1rAX_.HQtmD{padding-left:40px}._1rAX_.HQtmD.UoqHV ._3feq6{fill:#666}._1rAX_.HQtmD.UoqHV._2MeW-{color:#333;background-color:#f1f1f1}._1rAX_.HQtmD.UoqHV._2MeW- ._3feq6{fill:#333}._3feq6,.fCfUq{position:absolute;top:calc(50% - 12px);width:24px;height:24px;transition:fill .15s}.fCfUq{right:8px;fill:#666}._3feq6{left:8px;fill:transparent}",""]),t.locals={item:"_1rAX_",submenu:"_1-qrD",focused:"_2MeW-",submenuindicator:"fCfUq",option:"HQtmD",checked:"UoqHV",valueindicator:"_3feq6"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(1),d=n(232),p=a(d),f=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.colorOptions=["#ffffff","#eaeaea","#d4d4d4","#ddd1f3","#f0d1f6","#fbcfd6","#fedec1","#ffe697","#cdedd8","#cdeef0","#cde6f9","#ccd7ea","#3f3f3f","#737373","#979797","#8b65e0","#c064d1","#fc5356","#fd7b39","#ffc200","#00a82d","#57bfc4","#0081c2","#426bb3"],n.itemsPerRow=6,n.state={selectedColor:(0,c.normalizeColorString)(n.props.value)||n.colorOptions[0],focusedColor:null},n.colorElements={},n.focusColor=n.focusColor.bind(n),n.finalizeColor=n.finalizeColor.bind(n),n.handleKeyPress=n.handleKeyPress.bind(n),n}return i(t,e),l(t,[{key:"focusColor",value:function(e){var t=this.props,n=t.id,a=t.claimFocus;"function"==typeof a&&a(n),this.setState({focusedColor:e}),this.colorElements&&this.colorElements[e]&&this.colorElements[e].focus()}},{key:"focusNextColor",value:function(e){var t=this.colorOptions.indexOf(this.state.focusedColor),n=t+e;return-1===t?e<0?(this.focusColor(this.colorOptions[this.colorOptions.length-1]),!0):(this.focusColor(this.colorOptions[0]),!0):n>=0&&n<this.colorOptions.length&&(this.focusColor(this.colorOptions[n]),!0)}},{key:"finalizeColor",value:function(e){var t=this.props,n=t.id,a=t.doAction;this.focusColor(e),this.setState({selectedColor:e}),"function"==typeof a&&a(n,e)}},{key:"handleGainFocus",value:function(){this.focusColor(this.state.selectedColor),document.body.addEventListener("keydown",this.handleKeyPress)}},{key:"handleLoseFocus",value:function(){document.body.removeEventListener("keydown",this.handleKeyPress)}},{key:"handleKeyPress",value:function(e){var t=e.keyCode,n=e.shiftKey,a=this.props,o=a.id,r=(a.doAction,a.delegateFocus),i=this.state.focusedColor,l=!1;return 13===t||32===t?i&&(this.finalizeColor(i),l=!0):37===t?(this.focusNextColor(-1),l=!0):39===t?(this.focusNextColor(1),l=!0):38===t?(this.focusNextColor(-1*this.itemsPerRow)||r(o,-1),l=!0):40===t?(this.focusNextColor(this.itemsPerRow)||r(o,1),l=!0):n&&9===t?(r(o,-1),l=!0):n||9!==t||(r(o,1),l=!0),l&&(e.preventDefault(),e.stopImmediatePropagation()),l}},{key:"componentWillUnmount",value:function(){this.handleLoseFocus()}},{key:"componentWillReceiveProps",value:function(e){void 0!==e.value&&this.setState({selectedColor:(0,c.normalizeColorString)(e.value)}),e.isFocused&&!this.props.isFocused?this.handleGainFocus():!e.isFocused&&this.props.isFocused&&this.handleLoseFocus()}},{key:"render",value:function(){var e=this,t=this.props.isFocused,n=this.state,a=n.selectedColor,o=n.focusedColor;return u.default.createElement("div",{key:"colorpicker",className:p.default.colorpicker},u.default.createElement("div",{key:"label",className:p.default.title},uno.util.loc.t(this.props.label)),u.default.createElement("div",{key:"colors-container",className:p.default.colors},this.colorOptions.map(function(n,r){var i=(0,c.css)(p.default.color,"#ffffff"===n&&p.default.bordered,t&&n===o&&p.default.focused,n===a&&p.default.selected);return u.default.createElement("div",{key:"color-wrapper-"+r,className:p.default.colorwrapper,onMouseEnter:function(){return e.focusColor(n)},onMouseOver:function(){return e.focusColor(n)},onClick:function(){return e.finalizeColor(n)},tabIndex:"-1",ref:function(t){return e.colorElements[n]=t}},u.default.createElement("div",{key:"color-"+r,className:i,style:{backgroundColor:n}}))})))}}]),t}(s.PureComponent);t.default=f},function(e,t,n){var a=n(233);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,'._3JnrD{padding:0}.-SsIE{padding:0 16px;color:#c3c3c3;font-size:11px;text-transform:uppercase;letter-spacing:1px;line-height:24px}._2kaHh{display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;width:220px;padding:3px 14px}._1I5Xm{cursor:pointer;-webkit-flex:0 0 auto;flex:0 0 auto;outline:none;width:32px;height:32px;padding:3px}._2os1D{position:relative;width:26px;height:26px;border-radius:50%;transition:all .15s}._2os1D._3IpBx{border:1px solid #dcdcdc}._2os1D.NC1EP{-webkit-transform:scale(1.15);transform:scale(1.15)}._2os1D._1oE24:after{content:"";position:absolute;left:calc(50% - 16px);top:calc(50% - 16px);width:28px;height:28px;border:2px solid #0081c2;border-radius:50%}',""]),t.locals={colorpicker:"_3JnrD",title:"-SsIE",colors:"_2kaHh",colorwrapper:"_1I5Xm",color:"_2os1D",bordered:"_3IpBx",focused:"NC1EP",selected:"_1oE24"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(235),d=a(c),p=n(1),f=n(246),m=a(f),h=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={activePopover:null},n.closeMenu=n.closeMenu.bind(n),n.doAction=n.doAction.bind(n),n}return i(t,e),l(t,[{key:"closeMenu",value:function(){this.setState({activePopover:null})}},{key:"doAction",value:function(e,t,n){var a=this.props.settings&&this.props.settings[e]||{},o=a.action;"function"==typeof o&&o(t,n)}},{key:"componentWillReceiveProps",value:function(e){this.props.popoverOpenTime===e.popoverOpenTime&&this.state.activePopover===e.showPopover||this.setState({activePopover:e.showPopover})}},{key:"render",value:function(){var e=this,t=this.props,n=t.popoverDefinitions,a=t.targetElement,o=t.settings,r=this.state.activePopover,i=(0,p.css)("popovermenucontainer",m.default.container);return u.default.createElement("div",{className:i},Object.keys(n).map(function(t){var i=n[t],l=t===r;return u.default.createElement(d.default,{key:t,id:t,active:l,targetElement:l?a:null,actions:i,settings:o,doAction:e.doAction,closeMenu:e.closeMenu})}))}}],[{key:"defaultProps",get:function(){return{popoverDefinitions:{},showPopover:null,popoverOpenTime:0,targetElement:null,settings:{}}}}]),t}(s.PureComponent);t.default=h},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(236),d=a(c),p=n(1),f=n(244),m=a(f),h=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={focusedAction:null,xPosition:0,yPosition:0},n.mutationObserver=null,n.popovermenuElement=null,n.claimFocus=n.claimFocus.bind(n),n.handleUnhover=n.handleUnhover.bind(n),n.handleContextMenu=n.handleContextMenu.bind(n),n.handleResize=(0,p.debounce)(n.handleResize.bind(n),400,{leading:!0,trailing:!0}),n.handleTargetMutation=n.handleTargetMutation.bind(n),n}return i(t,e),l(t,[{key:"claimFocus",value:function(e){this.state.focusedAction!==e&&this.setState({focusedAction:e})}},{key:"reposition",value:function(e,t){if(!e||"function"!=typeof e.getBoundingClientRect)return!1;var n=e.getBoundingClientRect(),a=document.scrollingElement||document.body,o=a.scrollHeight,r=a.scrollWidth,i=.5*(n.left+n.right),l=n.top;i+=a.scrollLeft,l+=a.scrollTop;var s=this.popovermenuElement.classList.contains(m.default.active);s||this.popovermenuElement.classList.add(m.default.active);var u=this.popovermenuElement.getBoundingClientRect();return i-=.5*u.width,l-=u.height+2,i=Math.min(i,r-4-u.width),i=Math.max(i,4),l=Math.min(l,o-4-u.height),l=Math.max(l,4),t&&(this.popovermenuElement.classList.remove(m.default.active),this.popovermenuElement.classList.add(m.default.notransition),this.popovermenuElement.offsetHeight,this.popovermenuElement.classList.remove(m.default.notransition)),s?this.popovermenuElement.classList.add(m.default.active):this.popovermenuElement.classList.remove(m.default.active),this.setState({xPosition:i,yPosition:l}),!0}},{key:"handleActivate",value:function(){this.claimFocus(null),window.addEventListener("resize",this.handleResize)}},{key:"handleDeactivate",value:function(){window.removeEventListener("resize",this.handleResize)}},{key:"handleUnhover",value:function(e){this.claimFocus(null)}},{key:"handleContextMenu",value:function(e){e.preventDefault(),e.stopPropagation()}},{key:"handleResize",value:function(e){var t=this;this.reposition(this.props.targetElement),window.setTimeout(function(){t.reposition(t.props.targetElement)},10)}},{key:"handleTargetMutation",value:function(e){this.reposition(this.props.targetElement)}},{key:"componentWillUnmount",value:function(){this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.handleDeactivate()}},{key:"componentWillReceiveProps",value:function(e){e.targetElement&&(this.reposition(e.targetElement,!0),this.mutationObserver||(this.mutationObserver=new window.MutationObserver(this.handleTargetMutation)),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver.observe(e.targetElement,{attributes:!0,attributeFilter:["src","width","data-width","height","data-height"]}))),e.active&&!this.props.active&&this.handleActivate(),!e.active&&this.props.active&&this.handleDeactivate()}},{key:"render",value:function(){var e=this,t=this.state,n=t.focusedAction,a=t.xPosition,o=t.yPosition,r=this.props,i=r.id,l=r.active,s=r.actions,c=r.doAction,f=this.props.settings||{},h=(0,p.css)(m.default.popovermenu,l&&m.default.active),v={left:a,top:o};return u.default.createElement("div",{key:"popovermenu-"+i,className:h,style:v,onMouseLeave:this.handleUnhover,onContextMenu:this.handleContextMenu,ref:function(t){return e.popovermenuElement=t}},s.map(function(t){var a=f[t.id]||{},o=a.enabled;return void 0===o||o?u.default.createElement(d.default,{key:t.id,id:t.id,icon:t.icon,label:t.label,doAction:c,isFocused:t.id===n,claimFocus:e.claimFocus}):null}))}}]),t}(s.Component);t.default=h},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(6),d=a(c),p=n(13),f=a(p),m=n(1),h=n(237),v=a(h),g=n(242),y=a(g),b=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={tooltip:null},n.buttonElement=null,n.handleHover=n.handleHover.bind(n),n.handleUnhover=n.handleUnhover.bind(n),n.handleClick=n.handleClick.bind(n),n}return i(t,e),l(t,[{key:"claimFocus",value:function(){var e=this.props,t=e.id,n=e.claimFocus;"function"==typeof n&&t&&n(t)}},{key:"handleHover",value:function(e){this.claimFocus(),this.props.label&&this.setState({tooltip:u.default.createElement(f.default,{rect:(0,m.rect)(e.target)},this.props.label)})}},{key:"handleUnhover",value:function(e){this.setState({tooltip:null})}},{key:"handleClick",value:function(e){var t=this.props,n=t.id,a=t.doAction;"function"==typeof a&&a(n,null,{x:e.clientX,y:e.clientY})}},{key:"render",value:function(){var e=this.props,t=e.isFocused,n=e.icon,a=this.state.tooltip,o=(0,m.css)(y.default.actionbutton,t&&y.default.focused),r=v.default[n];return u.default.createElement("div",{className:o,onMouseEnter:this.handleHover,onMouseLeave:this.handleUnhover,onClick:this.handleClick},u.default.createElement(d.default,{className:y.default.icon,svg:r}),a)}}]),t}(s.PureComponent);t.default=b},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(238),r=a(o),i=n(239),l=a(i),s=n(240),u=a(s),c=n(241),d=a(c);t.default={"action-edit":r.default,"action-preview":l.default,"action-replace":u.default,"action-more-options":d.default}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"qK9Cd",use:"qK9Cd-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="qK9Cd">\n    <path d="M5.976 16.51c.22.072.429.188.6.36.17.17.287.38.359.6l1.786-.447a2.899 2.899 0 0 0-2.259-2.29l-.04-.009-.446 1.787zM18.68 8.597L9.487 17.79l-4.512 1.04a.3.3 0 0 1-.36-.36l1.042-4.51 9.192-9.193c.423-.423 1.623.091 2.681 1.15 1.058 1.057 1.572 2.257 1.15 2.68z" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"1xj0f",use:"1xj0f-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="1xj0f">\n    <path d="M11.75,10.25 L13.5,10.25 C13.9142136,10.25 14.25,10.5857864 14.25,11 C14.25,11.4142136 13.9142136,11.75 13.5,11.75 L11.75,11.75 L11.75,13.5 C11.75,13.9142136 11.4142136,14.25 11,14.25 C10.5857864,14.25 10.25,13.9142136 10.25,13.5 L10.25,11.75 L8.5,11.75 C8.08578644,11.75 7.75,11.4142136 7.75,11 C7.75,10.5857864 8.08578644,10.25 8.5,10.25 L10.25,10.25 L10.25,8.5 C10.25,8.08578644 10.5857864,7.75 11,7.75 C11.4142136,7.75 11.75,8.08578644 11.75,8.5 L11.75,10.25 Z M16.451757,15.3910968 L19.5229708,18.4623106 C19.815864,18.7552038 19.815864,19.2300776 19.5229708,19.5229708 C19.2300776,19.815864 18.7552038,19.815864 18.4623106,19.5229708 L15.3910968,16.451757 C14.1902373,17.4202081 12.6628275,18 11,18 C7.13400675,18 4,14.8659932 4,11 C4,7.13400675 7.13400675,4 11,4 C14.8659932,4 18,7.13400675 18,11 C18,12.6628275 17.4202081,14.1902373 16.451757,15.3910968 Z M11,16.5 C14.0375661,16.5 16.5,14.0375661 16.5,11 C16.5,7.96243388 14.0375661,5.5 11,5.5 C7.96243388,5.5 5.5,7.96243388 5.5,11 C5.5,14.0375661 7.96243388,16.5 11,16.5 Z" fill-rule="nonzero" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"2Pj10",use:"2Pj10-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="2Pj10">\n    <path d="M5,5 L5,10 L10,10 L10,5 L5,5 Z M4.5,3.5 L10.5,3.5 C11.0522847,3.5 11.5,3.94771525 11.5,4.5 L11.5,10.5 C11.5,11.0522847 11.0522847,11.5 10.5,11.5 L4.5,11.5 C3.94771525,11.5 3.5,11.0522847 3.5,10.5 L3.5,4.5 C3.5,3.94771525 3.94771525,3.5 4.5,3.5 Z M15,15 L15,20 L20,20 L20,15 L15,15 Z M9.7056797,18.3950195 L8.87132034,17.5606602 C8.6760582,17.365398 8.6760582,17.0488155 8.87132034,16.8535534 C9.06658249,16.6582912 9.38316498,16.6582912 9.57842712,16.8535534 L11.1997475,18.4748737 C11.3950096,18.6701359 11.3950096,18.9867184 11.1997475,19.1819805 L9.57842712,20.8033009 C9.38316498,20.998563 9.06658249,20.998563 8.87132034,20.8033009 C8.6760582,20.6080387 8.6760582,20.2914562 8.87132034,20.0961941 L9.57249489,19.3950195 L7.61738634,19.3950195 C5.68438972,19.3950195 4.11738634,17.8280162 4.11738634,15.8950195 L4.11738634,14.3307209 C4.11738634,14.0545785 4.34124397,13.8307209 4.61738634,13.8307209 C4.89352872,13.8307209 5.11738634,14.0545785 5.11738634,14.3307209 L5.11738634,15.8950195 C5.11738634,17.2757314 6.23667447,18.3950195 7.61738634,18.3950195 L9.7056797,18.3950195 Z M15.0300095,7.04068186 L15.8357864,7.84645882 C16.0310486,8.04172096 16.0310486,8.35830345 15.8357864,8.5535656 C15.6405243,8.74882774 15.3239418,8.74882774 15.1286797,8.5535656 L13.5073593,6.93224525 C13.3120972,6.73698311 13.3120972,6.42040062 13.5073593,6.22513847 L15.1286797,4.60381813 C15.3239418,4.40855598 15.6405243,4.40855598 15.8357864,4.60381813 C16.0310486,4.79908028 16.0310486,5.11566276 15.8357864,5.31092491 L15.1060295,6.04068186 L17.0727539,6.04068186 C19.0057505,6.04068186 20.5727539,7.60768523 20.5727539,9.54068186 L20.5727539,11.1049805 C20.5727539,11.3811228 20.3488963,11.6049805 20.0727539,11.6049805 C19.7966115,11.6049805 19.5727539,11.3811228 19.5727539,11.1049805 L19.5727539,9.54068186 C19.5727539,8.15996998 18.4534658,7.04068186 17.0727539,7.04068186 L15.0300095,7.04068186 Z M14.5,13.5 L20.5,13.5 C21.0522847,13.5 21.5,13.9477153 21.5,14.5 L21.5,20.5 C21.5,21.0522847 21.0522847,21.5 20.5,21.5 L14.5,21.5 C13.9477153,21.5 13.5,21.0522847 13.5,20.5 L13.5,14.5 C13.5,13.9477153 13.9477153,13.5 14.5,13.5 Z" fill-rule="nonzero" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"2Vgq_",use:"2Vgq_-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="2Vgq_">\n    <path d="M7.5,14 C6.67157288,14 6,13.3284271 6,12.5 C6,11.6715729 6.67157288,11 7.5,11 C8.32842712,11 9,11.6715729 9,12.5 C9,13.3284271 8.32842712,14 7.5,14 Z M12.5,14 C11.6715729,14 11,13.3284271 11,12.5 C11,11.6715729 11.6715729,11 12.5,11 C13.3284271,11 14,11.6715729 14,12.5 C14,13.3284271 13.3284271,14 12.5,14 Z M17.5,14 C16.6715729,14 16,13.3284271 16,12.5 C16,11.6715729 16.6715729,11 17.5,11 C18.3284271,11 19,11.6715729 19,12.5 C19,13.3284271 18.3284271,14 17.5,14 Z" />\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){var a=n(243);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._1hIpS{cursor:pointer;-webkit-flex:0 0 32px;flex:0 0 32px;background:#fff;transition:all .2s}._1hIpS ._1v1aV{display:block;width:32px;height:32px;padding:4px;fill:#666;transition:all .2s}._1hIpS._3jG56{background:#f1f1f1}._1hIpS._3jG56 ._1v1aV{fill:#333}",""]),t.locals={actionbutton:"_1hIpS",icon:"_1v1aV",focused:"_3jG56"}},function(e,t,n){var a=n(245);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._1fTW4{z-index:2147483447;cursor:default;position:absolute;left:0;top:0;padding:4px;display:-webkit-flex;display:flex;-webkit-flex-flow:row nowrap;flex-flow:row nowrap;overflow:hidden;outline:none;background:#fff;border-radius:4px;box-shadow:0 0 6px 0 rgba(0,0,0,.3);opacity:0;-webkit-transform:translateY(20px);transform:translateY(20px);transition:opacity .2s,-webkit-transform .2s;transition:transform .2s,opacity .2s;transition:transform .2s,opacity .2s,-webkit-transform .2s}._1fTW4._3MuPi{transition:all 0ms!important}._1fTW4._1AHTG{pointer-events:auto;-webkit-transform:translateY(0);transform:translateY(0);opacity:1;transition:opacity .3s cubic-bezier(.215,.61,.355,1),-webkit-transform .3s cubic-bezier(.215,.61,.355,1);transition:transform .3s cubic-bezier(.215,.61,.355,1),opacity .3s cubic-bezier(.215,.61,.355,1);transition:transform .3s cubic-bezier(.215,.61,.355,1),opacity .3s cubic-bezier(.215,.61,.355,1),-webkit-transform .3s cubic-bezier(.215,.61,.355,1)}",""]),t.locals={popovermenu:"_1fTW4",notransition:"_3MuPi",active:"_1AHTG"}},function(e,t,n){var a=n(247);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._20bku{position:absolute;left:0;top:0;right:0;bottom:0;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial;color:#333;font-size:13px;overflow:hidden}.fullsize ._20bku{display:none}",""]),t.locals={container:"_20bku"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.styleModules=void 0;var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(12),d=a(c),p=n(1),f=n(249),m=a(f),h=n(6),v=a(h),g=n(251),y=a(g),b=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.handleResize=n.handleResize.bind(n),n.handleTemplateBtnClick=n.handleTemplateBtnClick.bind(n),n}return i(t,e),l(t,[{key:"componentDidMount",value:function(){window.addEventListener("resize",this.handleResize)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.handleResize)}},{key:"handleResize",value:function(){this.forceUpdate()}},{key:"handleTemplateBtnClick",value:function(e){this.props.openTemplateManager&&this.props.openTemplateManager(e)}},{key:"render",value:function(){var e=this.props,t=e.visible,n=void 0!==t&&t,a=e.textStyles,o=void 0===a?{}:a,r=e.isMobile,i=e.showTemplates;if(!n)return null;var l=void 0;if(i){var c=r?uno.util.loc.t("placeholder-copy-mobile-templates"):uno.util.loc.t("placeholder-copy-templates"),d=c.indexOf("<button>"),f=c.indexOf("</button>");l=-1!==d&&-1!==f&&d<f?u.default.createElement(s.Fragment,null,u.default.createElement("span",{className:m.default.copyText},c.substring(0,d)),u.default.createElement("div",{className:m.default.button,onClick:this.handleTemplateBtnClick},u.default.createElement(v.default,{className:m.default.icon,svg:y.default}),c.substring(d+8,f)),c.substring(f+9)?u.default.createElement("span",{className:m.default.copyText},c.substring(f+9)):null):u.default.createElement("span",{className:m.default.copyText},c)}else{var h=r?uno.util.loc.t("placeholder-copy-mobile"):uno.util.loc.t("placeholder-copy");l=u.default.createElement("span",{className:m.default.copyText},h)}return u.default.createElement("div",{className:(0,p.css)("placeholder",m.default.container),style:o},l)}}]),t}(s.PureComponent);b.propTypes={visible:d.default.bool,textStyles:d.default.object,isMobile:d.default.bool,showTemplates:d.default.bool,openTemplateManager:d.default.func};t.styleModules=m.default;t.default=b},function(e,t,n){var a=n(250);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._1BFuh{color:#b0b0b0;margin-top:-.5em}.DeGm6{line-height:2.45}._1B0yJ{pointer-events:auto;cursor:pointer;display:inline-block;height:32px;line-height:24px;padding:4px 16px 4px 12px;margin:-5px 0;font-size:.9em;font-weight:300;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;color:#666;background-color:#f8f8f8;border-radius:16px;transition:background-color .2s}.windows ._1B0yJ{font-family:Segoe,Helvetica Neue,Helvetica,Arial,sans-serif}.ios ._1B0yJ,.mac ._1B0yJ,.web ._1B0yJ{font-family:SFUIText,-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial,sans-serif}.android ._1B0yJ{font-family:Roboto,Helvetica Neue,Helvetica,Arial,sans-serif}._1B0yJ ._1RR9R{width:24px;height:24px;display:inline-block;vertical-align:top;fill:#666;margin-right:.2em}._1B0yJ:focus,._1B0yJ:hover{background-color:#f0f0f0}._1BFuh>*{margin-right:3px}._1BFuh>:last-child{margin-right:0}",""]),t.locals={container:"_1BFuh",copyText:"DeGm6",button:"_1B0yJ",icon:"_1RR9R"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"3J-9P",use:"3J-9P-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="3J-9P">\n    <g stroke="none" fill-rule="nonzero">\n        <path d="M6,3 L18,3 C18.5522847,3 19,3.44771525 19,4 L19,19 C19,19.5522847 18.5522847,20 18,20 L6,20 C5.44771525,20 5,19.5522847 5,19 L5,4 C5,3.44771525 5.44771525,3 6,3 Z M6,4 L6,19 L18,19 L18,4 L6,4 Z M8,12 L16,12 L16,13 L8,13 L8,12 Z M8,15 L16,15 L16,16 L8,16 L8,15 Z M8,6 L12,6 L12,10 L8,10 L8,6 Z M9,7 L9,9 L11,9 L11,7 L9,7 Z" />\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(1),d=n(6),p=a(d),f=n(253),m=a(f),h=n(254),v=a(h),g=n(257),y=a(g),b=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={type:e.type||"none",title:e.title||"",access:e.access||"private",hasResources:e.hasResources},n.dialogElement=null,n.textfield=null,n.handleBodyClick=n.handleBodyClick.bind(n),n.handleSubmit=n.handleSubmit.bind(n),n.handleCancelClick=n.handleCancelClick.bind(n),n.handleTitleChange=n.handleTitleChange.bind(n),n.handleAccessChange=n.handleAccessChange.bind(n),n.handleKeyPress=n.handleKeyPress.bind(n),n.handleBlur=n.handleBlur.bind(n),n.handleFocusBefore=n.handleFocusBefore.bind(n),n.handleFocusAfter=n.handleFocusAfter.bind(n),n}return i(t,e),l(t,[{key:"handleActivate",value:function(){var e=this;this.documentOverflowY=document.scrollingElement.style.overflowY,document.scrollingElement.style.overflowY="hidden",this.dialogElement.classList.add(y.default.notransition),this.dialogElement.classList.add(y.default.intro),this.dialogElement.offsetHeight,this.dialogElement.classList.remove(y.default.notransition),this.dialogElement.classList.remove(y.default.intro),this.dialogElement.contains(document.activeElement)||this.dialogElement.focus(),setTimeout(function(){e.focusInput()}),document.body.addEventListener("mousedown",this.handleBodyClick),this.dialogElement.addEventListener("mousedown",this.handleDialogClick),document.body.addEventListener("keydown",this.handleKeyPress)}},{key:"handleDeactivate",value:function(){document.scrollingElement.style.overflowY=this.documentOverflowY,document.body.removeEventListener("mousedown",this.handleBodyClick),this.dialogElement.removeEventListener("mousedown",this.handleDialogClick),document.body.removeEventListener("keydown",this.handleKeyPress)}},{key:"close",value:function(e){var t=this.props,n=t.closeDialog,a=t.restoreRange;"function"==typeof n&&n(),e&&"function"==typeof a&&a()}},{key:"focusInput",value:function(e){if(!this.dialogElement)return!1;var t=(0,c.getFocusableElements)(this.dialogElement),n=void 0;return t.length&&(n=e?t[t.length-1]:t[0]),!!n&&(n.focus(),!0)}},{key:"handleBodyClick",value:function(e){this.close(!1)}},{key:"handleDialogClick",value:function(e){e.stopPropagation()}},{key:"handleSubmit",value:function(e){var t=this.props.doAction,n=this.state,a=n.type,o=n.title,r=n.access;e.preventDefault(),("create"===a||"update"===a)&&o.trim().length<1||("function"==typeof t&&t({title:o.trim(),access:r}),this.close(!0))}},{key:"handleCancelClick",value:function(e){this.close(!0)}},{key:"handleTitleChange",value:function(e){this.setState({title:e})}},{key:"handleAccessChange",value:function(e){this.setState({access:e})}},{key:"handleKeyPress",value:function(e){return 27===e.keyCode&&(e.stopImmediatePropagation(),e.stopPropagation(),this.close(!0),!0)}},{key:"handleBlur",value:function(e){var t=this;setTimeout(function(){t.dialogElement&&t.dialogElement.contains(document.activeElement)||t.close(!1)})}},{key:"handleFocusBefore",value:function(){this.focusInput(!0)}},{key:"handleFocusAfter",value:function(){this.focusInput(!1)}},{key:"componentWillUnmount",value:function(){this.handleDeactivate()}},{key:"componentWillReceiveProps",value:function(e){e.active&&!this.props.active?(this.setState({type:e.type||"none",title:e.title||"",access:e.access||"private",hasResources:e.hasResources}),this.handleActivate()):!e.active&&this.props.active&&this.handleDeactivate()}},{key:"render",value:function(){var e=this,t=this.props.active,n=this.state,a=n.type,o=n.title,r=n.hasResources,i=(0,c.css)("templatedialogcontainer",y.default.container,t&&y.default.active),l=[];switch(a){case"create":l.push(u.default.createElement("h3",{key:"title",className:y.default.title},uno.util.loc.t("Save as template")));break;case"update":l.push(u.default.createElement("h3",{key:"title",className:y.default.title},uno.util.loc.t("Rename template")));break;case"delete":l.push(u.default.createElement("h3",{key:"title",className:y.default.title},uno.util.loc.t("Delete template")))}if("create"===a&&r&&l.push(u.default.createElement("div",{key:"attachment-warning",className:y.default.warning},u.default.createElement(p.default,{className:y.default.icon,svg:m.default}),uno.util.loc.t("template-dialogs-create-warning"))),"delete"===a){var s="string"==typeof o?o.length>40?o.substring(0,40)+"…":o:"";uno.util.loc.t("template-dialogs-delete-info",{TITLE:s}).split("\n\n").forEach(function(e,t){l.push(u.default.createElement("p",{key:"delete-message-"+t,className:y.default.message},e))})}"create"!==a&&"update"!==a||(l.push(u.default.createElement("h4",{key:"title-field-label",className:y.default.fieldlabel},uno.util.loc.t("Title"))),l.push(u.default.createElement(v.default,{key:"title-input",value:o,onChange:this.handleTitleChange,placeholder:"Title",active:t})));var d="Submit";switch(a){case"create":case"update":d=uno.util.loc.t("Save");break;case"delete":d=uno.util.loc.t("Delete")}return[u.default.createElement("div",{key:"focus-bumper-before",className:y.default.focusbumper,tabIndex:"0",onFocus:this.handleFocusBefore}),u.default.createElement("form",{key:"dialog",className:i,tabIndex:"-1",ref:function(t){return e.dialogElement=t},onSubmit:this.handleSubmit,onBlur:this.handleBlur},l,u.default.createElement("div",{className:y.default.buttonsContainer},u.default.createElement("button",{className:(0,c.css)(y.default.button,y.default.primary),tabIndex:"0"},d),u.default.createElement("button",{type:"button",className:y.default.button,tabIndex:"0",onClick:this.handleCancelClick},uno.util.loc.t("Cancel")))),u.default.createElement("div",{key:"focus-bumper-after",className:y.default.focusbumper,tabIndex:"0",onFocus:this.handleFocusAfter})]}}],[{key:"defaultProps",get:function(){return{active:!1,closeDialog:function(){},doAction:function(){}}}}]),t}(s.PureComponent);t.default=b},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=n.n(a),r=n(3),i=n.n(r),l=new o.a({id:"1iItu",use:"1iItu-usage",viewBox:"0 0 24 24",content:'<symbol viewBox="0 0 24 24" id="1iItu">\n    <g stroke="none" fill-rule="evenodd">\n        <path d="M12.7571914,3.50044482 L21.6481971,18.9115215 C21.9241862,19.3899026 21.7601151,20.0014404 21.281734,20.2774295 C21.1297808,20.3650948 20.9574395,20.4112439 20.7820115,20.4112439 L3,20.4112439 C2.44771525,20.4112439 2,19.9635287 2,19.4112439 C2,19.235816 2.04614911,19.0634747 2.13381441,18.9115215 L11.0248202,3.50044482 C11.3008093,3.02206373 11.9123471,2.8579926 12.3907282,3.13398169 C12.5429638,3.22180991 12.6693631,3.34820923 12.7571914,3.50044482 Z M11.7939067,7.98467934 C11.241622,7.98467934 10.7939067,8.43239459 10.7939067,8.98467934 L10.7939067,13.9846793 C10.7939067,14.5369641 11.241622,14.9846793 11.7939067,14.9846793 C12.3461915,14.9846793 12.7939067,14.5369641 12.7939067,13.9846793 L12.7939067,8.98467934 C12.7939067,8.43239459 12.3461915,7.98467934 11.7939067,7.98467934 Z M11.7939067,15.9846793 C11.241622,15.9846793 10.7939067,16.4323946 10.7939067,16.9846793 C10.7939067,17.5369641 11.241622,17.9846793 11.7939067,17.9846793 C12.3461915,17.9846793 12.7939067,17.5369641 12.7939067,16.9846793 C12.7939067,16.4323946 12.3461915,15.9846793 11.7939067,15.9846793 Z" />\n    </g>\n</symbol>'});i.a.add(l);t.default=l},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(1),d=n(255),p=a(d),f=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={value:e.value||"",isFocused:!1},n.handleFocus=n.handleFocus.bind(n),n.handleBlur=n.handleBlur.bind(n),n.handleInput=n.handleInput.bind(n),n}return i(t,e),l(t,[{key:"handleFocus",value:function(){this.setState({isFocused:!0})}},{key:"handleBlur",value:function(){this.setState({isFocused:!1})}},{key:"handleInput",value:function(e){var t=this.props.onChange,n=e.target.value;this.setState({value:n}),"function"==typeof t&&t(n)}},{key:"componentDidMount",value:function(){this.inputEl.value=this.state.value}},{key:"componentDidUpdate",value:function(e,t){!e.active&&this.props.active&&(this.setState({value:this.props.value}),this.inputEl.value=this.props.value||"")}},{key:"render",value:function(){var e=this,t=this.props.placeholder,n=this.state,a=(n.value,n.isFocused),o=(0,c.css)(p.default.container,a&&p.default.focus);return u.default.createElement("div",{className:o},u.default.createElement("input",{className:p.default.field,type:"text",placeholder:uno.util.loc.t(t),onFocus:this.handleFocus,onBlur:this.handleBlur,onChange:this.handleInput,ref:function(t){return e.inputEl=t}}))}}]),t}(s.Component);t.default=f},function(e,t,n){var a=n(256);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,'._2L8sv{position:relative;width:100%;height:34px}._2L8sv:after,._2L8sv:before{content:"";position:absolute;left:0;bottom:0;display:block;width:100%;height:2px}._2L8sv:before{z-index:1;background:#e4e4e4}._2L8sv:after{z-index:2;background:#0097ff;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleX(0);transform:scaleX(0);transition:all .2s cubic-bezier(.215,.61,.355,1)}._2L8sv._35cFV:after{-webkit-transform:scaleX(1);transform:scaleX(1);transition-duration:.4s}._1qy50{width:100%;padding:3px 0;color:#333;font-size:16px;line-height:1.75;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial;font-weight:400;background:transparent;border:none;outline:none}._1qy50::-webkit-input-placeholder{color:#c3c3c3;font-weight:100;letter-spacing:.5px}._1qy50::placeholder{color:#c3c3c3;font-weight:100;letter-spacing:.5px}',""]),t.locals={container:"_2L8sv",focus:"_35cFV",field:"_1qy50"}},function(e,t,n){var a=n(258);"string"==typeof a&&(a=[[e.i,a,""]]);var o={hmr:!0};o.transform=void 0;n(5)(a,o);a.locals&&(e.exports=a.locals)},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,"._4gTq0{z-index:2147483647;position:fixed;left:calc(50% - 245px);top:15%;width:490px;padding:25px 20px;z-index:101;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial;font-size:13px;background:#fff;outline:none;box-shadow:0 0 16px rgba(0,0,0,.29);overflow:hidden;border-radius:4px;-webkit-transform:translateY(20px) translateZ(0);transform:translateY(20px) translateZ(0);opacity:0;transition:opacity .2s,-webkit-transform .2s;transition:transform .2s,opacity .2s;transition:transform .2s,opacity .2s,-webkit-transform .2s}._4gTq0._2lonC{transition:all 0ms!important}._4gTq0._3OQ6x{-webkit-transform:translateY(20px) translateZ(0);transform:translateY(20px) translateZ(0)}._4gTq0._2XUMD{pointer-events:auto;opacity:1;-webkit-transform:translateY(0) translateZ(0);transform:translateY(0) translateZ(0);transition:opacity .3s cubic-bezier(.215,.61,.355,1),-webkit-transform .3s cubic-bezier(.215,.61,.355,1);transition:transform .3s cubic-bezier(.215,.61,.355,1),opacity .3s cubic-bezier(.215,.61,.355,1);transition:transform .3s cubic-bezier(.215,.61,.355,1),opacity .3s cubic-bezier(.215,.61,.355,1),-webkit-transform .3s cubic-bezier(.215,.61,.355,1)}._3Kvpp{margin:0 0 20px;color:#333;font-weight:400;letter-spacing:.5px;max-height:84px;font-size:20px;line-height:1.4;display:block;display:-webkit-box;-webkit-line-clamp:3;overflow:hidden;text-overflow:ellipsis}._2LYIY{position:relative;padding:9px 10px 9px 40px;color:#666;font-weight:300;line-height:28px;background-color:#fff5d8;border:1px solid #ffe7a3;border-radius:3px}._2LYIY ._1e9OA{position:absolute;left:10px;top:12px;width:24px;height:24px;fill:#ffbe0b}._1eYJ2{padding:12px 0;margin:0;color:#333;font-size:14px;font-weight:300;line-height:22px}.cnW-3{margin:16px 0 4px;color:#666;line-height:2;font-weight:400;letter-spacing:.5px}._28EZr{display:-webkit-flex;display:flex;-webkit-flex-flow:row-reverse nowrap;flex-flow:row-reverse nowrap;padding:23px 0 6px}._28EZr>:first-child{margin-right:0}._1cZzT{-webkit-flex:0 0;flex:0 0;cursor:pointer;padding:6px 20px;margin:0 4px;color:#9ba0a6;font-size:14px;font-weight:300;line-height:22px;border-radius:3px;border:1px solid #ededed;background-color:#fff;transition:all .15s;white-space:nowrap}._1cZzT:focus,._1cZzT:hover{border:1px solid #c3c3c3}._1cZzT._2raVb{color:#fff;background-color:#20c05c;border:0}._1cZzT._2raVb:focus,._1cZzT._2raVb:hover{border:0;background-color:#28af58}._1ec4J{position:absolute;width:0;height:0;overflow:hidden}",""]),t.locals={container:"_4gTq0",notransition:"_2lonC",intro:"_3OQ6x",active:"_2XUMD",title:"_3Kvpp",warning:"_2LYIY",icon:"_1e9OA",message:"_1eYJ2",fieldlabel:"cnW-3",buttonsContainer:"_28EZr",button:"_1cZzT",primary:"_2raVb",focusbumper:"_1ec4J"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.toast=t.ToastContainer=void 0;var o=n(260),r=a(o),i=n(263),l=a(i);t.ToastContainer=r.default,t.toast=l.default},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(1),d=n(44),p=a(d),f=n(262),m=a(f),h=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={toasts:[]},n.counter=0,n.cleanup=n.cleanup.bind(n),n.create=n.create.bind(n),n.dismiss=n.dismiss.bind(n),n}return i(t,e),l(t,[{key:"cleanup",value:function(e){var t=this.state.toasts,n=t.find(function(t){return t.id===e});return!!n&&(t.splice(t.indexOf(n),1),this.setState({toasts:t}),!0)}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.state.toasts;this.counter+=1,e.id=this.counter,e.enabled=!0;var n=e.type&&t.find(function(t){return t.type===e.type});return n?(n.enabled=!1,t.splice(t.indexOf(n),0,e),this.setState({toasts:t})):this.setState({toasts:t.concat([e])}),e.id}},{key:"dismiss",value:function(e){var t=this.state.toasts,n=t.find(function(t){return t.id===e});return!!n&&(n.enabled=!1,this.setState({toasts:t}),!0)}},{key:"componentDidMount",value:function(){c.ReactInvokeBridge.mount("toast",this)}},{key:"componentWillUnmount",value:function(){c.ReactInvokeBridge.mount("toast")}},{key:"render",value:function(){var e=this,t=this.state.toasts,n=(0,c.css)("toastcontainer",p.default.container),a=t.find(function(e){return e.enabled}),o=t.filter(function(e){return e===a||!e.enabled});return u.default.createElement("div",{className:n},o.map(function(t){var n=t.id,a=t.enabled,o=t.messageText,r=t.actionText,i=t.actionCallback,l=t.timeout;return u.default.createElement(m.default,{key:n,id:n,enabled:a,messageText:o,actionText:r,actionCallback:i,timeout:l,dismiss:e.dismiss,cleanup:e.cleanup})}))}}]),t}(s.Component);t.default=h},function(e,t,n){t=e.exports=n(4)(!1),t.push([e.i,".mbhiE{z-index:1000;position:fixed;left:4px;top:4px;right:4px;bottom:4px;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,Helvetica Neue,Helvetica,Arial;transition:margin-bottom .3s ease-in-out}.statusbarvisible .mbhiE{margin-bottom:44px}._1PEhn{position:absolute;left:50%;bottom:4px;-webkit-transform:translateX(-50%);transform:translateX(-50%);width:300px;max-width:90vw;padding:12px 20px 14px;overflow:hidden;text-align:center;color:#fff;font-size:14px;background:#0080bf;border-radius:4px;opacity:0;transition:all .3s cubic-bezier(.25,.46,.45,.94)}._1PEhn._1v97Q{text-align:left}._1PEhn ._2LzeS{float:right;padding-left:1em;color:#fff;font-weight:700}._1PEhn.pkR_6._1XIHw{-webkit-animation:_1jZPT .5s 1 cubic-bezier(.25,.46,.45,.94);animation:_1jZPT .5s 1 cubic-bezier(.25,.46,.45,.94)}._1PEhn.pkR_6.WAD7D{-webkit-animation:_1kyc1 .5s 1 cubic-bezier(.25,.46,.45,.94);animation:_1kyc1 .5s 1 cubic-bezier(.25,.46,.45,.94)}._1PEhn.lMSGY{-webkit-transform:translateY(20px) translateX(-50%);transform:translateY(20px) translateX(-50%)}._1PEhn.pkR_6{pointer-events:auto;cursor:pointer;-webkit-transform:translateX(-50%);transform:translateX(-50%);opacity:1;transition-duration:.5s}@-webkit-keyframes _1jZPT{0%{-webkit-transform:translateX(-50px) translateX(-50%);transform:translateX(-50px) translateX(-50%)}to{-webkit-transform:translateX(-50%);transform:translateX(-50%)}}@keyframes _1jZPT{0%{-webkit-transform:translateX(-50px) translateX(-50%);transform:translateX(-50px) translateX(-50%)}to{-webkit-transform:translateX(-50%);transform:translateX(-50%)}}@-webkit-keyframes _1kyc1{0%{-webkit-transform:translateY(20px) translateX(-50%);transform:translateY(20px) translateX(-50%)}to{-webkit-transform:translateX(-50%);transform:translateX(-50%)}}@keyframes _1kyc1{0%{-webkit-transform:translateY(20px) translateX(-50%);transform:translateY(20px) translateX(-50%)}to{-webkit-transform:translateX(-50%);transform:translateX(-50%)}}._21e_d{position:absolute;left:0;bottom:0;width:100%;height:3px;background:linear-gradient(90deg,hsla(0,0%,100%,.04),hsla(0,0%,100%,.08) 50%,hsla(0,0%,100%,.3));-webkit-transform-origin:0 50%;transform-origin:0 50%;-webkit-transform:scaleX(1);transform:scaleX(1);transition:all 8s cubic-bezier(.25,.25,.75,.75)}",""]),t.locals={container:"mbhiE",toast:"_1PEhn",hasaction:"_1v97Q",action:"_2LzeS",active:"pkR_6",fadeinfromleft:"_1XIHw","enter-from-left":"_1jZPT",enterFromLeft:"_1jZPT",fadeinfrombottom:"WAD7D","enter-from-bottom":"_1kyc1",enterFromBottom:"_1kyc1",fadeoutdown:"lMSGY",timeoutindicator:"_21e_d"}},function(e,t,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),s=n(0),u=a(s),c=n(1),d=n(44),p=a(d),f=/(?:scaleX\(([-+]?[0-9]+(?:\.[0-9]+)?)\))|(?:matrix\(([-+]?[0-9]+(?:\.[0-9]+)?),\s*0,\s*0,\s*1,\s*0,\s*0\))/,m=function(e){function t(e){o(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={enabled:!0},n.toastElement=null,n.timeoutElement=null,n.isCountingDown=!1,n.autoDismissDuration=null,n.autoDismissProgress=null,n.autoDismiss=n.autoDismiss.bind(n),n.pauseAutoDismiss=n.pauseAutoDismiss.bind(n),n.handleClick=n.handleClick.bind(n),n.handleAutoDismiss=n.handleAutoDismiss.bind(n),n}return i(t,e),l(t,[{key:"disable",value:function(){var e=this.props,t=e.cleanup,n=e.id;if(this.setState({enabled:!1}),this.timeoutElement&&this.timeoutElement.removeEventListener((0,c.getTransitionEvent)(),this.handleAutoDismiss),"function"==typeof t){var a=(0,c.getTransitionEvent)(),o=this.toastElement;if(o&&a){var r=function e(r){return r.target!==o?null:(o.removeEventListener(a,e),t(n),!0)};o.addEventListener(a,r)}else setTimeout(function(){t(n)},1e3)}}},{key:"autoDismiss",value:function(){var e=this.state.enabled;if("number"!=typeof this.autoDismissDuration||"number"!=typeof this.autoDismissProgress)return null;if(e&&!this.isCountingDown){var t=this.autoDismissProgress*this.autoDismissDuration;return(0,c.setPrefixedStyle)(this.timeoutElement,"transitionDuration",t+"ms"),(0,c.setPrefixedStyle)(this.timeoutElement,"transform","scaleX(0)"),this.isCountingDown=!0,this.timeoutElement.addEventListener((0,c.getTransitionEvent)(),this.handleAutoDismiss),!0}return!1}},{key:"pauseAutoDismiss",value:function(){if(this.state.enabled&&this.isCountingDown){this.timeoutElement.removeEventListener((0,c.getTransitionEvent)(),this.handleAutoDismiss);var e=f.exec((0,c.getPrefixedStyle)(this.timeoutElement,"transform"));this.autoDismissProgress=e&&e.length>=3?parseFloat(e[1]||e[2]):.01,(0,c.setPrefixedStyle)(this.timeoutElement,"transform","scaleX("+this.autoDismissProgress+")"),(0,c.setPrefixedStyle)(this.timeoutElement,"transitionDuration","0ms"),this.isCountingDown=!1}}},{key:"handleClick",value:function(){var e=this.props,t=e.id,n=e.dismiss,a=e.actionCallback;"function"==typeof a&&(a(),"function"==typeof n?n(t):this.disable())}},{key:"handleAutoDismiss",value:function(){var e=this.props,t=e.id,n=e.dismiss;"function"==typeof n?n(t):this.disable()}},{key:"componentWillReceiveProps",value:function(e){this.state.enabled&&!1===e.enabled&&this.disable()}},{key:"componentDidMount",value:function(){if(this.timeoutElement){var e=(0,c.cssTimeToMs)((0,c.getPrefixedStyle)(this.timeoutElement,"transitionDuration"));this.autoDismissDuration=e||1e4,this.autoDismissProgress=1,setTimeout(this.autoDismiss,0)}}},{key:"render",value:function(){var e=this,t=this.props,n=t.id,a=t.messageText,o=t.actionText,r=t.timeout,i=this.state.enabled,l=o&&o.length?u.default.createElement("span",{className:p.default.action},o):null,s=(0,c.css)(p.default.toast,p.default.fadeinfrombottom,p.default.fadeoutdown,i&&p.default.active,l&&p.default.hasaction),d=void 0;return"number"==typeof r&&(d={transitionDuration:1e3*Math.max(Math.min(r,30),1)+"ms"}),u.default.createElement("div",{key:n,className:s,onClick:this.handleClick,onMouseEnter:this.pauseAutoDismiss,onMouseLeave:this.autoDismiss,ref:function(t){return e.toastElement=t}},l," ",a,u.default.createElement("div",{className:p.default.timeoutindicator,style:d,ref:function(t){return e.timeoutElement=t}}))}}]),t}(s.PureComponent);t.default=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),o=null;a.ReactInvokeBridge.get("toast").then(function(e){o=e});var r=function(e){return o&&o.create(e)};t.default=r}]);var CLOSURE_NO_DEPS = true;
var COMPILED = false;
var goog = goog || {};
goog.global = this;
goog.global.CLOSURE_UNCOMPILED_DEFINES;
goog.global.CLOSURE_DEFINES;
goog.isDef = function(val) {
  return val !== void 0;
};
goog.isString = function(val) {
  return typeof val == "string";
};
goog.isBoolean = function(val) {
  return typeof val == "boolean";
};
goog.isNumber = function(val) {
  return typeof val == "number";
};
goog.exportPath_ = function(name, opt_object, opt_objectToExportTo) {
  var parts = name.split(".");
  var cur = opt_objectToExportTo || goog.global;
  if (!(parts[0] in cur) && cur.execScript) {
    cur.execScript("var " + parts[0]);
  }
  for (var part; parts.length && (part = parts.shift());) {
    if (!parts.length && goog.isDef(opt_object)) {
      cur[part] = opt_object;
    } else {
      if (cur[part] && cur[part] !== Object.prototype[part]) {
        cur = cur[part];
      } else {
        cur = cur[part] = {};
      }
    }
  }
};
goog.define = function(name, defaultValue) {
  var value = defaultValue;
  if (!COMPILED) {
    if (goog.global.CLOSURE_UNCOMPILED_DEFINES && goog.global.CLOSURE_UNCOMPILED_DEFINES.nodeType === undefined && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES, name)) {
      value = goog.global.CLOSURE_UNCOMPILED_DEFINES[name];
    } else {
      if (goog.global.CLOSURE_DEFINES && goog.global.CLOSURE_DEFINES.nodeType === undefined && Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES, name)) {
        value = goog.global.CLOSURE_DEFINES[name];
      }
    }
  }
  goog.exportPath_(name, value);
};
goog.define("goog.DEBUG", true);
goog.define("goog.LOCALE", "en");
goog.define("goog.TRUSTED_SITE", true);
goog.define("goog.STRICT_MODE_COMPATIBLE", false);
goog.define("goog.DISALLOW_TEST_ONLY_CODE", COMPILED && !goog.DEBUG);
goog.define("goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING", false);
goog.provide = function(name) {
  if (goog.isInModuleLoader_()) {
    throw Error("goog.provide can not be used within a goog.module.");
  }
  if (!COMPILED) {
    if (goog.isProvided_(name)) {
      throw Error('Namespace "' + name + '" already declared.');
    }
  }
  goog.constructNamespace_(name);
};
goog.constructNamespace_ = function(name, opt_obj) {
  if (!COMPILED) {
    delete goog.implicitNamespaces_[name];
    var namespace = name;
    while (namespace = namespace.substring(0, namespace.lastIndexOf("."))) {
      if (goog.getObjectByName(namespace)) {
        break;
      }
      goog.implicitNamespaces_[namespace] = true;
    }
  }
  goog.exportPath_(name, opt_obj);
};
goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/;
goog.module = function(name) {
  if (!goog.isString(name) || !name || name.search(goog.VALID_MODULE_RE_) == -1) {
    throw Error("Invalid module identifier");
  }
  if (!goog.isInModuleLoader_()) {
    throw Error("Module " + name + " has been loaded incorrectly. Note, " + "modules cannot be loaded as normal scripts. They require some kind of " + "pre-processing step. You're likely trying to load a module via a " + "script tag or as a part of a concatenated bundle without rewriting the " + "module. For more info see: " + "https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");
  }
  if (goog.moduleLoaderState_.moduleName) {
    throw Error("goog.module may only be called once per module.");
  }
  goog.moduleLoaderState_.moduleName = name;
  if (!COMPILED) {
    if (goog.isProvided_(name)) {
      throw Error('Namespace "' + name + '" already declared.');
    }
    delete goog.implicitNamespaces_[name];
  }
};
goog.module.get = function(name) {
  return goog.module.getInternal_(name);
};
goog.module.getInternal_ = function(name) {
  if (!COMPILED) {
    if (name in goog.loadedModules_) {
      return goog.loadedModules_[name];
    } else {
      if (!goog.implicitNamespaces_[name]) {
        var ns = goog.getObjectByName(name);
        return ns != null ? ns : null;
      }
    }
  }
  return null;
};
goog.moduleLoaderState_ = null;
goog.isInModuleLoader_ = function() {
  return goog.moduleLoaderState_ != null;
};
goog.module.declareLegacyNamespace = function() {
  if (!COMPILED && !goog.isInModuleLoader_()) {
    throw new Error("goog.module.declareLegacyNamespace must be called from " + "within a goog.module");
  }
  if (!COMPILED && !goog.moduleLoaderState_.moduleName) {
    throw Error("goog.module must be called prior to " + "goog.module.declareLegacyNamespace.");
  }
  goog.moduleLoaderState_.declareLegacyNamespace = true;
};
goog.setTestOnly = function(opt_message) {
  if (goog.DISALLOW_TEST_ONLY_CODE) {
    opt_message = opt_message || "";
    throw Error("Importing test-only code into non-debug environment" + (opt_message ? ": " + opt_message : "."));
  }
};
goog.forwardDeclare = function(name) {
};
goog.forwardDeclare("Document");
goog.forwardDeclare("HTMLScriptElement");
goog.forwardDeclare("XMLHttpRequest");
if (!COMPILED) {
  goog.isProvided_ = function(name) {
    return name in goog.loadedModules_ || !goog.implicitNamespaces_[name] && goog.isDefAndNotNull(goog.getObjectByName(name));
  };
  goog.implicitNamespaces_ = {"goog.module":true};
}
goog.getObjectByName = function(name, opt_obj) {
  var parts = name.split(".");
  var cur = opt_obj || goog.global;
  for (var part; part = parts.shift();) {
    if (goog.isDefAndNotNull(cur[part])) {
      cur = cur[part];
    } else {
      return null;
    }
  }
  return cur;
};
goog.globalize = function(obj, opt_global) {
  var global = opt_global || goog.global;
  for (var x in obj) {
    global[x] = obj[x];
  }
};
goog.addDependency = function(relPath, provides, requires, opt_loadFlags) {
  if (goog.DEPENDENCIES_ENABLED) {
    var provide, require;
    var path = relPath.replace(/\\/g, "/");
    var deps = goog.dependencies_;
    if (!opt_loadFlags || typeof opt_loadFlags === "boolean") {
      opt_loadFlags = opt_loadFlags ? {"module":"goog"} : {};
    }
    for (var i = 0; provide = provides[i]; i++) {
      deps.nameToPath[provide] = path;
      deps.loadFlags[path] = opt_loadFlags;
    }
    for (var j = 0; require = requires[j]; j++) {
      if (!(path in deps.requires)) {
        deps.requires[path] = {};
      }
      deps.requires[path][require] = true;
    }
  }
};
goog.define("goog.ENABLE_DEBUG_LOADER", true);
goog.logToConsole_ = function(msg) {
  if (goog.global.console) {
    goog.global.console["error"](msg);
  }
};
goog.require = function(name) {
  if (!COMPILED) {
    if (goog.ENABLE_DEBUG_LOADER && goog.IS_OLD_IE_) {
      goog.maybeProcessDeferredDep_(name);
    }
    if (goog.isProvided_(name)) {
      if (goog.isInModuleLoader_()) {
        return goog.module.getInternal_(name);
      }
    } else {
      if (goog.ENABLE_DEBUG_LOADER) {
        var path = goog.getPathFromDeps_(name);
        if (path) {
          goog.writeScripts_(path);
        } else {
          var errorMessage = "goog.require could not find: " + name;
          goog.logToConsole_(errorMessage);
          throw Error(errorMessage);
        }
      }
    }
    return null;
  }
};
goog.basePath = "";
goog.global.CLOSURE_BASE_PATH;
goog.global.CLOSURE_NO_DEPS;
goog.global.CLOSURE_IMPORT_SCRIPT;
goog.nullFunction = function() {
};
goog.abstractMethod = function() {
  throw Error("unimplemented abstract method");
};
goog.addSingletonGetter = function(ctor) {
  ctor.instance_ = undefined;
  ctor.getInstance = function() {
    if (ctor.instance_) {
      return ctor.instance_;
    }
    if (goog.DEBUG) {
      goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = ctor;
    }
    return ctor.instance_ = new ctor;
  };
};
goog.instantiatedSingletons_ = [];
goog.define("goog.LOAD_MODULE_USING_EVAL", true);
goog.define("goog.SEAL_MODULE_EXPORTS", goog.DEBUG);
goog.loadedModules_ = {};
goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;
goog.define("goog.TRANSPILE", "detect");
goog.define("goog.TRANSPILER", "transpile.js");
if (goog.DEPENDENCIES_ENABLED) {
  goog.dependencies_ = {loadFlags:{}, nameToPath:{}, requires:{}, visited:{}, written:{}, deferred:{}};
  goog.inHtmlDocument_ = function() {
    var doc = goog.global.document;
    return doc != null && "write" in doc;
  };
  goog.findBasePath_ = function() {
    if (goog.isDef(goog.global.CLOSURE_BASE_PATH) && goog.isString(goog.global.CLOSURE_BASE_PATH)) {
      goog.basePath = goog.global.CLOSURE_BASE_PATH;
      return;
    } else {
      if (!goog.inHtmlDocument_()) {
        return;
      }
    }
    var doc = goog.global.document;
    var currentScript = doc.currentScript;
    if (currentScript) {
      var scripts = [currentScript];
    } else {
      var scripts = doc.getElementsByTagName("SCRIPT");
    }
    for (var i = scripts.length - 1; i >= 0; --i) {
      var script = scripts[i];
      var src = script.src;
      var qmark = src.lastIndexOf("?");
      var l = qmark == -1 ? src.length : qmark;
      if (src.substr(l - 7, 7) == "base.js") {
        goog.basePath = src.substr(0, l - 7);
        return;
      }
    }
  };
  goog.importScript_ = function(src, opt_sourceText) {
    var importScript = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_;
    if (importScript(src, opt_sourceText)) {
      goog.dependencies_.written[src] = true;
    }
  };
  goog.IS_OLD_IE_ = !!(!goog.global.atob && goog.global.document && goog.global.document.all);
  goog.oldIeWaiting_ = false;
  goog.importProcessedScript_ = function(src, isModule, needsTranspile) {
    var bootstrap = 'goog.retrieveAndExec_("' + src + '", ' + isModule + ", " + needsTranspile + ");";
    goog.importScript_("", bootstrap);
  };
  goog.queuedModules_ = [];
  goog.wrapModule_ = function(srcUrl, scriptText) {
    if (!goog.LOAD_MODULE_USING_EVAL || !goog.isDef(goog.global.JSON)) {
      return "" + "goog.loadModule(function(exports) {" + '"use strict";' + scriptText + "\n" + ";return exports" + "});" + "\n//# sourceURL=" + srcUrl + "\n";
    } else {
      return "" + "goog.loadModule(" + goog.global.JSON.stringify(scriptText + "\n//# sourceURL=" + srcUrl + "\n") + ");";
    }
  };
  goog.loadQueuedModules_ = function() {
    var count = goog.queuedModules_.length;
    if (count > 0) {
      var queue = goog.queuedModules_;
      goog.queuedModules_ = [];
      for (var i = 0; i < count; i++) {
        var path = queue[i];
        goog.maybeProcessDeferredPath_(path);
      }
    }
    goog.oldIeWaiting_ = false;
  };
  goog.maybeProcessDeferredDep_ = function(name) {
    if (goog.isDeferredModule_(name) && goog.allDepsAreAvailable_(name)) {
      var path = goog.getPathFromDeps_(name);
      goog.maybeProcessDeferredPath_(goog.basePath + path);
    }
  };
  goog.isDeferredModule_ = function(name) {
    var path = goog.getPathFromDeps_(name);
    var loadFlags = path && goog.dependencies_.loadFlags[path] || {};
    var languageLevel = loadFlags["lang"] || "es3";
    if (path && (loadFlags["module"] == "goog" || goog.needsTranspile_(languageLevel))) {
      var abspath = goog.basePath + path;
      return abspath in goog.dependencies_.deferred;
    }
    return false;
  };
  goog.allDepsAreAvailable_ = function(name) {
    var path = goog.getPathFromDeps_(name);
    if (path && path in goog.dependencies_.requires) {
      for (var requireName in goog.dependencies_.requires[path]) {
        if (!goog.isProvided_(requireName) && !goog.isDeferredModule_(requireName)) {
          return false;
        }
      }
    }
    return true;
  };
  goog.maybeProcessDeferredPath_ = function(abspath) {
    if (abspath in goog.dependencies_.deferred) {
      var src = goog.dependencies_.deferred[abspath];
      delete goog.dependencies_.deferred[abspath];
      goog.globalEval(src);
    }
  };
  goog.loadModuleFromUrl = function(url) {
    goog.retrieveAndExec_(url, true, false);
  };
  goog.writeScriptSrcNode_ = function(src) {
    goog.global.document.write('<script type="text/javascript" src="' + src + '"></' + "script>");
  };
  goog.appendScriptSrcNode_ = function(src) {
    var doc = goog.global.document;
    var scriptEl = doc.createElement("script");
    scriptEl.type = "text/javascript";
    scriptEl.src = src;
    scriptEl.defer = false;
    scriptEl.async = false;
    doc.head.appendChild(scriptEl);
  };
  goog.writeScriptTag_ = function(src, opt_sourceText) {
    if (goog.inHtmlDocument_()) {
      var doc = goog.global.document;
      if (!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING && doc.readyState == "complete") {
        var isDeps = /\bdeps.js$/.test(src);
        if (isDeps) {
          return false;
        } else {
          throw Error('Cannot write "' + src + '" after document load');
        }
      }
      if (opt_sourceText === undefined) {
        if (!goog.IS_OLD_IE_) {
          if (goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING) {
            goog.appendScriptSrcNode_(src);
          } else {
            goog.writeScriptSrcNode_(src);
          }
        } else {
          goog.oldIeWaiting_ = true;
          var state = " onreadystatechange='goog.onScriptLoad_(this, " + ++goog.lastNonModuleScriptIndex_ + ")' ";
          doc.write('<script type="text/javascript" src="' + src + '"' + state + "></" + "script>");
        }
      } else {
        doc.write('<script type="text/javascript">' + goog.protectScriptTag_(opt_sourceText) + "</" + "script>");
      }
      return true;
    } else {
      return false;
    }
  };
  goog.protectScriptTag_ = function(str) {
    return str.replace(/<\/(SCRIPT)/ig, "\\x3c/$1");
  };
  goog.needsTranspile_ = function(lang) {
    if (goog.TRANSPILE == "always") {
      return true;
    } else {
      if (goog.TRANSPILE == "never") {
        return false;
      } else {
        if (!goog.requiresTranspilation_) {
          goog.requiresTranspilation_ = goog.createRequiresTranspilation_();
        }
      }
    }
    if (lang in goog.requiresTranspilation_) {
      return goog.requiresTranspilation_[lang];
    } else {
      throw new Error("Unknown language mode: " + lang);
    }
  };
  goog.requiresTranspilation_ = null;
  goog.lastNonModuleScriptIndex_ = 0;
  goog.onScriptLoad_ = function(script, scriptIndex) {
    if (script.readyState == "complete" && goog.lastNonModuleScriptIndex_ == scriptIndex) {
      goog.loadQueuedModules_();
    }
    return true;
  };
  goog.writeScripts_ = function(pathToLoad) {
    var scripts = [];
    var seenScript = {};
    var deps = goog.dependencies_;
    function visitNode(path) {
      if (path in deps.written) {
        return;
      }
      if (path in deps.visited) {
        return;
      }
      deps.visited[path] = true;
      if (path in deps.requires) {
        for (var requireName in deps.requires[path]) {
          if (!goog.isProvided_(requireName)) {
            if (requireName in deps.nameToPath) {
              visitNode(deps.nameToPath[requireName]);
            } else {
              throw Error("Undefined nameToPath for " + requireName);
            }
          }
        }
      }
      if (!(path in seenScript)) {
        seenScript[path] = true;
        scripts.push(path);
      }
    }
    visitNode(pathToLoad);
    for (var i = 0; i < scripts.length; i++) {
      var path = scripts[i];
      goog.dependencies_.written[path] = true;
    }
    var moduleState = goog.moduleLoaderState_;
    goog.moduleLoaderState_ = null;
    for (var i = 0; i < scripts.length; i++) {
      var path = scripts[i];
      if (path) {
        var loadFlags = deps.loadFlags[path] || {};
        var languageLevel = loadFlags["lang"] || "es3";
        var needsTranspile = goog.needsTranspile_(languageLevel);
        if (loadFlags["module"] == "goog" || needsTranspile) {
          goog.importProcessedScript_(goog.basePath + path, loadFlags["module"] == "goog", needsTranspile);
        } else {
          goog.importScript_(goog.basePath + path);
        }
      } else {
        goog.moduleLoaderState_ = moduleState;
        throw Error("Undefined script input");
      }
    }
    goog.moduleLoaderState_ = moduleState;
  };
  goog.getPathFromDeps_ = function(rule) {
    if (rule in goog.dependencies_.nameToPath) {
      return goog.dependencies_.nameToPath[rule];
    } else {
      return null;
    }
  };
  goog.findBasePath_();
  if (!goog.global.CLOSURE_NO_DEPS) {
    goog.importScript_(goog.basePath + "deps.js");
  }
}
goog.hasBadLetScoping = null;
goog.useSafari10Workaround = function() {
  if (goog.hasBadLetScoping == null) {
    var hasBadLetScoping;
    try {
      hasBadLetScoping = !eval('"use strict";' + "let x = 1; function f() { return typeof x; };" + 'f() == "number";');
    } catch (e) {
      hasBadLetScoping = false;
    }
    goog.hasBadLetScoping = hasBadLetScoping;
  }
  return goog.hasBadLetScoping;
};
goog.workaroundSafari10EvalBug = function(moduleDef) {
  return "(function(){" + moduleDef + "\n" + ";" + "})();\n";
};
goog.loadModule = function(moduleDef) {
  var previousState = goog.moduleLoaderState_;
  try {
    goog.moduleLoaderState_ = {moduleName:undefined, declareLegacyNamespace:false};
    var exports;
    if (goog.isFunction(moduleDef)) {
      exports = moduleDef.call(undefined, {});
    } else {
      if (goog.isString(moduleDef)) {
        if (goog.useSafari10Workaround()) {
          moduleDef = goog.workaroundSafari10EvalBug(moduleDef);
        }
        exports = goog.loadModuleFromSource_.call(undefined, moduleDef);
      } else {
        throw Error("Invalid module definition");
      }
    }
    var moduleName = goog.moduleLoaderState_.moduleName;
    if (!goog.isString(moduleName) || !moduleName) {
      throw Error('Invalid module name "' + moduleName + '"');
    }
    if (goog.moduleLoaderState_.declareLegacyNamespace) {
      goog.constructNamespace_(moduleName, exports);
    } else {
      if (goog.SEAL_MODULE_EXPORTS && Object.seal && typeof exports == "object" && exports != null) {
        Object.seal(exports);
      }
    }
    goog.loadedModules_[moduleName] = exports;
  } finally {
    goog.moduleLoaderState_ = previousState;
  }
};
goog.loadModuleFromSource_ = function() {
  var exports = {};
  eval(arguments[0]);
  return exports;
};
goog.normalizePath_ = function(path) {
  var components = path.split("/");
  var i = 0;
  while (i < components.length) {
    if (components[i] == ".") {
      components.splice(i, 1);
    } else {
      if (i && components[i] == ".." && components[i - 1] && components[i - 1] != "..") {
        components.splice(--i, 2);
      } else {
        i++;
      }
    }
  }
  return components.join("/");
};
goog.global.CLOSURE_LOAD_FILE_SYNC;
goog.loadFileSync_ = function(src) {
  if (goog.global.CLOSURE_LOAD_FILE_SYNC) {
    return goog.global.CLOSURE_LOAD_FILE_SYNC(src);
  } else {
    try {
      var xhr = new goog.global["XMLHttpRequest"];
      xhr.open("get", src, false);
      xhr.send();
      return xhr.status == 0 || xhr.status == 200 ? xhr.responseText : null;
    } catch (err) {
      return null;
    }
  }
};
goog.retrieveAndExec_ = function(src, isModule, needsTranspile) {
  if (!COMPILED) {
    var originalPath = src;
    src = goog.normalizePath_(src);
    var importScript = goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_;
    var scriptText = goog.loadFileSync_(src);
    if (scriptText == null) {
      throw new Error('Load of "' + src + '" failed');
    }
    if (needsTranspile) {
      scriptText = goog.transpile_.call(goog.global, scriptText, src);
    }
    if (isModule) {
      scriptText = goog.wrapModule_(src, scriptText);
    } else {
      scriptText += "\n//# sourceURL=" + src;
    }
    var isOldIE = goog.IS_OLD_IE_;
    if (isOldIE && goog.oldIeWaiting_) {
      goog.dependencies_.deferred[originalPath] = scriptText;
      goog.queuedModules_.push(originalPath);
    } else {
      importScript(src, scriptText);
    }
  }
};
goog.transpile_ = function(code, path) {
  var jscomp = goog.global["$jscomp"];
  if (!jscomp) {
    goog.global["$jscomp"] = jscomp = {};
  }
  var transpile = jscomp.transpile;
  if (!transpile) {
    var transpilerPath = goog.basePath + goog.TRANSPILER;
    var transpilerCode = goog.loadFileSync_(transpilerPath);
    if (transpilerCode) {
      eval(transpilerCode + "\n//# sourceURL=" + transpilerPath);
      if (goog.global["$gwtExport"] && goog.global["$gwtExport"]["$jscomp"] && !goog.global["$gwtExport"]["$jscomp"]["transpile"]) {
        throw new Error('The transpiler did not properly export the "transpile" ' + "method. $gwtExport: " + JSON.stringify(goog.global["$gwtExport"]));
      }
      goog.global["$jscomp"].transpile = goog.global["$gwtExport"]["$jscomp"]["transpile"];
      jscomp = goog.global["$jscomp"];
      transpile = jscomp.transpile;
    }
  }
  if (!transpile) {
    var suffix = " requires transpilation but no transpiler was found.";
    transpile = jscomp.transpile = function(code, path) {
      goog.logToConsole_(path + suffix);
      return code;
    };
  }
  return transpile(code, path);
};
goog.typeOf = function(value) {
  var s = typeof value;
  if (s == "object") {
    if (value) {
      if (value instanceof Array) {
        return "array";
      } else {
        if (value instanceof Object) {
          return s;
        }
      }
      var className = Object.prototype.toString.call(value);
      if (className == "[object Window]") {
        return "object";
      }
      if (className == "[object Array]" || typeof value.length == "number" && typeof value.splice != "undefined" && typeof value.propertyIsEnumerable != "undefined" && !value.propertyIsEnumerable("splice")) {
        return "array";
      }
      if (className == "[object Function]" || typeof value.call != "undefined" && typeof value.propertyIsEnumerable != "undefined" && !value.propertyIsEnumerable("call")) {
        return "function";
      }
    } else {
      return "null";
    }
  } else {
    if (s == "function" && typeof value.call == "undefined") {
      return "object";
    }
  }
  return s;
};
goog.isNull = function(val) {
  return val === null;
};
goog.isDefAndNotNull = function(val) {
  return val != null;
};
goog.isArray = function(val) {
  return goog.typeOf(val) == "array";
};
goog.isArrayLike = function(val) {
  var type = goog.typeOf(val);
  return type == "array" || type == "object" && typeof val.length == "number";
};
goog.isDateLike = function(val) {
  return goog.isObject(val) && typeof val.getFullYear == "function";
};
goog.isFunction = function(val) {
  return goog.typeOf(val) == "function";
};
goog.isObject = function(val) {
  var type = typeof val;
  return type == "object" && val != null || type == "function";
};
goog.getUid = function(obj) {
  return obj[goog.UID_PROPERTY_] || (obj[goog.UID_PROPERTY_] = ++goog.uidCounter_);
};
goog.hasUid = function(obj) {
  return !!obj[goog.UID_PROPERTY_];
};
goog.removeUid = function(obj) {
  if (obj !== null && "removeAttribute" in obj) {
    obj.removeAttribute(goog.UID_PROPERTY_);
  }
  try {
    delete obj[goog.UID_PROPERTY_];
  } catch (ex) {
  }
};
goog.UID_PROPERTY_ = "closure_uid_" + (Math.random() * 1e9 >>> 0);
goog.uidCounter_ = 0;
goog.getHashCode = goog.getUid;
goog.removeHashCode = goog.removeUid;
goog.cloneObject = function(obj) {
  var type = goog.typeOf(obj);
  if (type == "object" || type == "array") {
    if (obj.clone) {
      return obj.clone();
    }
    var clone = type == "array" ? [] : {};
    for (var key in obj) {
      clone[key] = goog.cloneObject(obj[key]);
    }
    return clone;
  }
  return obj;
};
goog.bindNative_ = function(fn, selfObj, var_args) {
  return fn.call.apply(fn.bind, arguments);
};
goog.bindJs_ = function(fn, selfObj, var_args) {
  if (!fn) {
    throw new Error;
  }
  if (arguments.length > 2) {
    var boundArgs = Array.prototype.slice.call(arguments, 2);
    return function() {
      var newArgs = Array.prototype.slice.call(arguments);
      Array.prototype.unshift.apply(newArgs, boundArgs);
      return fn.apply(selfObj, newArgs);
    };
  } else {
    return function() {
      return fn.apply(selfObj, arguments);
    };
  }
};
goog.bind = function(fn, selfObj, var_args) {
  if (Function.prototype.bind && Function.prototype.bind.toString().indexOf("native code") != -1) {
    goog.bind = goog.bindNative_;
  } else {
    goog.bind = goog.bindJs_;
  }
  return goog.bind.apply(null, arguments);
};
goog.partial = function(fn, var_args) {
  var args = Array.prototype.slice.call(arguments, 1);
  return function() {
    var newArgs = args.slice();
    newArgs.push.apply(newArgs, arguments);
    return fn.apply(this, newArgs);
  };
};
goog.mixin = function(target, source) {
  for (var x in source) {
    target[x] = source[x];
  }
};
goog.now = goog.TRUSTED_SITE && Date.now || function() {
  return +new Date;
};
goog.globalEval = function(script) {
  if (goog.global.execScript) {
    goog.global.execScript(script, "JavaScript");
  } else {
    if (goog.global.eval) {
      if (goog.evalWorksForGlobals_ == null) {
        goog.global.eval("var _evalTest_ = 1;");
        if (typeof goog.global["_evalTest_"] != "undefined") {
          try {
            delete goog.global["_evalTest_"];
          } catch (ignore) {
          }
          goog.evalWorksForGlobals_ = true;
        } else {
          goog.evalWorksForGlobals_ = false;
        }
      }
      if (goog.evalWorksForGlobals_) {
        goog.global.eval(script);
      } else {
        var doc = goog.global.document;
        var scriptElt = doc.createElement("SCRIPT");
        scriptElt.type = "text/javascript";
        scriptElt.defer = false;
        scriptElt.appendChild(doc.createTextNode(script));
        doc.body.appendChild(scriptElt);
        doc.body.removeChild(scriptElt);
      }
    } else {
      throw Error("goog.globalEval not available");
    }
  }
};
goog.evalWorksForGlobals_ = null;
goog.cssNameMapping_;
goog.cssNameMappingStyle_;
goog.global.CLOSURE_CSS_NAME_MAP_FN;
goog.getCssName = function(className, opt_modifier) {
  if (String(className).charAt(0) == ".") {
    throw new Error('className passed in goog.getCssName must not start with ".".' + " You passed: " + className);
  }
  var getMapping = function(cssName) {
    return goog.cssNameMapping_[cssName] || cssName;
  };
  var renameByParts = function(cssName) {
    var parts = cssName.split("-");
    var mapped = [];
    for (var i = 0; i < parts.length; i++) {
      mapped.push(getMapping(parts[i]));
    }
    return mapped.join("-");
  };
  var rename;
  if (goog.cssNameMapping_) {
    rename = goog.cssNameMappingStyle_ == "BY_WHOLE" ? getMapping : renameByParts;
  } else {
    rename = function(a) {
      return a;
    };
  }
  var result = opt_modifier ? className + "-" + rename(opt_modifier) : rename(className);
  if (goog.global.CLOSURE_CSS_NAME_MAP_FN) {
    return goog.global.CLOSURE_CSS_NAME_MAP_FN(result);
  }
  return result;
};
goog.setCssNameMapping = function(mapping, opt_style) {
  goog.cssNameMapping_ = mapping;
  goog.cssNameMappingStyle_ = opt_style;
};
goog.global.CLOSURE_CSS_NAME_MAPPING;
if (!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING) {
  goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING;
}
goog.getMsg = function(str, opt_values) {
  if (opt_values) {
    str = str.replace(/\{\$([^}]+)}/g, function(match, key) {
      return opt_values != null && key in opt_values ? opt_values[key] : match;
    });
  }
  return str;
};
goog.getMsgWithFallback = function(a, b) {
  return a;
};
goog.exportSymbol = function(publicPath, object, opt_objectToExportTo) {
  goog.exportPath_(publicPath, object, opt_objectToExportTo);
};
goog.exportProperty = function(object, publicName, symbol) {
  object[publicName] = symbol;
};
goog.inherits = function(childCtor, parentCtor) {
  function tempCtor() {
  }
  tempCtor.prototype = parentCtor.prototype;
  childCtor.superClass_ = parentCtor.prototype;
  childCtor.prototype = new tempCtor;
  childCtor.prototype.constructor = childCtor;
  childCtor.base = function(me, methodName, var_args) {
    var args = new Array(arguments.length - 2);
    for (var i = 2; i < arguments.length; i++) {
      args[i - 2] = arguments[i];
    }
    return parentCtor.prototype[methodName].apply(me, args);
  };
};
goog.base = function(me, opt_methodName, var_args) {
  var caller = arguments.callee.caller;
  if (goog.STRICT_MODE_COMPATIBLE || goog.DEBUG && !caller) {
    throw Error("arguments.caller not defined.  goog.base() cannot be used " + "with strict mode code. See " + "http://www.ecma-international.org/ecma-262/5.1/#sec-C");
  }
  if (caller.superClass_) {
    var ctorArgs = new Array(arguments.length - 1);
    for (var i = 1; i < arguments.length; i++) {
      ctorArgs[i - 1] = arguments[i];
    }
    return caller.superClass_.constructor.apply(me, ctorArgs);
  }
  var args = new Array(arguments.length - 2);
  for (var i = 2; i < arguments.length; i++) {
    args[i - 2] = arguments[i];
  }
  var foundCaller = false;
  for (var ctor = me.constructor; ctor; ctor = ctor.superClass_ && ctor.superClass_.constructor) {
    if (ctor.prototype[opt_methodName] === caller) {
      foundCaller = true;
    } else {
      if (foundCaller) {
        return ctor.prototype[opt_methodName].apply(me, args);
      }
    }
  }
  if (me[opt_methodName] === caller) {
    return me.constructor.prototype[opt_methodName].apply(me, args);
  } else {
    throw Error("goog.base called from a method of one name " + "to a method of a different name");
  }
};
goog.scope = function(fn) {
  if (goog.isInModuleLoader_()) {
    throw Error("goog.scope is not supported within a goog.module.");
  }
  fn.call(goog.global);
};
if (!COMPILED) {
  goog.global["COMPILED"] = COMPILED;
}
goog.defineClass = function(superClass, def) {
  var constructor = def.constructor;
  var statics = def.statics;
  if (!constructor || constructor == Object.prototype.constructor) {
    constructor = function() {
      throw Error("cannot instantiate an interface (no constructor defined).");
    };
  }
  var cls = goog.defineClass.createSealingConstructor_(constructor, superClass);
  if (superClass) {
    goog.inherits(cls, superClass);
  }
  delete def.constructor;
  delete def.statics;
  goog.defineClass.applyProperties_(cls.prototype, def);
  if (statics != null) {
    if (statics instanceof Function) {
      statics(cls);
    } else {
      goog.defineClass.applyProperties_(cls, statics);
    }
  }
  return cls;
};
goog.defineClass.ClassDescriptor;
goog.define("goog.defineClass.SEAL_CLASS_INSTANCES", goog.DEBUG);
goog.defineClass.createSealingConstructor_ = function(ctr, superClass) {
  if (!goog.defineClass.SEAL_CLASS_INSTANCES) {
    return ctr;
  }
  var superclassSealable = !goog.defineClass.isUnsealable_(superClass);
  var wrappedCtr = function() {
    var instance = ctr.apply(this, arguments) || this;
    instance[goog.UID_PROPERTY_] = instance[goog.UID_PROPERTY_];
    if (this.constructor === wrappedCtr && superclassSealable && Object.seal instanceof Function) {
      Object.seal(instance);
    }
    return instance;
  };
  return wrappedCtr;
};
goog.defineClass.isUnsealable_ = function(ctr) {
  return ctr && ctr.prototype && ctr.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_];
};
goog.defineClass.OBJECT_PROTOTYPE_FIELDS_ = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
goog.defineClass.applyProperties_ = function(target, source) {
  var key;
  for (key in source) {
    if (Object.prototype.hasOwnProperty.call(source, key)) {
      target[key] = source[key];
    }
  }
  for (var i = 0; i < goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length; i++) {
    key = goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[i];
    if (Object.prototype.hasOwnProperty.call(source, key)) {
      target[key] = source[key];
    }
  }
};
goog.tagUnsealableClass = function(ctr) {
  if (!COMPILED && goog.defineClass.SEAL_CLASS_INSTANCES) {
    ctr.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_] = true;
  }
};
goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_ = "goog_defineClass_legacy_unsealable";
goog.createRequiresTranspilation_ = function() {
  var requiresTranspilation = {"es3":false};
  var transpilationRequiredForAllLaterModes = false;
  function addNewerLanguageTranspilationCheck(modeName, isSupported) {
    if (transpilationRequiredForAllLaterModes) {
      requiresTranspilation[modeName] = true;
    } else {
      if (isSupported()) {
        requiresTranspilation[modeName] = false;
      } else {
        requiresTranspilation[modeName] = true;
        transpilationRequiredForAllLaterModes = true;
      }
    }
  }
  function evalCheck(code) {
    try {
      return !!eval(code);
    } catch (ignored) {
      return false;
    }
  }
  var userAgent = goog.global.navigator && goog.global.navigator.userAgent ? goog.global.navigator.userAgent : "";
  addNewerLanguageTranspilationCheck("es5", function() {
    return evalCheck("[1,].length==1");
  });
  addNewerLanguageTranspilationCheck("es6", function() {
    var re = /Edge\/(\d+)(\.\d)*/i;
    var edgeUserAgent = userAgent.match(re);
    if (edgeUserAgent && Number(edgeUserAgent[1]) < 15) {
      return false;
    }
    var es6fullTest = "class X{constructor(){if(new.target!=String)throw 1;this.x=42}}" + "let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof " + "String))throw 1;for(const a of[2,3]){if(a==2)continue;function " + "f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()" + "==3}";
    return evalCheck('(()=>{"use strict";' + es6fullTest + "})()");
  });
  addNewerLanguageTranspilationCheck("es6-impl", function() {
    return true;
  });
  addNewerLanguageTranspilationCheck("es7", function() {
    return evalCheck("2 ** 2 == 4");
  });
  addNewerLanguageTranspilationCheck("es8", function() {
    return evalCheck("async () => 1, true");
  });
  return requiresTranspilation;
};
goog.provide("goog.debug.Error");
goog.debug.Error = function(opt_msg) {
  if (Error.captureStackTrace) {
    Error.captureStackTrace(this, goog.debug.Error);
  } else {
    var stack = (new Error).stack;
    if (stack) {
      this.stack = stack;
    }
  }
  if (opt_msg) {
    this.message = String(opt_msg);
  }
  this.reportErrorToServer = true;
};
goog.inherits(goog.debug.Error, Error);
goog.debug.Error.prototype.name = "CustomError";
goog.provide("goog.dom.NodeType");
goog.dom.NodeType = {ELEMENT:1, ATTRIBUTE:2, TEXT:3, CDATA_SECTION:4, ENTITY_REFERENCE:5, ENTITY:6, PROCESSING_INSTRUCTION:7, COMMENT:8, DOCUMENT:9, DOCUMENT_TYPE:10, DOCUMENT_FRAGMENT:11, NOTATION:12};
goog.provide("goog.string");
goog.provide("goog.string.Unicode");
goog.define("goog.string.DETECT_DOUBLE_ESCAPING", false);
goog.define("goog.string.FORCE_NON_DOM_HTML_UNESCAPING", false);
goog.string.Unicode = {NBSP:"\u00a0"};
goog.string.startsWith = function(str, prefix) {
  return str.lastIndexOf(prefix, 0) == 0;
};
goog.string.endsWith = function(str, suffix) {
  var l = str.length - suffix.length;
  return l >= 0 && str.indexOf(suffix, l) == l;
};
goog.string.caseInsensitiveStartsWith = function(str, prefix) {
  return goog.string.caseInsensitiveCompare(prefix, str.substr(0, prefix.length)) == 0;
};
goog.string.caseInsensitiveEndsWith = function(str, suffix) {
  return goog.string.caseInsensitiveCompare(suffix, str.substr(str.length - suffix.length, suffix.length)) == 0;
};
goog.string.caseInsensitiveEquals = function(str1, str2) {
  return str1.toLowerCase() == str2.toLowerCase();
};
goog.string.subs = function(str, var_args) {
  var splitParts = str.split("%s");
  var returnString = "";
  var subsArguments = Array.prototype.slice.call(arguments, 1);
  while (subsArguments.length && splitParts.length > 1) {
    returnString += splitParts.shift() + subsArguments.shift();
  }
  return returnString + splitParts.join("%s");
};
goog.string.collapseWhitespace = function(str) {
  return str.replace(/[\s\xa0]+/g, " ").replace(/^\s+|\s+$/g, "");
};
goog.string.isEmptyOrWhitespace = function(str) {
  return /^[\s\xa0]*$/.test(str);
};
goog.string.isEmptyString = function(str) {
  return str.length == 0;
};
goog.string.isEmpty = goog.string.isEmptyOrWhitespace;
goog.string.isEmptyOrWhitespaceSafe = function(str) {
  return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(str));
};
goog.string.isEmptySafe = goog.string.isEmptyOrWhitespaceSafe;
goog.string.isBreakingWhitespace = function(str) {
  return !/[^\t\n\r ]/.test(str);
};
goog.string.isAlpha = function(str) {
  return !/[^a-zA-Z]/.test(str);
};
goog.string.isNumeric = function(str) {
  return !/[^0-9]/.test(str);
};
goog.string.isAlphaNumeric = function(str) {
  return !/[^a-zA-Z0-9]/.test(str);
};
goog.string.isSpace = function(ch) {
  return ch == " ";
};
goog.string.isUnicodeChar = function(ch) {
  return ch.length == 1 && ch >= " " && ch <= "~" || ch >= "\u0080" && ch <= "\ufffd";
};
goog.string.stripNewlines = function(str) {
  return str.replace(/(\r\n|\r|\n)+/g, " ");
};
goog.string.canonicalizeNewlines = function(str) {
  return str.replace(/(\r\n|\r|\n)/g, "\n");
};
goog.string.normalizeWhitespace = function(str) {
  return str.replace(/\xa0|\s/g, " ");
};
goog.string.normalizeSpaces = function(str) {
  return str.replace(/\xa0|[ \t]+/g, " ");
};
goog.string.collapseBreakingSpaces = function(str) {
  return str.replace(/[\t\r\n ]+/g, " ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g, "");
};
goog.string.trim = goog.TRUSTED_SITE && String.prototype.trim ? function(str) {
  return str.trim();
} : function(str) {
  return str.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "");
};
goog.string.trimLeft = function(str) {
  return str.replace(/^[\s\xa0]+/, "");
};
goog.string.trimRight = function(str) {
  return str.replace(/[\s\xa0]+$/, "");
};
goog.string.caseInsensitiveCompare = function(str1, str2) {
  var test1 = String(str1).toLowerCase();
  var test2 = String(str2).toLowerCase();
  if (test1 < test2) {
    return -1;
  } else {
    if (test1 == test2) {
      return 0;
    } else {
      return 1;
    }
  }
};
goog.string.numberAwareCompare_ = function(str1, str2, tokenizerRegExp) {
  if (str1 == str2) {
    return 0;
  }
  if (!str1) {
    return -1;
  }
  if (!str2) {
    return 1;
  }
  var tokens1 = str1.toLowerCase().match(tokenizerRegExp);
  var tokens2 = str2.toLowerCase().match(tokenizerRegExp);
  var count = Math.min(tokens1.length, tokens2.length);
  for (var i = 0; i < count; i++) {
    var a = tokens1[i];
    var b = tokens2[i];
    if (a != b) {
      var num1 = parseInt(a, 10);
      if (!isNaN(num1)) {
        var num2 = parseInt(b, 10);
        if (!isNaN(num2) && num1 - num2) {
          return num1 - num2;
        }
      }
      return a < b ? -1 : 1;
    }
  }
  if (tokens1.length != tokens2.length) {
    return tokens1.length - tokens2.length;
  }
  return str1 < str2 ? -1 : 1;
};
goog.string.intAwareCompare = function(str1, str2) {
  return goog.string.numberAwareCompare_(str1, str2, /\d+|\D+/g);
};
goog.string.floatAwareCompare = function(str1, str2) {
  return goog.string.numberAwareCompare_(str1, str2, /\d+|\.\d+|\D+/g);
};
goog.string.numerateCompare = goog.string.floatAwareCompare;
goog.string.urlEncode = function(str) {
  return encodeURIComponent(String(str));
};
goog.string.urlDecode = function(str) {
  return decodeURIComponent(str.replace(/\+/g, " "));
};
goog.string.newLineToBr = function(str, opt_xml) {
  return str.replace(/(\r\n|\r|\n)/g, opt_xml ? "<br />" : "<br>");
};
goog.string.htmlEscape = function(str, opt_isLikelyToContainHtmlChars) {
  if (opt_isLikelyToContainHtmlChars) {
    str = str.replace(goog.string.AMP_RE_, "&amp;").replace(goog.string.LT_RE_, "&lt;").replace(goog.string.GT_RE_, "&gt;").replace(goog.string.QUOT_RE_, "&quot;").replace(goog.string.SINGLE_QUOTE_RE_, "&#39;").replace(goog.string.NULL_RE_, "&#0;");
    if (goog.string.DETECT_DOUBLE_ESCAPING) {
      str = str.replace(goog.string.E_RE_, "&#101;");
    }
    return str;
  } else {
    if (!goog.string.ALL_RE_.test(str)) {
      return str;
    }
    if (str.indexOf("&") != -1) {
      str = str.replace(goog.string.AMP_RE_, "&amp;");
    }
    if (str.indexOf("<") != -1) {
      str = str.replace(goog.string.LT_RE_, "&lt;");
    }
    if (str.indexOf(">") != -1) {
      str = str.replace(goog.string.GT_RE_, "&gt;");
    }
    if (str.indexOf('"') != -1) {
      str = str.replace(goog.string.QUOT_RE_, "&quot;");
    }
    if (str.indexOf("'") != -1) {
      str = str.replace(goog.string.SINGLE_QUOTE_RE_, "&#39;");
    }
    if (str.indexOf("\x00") != -1) {
      str = str.replace(goog.string.NULL_RE_, "&#0;");
    }
    if (goog.string.DETECT_DOUBLE_ESCAPING && str.indexOf("e") != -1) {
      str = str.replace(goog.string.E_RE_, "&#101;");
    }
    return str;
  }
};
goog.string.AMP_RE_ = /&/g;
goog.string.LT_RE_ = /</g;
goog.string.GT_RE_ = />/g;
goog.string.QUOT_RE_ = /"/g;
goog.string.SINGLE_QUOTE_RE_ = /'/g;
goog.string.NULL_RE_ = /\x00/g;
goog.string.E_RE_ = /e/g;
goog.string.ALL_RE_ = goog.string.DETECT_DOUBLE_ESCAPING ? /[\x00&<>"'e]/ : /[\x00&<>"']/;
goog.string.unescapeEntities = function(str) {
  if (goog.string.contains(str, "&")) {
    if (!goog.string.FORCE_NON_DOM_HTML_UNESCAPING && "document" in goog.global) {
      return goog.string.unescapeEntitiesUsingDom_(str);
    } else {
      return goog.string.unescapePureXmlEntities_(str);
    }
  }
  return str;
};
goog.string.unescapeEntitiesWithDocument = function(str, document) {
  if (goog.string.contains(str, "&")) {
    return goog.string.unescapeEntitiesUsingDom_(str, document);
  }
  return str;
};
goog.string.unescapeEntitiesUsingDom_ = function(str, opt_document) {
  var seen = {"&amp;":"&", "&lt;":"<", "&gt;":">", "&quot;":'"'};
  var div;
  if (opt_document) {
    div = opt_document.createElement("div");
  } else {
    div = goog.global.document.createElement("div");
  }
  return str.replace(goog.string.HTML_ENTITY_PATTERN_, function(s, entity) {
    var value = seen[s];
    if (value) {
      return value;
    }
    if (entity.charAt(0) == "#") {
      var n = Number("0" + entity.substr(1));
      if (!isNaN(n)) {
        value = String.fromCharCode(n);
      }
    }
    if (!value) {
      div.innerHTML = s + " ";
      value = div.firstChild.nodeValue.slice(0, -1);
    }
    return seen[s] = value;
  });
};
goog.string.unescapePureXmlEntities_ = function(str) {
  return str.replace(/&([^;]+);/g, function(s, entity) {
    switch(entity) {
      case "amp":
        return "&";
      case "lt":
        return "<";
      case "gt":
        return ">";
      case "quot":
        return '"';
      default:
        if (entity.charAt(0) == "#") {
          var n = Number("0" + entity.substr(1));
          if (!isNaN(n)) {
            return String.fromCharCode(n);
          }
        }
        return s;
    }
  });
};
goog.string.HTML_ENTITY_PATTERN_ = /&([^;\s<&]+);?/g;
goog.string.whitespaceEscape = function(str, opt_xml) {
  return goog.string.newLineToBr(str.replace(/  /g, " &#160;"), opt_xml);
};
goog.string.preserveSpaces = function(str) {
  return str.replace(/(^|[\n ]) /g, "$1" + goog.string.Unicode.NBSP);
};
goog.string.stripQuotes = function(str, quoteChars) {
  var length = quoteChars.length;
  for (var i = 0; i < length; i++) {
    var quoteChar = length == 1 ? quoteChars : quoteChars.charAt(i);
    if (str.charAt(0) == quoteChar && str.charAt(str.length - 1) == quoteChar) {
      return str.substring(1, str.length - 1);
    }
  }
  return str;
};
goog.string.truncate = function(str, chars, opt_protectEscapedCharacters) {
  if (opt_protectEscapedCharacters) {
    str = goog.string.unescapeEntities(str);
  }
  if (str.length > chars) {
    str = str.substring(0, chars - 3) + "...";
  }
  if (opt_protectEscapedCharacters) {
    str = goog.string.htmlEscape(str);
  }
  return str;
};
goog.string.truncateMiddle = function(str, chars, opt_protectEscapedCharacters, opt_trailingChars) {
  if (opt_protectEscapedCharacters) {
    str = goog.string.unescapeEntities(str);
  }
  if (opt_trailingChars && str.length > chars) {
    if (opt_trailingChars > chars) {
      opt_trailingChars = chars;
    }
    var endPoint = str.length - opt_trailingChars;
    var startPoint = chars - opt_trailingChars;
    str = str.substring(0, startPoint) + "..." + str.substring(endPoint);
  } else {
    if (str.length > chars) {
      var half = Math.floor(chars / 2);
      var endPos = str.length - half;
      half += chars % 2;
      str = str.substring(0, half) + "..." + str.substring(endPos);
    }
  }
  if (opt_protectEscapedCharacters) {
    str = goog.string.htmlEscape(str);
  }
  return str;
};
goog.string.specialEscapeChars_ = {"\x00":"\\0", "\b":"\\b", "\f":"\\f", "\n":"\\n", "\r":"\\r", "\t":"\\t", "\x0B":"\\x0B", '"':'\\"', "\\":"\\\\", "<":"<"};
goog.string.jsEscapeCache_ = {"'":"\\'"};
goog.string.quote = function(s) {
  s = String(s);
  var sb = ['"'];
  for (var i = 0; i < s.length; i++) {
    var ch = s.charAt(i);
    var cc = ch.charCodeAt(0);
    sb[i + 1] = goog.string.specialEscapeChars_[ch] || (cc > 31 && cc < 127 ? ch : goog.string.escapeChar(ch));
  }
  sb.push('"');
  return sb.join("");
};
goog.string.escapeString = function(str) {
  var sb = [];
  for (var i = 0; i < str.length; i++) {
    sb[i] = goog.string.escapeChar(str.charAt(i));
  }
  return sb.join("");
};
goog.string.escapeChar = function(c) {
  if (c in goog.string.jsEscapeCache_) {
    return goog.string.jsEscapeCache_[c];
  }
  if (c in goog.string.specialEscapeChars_) {
    return goog.string.jsEscapeCache_[c] = goog.string.specialEscapeChars_[c];
  }
  var rv = c;
  var cc = c.charCodeAt(0);
  if (cc > 31 && cc < 127) {
    rv = c;
  } else {
    if (cc < 256) {
      rv = "\\x";
      if (cc < 16 || cc > 256) {
        rv += "0";
      }
    } else {
      rv = "\\u";
      if (cc < 4096) {
        rv += "0";
      }
    }
    rv += cc.toString(16).toUpperCase();
  }
  return goog.string.jsEscapeCache_[c] = rv;
};
goog.string.contains = function(str, subString) {
  return str.indexOf(subString) != -1;
};
goog.string.caseInsensitiveContains = function(str, subString) {
  return goog.string.contains(str.toLowerCase(), subString.toLowerCase());
};
goog.string.countOf = function(s, ss) {
  return s && ss ? s.split(ss).length - 1 : 0;
};
goog.string.removeAt = function(s, index, stringLength) {
  var resultStr = s;
  if (index >= 0 && index < s.length && stringLength > 0) {
    resultStr = s.substr(0, index) + s.substr(index + stringLength, s.length - index - stringLength);
  }
  return resultStr;
};
goog.string.remove = function(str, substr) {
  return str.replace(substr, "");
};
goog.string.removeAll = function(s, ss) {
  var re = new RegExp(goog.string.regExpEscape(ss), "g");
  return s.replace(re, "");
};
goog.string.replaceAll = function(s, ss, replacement) {
  var re = new RegExp(goog.string.regExpEscape(ss), "g");
  return s.replace(re, replacement.replace(/\$/g, "$$$$"));
};
goog.string.regExpEscape = function(s) {
  return String(s).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1").replace(/\x08/g, "\\x08");
};
goog.string.repeat = String.prototype.repeat ? function(string, length) {
  return string.repeat(length);
} : function(string, length) {
  return (new Array(length + 1)).join(string);
};
goog.string.padNumber = function(num, length, opt_precision) {
  var s = goog.isDef(opt_precision) ? num.toFixed(opt_precision) : String(num);
  var index = s.indexOf(".");
  if (index == -1) {
    index = s.length;
  }
  return goog.string.repeat("0", Math.max(0, length - index)) + s;
};
goog.string.makeSafe = function(obj) {
  return obj == null ? "" : String(obj);
};
goog.string.buildString = function(var_args) {
  return Array.prototype.join.call(arguments, "");
};
goog.string.getRandomString = function() {
  var x = 2147483648;
  return Math.floor(Math.random() * x).toString(36) + Math.abs(Math.floor(Math.random() * x) ^ goog.now()).toString(36);
};
goog.string.compareVersions = function(version1, version2) {
  var order = 0;
  var v1Subs = goog.string.trim(String(version1)).split(".");
  var v2Subs = goog.string.trim(String(version2)).split(".");
  var subCount = Math.max(v1Subs.length, v2Subs.length);
  for (var subIdx = 0; order == 0 && subIdx < subCount; subIdx++) {
    var v1Sub = v1Subs[subIdx] || "";
    var v2Sub = v2Subs[subIdx] || "";
    do {
      var v1Comp = /(\d*)(\D*)(.*)/.exec(v1Sub) || ["", "", "", ""];
      var v2Comp = /(\d*)(\D*)(.*)/.exec(v2Sub) || ["", "", "", ""];
      if (v1Comp[0].length == 0 && v2Comp[0].length == 0) {
        break;
      }
      var v1CompNum = v1Comp[1].length == 0 ? 0 : parseInt(v1Comp[1], 10);
      var v2CompNum = v2Comp[1].length == 0 ? 0 : parseInt(v2Comp[1], 10);
      order = goog.string.compareElements_(v1CompNum, v2CompNum) || goog.string.compareElements_(v1Comp[2].length == 0, v2Comp[2].length == 0) || goog.string.compareElements_(v1Comp[2], v2Comp[2]);
      v1Sub = v1Comp[3];
      v2Sub = v2Comp[3];
    } while (order == 0);
  }
  return order;
};
goog.string.compareElements_ = function(left, right) {
  if (left < right) {
    return -1;
  } else {
    if (left > right) {
      return 1;
    }
  }
  return 0;
};
goog.string.hashCode = function(str) {
  var result = 0;
  for (var i = 0; i < str.length; ++i) {
    result = 31 * result + str.charCodeAt(i) >>> 0;
  }
  return result;
};
goog.string.uniqueStringCounter_ = Math.random() * 2147483648 | 0;
goog.string.createUniqueString = function() {
  return "goog_" + goog.string.uniqueStringCounter_++;
};
goog.string.toNumber = function(str) {
  var num = Number(str);
  if (num == 0 && goog.string.isEmptyOrWhitespace(str)) {
    return NaN;
  }
  return num;
};
goog.string.isLowerCamelCase = function(str) {
  return /^[a-z]+([A-Z][a-z]*)*$/.test(str);
};
goog.string.isUpperCamelCase = function(str) {
  return /^([A-Z][a-z]*)+$/.test(str);
};
goog.string.toCamelCase = function(str) {
  return String(str).replace(/\-([a-z])/g, function(all, match) {
    return match.toUpperCase();
  });
};
goog.string.toSelectorCase = function(str) {
  return String(str).replace(/([A-Z])/g, "-$1").toLowerCase();
};
goog.string.toTitleCase = function(str, opt_delimiters) {
  var delimiters = goog.isString(opt_delimiters) ? goog.string.regExpEscape(opt_delimiters) : "\\s";
  delimiters = delimiters ? "|[" + delimiters + "]+" : "";
  var regexp = new RegExp("(^" + delimiters + ")([a-z])", "g");
  return str.replace(regexp, function(all, p1, p2) {
    return p1 + p2.toUpperCase();
  });
};
goog.string.capitalize = function(str) {
  return String(str.charAt(0)).toUpperCase() + String(str.substr(1)).toLowerCase();
};
goog.string.parseInt = function(value) {
  if (isFinite(value)) {
    value = String(value);
  }
  if (goog.isString(value)) {
    return /^\s*-?0x/i.test(value) ? parseInt(value, 16) : parseInt(value, 10);
  }
  return NaN;
};
goog.string.splitLimit = function(str, separator, limit) {
  var parts = str.split(separator);
  var returnVal = [];
  while (limit > 0 && parts.length) {
    returnVal.push(parts.shift());
    limit--;
  }
  if (parts.length) {
    returnVal.push(parts.join(separator));
  }
  return returnVal;
};
goog.string.lastComponent = function(str, separators) {
  if (!separators) {
    return str;
  } else {
    if (typeof separators == "string") {
      separators = [separators];
    }
  }
  var lastSeparatorIndex = -1;
  for (var i = 0; i < separators.length; i++) {
    if (separators[i] == "") {
      continue;
    }
    var currentSeparatorIndex = str.lastIndexOf(separators[i]);
    if (currentSeparatorIndex > lastSeparatorIndex) {
      lastSeparatorIndex = currentSeparatorIndex;
    }
  }
  if (lastSeparatorIndex == -1) {
    return str;
  }
  return str.slice(lastSeparatorIndex + 1);
};
goog.string.editDistance = function(a, b) {
  var v0 = [];
  var v1 = [];
  if (a == b) {
    return 0;
  }
  if (!a.length || !b.length) {
    return Math.max(a.length, b.length);
  }
  for (var i = 0; i < b.length + 1; i++) {
    v0[i] = i;
  }
  for (var i = 0; i < a.length; i++) {
    v1[0] = i + 1;
    for (var j = 0; j < b.length; j++) {
      var cost = Number(a[i] != b[j]);
      v1[j + 1] = Math.min(v1[j] + 1, v0[j + 1] + 1, v0[j] + cost);
    }
    for (var j = 0; j < v0.length; j++) {
      v0[j] = v1[j];
    }
  }
  return v1[b.length];
};
goog.provide("goog.asserts");
goog.provide("goog.asserts.AssertionError");
goog.require("goog.debug.Error");
goog.require("goog.dom.NodeType");
goog.require("goog.string");
goog.define("goog.asserts.ENABLE_ASSERTS", goog.DEBUG);
goog.asserts.AssertionError = function(messagePattern, messageArgs) {
  messageArgs.unshift(messagePattern);
  goog.debug.Error.call(this, goog.string.subs.apply(null, messageArgs));
  messageArgs.shift();
  this.messagePattern = messagePattern;
};
goog.inherits(goog.asserts.AssertionError, goog.debug.Error);
goog.asserts.AssertionError.prototype.name = "AssertionError";
goog.asserts.DEFAULT_ERROR_HANDLER = function(e) {
  throw e;
};
goog.asserts.errorHandler_ = goog.asserts.DEFAULT_ERROR_HANDLER;
goog.asserts.doAssertFailure_ = function(defaultMessage, defaultArgs, givenMessage, givenArgs) {
  var message = "Assertion failed";
  if (givenMessage) {
    message += ": " + givenMessage;
    var args = givenArgs;
  } else {
    if (defaultMessage) {
      message += ": " + defaultMessage;
      args = defaultArgs;
    }
  }
  var e = new goog.asserts.AssertionError("" + message, args || []);
  goog.asserts.errorHandler_(e);
};
goog.asserts.setErrorHandler = function(errorHandler) {
  if (goog.asserts.ENABLE_ASSERTS) {
    goog.asserts.errorHandler_ = errorHandler;
  }
};
goog.asserts.assert = function(condition, opt_message, var_args) {
  if (goog.asserts.ENABLE_ASSERTS && !condition) {
    goog.asserts.doAssertFailure_("", null, opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return condition;
};
goog.asserts.fail = function(opt_message, var_args) {
  if (goog.asserts.ENABLE_ASSERTS) {
    goog.asserts.errorHandler_(new goog.asserts.AssertionError("Failure" + (opt_message ? ": " + opt_message : ""), Array.prototype.slice.call(arguments, 1)));
  }
};
goog.asserts.assertNumber = function(value, opt_message, var_args) {
  if (goog.asserts.ENABLE_ASSERTS && !goog.isNumber(value)) {
    goog.asserts.doAssertFailure_("Expected number but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return value;
};
goog.asserts.assertString = function(value, opt_message, var_args) {
  if (goog.asserts.ENABLE_ASSERTS && !goog.isString(value)) {
    goog.asserts.doAssertFailure_("Expected string but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return value;
};
goog.asserts.assertFunction = function(value, opt_message, var_args) {
  if (goog.asserts.ENABLE_ASSERTS && !goog.isFunction(value)) {
    goog.asserts.doAssertFailure_("Expected function but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return value;
};
goog.asserts.assertObject = function(value, opt_message, var_args) {
  if (goog.asserts.ENABLE_ASSERTS && !goog.isObject(value)) {
    goog.asserts.doAssertFailure_("Expected object but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return value;
};
goog.asserts.assertArray = function(value, opt_message, var_args) {
  if (goog.asserts.ENABLE_ASSERTS && !goog.isArray(value)) {
    goog.asserts.doAssertFailure_("Expected array but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return value;
};
goog.asserts.assertBoolean = function(value, opt_message, var_args) {
  if (goog.asserts.ENABLE_ASSERTS && !goog.isBoolean(value)) {
    goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return value;
};
goog.asserts.assertElement = function(value, opt_message, var_args) {
  if (goog.asserts.ENABLE_ASSERTS && (!goog.isObject(value) || value.nodeType != goog.dom.NodeType.ELEMENT)) {
    goog.asserts.doAssertFailure_("Expected Element but got %s: %s.", [goog.typeOf(value), value], opt_message, Array.prototype.slice.call(arguments, 2));
  }
  return value;
};
goog.asserts.assertInstanceof = function(value, type, opt_message, var_args) {
  if (goog.asserts.ENABLE_ASSERTS && !(value instanceof type)) {
    goog.asserts.doAssertFailure_("Expected instanceof %s but got %s.", [goog.asserts.getType_(type), goog.asserts.getType_(value)], opt_message, Array.prototype.slice.call(arguments, 3));
  }
  return value;
};
goog.asserts.assertObjectPrototypeIsIntact = function() {
  for (var key in Object.prototype) {
    goog.asserts.fail(key + " should not be enumerable in Object.prototype.");
  }
};
goog.asserts.getType_ = function(value) {
  if (value instanceof Function) {
    return value.displayName || value.name || "unknown type name";
  } else {
    if (value instanceof Object) {
      return value.constructor.displayName || value.constructor.name || Object.prototype.toString.call(value);
    } else {
      return value === null ? "null" : typeof value;
    }
  }
};
goog.provide("goog.array");
goog.require("goog.asserts");
goog.define("goog.NATIVE_ARRAY_PROTOTYPES", goog.TRUSTED_SITE);
goog.define("goog.array.ASSUME_NATIVE_FUNCTIONS", false);
goog.array.peek = function(array) {
  return array[array.length - 1];
};
goog.array.last = goog.array.peek;
goog.array.indexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.indexOf) ? function(arr, obj, opt_fromIndex) {
  goog.asserts.assert(arr.length != null);
  return Array.prototype.indexOf.call(arr, obj, opt_fromIndex);
} : function(arr, obj, opt_fromIndex) {
  var fromIndex = opt_fromIndex == null ? 0 : opt_fromIndex < 0 ? Math.max(0, arr.length + opt_fromIndex) : opt_fromIndex;
  if (goog.isString(arr)) {
    if (!goog.isString(obj) || obj.length != 1) {
      return -1;
    }
    return arr.indexOf(obj, fromIndex);
  }
  for (var i = fromIndex; i < arr.length; i++) {
    if (i in arr && arr[i] === obj) {
      return i;
    }
  }
  return -1;
};
goog.array.lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.lastIndexOf) ? function(arr, obj, opt_fromIndex) {
  goog.asserts.assert(arr.length != null);
  var fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;
  return Array.prototype.lastIndexOf.call(arr, obj, fromIndex);
} : function(arr, obj, opt_fromIndex) {
  var fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;
  if (fromIndex < 0) {
    fromIndex = Math.max(0, arr.length + fromIndex);
  }
  if (goog.isString(arr)) {
    if (!goog.isString(obj) || obj.length != 1) {
      return -1;
    }
    return arr.lastIndexOf(obj, fromIndex);
  }
  for (var i = fromIndex; i >= 0; i--) {
    if (i in arr && arr[i] === obj) {
      return i;
    }
  }
  return -1;
};
goog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.forEach) ? function(arr, f, opt_obj) {
  goog.asserts.assert(arr.length != null);
  Array.prototype.forEach.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
  var l = arr.length;
  var arr2 = goog.isString(arr) ? arr.split("") : arr;
  for (var i = 0; i < l; i++) {
    if (i in arr2) {
      f.call(opt_obj, arr2[i], i, arr);
    }
  }
};
goog.array.forEachRight = function(arr, f, opt_obj) {
  var l = arr.length;
  var arr2 = goog.isString(arr) ? arr.split("") : arr;
  for (var i = l - 1; i >= 0; --i) {
    if (i in arr2) {
      f.call(opt_obj, arr2[i], i, arr);
    }
  }
};
goog.array.filter = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.filter) ? function(arr, f, opt_obj) {
  goog.asserts.assert(arr.length != null);
  return Array.prototype.filter.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
  var l = arr.length;
  var res = [];
  var resLength = 0;
  var arr2 = goog.isString(arr) ? arr.split("") : arr;
  for (var i = 0; i < l; i++) {
    if (i in arr2) {
      var val = arr2[i];
      if (f.call(opt_obj, val, i, arr)) {
        res[resLength++] = val;
      }
    }
  }
  return res;
};
goog.array.map = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.map) ? function(arr, f, opt_obj) {
  goog.asserts.assert(arr.length != null);
  return Array.prototype.map.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
  var l = arr.length;
  var res = new Array(l);
  var arr2 = goog.isString(arr) ? arr.split("") : arr;
  for (var i = 0; i < l; i++) {
    if (i in arr2) {
      res[i] = f.call(opt_obj, arr2[i], i, arr);
    }
  }
  return res;
};
goog.array.reduce = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduce) ? function(arr, f, val, opt_obj) {
  goog.asserts.assert(arr.length != null);
  if (opt_obj) {
    f = goog.bind(f, opt_obj);
  }
  return Array.prototype.reduce.call(arr, f, val);
} : function(arr, f, val, opt_obj) {
  var rval = val;
  goog.array.forEach(arr, function(val, index) {
    rval = f.call(opt_obj, rval, val, index, arr);
  });
  return rval;
};
goog.array.reduceRight = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduceRight) ? function(arr, f, val, opt_obj) {
  goog.asserts.assert(arr.length != null);
  goog.asserts.assert(f != null);
  if (opt_obj) {
    f = goog.bind(f, opt_obj);
  }
  return Array.prototype.reduceRight.call(arr, f, val);
} : function(arr, f, val, opt_obj) {
  var rval = val;
  goog.array.forEachRight(arr, function(val, index) {
    rval = f.call(opt_obj, rval, val, index, arr);
  });
  return rval;
};
goog.array.some = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.some) ? function(arr, f, opt_obj) {
  goog.asserts.assert(arr.length != null);
  return Array.prototype.some.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
  var l = arr.length;
  var arr2 = goog.isString(arr) ? arr.split("") : arr;
  for (var i = 0; i < l; i++) {
    if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
      return true;
    }
  }
  return false;
};
goog.array.every = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.every) ? function(arr, f, opt_obj) {
  goog.asserts.assert(arr.length != null);
  return Array.prototype.every.call(arr, f, opt_obj);
} : function(arr, f, opt_obj) {
  var l = arr.length;
  var arr2 = goog.isString(arr) ? arr.split("") : arr;
  for (var i = 0; i < l; i++) {
    if (i in arr2 && !f.call(opt_obj, arr2[i], i, arr)) {
      return false;
    }
  }
  return true;
};
goog.array.count = function(arr, f, opt_obj) {
  var count = 0;
  goog.array.forEach(arr, function(element, index, arr) {
    if (f.call(opt_obj, element, index, arr)) {
      ++count;
    }
  }, opt_obj);
  return count;
};
goog.array.find = function(arr, f, opt_obj) {
  var i = goog.array.findIndex(arr, f, opt_obj);
  return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i];
};
goog.array.findIndex = function(arr, f, opt_obj) {
  var l = arr.length;
  var arr2 = goog.isString(arr) ? arr.split("") : arr;
  for (var i = 0; i < l; i++) {
    if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
      return i;
    }
  }
  return -1;
};
goog.array.findRight = function(arr, f, opt_obj) {
  var i = goog.array.findIndexRight(arr, f, opt_obj);
  return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i];
};
goog.array.findIndexRight = function(arr, f, opt_obj) {
  var l = arr.length;
  var arr2 = goog.isString(arr) ? arr.split("") : arr;
  for (var i = l - 1; i >= 0; i--) {
    if (i in arr2 && f.call(opt_obj, arr2[i], i, arr)) {
      return i;
    }
  }
  return -1;
};
goog.array.contains = function(arr, obj) {
  return goog.array.indexOf(arr, obj) >= 0;
};
goog.array.isEmpty = function(arr) {
  return arr.length == 0;
};
goog.array.clear = function(arr) {
  if (!goog.isArray(arr)) {
    for (var i = arr.length - 1; i >= 0; i--) {
      delete arr[i];
    }
  }
  arr.length = 0;
};
goog.array.insert = function(arr, obj) {
  if (!goog.array.contains(arr, obj)) {
    arr.push(obj);
  }
};
goog.array.insertAt = function(arr, obj, opt_i) {
  goog.array.splice(arr, opt_i, 0, obj);
};
goog.array.insertArrayAt = function(arr, elementsToAdd, opt_i) {
  goog.partial(goog.array.splice, arr, opt_i, 0).apply(null, elementsToAdd);
};
goog.array.insertBefore = function(arr, obj, opt_obj2) {
  var i;
  if (arguments.length == 2 || (i = goog.array.indexOf(arr, opt_obj2)) < 0) {
    arr.push(obj);
  } else {
    goog.array.insertAt(arr, obj, i);
  }
};
goog.array.remove = function(arr, obj) {
  var i = goog.array.indexOf(arr, obj);
  var rv;
  if (rv = i >= 0) {
    goog.array.removeAt(arr, i);
  }
  return rv;
};
goog.array.removeLast = function(arr, obj) {
  var i = goog.array.lastIndexOf(arr, obj);
  if (i >= 0) {
    goog.array.removeAt(arr, i);
    return true;
  }
  return false;
};
goog.array.removeAt = function(arr, i) {
  goog.asserts.assert(arr.length != null);
  return Array.prototype.splice.call(arr, i, 1).length == 1;
};
goog.array.removeIf = function(arr, f, opt_obj) {
  var i = goog.array.findIndex(arr, f, opt_obj);
  if (i >= 0) {
    goog.array.removeAt(arr, i);
    return true;
  }
  return false;
};
goog.array.removeAllIf = function(arr, f, opt_obj) {
  var removedCount = 0;
  goog.array.forEachRight(arr, function(val, index) {
    if (f.call(opt_obj, val, index, arr)) {
      if (goog.array.removeAt(arr, index)) {
        removedCount++;
      }
    }
  });
  return removedCount;
};
goog.array.concat = function(var_args) {
  return Array.prototype.concat.apply([], arguments);
};
goog.array.join = function(var_args) {
  return Array.prototype.concat.apply([], arguments);
};
goog.array.toArray = function(object) {
  var length = object.length;
  if (length > 0) {
    var rv = new Array(length);
    for (var i = 0; i < length; i++) {
      rv[i] = object[i];
    }
    return rv;
  }
  return [];
};
goog.array.clone = goog.array.toArray;
goog.array.extend = function(arr1, var_args) {
  for (var i = 1; i < arguments.length; i++) {
    var arr2 = arguments[i];
    if (goog.isArrayLike(arr2)) {
      var len1 = arr1.length || 0;
      var len2 = arr2.length || 0;
      arr1.length = len1 + len2;
      for (var j = 0; j < len2; j++) {
        arr1[len1 + j] = arr2[j];
      }
    } else {
      arr1.push(arr2);
    }
  }
};
goog.array.splice = function(arr, index, howMany, var_args) {
  goog.asserts.assert(arr.length != null);
  return Array.prototype.splice.apply(arr, goog.array.slice(arguments, 1));
};
goog.array.slice = function(arr, start, opt_end) {
  goog.asserts.assert(arr.length != null);
  if (arguments.length <= 2) {
    return Array.prototype.slice.call(arr, start);
  } else {
    return Array.prototype.slice.call(arr, start, opt_end);
  }
};
goog.array.removeDuplicates = function(arr, opt_rv, opt_hashFn) {
  var returnArray = opt_rv || arr;
  var defaultHashFn = function(item) {
    return goog.isObject(item) ? "o" + goog.getUid(item) : (typeof item).charAt(0) + item;
  };
  var hashFn = opt_hashFn || defaultHashFn;
  var seen = {}, cursorInsert = 0, cursorRead = 0;
  while (cursorRead < arr.length) {
    var current = arr[cursorRead++];
    var key = hashFn(current);
    if (!Object.prototype.hasOwnProperty.call(seen, key)) {
      seen[key] = true;
      returnArray[cursorInsert++] = current;
    }
  }
  returnArray.length = cursorInsert;
};
goog.array.binarySearch = function(arr, target, opt_compareFn) {
  return goog.array.binarySearch_(arr, opt_compareFn || goog.array.defaultCompare, false, target);
};
goog.array.binarySelect = function(arr, evaluator, opt_obj) {
  return goog.array.binarySearch_(arr, evaluator, true, undefined, opt_obj);
};
goog.array.binarySearch_ = function(arr, compareFn, isEvaluator, opt_target, opt_selfObj) {
  var left = 0;
  var right = arr.length;
  var found;
  while (left < right) {
    var middle = left + right >> 1;
    var compareResult;
    if (isEvaluator) {
      compareResult = compareFn.call(opt_selfObj, arr[middle], middle, arr);
    } else {
      compareResult = compareFn(opt_target, arr[middle]);
    }
    if (compareResult > 0) {
      left = middle + 1;
    } else {
      right = middle;
      found = !compareResult;
    }
  }
  return found ? left : ~left;
};
goog.array.sort = function(arr, opt_compareFn) {
  arr.sort(opt_compareFn || goog.array.defaultCompare);
};
goog.array.stableSort = function(arr, opt_compareFn) {
  var compArr = new Array(arr.length);
  for (var i = 0; i < arr.length; i++) {
    compArr[i] = {index:i, value:arr[i]};
  }
  var valueCompareFn = opt_compareFn || goog.array.defaultCompare;
  function stableCompareFn(obj1, obj2) {
    return valueCompareFn(obj1.value, obj2.value) || obj1.index - obj2.index;
  }
  goog.array.sort(compArr, stableCompareFn);
  for (var i = 0; i < arr.length; i++) {
    arr[i] = compArr[i].value;
  }
};
goog.array.sortByKey = function(arr, keyFn, opt_compareFn) {
  var keyCompareFn = opt_compareFn || goog.array.defaultCompare;
  goog.array.sort(arr, function(a, b) {
    return keyCompareFn(keyFn(a), keyFn(b));
  });
};
goog.array.sortObjectsByKey = function(arr, key, opt_compareFn) {
  goog.array.sortByKey(arr, function(obj) {
    return obj[key];
  }, opt_compareFn);
};
goog.array.isSorted = function(arr, opt_compareFn, opt_strict) {
  var compare = opt_compareFn || goog.array.defaultCompare;
  for (var i = 1; i < arr.length; i++) {
    var compareResult = compare(arr[i - 1], arr[i]);
    if (compareResult > 0 || compareResult == 0 && opt_strict) {
      return false;
    }
  }
  return true;
};
goog.array.equals = function(arr1, arr2, opt_equalsFn) {
  if (!goog.isArrayLike(arr1) || !goog.isArrayLike(arr2) || arr1.length != arr2.length) {
    return false;
  }
  var l = arr1.length;
  var equalsFn = opt_equalsFn || goog.array.defaultCompareEquality;
  for (var i = 0; i < l; i++) {
    if (!equalsFn(arr1[i], arr2[i])) {
      return false;
    }
  }
  return true;
};
goog.array.compare3 = function(arr1, arr2, opt_compareFn) {
  var compare = opt_compareFn || goog.array.defaultCompare;
  var l = Math.min(arr1.length, arr2.length);
  for (var i = 0; i < l; i++) {
    var result = compare(arr1[i], arr2[i]);
    if (result != 0) {
      return result;
    }
  }
  return goog.array.defaultCompare(arr1.length, arr2.length);
};
goog.array.defaultCompare = function(a, b) {
  return a > b ? 1 : a < b ? -1 : 0;
};
goog.array.inverseDefaultCompare = function(a, b) {
  return -goog.array.defaultCompare(a, b);
};
goog.array.defaultCompareEquality = function(a, b) {
  return a === b;
};
goog.array.binaryInsert = function(array, value, opt_compareFn) {
  var index = goog.array.binarySearch(array, value, opt_compareFn);
  if (index < 0) {
    goog.array.insertAt(array, value, -(index + 1));
    return true;
  }
  return false;
};
goog.array.binaryRemove = function(array, value, opt_compareFn) {
  var index = goog.array.binarySearch(array, value, opt_compareFn);
  return index >= 0 ? goog.array.removeAt(array, index) : false;
};
goog.array.bucket = function(array, sorter, opt_obj) {
  var buckets = {};
  for (var i = 0; i < array.length; i++) {
    var value = array[i];
    var key = sorter.call(opt_obj, value, i, array);
    if (goog.isDef(key)) {
      var bucket = buckets[key] || (buckets[key] = []);
      bucket.push(value);
    }
  }
  return buckets;
};
goog.array.toObject = function(arr, keyFunc, opt_obj) {
  var ret = {};
  goog.array.forEach(arr, function(element, index) {
    ret[keyFunc.call(opt_obj, element, index, arr)] = element;
  });
  return ret;
};
goog.array.range = function(startOrEnd, opt_end, opt_step) {
  var array = [];
  var start = 0;
  var end = startOrEnd;
  var step = opt_step || 1;
  if (opt_end !== undefined) {
    start = startOrEnd;
    end = opt_end;
  }
  if (step * (end - start) < 0) {
    return [];
  }
  if (step > 0) {
    for (var i = start; i < end; i += step) {
      array.push(i);
    }
  } else {
    for (var i = start; i > end; i += step) {
      array.push(i);
    }
  }
  return array;
};
goog.array.repeat = function(value, n) {
  var array = [];
  for (var i = 0; i < n; i++) {
    array[i] = value;
  }
  return array;
};
goog.array.flatten = function(var_args) {
  var CHUNK_SIZE = 8192;
  var result = [];
  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (goog.isArray(element)) {
      for (var c = 0; c < element.length; c += CHUNK_SIZE) {
        var chunk = goog.array.slice(element, c, c + CHUNK_SIZE);
        var recurseResult = goog.array.flatten.apply(null, chunk);
        for (var r = 0; r < recurseResult.length; r++) {
          result.push(recurseResult[r]);
        }
      }
    } else {
      result.push(element);
    }
  }
  return result;
};
goog.array.rotate = function(array, n) {
  goog.asserts.assert(array.length != null);
  if (array.length) {
    n %= array.length;
    if (n > 0) {
      Array.prototype.unshift.apply(array, array.splice(-n, n));
    } else {
      if (n < 0) {
        Array.prototype.push.apply(array, array.splice(0, -n));
      }
    }
  }
  return array;
};
goog.array.moveItem = function(arr, fromIndex, toIndex) {
  goog.asserts.assert(fromIndex >= 0 && fromIndex < arr.length);
  goog.asserts.assert(toIndex >= 0 && toIndex < arr.length);
  var removedItems = Array.prototype.splice.call(arr, fromIndex, 1);
  Array.prototype.splice.call(arr, toIndex, 0, removedItems[0]);
};
goog.array.zip = function(var_args) {
  if (!arguments.length) {
    return [];
  }
  var result = [];
  var minLen = arguments[0].length;
  for (var i = 1; i < arguments.length; i++) {
    if (arguments[i].length < minLen) {
      minLen = arguments[i].length;
    }
  }
  for (var i = 0; i < minLen; i++) {
    var value = [];
    for (var j = 0; j < arguments.length; j++) {
      value.push(arguments[j][i]);
    }
    result.push(value);
  }
  return result;
};
goog.array.shuffle = function(arr, opt_randFn) {
  var randFn = opt_randFn || Math.random;
  for (var i = arr.length - 1; i > 0; i--) {
    var j = Math.floor(randFn() * (i + 1));
    var tmp = arr[i];
    arr[i] = arr[j];
    arr[j] = tmp;
  }
};
goog.array.copyByIndex = function(arr, index_arr) {
  var result = [];
  goog.array.forEach(index_arr, function(index) {
    result.push(arr[index]);
  });
  return result;
};
goog.array.concatMap = function(arr, f, opt_obj) {
  return goog.array.concat.apply([], goog.array.map(arr, f, opt_obj));
};
goog.provide("goog.labs.userAgent.util");
goog.require("goog.string");
goog.labs.userAgent.util.getNativeUserAgentString_ = function() {
  var navigator = goog.labs.userAgent.util.getNavigator_();
  if (navigator) {
    var userAgent = navigator.userAgent;
    if (userAgent) {
      return userAgent;
    }
  }
  return "";
};
goog.labs.userAgent.util.getNavigator_ = function() {
  return goog.global.navigator;
};
goog.labs.userAgent.util.userAgent_ = goog.labs.userAgent.util.getNativeUserAgentString_();
goog.labs.userAgent.util.setUserAgent = function(opt_userAgent) {
  goog.labs.userAgent.util.userAgent_ = opt_userAgent || goog.labs.userAgent.util.getNativeUserAgentString_();
};
goog.labs.userAgent.util.getUserAgent = function() {
  return goog.labs.userAgent.util.userAgent_;
};
goog.labs.userAgent.util.matchUserAgent = function(str) {
  var userAgent = goog.labs.userAgent.util.getUserAgent();
  return goog.string.contains(userAgent, str);
};
goog.labs.userAgent.util.matchUserAgentIgnoreCase = function(str) {
  var userAgent = goog.labs.userAgent.util.getUserAgent();
  return goog.string.caseInsensitiveContains(userAgent, str);
};
goog.labs.userAgent.util.extractVersionTuples = function(userAgent) {
  var versionRegExp = new RegExp("(\\w[\\w ]+)" + "/" + "([^\\s]+)" + "\\s*" + "(?:\\((.*?)\\))?", "g");
  var data = [];
  var match;
  while (match = versionRegExp.exec(userAgent)) {
    data.push([match[1], match[2], match[3] || undefined]);
  }
  return data;
};
goog.provide("goog.object");
goog.object.is = function(v, v2) {
  if (v === v2) {
    return v !== 0 || 1 / v === 1 / v2;
  }
  return v !== v && v2 !== v2;
};
goog.object.forEach = function(obj, f, opt_obj) {
  for (var key in obj) {
    f.call(opt_obj, obj[key], key, obj);
  }
};
goog.object.filter = function(obj, f, opt_obj) {
  var res = {};
  for (var key in obj) {
    if (f.call(opt_obj, obj[key], key, obj)) {
      res[key] = obj[key];
    }
  }
  return res;
};
goog.object.map = function(obj, f, opt_obj) {
  var res = {};
  for (var key in obj) {
    res[key] = f.call(opt_obj, obj[key], key, obj);
  }
  return res;
};
goog.object.some = function(obj, f, opt_obj) {
  for (var key in obj) {
    if (f.call(opt_obj, obj[key], key, obj)) {
      return true;
    }
  }
  return false;
};
goog.object.every = function(obj, f, opt_obj) {
  for (var key in obj) {
    if (!f.call(opt_obj, obj[key], key, obj)) {
      return false;
    }
  }
  return true;
};
goog.object.getCount = function(obj) {
  var rv = 0;
  for (var key in obj) {
    rv++;
  }
  return rv;
};
goog.object.getAnyKey = function(obj) {
  for (var key in obj) {
    return key;
  }
};
goog.object.getAnyValue = function(obj) {
  for (var key in obj) {
    return obj[key];
  }
};
goog.object.contains = function(obj, val) {
  return goog.object.containsValue(obj, val);
};
goog.object.getValues = function(obj) {
  var res = [];
  var i = 0;
  for (var key in obj) {
    res[i++] = obj[key];
  }
  return res;
};
goog.object.getKeys = function(obj) {
  var res = [];
  var i = 0;
  for (var key in obj) {
    res[i++] = key;
  }
  return res;
};
goog.object.getValueByKeys = function(obj, var_args) {
  var isArrayLike = goog.isArrayLike(var_args);
  var keys = isArrayLike ? var_args : arguments;
  for (var i = isArrayLike ? 0 : 1; i < keys.length; i++) {
    obj = obj[keys[i]];
    if (!goog.isDef(obj)) {
      break;
    }
  }
  return obj;
};
goog.object.containsKey = function(obj, key) {
  return obj !== null && key in obj;
};
goog.object.containsValue = function(obj, val) {
  for (var key in obj) {
    if (obj[key] == val) {
      return true;
    }
  }
  return false;
};
goog.object.findKey = function(obj, f, opt_this) {
  for (var key in obj) {
    if (f.call(opt_this, obj[key], key, obj)) {
      return key;
    }
  }
  return undefined;
};
goog.object.findValue = function(obj, f, opt_this) {
  var key = goog.object.findKey(obj, f, opt_this);
  return key && obj[key];
};
goog.object.isEmpty = function(obj) {
  for (var key in obj) {
    return false;
  }
  return true;
};
goog.object.clear = function(obj) {
  for (var i in obj) {
    delete obj[i];
  }
};
goog.object.remove = function(obj, key) {
  var rv;
  if (rv = key in obj) {
    delete obj[key];
  }
  return rv;
};
goog.object.add = function(obj, key, val) {
  if (obj !== null && key in obj) {
    throw Error('The object already contains the key "' + key + '"');
  }
  goog.object.set(obj, key, val);
};
goog.object.get = function(obj, key, opt_val) {
  if (obj !== null && key in obj) {
    return obj[key];
  }
  return opt_val;
};
goog.object.set = function(obj, key, value) {
  obj[key] = value;
};
goog.object.setIfUndefined = function(obj, key, value) {
  return key in obj ? obj[key] : obj[key] = value;
};
goog.object.setWithReturnValueIfNotSet = function(obj, key, f) {
  if (key in obj) {
    return obj[key];
  }
  var val = f();
  obj[key] = val;
  return val;
};
goog.object.equals = function(a, b) {
  for (var k in a) {
    if (!(k in b) || a[k] !== b[k]) {
      return false;
    }
  }
  for (var k in b) {
    if (!(k in a)) {
      return false;
    }
  }
  return true;
};
goog.object.clone = function(obj) {
  var res = {};
  for (var key in obj) {
    res[key] = obj[key];
  }
  return res;
};
goog.object.unsafeClone = function(obj) {
  var type = goog.typeOf(obj);
  if (type == "object" || type == "array") {
    if (goog.isFunction(obj.clone)) {
      return obj.clone();
    }
    var clone = type == "array" ? [] : {};
    for (var key in obj) {
      clone[key] = goog.object.unsafeClone(obj[key]);
    }
    return clone;
  }
  return obj;
};
goog.object.transpose = function(obj) {
  var transposed = {};
  for (var key in obj) {
    transposed[obj[key]] = key;
  }
  return transposed;
};
goog.object.PROTOTYPE_FIELDS_ = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"];
goog.object.extend = function(target, var_args) {
  var key, source;
  for (var i = 1; i < arguments.length; i++) {
    source = arguments[i];
    for (key in source) {
      target[key] = source[key];
    }
    for (var j = 0; j < goog.object.PROTOTYPE_FIELDS_.length; j++) {
      key = goog.object.PROTOTYPE_FIELDS_[j];
      if (Object.prototype.hasOwnProperty.call(source, key)) {
        target[key] = source[key];
      }
    }
  }
};
goog.object.create = function(var_args) {
  var argLength = arguments.length;
  if (argLength == 1 && goog.isArray(arguments[0])) {
    return goog.object.create.apply(null, arguments[0]);
  }
  if (argLength % 2) {
    throw Error("Uneven number of arguments");
  }
  var rv = {};
  for (var i = 0; i < argLength; i += 2) {
    rv[arguments[i]] = arguments[i + 1];
  }
  return rv;
};
goog.object.createSet = function(var_args) {
  var argLength = arguments.length;
  if (argLength == 1 && goog.isArray(arguments[0])) {
    return goog.object.createSet.apply(null, arguments[0]);
  }
  var rv = {};
  for (var i = 0; i < argLength; i++) {
    rv[arguments[i]] = true;
  }
  return rv;
};
goog.object.createImmutableView = function(obj) {
  var result = obj;
  if (Object.isFrozen && !Object.isFrozen(obj)) {
    result = Object.create(obj);
    Object.freeze(result);
  }
  return result;
};
goog.object.isImmutableView = function(obj) {
  return !!Object.isFrozen && Object.isFrozen(obj);
};
goog.object.getAllPropertyNames = function(obj, opt_includeObjectPrototype, opt_includeFunctionPrototype) {
  if (!obj) {
    return [];
  }
  if (!Object.getOwnPropertyNames || !Object.getPrototypeOf) {
    return goog.object.getKeys(obj);
  }
  var visitedSet = {};
  var proto = obj;
  while (proto && (proto !== Object.prototype || !!opt_includeObjectPrototype) && (proto !== Function.prototype || !!opt_includeFunctionPrototype)) {
    var names = Object.getOwnPropertyNames(proto);
    for (var i = 0; i < names.length; i++) {
      visitedSet[names[i]] = true;
    }
    proto = Object.getPrototypeOf(proto);
  }
  return goog.object.getKeys(visitedSet);
};
goog.provide("goog.labs.userAgent.browser");
goog.require("goog.array");
goog.require("goog.labs.userAgent.util");
goog.require("goog.object");
goog.require("goog.string");
goog.labs.userAgent.browser.matchOpera_ = function() {
  return goog.labs.userAgent.util.matchUserAgent("Opera");
};
goog.labs.userAgent.browser.matchIE_ = function() {
  return goog.labs.userAgent.util.matchUserAgent("Trident") || goog.labs.userAgent.util.matchUserAgent("MSIE");
};
goog.labs.userAgent.browser.matchEdge_ = function() {
  return goog.labs.userAgent.util.matchUserAgent("Edge");
};
goog.labs.userAgent.browser.matchFirefox_ = function() {
  return goog.labs.userAgent.util.matchUserAgent("Firefox");
};
goog.labs.userAgent.browser.matchSafari_ = function() {
  return goog.labs.userAgent.util.matchUserAgent("Safari") && !(goog.labs.userAgent.browser.matchChrome_() || goog.labs.userAgent.browser.matchCoast_() || goog.labs.userAgent.browser.matchOpera_() || goog.labs.userAgent.browser.matchEdge_() || goog.labs.userAgent.browser.isSilk() || goog.labs.userAgent.util.matchUserAgent("Android"));
};
goog.labs.userAgent.browser.matchCoast_ = function() {
  return goog.labs.userAgent.util.matchUserAgent("Coast");
};
goog.labs.userAgent.browser.matchIosWebview_ = function() {
  return (goog.labs.userAgent.util.matchUserAgent("iPad") || goog.labs.userAgent.util.matchUserAgent("iPhone")) && !goog.labs.userAgent.browser.matchSafari_() && !goog.labs.userAgent.browser.matchChrome_() && !goog.labs.userAgent.browser.matchCoast_() && goog.labs.userAgent.util.matchUserAgent("AppleWebKit");
};
goog.labs.userAgent.browser.matchChrome_ = function() {
  return (goog.labs.userAgent.util.matchUserAgent("Chrome") || goog.labs.userAgent.util.matchUserAgent("CriOS")) && !goog.labs.userAgent.browser.matchEdge_();
};
goog.labs.userAgent.browser.matchAndroidBrowser_ = function() {
  return goog.labs.userAgent.util.matchUserAgent("Android") && !(goog.labs.userAgent.browser.isChrome() || goog.labs.userAgent.browser.isFirefox() || goog.labs.userAgent.browser.isOpera() || goog.labs.userAgent.browser.isSilk());
};
goog.labs.userAgent.browser.isOpera = goog.labs.userAgent.browser.matchOpera_;
goog.labs.userAgent.browser.isIE = goog.labs.userAgent.browser.matchIE_;
goog.labs.userAgent.browser.isEdge = goog.labs.userAgent.browser.matchEdge_;
goog.labs.userAgent.browser.isFirefox = goog.labs.userAgent.browser.matchFirefox_;
goog.labs.userAgent.browser.isSafari = goog.labs.userAgent.browser.matchSafari_;
goog.labs.userAgent.browser.isCoast = goog.labs.userAgent.browser.matchCoast_;
goog.labs.userAgent.browser.isIosWebview = goog.labs.userAgent.browser.matchIosWebview_;
goog.labs.userAgent.browser.isChrome = goog.labs.userAgent.browser.matchChrome_;
goog.labs.userAgent.browser.isAndroidBrowser = goog.labs.userAgent.browser.matchAndroidBrowser_;
goog.labs.userAgent.browser.isSilk = function() {
  return goog.labs.userAgent.util.matchUserAgent("Silk");
};
goog.labs.userAgent.browser.getVersion = function() {
  var userAgentString = goog.labs.userAgent.util.getUserAgent();
  if (goog.labs.userAgent.browser.isIE()) {
    return goog.labs.userAgent.browser.getIEVersion_(userAgentString);
  }
  var versionTuples = goog.labs.userAgent.util.extractVersionTuples(userAgentString);
  var versionMap = {};
  goog.array.forEach(versionTuples, function(tuple) {
    var key = tuple[0];
    var value = tuple[1];
    versionMap[key] = value;
  });
  var versionMapHasKey = goog.partial(goog.object.containsKey, versionMap);
  function lookUpValueWithKeys(keys) {
    var key = goog.array.find(keys, versionMapHasKey);
    return versionMap[key] || "";
  }
  if (goog.labs.userAgent.browser.isOpera()) {
    return lookUpValueWithKeys(["Version", "Opera"]);
  }
  if (goog.labs.userAgent.browser.isEdge()) {
    return lookUpValueWithKeys(["Edge"]);
  }
  if (goog.labs.userAgent.browser.isChrome()) {
    return lookUpValueWithKeys(["Chrome", "CriOS"]);
  }
  var tuple = versionTuples[2];
  return tuple && tuple[1] || "";
};
goog.labs.userAgent.browser.isVersionOrHigher = function(version) {
  return goog.string.compareVersions(goog.labs.userAgent.browser.getVersion(), version) >= 0;
};
goog.labs.userAgent.browser.getIEVersion_ = function(userAgent) {
  var rv = /rv: *([\d\.]*)/.exec(userAgent);
  if (rv && rv[1]) {
    return rv[1];
  }
  var version = "";
  var msie = /MSIE +([\d\.]+)/.exec(userAgent);
  if (msie && msie[1]) {
    var tridentVersion = /Trident\/(\d.\d)/.exec(userAgent);
    if (msie[1] == "7.0") {
      if (tridentVersion && tridentVersion[1]) {
        switch(tridentVersion[1]) {
          case "4.0":
            version = "8.0";
            break;
          case "5.0":
            version = "9.0";
            break;
          case "6.0":
            version = "10.0";
            break;
          case "7.0":
            version = "11.0";
            break;
        }
      } else {
        version = "7.0";
      }
    } else {
      version = msie[1];
    }
  }
  return version;
};
goog.provide("goog.labs.userAgent.engine");
goog.require("goog.array");
goog.require("goog.labs.userAgent.util");
goog.require("goog.string");
goog.labs.userAgent.engine.isPresto = function() {
  return goog.labs.userAgent.util.matchUserAgent("Presto");
};
goog.labs.userAgent.engine.isTrident = function() {
  return goog.labs.userAgent.util.matchUserAgent("Trident") || goog.labs.userAgent.util.matchUserAgent("MSIE");
};
goog.labs.userAgent.engine.isEdge = function() {
  return goog.labs.userAgent.util.matchUserAgent("Edge");
};
goog.labs.userAgent.engine.isWebKit = function() {
  return goog.labs.userAgent.util.matchUserAgentIgnoreCase("WebKit") && !goog.labs.userAgent.engine.isEdge();
};
goog.labs.userAgent.engine.isGecko = function() {
  return goog.labs.userAgent.util.matchUserAgent("Gecko") && !goog.labs.userAgent.engine.isWebKit() && !goog.labs.userAgent.engine.isTrident() && !goog.labs.userAgent.engine.isEdge();
};
goog.labs.userAgent.engine.getVersion = function() {
  var userAgentString = goog.labs.userAgent.util.getUserAgent();
  if (userAgentString) {
    var tuples = goog.labs.userAgent.util.extractVersionTuples(userAgentString);
    var engineTuple = goog.labs.userAgent.engine.getEngineTuple_(tuples);
    if (engineTuple) {
      if (engineTuple[0] == "Gecko") {
        return goog.labs.userAgent.engine.getVersionForKey_(tuples, "Firefox");
      }
      return engineTuple[1];
    }
    var browserTuple = tuples[0];
    var info;
    if (browserTuple && (info = browserTuple[2])) {
      var match = /Trident\/([^\s;]+)/.exec(info);
      if (match) {
        return match[1];
      }
    }
  }
  return "";
};
goog.labs.userAgent.engine.getEngineTuple_ = function(tuples) {
  if (!goog.labs.userAgent.engine.isEdge()) {
    return tuples[1];
  }
  for (var i = 0; i < tuples.length; i++) {
    var tuple = tuples[i];
    if (tuple[0] == "Edge") {
      return tuple;
    }
  }
};
goog.labs.userAgent.engine.isVersionOrHigher = function(version) {
  return goog.string.compareVersions(goog.labs.userAgent.engine.getVersion(), version) >= 0;
};
goog.labs.userAgent.engine.getVersionForKey_ = function(tuples, key) {
  var pair = goog.array.find(tuples, function(pair) {
    return key == pair[0];
  });
  return pair && pair[1] || "";
};
goog.provide("goog.labs.userAgent.platform");
goog.require("goog.labs.userAgent.util");
goog.require("goog.string");
goog.labs.userAgent.platform.isAndroid = function() {
  return goog.labs.userAgent.util.matchUserAgent("Android");
};
goog.labs.userAgent.platform.isIpod = function() {
  return goog.labs.userAgent.util.matchUserAgent("iPod");
};
goog.labs.userAgent.platform.isIphone = function() {
  return goog.labs.userAgent.util.matchUserAgent("iPhone") && !goog.labs.userAgent.util.matchUserAgent("iPod") && !goog.labs.userAgent.util.matchUserAgent("iPad");
};
goog.labs.userAgent.platform.isIpad = function() {
  return goog.labs.userAgent.util.matchUserAgent("iPad");
};
goog.labs.userAgent.platform.isIos = function() {
  return goog.labs.userAgent.platform.isIphone() || goog.labs.userAgent.platform.isIpad() || goog.labs.userAgent.platform.isIpod();
};
goog.labs.userAgent.platform.isMacintosh = function() {
  return goog.labs.userAgent.util.matchUserAgent("Macintosh");
};
goog.labs.userAgent.platform.isLinux = function() {
  return goog.labs.userAgent.util.matchUserAgent("Linux");
};
goog.labs.userAgent.platform.isWindows = function() {
  return goog.labs.userAgent.util.matchUserAgent("Windows");
};
goog.labs.userAgent.platform.isChromeOS = function() {
  return goog.labs.userAgent.util.matchUserAgent("CrOS");
};
goog.labs.userAgent.platform.getVersion = function() {
  var userAgentString = goog.labs.userAgent.util.getUserAgent();
  var version = "", re;
  if (goog.labs.userAgent.platform.isWindows()) {
    re = /Windows (?:NT|Phone) ([0-9.]+)/;
    var match = re.exec(userAgentString);
    if (match) {
      version = match[1];
    } else {
      version = "0.0";
    }
  } else {
    if (goog.labs.userAgent.platform.isIos()) {
      re = /(?:iPhone|iPod|iPad|CPU)\s+OS\s+(\S+)/;
      var match = re.exec(userAgentString);
      version = match && match[1].replace(/_/g, ".");
    } else {
      if (goog.labs.userAgent.platform.isMacintosh()) {
        re = /Mac OS X ([0-9_.]+)/;
        var match = re.exec(userAgentString);
        version = match ? match[1].replace(/_/g, ".") : "10";
      } else {
        if (goog.labs.userAgent.platform.isAndroid()) {
          re = /Android\s+([^\);]+)(\)|;)/;
          var match = re.exec(userAgentString);
          version = match && match[1];
        } else {
          if (goog.labs.userAgent.platform.isChromeOS()) {
            re = /(?:CrOS\s+(?:i686|x86_64)\s+([0-9.]+))/;
            var match = re.exec(userAgentString);
            version = match && match[1];
          }
        }
      }
    }
  }
  return version || "";
};
goog.labs.userAgent.platform.isVersionOrHigher = function(version) {
  return goog.string.compareVersions(goog.labs.userAgent.platform.getVersion(), version) >= 0;
};
goog.provide("goog.reflect");
goog.reflect.object = function(type, object) {
  return object;
};
goog.reflect.objectProperty = function(prop, object) {
  return prop;
};
goog.reflect.sinkValue = function(x) {
  goog.reflect.sinkValue[" "](x);
  return x;
};
goog.reflect.sinkValue[" "] = goog.nullFunction;
goog.reflect.canAccessProperty = function(obj, prop) {
  try {
    goog.reflect.sinkValue(obj[prop]);
    return true;
  } catch (e) {
  }
  return false;
};
goog.reflect.cache = function(cacheObj, key, valueFn, opt_keyFn) {
  var storedKey = opt_keyFn ? opt_keyFn(key) : key;
  if (Object.prototype.hasOwnProperty.call(cacheObj, storedKey)) {
    return cacheObj[storedKey];
  }
  return cacheObj[storedKey] = valueFn(key);
};
goog.provide("goog.userAgent");
goog.require("goog.labs.userAgent.browser");
goog.require("goog.labs.userAgent.engine");
goog.require("goog.labs.userAgent.platform");
goog.require("goog.labs.userAgent.util");
goog.require("goog.reflect");
goog.require("goog.string");
goog.define("goog.userAgent.ASSUME_IE", false);
goog.define("goog.userAgent.ASSUME_EDGE", false);
goog.define("goog.userAgent.ASSUME_GECKO", false);
goog.define("goog.userAgent.ASSUME_WEBKIT", false);
goog.define("goog.userAgent.ASSUME_MOBILE_WEBKIT", false);
goog.define("goog.userAgent.ASSUME_OPERA", false);
goog.define("goog.userAgent.ASSUME_ANY_VERSION", false);
goog.userAgent.BROWSER_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUME_EDGE || goog.userAgent.ASSUME_GECKO || goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_OPERA;
goog.userAgent.getUserAgentString = function() {
  return goog.labs.userAgent.util.getUserAgent();
};
goog.userAgent.getNavigator = function() {
  return goog.global["navigator"] || null;
};
goog.userAgent.OPERA = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_OPERA : goog.labs.userAgent.browser.isOpera();
goog.userAgent.IE = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_IE : goog.labs.userAgent.browser.isIE();
goog.userAgent.EDGE = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_EDGE : goog.labs.userAgent.engine.isEdge();
goog.userAgent.EDGE_OR_IE = goog.userAgent.EDGE || goog.userAgent.IE;
goog.userAgent.GECKO = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_GECKO : goog.labs.userAgent.engine.isGecko();
goog.userAgent.WEBKIT = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_MOBILE_WEBKIT : goog.labs.userAgent.engine.isWebKit();
goog.userAgent.isMobile_ = function() {
  return goog.userAgent.WEBKIT && goog.labs.userAgent.util.matchUserAgent("Mobile");
};
goog.userAgent.MOBILE = goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.isMobile_();
goog.userAgent.SAFARI = goog.userAgent.WEBKIT;
goog.userAgent.determinePlatform_ = function() {
  var navigator = goog.userAgent.getNavigator();
  return navigator && navigator.platform || "";
};
goog.userAgent.PLATFORM = goog.userAgent.determinePlatform_();
goog.define("goog.userAgent.ASSUME_MAC", false);
goog.define("goog.userAgent.ASSUME_WINDOWS", false);
goog.define("goog.userAgent.ASSUME_LINUX", false);
goog.define("goog.userAgent.ASSUME_X11", false);
goog.define("goog.userAgent.ASSUME_ANDROID", false);
goog.define("goog.userAgent.ASSUME_IPHONE", false);
goog.define("goog.userAgent.ASSUME_IPAD", false);
goog.define("goog.userAgent.ASSUME_IPOD", false);
goog.userAgent.PLATFORM_KNOWN_ = goog.userAgent.ASSUME_MAC || goog.userAgent.ASSUME_WINDOWS || goog.userAgent.ASSUME_LINUX || goog.userAgent.ASSUME_X11 || goog.userAgent.ASSUME_ANDROID || goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD || goog.userAgent.ASSUME_IPOD;
goog.userAgent.MAC = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_MAC : goog.labs.userAgent.platform.isMacintosh();
goog.userAgent.WINDOWS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_WINDOWS : goog.labs.userAgent.platform.isWindows();
goog.userAgent.isLegacyLinux_ = function() {
  return goog.labs.userAgent.platform.isLinux() || goog.labs.userAgent.platform.isChromeOS();
};
goog.userAgent.LINUX = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_LINUX : goog.userAgent.isLegacyLinux_();
goog.userAgent.isX11_ = function() {
  var navigator = goog.userAgent.getNavigator();
  return !!navigator && goog.string.contains(navigator["appVersion"] || "", "X11");
};
goog.userAgent.X11 = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_X11 : goog.userAgent.isX11_();
goog.userAgent.ANDROID = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_ANDROID : goog.labs.userAgent.platform.isAndroid();
goog.userAgent.IPHONE = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPHONE : goog.labs.userAgent.platform.isIphone();
goog.userAgent.IPAD = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPAD : goog.labs.userAgent.platform.isIpad();
goog.userAgent.IPOD = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPOD : goog.labs.userAgent.platform.isIpod();
goog.userAgent.IOS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD || goog.userAgent.ASSUME_IPOD : goog.labs.userAgent.platform.isIos();
goog.userAgent.determineVersion_ = function() {
  var version = "";
  var arr = goog.userAgent.getVersionRegexResult_();
  if (arr) {
    version = arr ? arr[1] : "";
  }
  if (goog.userAgent.IE) {
    var docMode = goog.userAgent.getDocumentMode_();
    if (docMode != null && docMode > parseFloat(version)) {
      return String(docMode);
    }
  }
  return version;
};
goog.userAgent.getVersionRegexResult_ = function() {
  var userAgent = goog.userAgent.getUserAgentString();
  if (goog.userAgent.GECKO) {
    return /rv\:([^\);]+)(\)|;)/.exec(userAgent);
  }
  if (goog.userAgent.EDGE) {
    return /Edge\/([\d\.]+)/.exec(userAgent);
  }
  if (goog.userAgent.IE) {
    return /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(userAgent);
  }
  if (goog.userAgent.WEBKIT) {
    return /WebKit\/(\S+)/.exec(userAgent);
  }
  if (goog.userAgent.OPERA) {
    return /(?:Version)[ \/]?(\S+)/.exec(userAgent);
  }
  return undefined;
};
goog.userAgent.getDocumentMode_ = function() {
  var doc = goog.global["document"];
  return doc ? doc["documentMode"] : undefined;
};
goog.userAgent.VERSION = goog.userAgent.determineVersion_();
goog.userAgent.compare = function(v1, v2) {
  return goog.string.compareVersions(v1, v2);
};
goog.userAgent.isVersionOrHigherCache_ = {};
goog.userAgent.isVersionOrHigher = function(version) {
  return goog.userAgent.ASSUME_ANY_VERSION || goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_, version, function() {
    return goog.string.compareVersions(goog.userAgent.VERSION, version) >= 0;
  });
};
goog.userAgent.isVersion = goog.userAgent.isVersionOrHigher;
goog.userAgent.isDocumentModeOrHigher = function(documentMode) {
  return Number(goog.userAgent.DOCUMENT_MODE) >= documentMode;
};
goog.userAgent.isDocumentMode = goog.userAgent.isDocumentModeOrHigher;
goog.userAgent.DOCUMENT_MODE = function() {
  var doc = goog.global["document"];
  var mode = goog.userAgent.getDocumentMode_();
  if (!doc || !goog.userAgent.IE) {
    return undefined;
  }
  return mode || (doc["compatMode"] == "CSS1Compat" ? parseInt(goog.userAgent.VERSION, 10) : 5);
}();
goog.provide("goog.debug");
goog.require("goog.array");
goog.require("goog.userAgent");
goog.define("goog.debug.LOGGING_ENABLED", goog.DEBUG);
goog.define("goog.debug.FORCE_SLOPPY_STACKS", false);
goog.debug.catchErrors = function(logFunc, opt_cancel, opt_target) {
  var target = opt_target || goog.global;
  var oldErrorHandler = target.onerror;
  var retVal = !!opt_cancel;
  if (goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher("535.3")) {
    retVal = !retVal;
  }
  target.onerror = function(message, url, line, opt_col, opt_error) {
    if (oldErrorHandler) {
      oldErrorHandler(message, url, line, opt_col, opt_error);
    }
    logFunc({message:message, fileName:url, line:line, col:opt_col, error:opt_error});
    return retVal;
  };
};
goog.debug.expose = function(obj, opt_showFn) {
  if (typeof obj == "undefined") {
    return "undefined";
  }
  if (obj == null) {
    return "NULL";
  }
  var str = [];
  for (var x in obj) {
    if (!opt_showFn && goog.isFunction(obj[x])) {
      continue;
    }
    var s = x + " = ";
    try {
      s += obj[x];
    } catch (e) {
      s += "*** " + e + " ***";
    }
    str.push(s);
  }
  return str.join("\n");
};
goog.debug.deepExpose = function(obj, opt_showFn) {
  var str = [];
  var uidsToCleanup = [];
  var ancestorUids = {};
  var helper = function(obj, space) {
    var nestspace = space + "  ";
    var indentMultiline = function(str) {
      return str.replace(/\n/g, "\n" + space);
    };
    try {
      if (!goog.isDef(obj)) {
        str.push("undefined");
      } else {
        if (goog.isNull(obj)) {
          str.push("NULL");
        } else {
          if (goog.isString(obj)) {
            str.push('"' + indentMultiline(obj) + '"');
          } else {
            if (goog.isFunction(obj)) {
              str.push(indentMultiline(String(obj)));
            } else {
              if (goog.isObject(obj)) {
                if (!goog.hasUid(obj)) {
                  uidsToCleanup.push(obj);
                }
                var uid = goog.getUid(obj);
                if (ancestorUids[uid]) {
                  str.push("*** reference loop detected (id=" + uid + ") ***");
                } else {
                  ancestorUids[uid] = true;
                  str.push("{");
                  for (var x in obj) {
                    if (!opt_showFn && goog.isFunction(obj[x])) {
                      continue;
                    }
                    str.push("\n");
                    str.push(nestspace);
                    str.push(x + " = ");
                    helper(obj[x], nestspace);
                  }
                  str.push("\n" + space + "}");
                  delete ancestorUids[uid];
                }
              } else {
                str.push(obj);
              }
            }
          }
        }
      }
    } catch (e) {
      str.push("*** " + e + " ***");
    }
  };
  helper(obj, "");
  for (var i = 0; i < uidsToCleanup.length; i++) {
    goog.removeUid(uidsToCleanup[i]);
  }
  return str.join("");
};
goog.debug.exposeArray = function(arr) {
  var str = [];
  for (var i = 0; i < arr.length; i++) {
    if (goog.isArray(arr[i])) {
      str.push(goog.debug.exposeArray(arr[i]));
    } else {
      str.push(arr[i]);
    }
  }
  return "[ " + str.join(", ") + " ]";
};
goog.debug.normalizeErrorObject = function(err) {
  var href = goog.getObjectByName("window.location.href");
  if (goog.isString(err)) {
    return {"message":err, "name":"Unknown error", "lineNumber":"Not available", "fileName":href, "stack":"Not available"};
  }
  var lineNumber, fileName;
  var threwError = false;
  try {
    lineNumber = err.lineNumber || err.line || "Not available";
  } catch (e) {
    lineNumber = "Not available";
    threwError = true;
  }
  try {
    fileName = err.fileName || err.filename || err.sourceURL || goog.global["$googDebugFname"] || href;
  } catch (e$0) {
    fileName = "Not available";
    threwError = true;
  }
  if (threwError || !err.lineNumber || !err.fileName || !err.stack || !err.message || !err.name) {
    return {"message":err.message || "Not available", "name":err.name || "UnknownError", "lineNumber":lineNumber, "fileName":fileName, "stack":err.stack || "Not available"};
  }
  return err;
};
goog.debug.enhanceError = function(err, opt_message) {
  var error;
  if (!(err instanceof Error)) {
    error = Error(err);
    if (Error.captureStackTrace) {
      Error.captureStackTrace(error, goog.debug.enhanceError);
    }
  } else {
    error = err;
  }
  if (!error.stack) {
    error.stack = goog.debug.getStacktrace(goog.debug.enhanceError);
  }
  if (opt_message) {
    var x = 0;
    while (error["message" + x]) {
      ++x;
    }
    error["message" + x] = String(opt_message);
  }
  return error;
};
goog.debug.getStacktraceSimple = function(opt_depth) {
  if (!goog.debug.FORCE_SLOPPY_STACKS) {
    var stack = goog.debug.getNativeStackTrace_(goog.debug.getStacktraceSimple);
    if (stack) {
      return stack;
    }
  }
  var sb = [];
  var fn = arguments.callee.caller;
  var depth = 0;
  while (fn && (!opt_depth || depth < opt_depth)) {
    sb.push(goog.debug.getFunctionName(fn));
    sb.push("()\n");
    try {
      fn = fn.caller;
    } catch (e) {
      sb.push("[exception trying to get caller]\n");
      break;
    }
    depth++;
    if (depth >= goog.debug.MAX_STACK_DEPTH) {
      sb.push("[...long stack...]");
      break;
    }
  }
  if (opt_depth && depth >= opt_depth) {
    sb.push("[...reached max depth limit...]");
  } else {
    sb.push("[end]");
  }
  return sb.join("");
};
goog.debug.MAX_STACK_DEPTH = 50;
goog.debug.getNativeStackTrace_ = function(fn) {
  var tempErr = new Error;
  if (Error.captureStackTrace) {
    Error.captureStackTrace(tempErr, fn);
    return String(tempErr.stack);
  } else {
    try {
      throw tempErr;
    } catch (e) {
      tempErr = e;
    }
    var stack = tempErr.stack;
    if (stack) {
      return String(stack);
    }
  }
  return null;
};
goog.debug.getStacktrace = function(fn) {
  var stack;
  if (!goog.debug.FORCE_SLOPPY_STACKS) {
    var contextFn = fn || goog.debug.getStacktrace;
    stack = goog.debug.getNativeStackTrace_(contextFn);
  }
  if (!stack) {
    stack = goog.debug.getStacktraceHelper_(fn || arguments.callee.caller, []);
  }
  return stack;
};
goog.debug.getStacktraceHelper_ = function(fn, visited) {
  var sb = [];
  if (goog.array.contains(visited, fn)) {
    sb.push("[...circular reference...]");
  } else {
    if (fn && visited.length < goog.debug.MAX_STACK_DEPTH) {
      sb.push(goog.debug.getFunctionName(fn) + "(");
      var args = fn.arguments;
      for (var i = 0; args && i < args.length; i++) {
        if (i > 0) {
          sb.push(", ");
        }
        var argDesc;
        var arg = args[i];
        switch(typeof arg) {
          case "object":
            argDesc = arg ? "object" : "null";
            break;
          case "string":
            argDesc = arg;
            break;
          case "number":
            argDesc = String(arg);
            break;
          case "boolean":
            argDesc = arg ? "true" : "false";
            break;
          case "function":
            argDesc = goog.debug.getFunctionName(arg);
            argDesc = argDesc ? argDesc : "[fn]";
            break;
          case "undefined":
          default:
            argDesc = typeof arg;
            break;
        }
        if (argDesc.length > 40) {
          argDesc = argDesc.substr(0, 40) + "...";
        }
        sb.push(argDesc);
      }
      visited.push(fn);
      sb.push(")\n");
      try {
        sb.push(goog.debug.getStacktraceHelper_(fn.caller, visited));
      } catch (e) {
        sb.push("[exception trying to get caller]\n");
      }
    } else {
      if (fn) {
        sb.push("[...long stack...]");
      } else {
        sb.push("[end]");
      }
    }
  }
  return sb.join("");
};
goog.debug.setFunctionResolver = function(resolver) {
  goog.debug.fnNameResolver_ = resolver;
};
goog.debug.getFunctionName = function(fn) {
  if (goog.debug.fnNameCache_[fn]) {
    return goog.debug.fnNameCache_[fn];
  }
  if (goog.debug.fnNameResolver_) {
    var name = goog.debug.fnNameResolver_(fn);
    if (name) {
      goog.debug.fnNameCache_[fn] = name;
      return name;
    }
  }
  var functionSource = String(fn);
  if (!goog.debug.fnNameCache_[functionSource]) {
    var matches = /function ([^\(]+)/.exec(functionSource);
    if (matches) {
      var method = matches[1];
      goog.debug.fnNameCache_[functionSource] = method;
    } else {
      goog.debug.fnNameCache_[functionSource] = "[Anonymous]";
    }
  }
  return goog.debug.fnNameCache_[functionSource];
};
goog.debug.makeWhitespaceVisible = function(string) {
  return string.replace(/ /g, "[_]").replace(/\f/g, "[f]").replace(/\n/g, "[n]\n").replace(/\r/g, "[r]").replace(/\t/g, "[t]");
};
goog.debug.runtimeType = function(value) {
  if (value instanceof Function) {
    return value.displayName || value.name || "unknown type name";
  } else {
    if (value instanceof Object) {
      return value.constructor.displayName || value.constructor.name || Object.prototype.toString.call(value);
    } else {
      return value === null ? "null" : typeof value;
    }
  }
};
goog.debug.fnNameCache_ = {};
goog.debug.fnNameResolver_;
goog.provide("goog.debug.LogRecord");
goog.debug.LogRecord = function(level, msg, loggerName, opt_time, opt_sequenceNumber) {
  this.reset(level, msg, loggerName, opt_time, opt_sequenceNumber);
};
goog.debug.LogRecord.prototype.time_;
goog.debug.LogRecord.prototype.level_;
goog.debug.LogRecord.prototype.msg_;
goog.debug.LogRecord.prototype.loggerName_;
goog.debug.LogRecord.prototype.sequenceNumber_ = 0;
goog.debug.LogRecord.prototype.exception_ = null;
goog.define("goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS", true);
goog.debug.LogRecord.nextSequenceNumber_ = 0;
goog.debug.LogRecord.prototype.reset = function(level, msg, loggerName, opt_time, opt_sequenceNumber) {
  if (goog.debug.LogRecord.ENABLE_SEQUENCE_NUMBERS) {
    this.sequenceNumber_ = typeof opt_sequenceNumber == "number" ? opt_sequenceNumber : goog.debug.LogRecord.nextSequenceNumber_++;
  }
  this.time_ = opt_time || goog.now();
  this.level_ = level;
  this.msg_ = msg;
  this.loggerName_ = loggerName;
  delete this.exception_;
};
goog.debug.LogRecord.prototype.getLoggerName = function() {
  return this.loggerName_;
};
goog.debug.LogRecord.prototype.getException = function() {
  return this.exception_;
};
goog.debug.LogRecord.prototype.setException = function(exception) {
  this.exception_ = exception;
};
goog.debug.LogRecord.prototype.setLoggerName = function(loggerName) {
  this.loggerName_ = loggerName;
};
goog.debug.LogRecord.prototype.getLevel = function() {
  return this.level_;
};
goog.debug.LogRecord.prototype.setLevel = function(level) {
  this.level_ = level;
};
goog.debug.LogRecord.prototype.getMessage = function() {
  return this.msg_;
};
goog.debug.LogRecord.prototype.setMessage = function(msg) {
  this.msg_ = msg;
};
goog.debug.LogRecord.prototype.getMillis = function() {
  return this.time_;
};
goog.debug.LogRecord.prototype.setMillis = function(time) {
  this.time_ = time;
};
goog.debug.LogRecord.prototype.getSequenceNumber = function() {
  return this.sequenceNumber_;
};
goog.provide("goog.debug.LogBuffer");
goog.require("goog.asserts");
goog.require("goog.debug.LogRecord");
goog.debug.LogBuffer = function() {
  goog.asserts.assert(goog.debug.LogBuffer.isBufferingEnabled(), "Cannot use goog.debug.LogBuffer without defining " + "goog.debug.LogBuffer.CAPACITY.");
  this.clear();
};
goog.debug.LogBuffer.getInstance = function() {
  if (!goog.debug.LogBuffer.instance_) {
    goog.debug.LogBuffer.instance_ = new goog.debug.LogBuffer;
  }
  return goog.debug.LogBuffer.instance_;
};
goog.define("goog.debug.LogBuffer.CAPACITY", 0);
goog.debug.LogBuffer.prototype.buffer_;
goog.debug.LogBuffer.prototype.curIndex_;
goog.debug.LogBuffer.prototype.isFull_;
goog.debug.LogBuffer.prototype.addRecord = function(level, msg, loggerName) {
  var curIndex = (this.curIndex_ + 1) % goog.debug.LogBuffer.CAPACITY;
  this.curIndex_ = curIndex;
  if (this.isFull_) {
    var ret = this.buffer_[curIndex];
    ret.reset(level, msg, loggerName);
    return ret;
  }
  this.isFull_ = curIndex == goog.debug.LogBuffer.CAPACITY - 1;
  return this.buffer_[curIndex] = new goog.debug.LogRecord(level, msg, loggerName);
};
goog.debug.LogBuffer.isBufferingEnabled = function() {
  return goog.debug.LogBuffer.CAPACITY > 0;
};
goog.debug.LogBuffer.prototype.clear = function() {
  this.buffer_ = new Array(goog.debug.LogBuffer.CAPACITY);
  this.curIndex_ = -1;
  this.isFull_ = false;
};
goog.debug.LogBuffer.prototype.forEachRecord = function(func) {
  var buffer = this.buffer_;
  if (!buffer[0]) {
    return;
  }
  var curIndex = this.curIndex_;
  var i = this.isFull_ ? curIndex : -1;
  do {
    i = (i + 1) % goog.debug.LogBuffer.CAPACITY;
    func(buffer[i]);
  } while (i != curIndex);
};
goog.provide("goog.debug.LogManager");
goog.provide("goog.debug.Loggable");
goog.provide("goog.debug.Logger");
goog.provide("goog.debug.Logger.Level");
goog.require("goog.array");
goog.require("goog.asserts");
goog.require("goog.debug");
goog.require("goog.debug.LogBuffer");
goog.require("goog.debug.LogRecord");
goog.debug.Loggable;
goog.debug.Logger = function(name) {
  this.name_ = name;
  this.parent_ = null;
  this.level_ = null;
  this.children_ = null;
  this.handlers_ = null;
};
goog.debug.Logger.ROOT_LOGGER_NAME = "";
goog.define("goog.debug.Logger.ENABLE_HIERARCHY", true);
if (!goog.debug.Logger.ENABLE_HIERARCHY) {
  goog.debug.Logger.rootHandlers_ = [];
  goog.debug.Logger.rootLevel_;
}
goog.debug.Logger.Level = function(name, value) {
  this.name = name;
  this.value = value;
};
goog.debug.Logger.Level.prototype.toString = function() {
  return this.name;
};
goog.debug.Logger.Level.OFF = new goog.debug.Logger.Level("OFF", Infinity);
goog.debug.Logger.Level.SHOUT = new goog.debug.Logger.Level("SHOUT", 1200);
goog.debug.Logger.Level.SEVERE = new goog.debug.Logger.Level("SEVERE", 1000);
goog.debug.Logger.Level.WARNING = new goog.debug.Logger.Level("WARNING", 900);
goog.debug.Logger.Level.INFO = new goog.debug.Logger.Level("INFO", 800);
goog.debug.Logger.Level.CONFIG = new goog.debug.Logger.Level("CONFIG", 700);
goog.debug.Logger.Level.FINE = new goog.debug.Logger.Level("FINE", 500);
goog.debug.Logger.Level.FINER = new goog.debug.Logger.Level("FINER", 400);
goog.debug.Logger.Level.FINEST = new goog.debug.Logger.Level("FINEST", 300);
goog.debug.Logger.Level.ALL = new goog.debug.Logger.Level("ALL", 0);
goog.debug.Logger.Level.PREDEFINED_LEVELS = [goog.debug.Logger.Level.OFF, goog.debug.Logger.Level.SHOUT, goog.debug.Logger.Level.SEVERE, goog.debug.Logger.Level.WARNING, goog.debug.Logger.Level.INFO, goog.debug.Logger.Level.CONFIG, goog.debug.Logger.Level.FINE, goog.debug.Logger.Level.FINER, goog.debug.Logger.Level.FINEST, goog.debug.Logger.Level.ALL];
goog.debug.Logger.Level.predefinedLevelsCache_ = null;
goog.debug.Logger.Level.createPredefinedLevelsCache_ = function() {
  goog.debug.Logger.Level.predefinedLevelsCache_ = {};
  for (var i = 0, level; level = goog.debug.Logger.Level.PREDEFINED_LEVELS[i]; i++) {
    goog.debug.Logger.Level.predefinedLevelsCache_[level.value] = level;
    goog.debug.Logger.Level.predefinedLevelsCache_[level.name] = level;
  }
};
goog.debug.Logger.Level.getPredefinedLevel = function(name) {
  if (!goog.debug.Logger.Level.predefinedLevelsCache_) {
    goog.debug.Logger.Level.createPredefinedLevelsCache_();
  }
  return goog.debug.Logger.Level.predefinedLevelsCache_[name] || null;
};
goog.debug.Logger.Level.getPredefinedLevelByValue = function(value) {
  if (!goog.debug.Logger.Level.predefinedLevelsCache_) {
    goog.debug.Logger.Level.createPredefinedLevelsCache_();
  }
  if (value in goog.debug.Logger.Level.predefinedLevelsCache_) {
    return goog.debug.Logger.Level.predefinedLevelsCache_[value];
  }
  for (var i = 0; i < goog.debug.Logger.Level.PREDEFINED_LEVELS.length; ++i) {
    var level = goog.debug.Logger.Level.PREDEFINED_LEVELS[i];
    if (level.value <= value) {
      return level;
    }
  }
  return null;
};
goog.debug.Logger.getLogger = function(name) {
  return goog.debug.LogManager.getLogger(name);
};
goog.debug.Logger.logToProfilers = function(msg) {
  if (goog.global["console"]) {
    if (goog.global["console"]["timeStamp"]) {
      goog.global["console"]["timeStamp"](msg);
    } else {
      if (goog.global["console"]["markTimeline"]) {
        goog.global["console"]["markTimeline"](msg);
      }
    }
  }
  if (goog.global["msWriteProfilerMark"]) {
    goog.global["msWriteProfilerMark"](msg);
  }
};
goog.debug.Logger.prototype.getName = function() {
  return this.name_;
};
goog.debug.Logger.prototype.addHandler = function(handler) {
  if (goog.debug.LOGGING_ENABLED) {
    if (goog.debug.Logger.ENABLE_HIERARCHY) {
      if (!this.handlers_) {
        this.handlers_ = [];
      }
      this.handlers_.push(handler);
    } else {
      goog.asserts.assert(!this.name_, "Cannot call addHandler on a non-root logger when " + "goog.debug.Logger.ENABLE_HIERARCHY is false.");
      goog.debug.Logger.rootHandlers_.push(handler);
    }
  }
};
goog.debug.Logger.prototype.removeHandler = function(handler) {
  if (goog.debug.LOGGING_ENABLED) {
    var handlers = goog.debug.Logger.ENABLE_HIERARCHY ? this.handlers_ : goog.debug.Logger.rootHandlers_;
    return !!handlers && goog.array.remove(handlers, handler);
  } else {
    return false;
  }
};
goog.debug.Logger.prototype.getParent = function() {
  return this.parent_;
};
goog.debug.Logger.prototype.getChildren = function() {
  if (!this.children_) {
    this.children_ = {};
  }
  return this.children_;
};
goog.debug.Logger.prototype.setLevel = function(level) {
  if (goog.debug.LOGGING_ENABLED) {
    if (goog.debug.Logger.ENABLE_HIERARCHY) {
      this.level_ = level;
    } else {
      goog.asserts.assert(!this.name_, "Cannot call setLevel() on a non-root logger when " + "goog.debug.Logger.ENABLE_HIERARCHY is false.");
      goog.debug.Logger.rootLevel_ = level;
    }
  }
};
goog.debug.Logger.prototype.getLevel = function() {
  return goog.debug.LOGGING_ENABLED ? this.level_ : goog.debug.Logger.Level.OFF;
};
goog.debug.Logger.prototype.getEffectiveLevel = function() {
  if (!goog.debug.LOGGING_ENABLED) {
    return goog.debug.Logger.Level.OFF;
  }
  if (!goog.debug.Logger.ENABLE_HIERARCHY) {
    return goog.debug.Logger.rootLevel_;
  }
  if (this.level_) {
    return this.level_;
  }
  if (this.parent_) {
    return this.parent_.getEffectiveLevel();
  }
  goog.asserts.fail("Root logger has no level set.");
  return null;
};
goog.debug.Logger.prototype.isLoggable = function(level) {
  return goog.debug.LOGGING_ENABLED && level.value >= this.getEffectiveLevel().value;
};
goog.debug.Logger.prototype.log = function(level, msg, opt_exception) {
  if (goog.debug.LOGGING_ENABLED && this.isLoggable(level)) {
    if (goog.isFunction(msg)) {
      msg = msg();
    }
    this.doLogRecord_(this.getLogRecord(level, msg, opt_exception));
  }
};
goog.debug.Logger.prototype.getLogRecord = function(level, msg, opt_exception) {
  if (goog.debug.LogBuffer.isBufferingEnabled()) {
    var logRecord = goog.debug.LogBuffer.getInstance().addRecord(level, msg, this.name_);
  } else {
    logRecord = new goog.debug.LogRecord(level, String(msg), this.name_);
  }
  if (opt_exception) {
    logRecord.setException(opt_exception);
  }
  return logRecord;
};
goog.debug.Logger.prototype.shout = function(msg, opt_exception) {
  if (goog.debug.LOGGING_ENABLED) {
    this.log(goog.debug.Logger.Level.SHOUT, msg, opt_exception);
  }
};
goog.debug.Logger.prototype.severe = function(msg, opt_exception) {
  if (goog.debug.LOGGING_ENABLED) {
    this.log(goog.debug.Logger.Level.SEVERE, msg, opt_exception);
  }
};
goog.debug.Logger.prototype.warning = function(msg, opt_exception) {
  if (goog.debug.LOGGING_ENABLED) {
    this.log(goog.debug.Logger.Level.WARNING, msg, opt_exception);
  }
};
goog.debug.Logger.prototype.info = function(msg, opt_exception) {
  if (goog.debug.LOGGING_ENABLED) {
    this.log(goog.debug.Logger.Level.INFO, msg, opt_exception);
  }
};
goog.debug.Logger.prototype.config = function(msg, opt_exception) {
  if (goog.debug.LOGGING_ENABLED) {
    this.log(goog.debug.Logger.Level.CONFIG, msg, opt_exception);
  }
};
goog.debug.Logger.prototype.fine = function(msg, opt_exception) {
  if (goog.debug.LOGGING_ENABLED) {
    this.log(goog.debug.Logger.Level.FINE, msg, opt_exception);
  }
};
goog.debug.Logger.prototype.finer = function(msg, opt_exception) {
  if (goog.debug.LOGGING_ENABLED) {
    this.log(goog.debug.Logger.Level.FINER, msg, opt_exception);
  }
};
goog.debug.Logger.prototype.finest = function(msg, opt_exception) {
  if (goog.debug.LOGGING_ENABLED) {
    this.log(goog.debug.Logger.Level.FINEST, msg, opt_exception);
  }
};
goog.debug.Logger.prototype.logRecord = function(logRecord) {
  if (goog.debug.LOGGING_ENABLED && this.isLoggable(logRecord.getLevel())) {
    this.doLogRecord_(logRecord);
  }
};
goog.debug.Logger.prototype.doLogRecord_ = function(logRecord) {
  goog.debug.Logger.logToProfilers("log:" + logRecord.getMessage());
  if (goog.debug.Logger.ENABLE_HIERARCHY) {
    var target = this;
    while (target) {
      target.callPublish_(logRecord);
      target = target.getParent();
    }
  } else {
    for (var i = 0, handler; handler = goog.debug.Logger.rootHandlers_[i++];) {
      handler(logRecord);
    }
  }
};
goog.debug.Logger.prototype.callPublish_ = function(logRecord) {
  if (this.handlers_) {
    for (var i = 0, handler; handler = this.handlers_[i]; i++) {
      handler(logRecord);
    }
  }
};
goog.debug.Logger.prototype.setParent_ = function(parent) {
  this.parent_ = parent;
};
goog.debug.Logger.prototype.addChild_ = function(name, logger) {
  this.getChildren()[name] = logger;
};
goog.debug.LogManager = {};
goog.debug.LogManager.loggers_ = {};
goog.debug.LogManager.rootLogger_ = null;
goog.debug.LogManager.initialize = function() {
  if (!goog.debug.LogManager.rootLogger_) {
    goog.debug.LogManager.rootLogger_ = new goog.debug.Logger(goog.debug.Logger.ROOT_LOGGER_NAME);
    goog.debug.LogManager.loggers_[goog.debug.Logger.ROOT_LOGGER_NAME] = goog.debug.LogManager.rootLogger_;
    goog.debug.LogManager.rootLogger_.setLevel(goog.debug.Logger.Level.CONFIG);
  }
};
goog.debug.LogManager.getLoggers = function() {
  return goog.debug.LogManager.loggers_;
};
goog.debug.LogManager.getRoot = function() {
  goog.debug.LogManager.initialize();
  return goog.debug.LogManager.rootLogger_;
};
goog.debug.LogManager.getLogger = function(name) {
  goog.debug.LogManager.initialize();
  var ret = goog.debug.LogManager.loggers_[name];
  return ret || goog.debug.LogManager.createLogger_(name);
};
goog.debug.LogManager.createFunctionForCatchErrors = function(opt_logger) {
  return function(info) {
    var logger = opt_logger || goog.debug.LogManager.getRoot();
    logger.severe("Error: " + info.message + " (" + info.fileName + " @ Line: " + info.line + ")");
  };
};
goog.debug.LogManager.createLogger_ = function(name) {
  var logger = new goog.debug.Logger(name);
  if (goog.debug.Logger.ENABLE_HIERARCHY) {
    var lastDotIndex = name.lastIndexOf(".");
    var parentName = name.substr(0, lastDotIndex);
    var leafName = name.substr(lastDotIndex + 1);
    var parentLogger = goog.debug.LogManager.getLogger(parentName);
    parentLogger.addChild_(leafName, logger);
    logger.setParent_(parentLogger);
  }
  goog.debug.LogManager.loggers_[name] = logger;
  return logger;
};
goog.provide("goog.dom.BrowserFeature");
goog.require("goog.userAgent");
goog.dom.BrowserFeature = {CAN_ADD_NAME_OR_TYPE_ATTRIBUTES:!goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9), CAN_USE_CHILDREN_ATTRIBUTE:!goog.userAgent.GECKO && !goog.userAgent.IE || goog.userAgent.IE && goog.userAgent.isDocumentModeOrHigher(9) || goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("1.9.1"), CAN_USE_INNER_TEXT:goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9"), CAN_USE_PARENT_ELEMENT_PROPERTY:goog.userAgent.IE || goog.userAgent.OPERA || goog.userAgent.WEBKIT, 
INNER_HTML_NEEDS_SCOPED_ELEMENT:goog.userAgent.IE, LEGACY_IE_RANGES:goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)};
goog.provide("goog.dom.HtmlElement");
goog.dom.HtmlElement = function() {
};
goog.provide("goog.dom.TagName");
goog.require("goog.dom.HtmlElement");
goog.dom.TagName = function(tagName) {
  this.tagName_ = tagName;
};
goog.dom.TagName.prototype.toString = function() {
  return this.tagName_;
};
goog.dom.TagName.A = new goog.dom.TagName("A");
goog.dom.TagName.ABBR = new goog.dom.TagName("ABBR");
goog.dom.TagName.ACRONYM = new goog.dom.TagName("ACRONYM");
goog.dom.TagName.ADDRESS = new goog.dom.TagName("ADDRESS");
goog.dom.TagName.APPLET = new goog.dom.TagName("APPLET");
goog.dom.TagName.AREA = new goog.dom.TagName("AREA");
goog.dom.TagName.ARTICLE = new goog.dom.TagName("ARTICLE");
goog.dom.TagName.ASIDE = new goog.dom.TagName("ASIDE");
goog.dom.TagName.AUDIO = new goog.dom.TagName("AUDIO");
goog.dom.TagName.B = new goog.dom.TagName("B");
goog.dom.TagName.BASE = new goog.dom.TagName("BASE");
goog.dom.TagName.BASEFONT = new goog.dom.TagName("BASEFONT");
goog.dom.TagName.BDI = new goog.dom.TagName("BDI");
goog.dom.TagName.BDO = new goog.dom.TagName("BDO");
goog.dom.TagName.BIG = new goog.dom.TagName("BIG");
goog.dom.TagName.BLOCKQUOTE = new goog.dom.TagName("BLOCKQUOTE");
goog.dom.TagName.BODY = new goog.dom.TagName("BODY");
goog.dom.TagName.BR = new goog.dom.TagName("BR");
goog.dom.TagName.BUTTON = new goog.dom.TagName("BUTTON");
goog.dom.TagName.CANVAS = new goog.dom.TagName("CANVAS");
goog.dom.TagName.CAPTION = new goog.dom.TagName("CAPTION");
goog.dom.TagName.CENTER = new goog.dom.TagName("CENTER");
goog.dom.TagName.CITE = new goog.dom.TagName("CITE");
goog.dom.TagName.CODE = new goog.dom.TagName("CODE");
goog.dom.TagName.COL = new goog.dom.TagName("COL");
goog.dom.TagName.COLGROUP = new goog.dom.TagName("COLGROUP");
goog.dom.TagName.COMMAND = new goog.dom.TagName("COMMAND");
goog.dom.TagName.DATA = new goog.dom.TagName("DATA");
goog.dom.TagName.DATALIST = new goog.dom.TagName("DATALIST");
goog.dom.TagName.DD = new goog.dom.TagName("DD");
goog.dom.TagName.DEL = new goog.dom.TagName("DEL");
goog.dom.TagName.DETAILS = new goog.dom.TagName("DETAILS");
goog.dom.TagName.DFN = new goog.dom.TagName("DFN");
goog.dom.TagName.DIALOG = new goog.dom.TagName("DIALOG");
goog.dom.TagName.DIR = new goog.dom.TagName("DIR");
goog.dom.TagName.DIV = new goog.dom.TagName("DIV");
goog.dom.TagName.DL = new goog.dom.TagName("DL");
goog.dom.TagName.DT = new goog.dom.TagName("DT");
goog.dom.TagName.EM = new goog.dom.TagName("EM");
goog.dom.TagName.EMBED = new goog.dom.TagName("EMBED");
goog.dom.TagName.FIELDSET = new goog.dom.TagName("FIELDSET");
goog.dom.TagName.FIGCAPTION = new goog.dom.TagName("FIGCAPTION");
goog.dom.TagName.FIGURE = new goog.dom.TagName("FIGURE");
goog.dom.TagName.FONT = new goog.dom.TagName("FONT");
goog.dom.TagName.FOOTER = new goog.dom.TagName("FOOTER");
goog.dom.TagName.FORM = new goog.dom.TagName("FORM");
goog.dom.TagName.FRAME = new goog.dom.TagName("FRAME");
goog.dom.TagName.FRAMESET = new goog.dom.TagName("FRAMESET");
goog.dom.TagName.H1 = new goog.dom.TagName("H1");
goog.dom.TagName.H2 = new goog.dom.TagName("H2");
goog.dom.TagName.H3 = new goog.dom.TagName("H3");
goog.dom.TagName.H4 = new goog.dom.TagName("H4");
goog.dom.TagName.H5 = new goog.dom.TagName("H5");
goog.dom.TagName.H6 = new goog.dom.TagName("H6");
goog.dom.TagName.HEAD = new goog.dom.TagName("HEAD");
goog.dom.TagName.HEADER = new goog.dom.TagName("HEADER");
goog.dom.TagName.HGROUP = new goog.dom.TagName("HGROUP");
goog.dom.TagName.HR = new goog.dom.TagName("HR");
goog.dom.TagName.HTML = new goog.dom.TagName("HTML");
goog.dom.TagName.I = new goog.dom.TagName("I");
goog.dom.TagName.IFRAME = new goog.dom.TagName("IFRAME");
goog.dom.TagName.IMG = new goog.dom.TagName("IMG");
goog.dom.TagName.INPUT = new goog.dom.TagName("INPUT");
goog.dom.TagName.INS = new goog.dom.TagName("INS");
goog.dom.TagName.ISINDEX = new goog.dom.TagName("ISINDEX");
goog.dom.TagName.KBD = new goog.dom.TagName("KBD");
goog.dom.TagName.KEYGEN = new goog.dom.TagName("KEYGEN");
goog.dom.TagName.LABEL = new goog.dom.TagName("LABEL");
goog.dom.TagName.LEGEND = new goog.dom.TagName("LEGEND");
goog.dom.TagName.LI = new goog.dom.TagName("LI");
goog.dom.TagName.LINK = new goog.dom.TagName("LINK");
goog.dom.TagName.MAP = new goog.dom.TagName("MAP");
goog.dom.TagName.MARK = new goog.dom.TagName("MARK");
goog.dom.TagName.MATH = new goog.dom.TagName("MATH");
goog.dom.TagName.MENU = new goog.dom.TagName("MENU");
goog.dom.TagName.META = new goog.dom.TagName("META");
goog.dom.TagName.METER = new goog.dom.TagName("METER");
goog.dom.TagName.NAV = new goog.dom.TagName("NAV");
goog.dom.TagName.NOFRAMES = new goog.dom.TagName("NOFRAMES");
goog.dom.TagName.NOSCRIPT = new goog.dom.TagName("NOSCRIPT");
goog.dom.TagName.OBJECT = new goog.dom.TagName("OBJECT");
goog.dom.TagName.OL = new goog.dom.TagName("OL");
goog.dom.TagName.OPTGROUP = new goog.dom.TagName("OPTGROUP");
goog.dom.TagName.OPTION = new goog.dom.TagName("OPTION");
goog.dom.TagName.OUTPUT = new goog.dom.TagName("OUTPUT");
goog.dom.TagName.P = new goog.dom.TagName("P");
goog.dom.TagName.PARAM = new goog.dom.TagName("PARAM");
goog.dom.TagName.PRE = new goog.dom.TagName("PRE");
goog.dom.TagName.PROGRESS = new goog.dom.TagName("PROGRESS");
goog.dom.TagName.Q = new goog.dom.TagName("Q");
goog.dom.TagName.RP = new goog.dom.TagName("RP");
goog.dom.TagName.RT = new goog.dom.TagName("RT");
goog.dom.TagName.RUBY = new goog.dom.TagName("RUBY");
goog.dom.TagName.S = new goog.dom.TagName("S");
goog.dom.TagName.SAMP = new goog.dom.TagName("SAMP");
goog.dom.TagName.SCRIPT = new goog.dom.TagName("SCRIPT");
goog.dom.TagName.SECTION = new goog.dom.TagName("SECTION");
goog.dom.TagName.SELECT = new goog.dom.TagName("SELECT");
goog.dom.TagName.SMALL = new goog.dom.TagName("SMALL");
goog.dom.TagName.SOURCE = new goog.dom.TagName("SOURCE");
goog.dom.TagName.SPAN = new goog.dom.TagName("SPAN");
goog.dom.TagName.STRIKE = new goog.dom.TagName("STRIKE");
goog.dom.TagName.STRONG = new goog.dom.TagName("STRONG");
goog.dom.TagName.STYLE = new goog.dom.TagName("STYLE");
goog.dom.TagName.SUB = new goog.dom.TagName("SUB");
goog.dom.TagName.SUMMARY = new goog.dom.TagName("SUMMARY");
goog.dom.TagName.SUP = new goog.dom.TagName("SUP");
goog.dom.TagName.SVG = new goog.dom.TagName("SVG");
goog.dom.TagName.TABLE = new goog.dom.TagName("TABLE");
goog.dom.TagName.TBODY = new goog.dom.TagName("TBODY");
goog.dom.TagName.TD = new goog.dom.TagName("TD");
goog.dom.TagName.TEMPLATE = new goog.dom.TagName("TEMPLATE");
goog.dom.TagName.TEXTAREA = new goog.dom.TagName("TEXTAREA");
goog.dom.TagName.TFOOT = new goog.dom.TagName("TFOOT");
goog.dom.TagName.TH = new goog.dom.TagName("TH");
goog.dom.TagName.THEAD = new goog.dom.TagName("THEAD");
goog.dom.TagName.TIME = new goog.dom.TagName("TIME");
goog.dom.TagName.TITLE = new goog.dom.TagName("TITLE");
goog.dom.TagName.TR = new goog.dom.TagName("TR");
goog.dom.TagName.TRACK = new goog.dom.TagName("TRACK");
goog.dom.TagName.TT = new goog.dom.TagName("TT");
goog.dom.TagName.U = new goog.dom.TagName("U");
goog.dom.TagName.UL = new goog.dom.TagName("UL");
goog.dom.TagName.VAR = new goog.dom.TagName("VAR");
goog.dom.TagName.VIDEO = new goog.dom.TagName("VIDEO");
goog.dom.TagName.WBR = new goog.dom.TagName("WBR");
goog.provide("goog.dom.tags");
goog.require("goog.object");
goog.dom.tags.VOID_TAGS_ = goog.object.createSet("area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr");
goog.dom.tags.isVoidTag = function(tagName) {
  return goog.dom.tags.VOID_TAGS_[tagName] === true;
};
goog.provide("goog.string.TypedString");
goog.string.TypedString = function() {
};
goog.string.TypedString.prototype.implementsGoogStringTypedString;
goog.string.TypedString.prototype.getTypedStringValue;
goog.provide("goog.string.Const");
goog.require("goog.asserts");
goog.require("goog.string.TypedString");
goog.string.Const = function() {
  this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ = "";
  this.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ = goog.string.Const.TYPE_MARKER_;
};
goog.string.Const.prototype.implementsGoogStringTypedString = true;
goog.string.Const.prototype.getTypedStringValue = function() {
  return this.stringConstValueWithSecurityContract__googStringSecurityPrivate_;
};
goog.string.Const.prototype.toString = function() {
  return "Const{" + this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ + "}";
};
goog.string.Const.unwrap = function(stringConst) {
  if (stringConst instanceof goog.string.Const && stringConst.constructor === goog.string.Const && stringConst.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ === goog.string.Const.TYPE_MARKER_) {
    return stringConst.stringConstValueWithSecurityContract__googStringSecurityPrivate_;
  } else {
    goog.asserts.fail("expected object of type Const, got '" + stringConst + "'");
    return "type_error:Const";
  }
};
goog.string.Const.from = function(s) {
  return goog.string.Const.create__googStringSecurityPrivate_(s);
};
goog.string.Const.TYPE_MARKER_ = {};
goog.string.Const.create__googStringSecurityPrivate_ = function(s) {
  var stringConst = new goog.string.Const;
  stringConst.stringConstValueWithSecurityContract__googStringSecurityPrivate_ = s;
  return stringConst;
};
goog.string.Const.EMPTY = goog.string.Const.from("");
goog.provide("goog.html.SafeScript");
goog.require("goog.asserts");
goog.require("goog.string.Const");
goog.require("goog.string.TypedString");
goog.html.SafeScript = function() {
  this.privateDoNotAccessOrElseSafeScriptWrappedValue_ = "";
  this.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_;
};
goog.html.SafeScript.prototype.implementsGoogStringTypedString = true;
goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
goog.html.SafeScript.fromConstant = function(script) {
  var scriptString = goog.string.Const.unwrap(script);
  if (scriptString.length === 0) {
    return goog.html.SafeScript.EMPTY;
  }
  return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(scriptString);
};
goog.html.SafeScript.prototype.getTypedStringValue = function() {
  return this.privateDoNotAccessOrElseSafeScriptWrappedValue_;
};
if (goog.DEBUG) {
  goog.html.SafeScript.prototype.toString = function() {
    return "SafeScript{" + this.privateDoNotAccessOrElseSafeScriptWrappedValue_ + "}";
  };
}
goog.html.SafeScript.unwrap = function(safeScript) {
  if (safeScript instanceof goog.html.SafeScript && safeScript.constructor === goog.html.SafeScript && safeScript.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) {
    return safeScript.privateDoNotAccessOrElseSafeScriptWrappedValue_;
  } else {
    goog.asserts.fail("expected object of type SafeScript, got '" + safeScript + "' of type " + goog.typeOf(safeScript));
    return "type_error:SafeScript";
  }
};
goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse = function(script) {
  return (new goog.html.SafeScript).initSecurityPrivateDoNotAccessOrElse_(script);
};
goog.html.SafeScript.prototype.initSecurityPrivateDoNotAccessOrElse_ = function(script) {
  this.privateDoNotAccessOrElseSafeScriptWrappedValue_ = script;
  return this;
};
goog.html.SafeScript.EMPTY = goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse("");
goog.provide("goog.html.SafeStyle");
goog.require("goog.array");
goog.require("goog.asserts");
goog.require("goog.string");
goog.require("goog.string.Const");
goog.require("goog.string.TypedString");
goog.html.SafeStyle = function() {
  this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = "";
  this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_;
};
goog.html.SafeStyle.prototype.implementsGoogStringTypedString = true;
goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
goog.html.SafeStyle.fromConstant = function(style) {
  var styleString = goog.string.Const.unwrap(style);
  if (styleString.length === 0) {
    return goog.html.SafeStyle.EMPTY;
  }
  goog.html.SafeStyle.checkStyle_(styleString);
  goog.asserts.assert(goog.string.endsWith(styleString, ";"), "Last character of style string is not ';': " + styleString);
  goog.asserts.assert(goog.string.contains(styleString, ":"), "Style string must contain at least one ':', to " + 'specify a "name: value" pair: ' + styleString);
  return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(styleString);
};
goog.html.SafeStyle.checkStyle_ = function(style) {
  goog.asserts.assert(!/[<>]/.test(style), "Forbidden characters in style string: " + style);
};
goog.html.SafeStyle.prototype.getTypedStringValue = function() {
  return this.privateDoNotAccessOrElseSafeStyleWrappedValue_;
};
if (goog.DEBUG) {
  goog.html.SafeStyle.prototype.toString = function() {
    return "SafeStyle{" + this.privateDoNotAccessOrElseSafeStyleWrappedValue_ + "}";
  };
}
goog.html.SafeStyle.unwrap = function(safeStyle) {
  if (safeStyle instanceof goog.html.SafeStyle && safeStyle.constructor === goog.html.SafeStyle && safeStyle.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) {
    return safeStyle.privateDoNotAccessOrElseSafeStyleWrappedValue_;
  } else {
    goog.asserts.fail("expected object of type SafeStyle, got '" + safeStyle + "' of type " + goog.typeOf(safeStyle));
    return "type_error:SafeStyle";
  }
};
goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse = function(style) {
  return (new goog.html.SafeStyle).initSecurityPrivateDoNotAccessOrElse_(style);
};
goog.html.SafeStyle.prototype.initSecurityPrivateDoNotAccessOrElse_ = function(style) {
  this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = style;
  return this;
};
goog.html.SafeStyle.EMPTY = goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse("");
goog.html.SafeStyle.INNOCUOUS_STRING = "zClosurez";
goog.html.SafeStyle.PropertyMap;
goog.html.SafeStyle.create = function(map) {
  var style = "";
  for (var name in map) {
    if (!/^[-_a-zA-Z0-9]+$/.test(name)) {
      throw Error("Name allows only [-_a-zA-Z0-9], got: " + name);
    }
    var value = map[name];
    if (value == null) {
      continue;
    }
    if (value instanceof goog.string.Const) {
      value = goog.string.Const.unwrap(value);
      goog.asserts.assert(!/[{;}]/.test(value), "Value does not allow [{;}].");
    } else {
      if (!goog.html.SafeStyle.VALUE_RE_.test(value)) {
        goog.asserts.fail("String value allows only [-,.\"'%_!# a-zA-Z0-9], rgb() and " + "rgba(), got: " + value);
        value = goog.html.SafeStyle.INNOCUOUS_STRING;
      } else {
        if (!goog.html.SafeStyle.hasBalancedQuotes_(value)) {
          goog.asserts.fail("String value requires balanced quotes, got: " + value);
          value = goog.html.SafeStyle.INNOCUOUS_STRING;
        }
      }
    }
    style += name + ":" + value + ";";
  }
  if (!style) {
    return goog.html.SafeStyle.EMPTY;
  }
  goog.html.SafeStyle.checkStyle_(style);
  return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(style);
};
goog.html.SafeStyle.hasBalancedQuotes_ = function(value) {
  var outsideSingle = true;
  var outsideDouble = true;
  for (var i = 0; i < value.length; i++) {
    var c = value.charAt(i);
    if (c == "'" && outsideDouble) {
      outsideSingle = !outsideSingle;
    } else {
      if (c == '"' && outsideSingle) {
        outsideDouble = !outsideDouble;
      }
    }
  }
  return outsideSingle && outsideDouble;
};
goog.html.SafeStyle.VALUE_RE_ = /^([-,."'%_!# a-zA-Z0-9]+|(?:rgb|hsl)a?\([0-9.%, ]+\))$/;
goog.html.SafeStyle.concat = function(var_args) {
  var style = "";
  var addArgument = function(argument) {
    if (goog.isArray(argument)) {
      goog.array.forEach(argument, addArgument);
    } else {
      style += goog.html.SafeStyle.unwrap(argument);
    }
  };
  goog.array.forEach(arguments, addArgument);
  if (!style) {
    return goog.html.SafeStyle.EMPTY;
  }
  return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(style);
};
goog.provide("goog.html.SafeStyleSheet");
goog.require("goog.array");
goog.require("goog.asserts");
goog.require("goog.string");
goog.require("goog.string.Const");
goog.require("goog.string.TypedString");
goog.html.SafeStyleSheet = function() {
  this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ = "";
  this.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_;
};
goog.html.SafeStyleSheet.prototype.implementsGoogStringTypedString = true;
goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
goog.html.SafeStyleSheet.concat = function(var_args) {
  var result = "";
  var addArgument = function(argument) {
    if (goog.isArray(argument)) {
      goog.array.forEach(argument, addArgument);
    } else {
      result += goog.html.SafeStyleSheet.unwrap(argument);
    }
  };
  goog.array.forEach(arguments, addArgument);
  return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(result);
};
goog.html.SafeStyleSheet.fromConstant = function(styleSheet) {
  var styleSheetString = goog.string.Const.unwrap(styleSheet);
  if (styleSheetString.length === 0) {
    return goog.html.SafeStyleSheet.EMPTY;
  }
  goog.asserts.assert(!goog.string.contains(styleSheetString, "<"), "Forbidden '<' character in style sheet string: " + styleSheetString);
  return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(styleSheetString);
};
goog.html.SafeStyleSheet.prototype.getTypedStringValue = function() {
  return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_;
};
if (goog.DEBUG) {
  goog.html.SafeStyleSheet.prototype.toString = function() {
    return "SafeStyleSheet{" + this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ + "}";
  };
}
goog.html.SafeStyleSheet.unwrap = function(safeStyleSheet) {
  if (safeStyleSheet instanceof goog.html.SafeStyleSheet && safeStyleSheet.constructor === goog.html.SafeStyleSheet && safeStyleSheet.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) {
    return safeStyleSheet.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_;
  } else {
    goog.asserts.fail("expected object of type SafeStyleSheet, got '" + safeStyleSheet + "' of type " + goog.typeOf(safeStyleSheet));
    return "type_error:SafeStyleSheet";
  }
};
goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse = function(styleSheet) {
  return (new goog.html.SafeStyleSheet).initSecurityPrivateDoNotAccessOrElse_(styleSheet);
};
goog.html.SafeStyleSheet.prototype.initSecurityPrivateDoNotAccessOrElse_ = function(styleSheet) {
  this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ = styleSheet;
  return this;
};
goog.html.SafeStyleSheet.EMPTY = goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse("");
goog.provide("goog.fs.url");
goog.fs.url.createObjectUrl = function(blob) {
  return goog.fs.url.getUrlObject_().createObjectURL(blob);
};
goog.fs.url.revokeObjectUrl = function(url) {
  goog.fs.url.getUrlObject_().revokeObjectURL(url);
};
goog.fs.url.UrlObject_;
goog.fs.url.getUrlObject_ = function() {
  var urlObject = goog.fs.url.findUrlObject_();
  if (urlObject != null) {
    return urlObject;
  } else {
    throw Error("This browser doesn't seem to support blob URLs");
  }
};
goog.fs.url.findUrlObject_ = function() {
  if (goog.isDef(goog.global.URL) && goog.isDef(goog.global.URL.createObjectURL)) {
    return goog.global.URL;
  } else {
    if (goog.isDef(goog.global.webkitURL) && goog.isDef(goog.global.webkitURL.createObjectURL)) {
      return goog.global.webkitURL;
    } else {
      if (goog.isDef(goog.global.createObjectURL)) {
        return goog.global;
      } else {
        return null;
      }
    }
  }
};
goog.fs.url.browserSupportsObjectUrls = function() {
  return goog.fs.url.findUrlObject_() != null;
};
goog.provide("goog.i18n.bidi");
goog.provide("goog.i18n.bidi.Dir");
goog.provide("goog.i18n.bidi.DirectionalString");
goog.provide("goog.i18n.bidi.Format");
goog.define("goog.i18n.bidi.FORCE_RTL", false);
goog.i18n.bidi.IS_RTL = goog.i18n.bidi.FORCE_RTL || (goog.LOCALE.substring(0, 2).toLowerCase() == "ar" || goog.LOCALE.substring(0, 2).toLowerCase() == "fa" || goog.LOCALE.substring(0, 2).toLowerCase() == "he" || goog.LOCALE.substring(0, 2).toLowerCase() == "iw" || goog.LOCALE.substring(0, 2).toLowerCase() == "ps" || goog.LOCALE.substring(0, 2).toLowerCase() == "sd" || goog.LOCALE.substring(0, 2).toLowerCase() == "ug" || goog.LOCALE.substring(0, 2).toLowerCase() == "ur" || goog.LOCALE.substring(0, 
2).toLowerCase() == "yi") && (goog.LOCALE.length == 2 || goog.LOCALE.substring(2, 3) == "-" || goog.LOCALE.substring(2, 3) == "_") || goog.LOCALE.length >= 3 && goog.LOCALE.substring(0, 3).toLowerCase() == "ckb" && (goog.LOCALE.length == 3 || goog.LOCALE.substring(3, 4) == "-" || goog.LOCALE.substring(3, 4) == "_");
goog.i18n.bidi.Format = {LRE:"\u202a", RLE:"\u202b", PDF:"\u202c", LRM:"\u200e", RLM:"\u200f"};
goog.i18n.bidi.Dir = {LTR:1, RTL:-1, NEUTRAL:0};
goog.i18n.bidi.RIGHT = "right";
goog.i18n.bidi.LEFT = "left";
goog.i18n.bidi.I18N_RIGHT = goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.LEFT : goog.i18n.bidi.RIGHT;
goog.i18n.bidi.I18N_LEFT = goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.RIGHT : goog.i18n.bidi.LEFT;
goog.i18n.bidi.toDir = function(givenDir, opt_noNeutral) {
  if (typeof givenDir == "number") {
    return givenDir > 0 ? goog.i18n.bidi.Dir.LTR : givenDir < 0 ? goog.i18n.bidi.Dir.RTL : opt_noNeutral ? null : goog.i18n.bidi.Dir.NEUTRAL;
  } else {
    if (givenDir == null) {
      return null;
    } else {
      return givenDir ? goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR;
    }
  }
};
goog.i18n.bidi.ltrChars_ = "A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff" + "\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff";
goog.i18n.bidi.rtlChars_ = "\u0591-\u06ef\u06fa-\u07ff\u200f\ufb1d-\ufdff\ufe70-\ufefc";
goog.i18n.bidi.htmlSkipReg_ = /<[^>]*>|&[^;]+;/g;
goog.i18n.bidi.stripHtmlIfNeeded_ = function(str, opt_isStripNeeded) {
  return opt_isStripNeeded ? str.replace(goog.i18n.bidi.htmlSkipReg_, "") : str;
};
goog.i18n.bidi.rtlCharReg_ = new RegExp("[" + goog.i18n.bidi.rtlChars_ + "]");
goog.i18n.bidi.ltrCharReg_ = new RegExp("[" + goog.i18n.bidi.ltrChars_ + "]");
goog.i18n.bidi.hasAnyRtl = function(str, opt_isHtml) {
  return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml));
};
goog.i18n.bidi.hasRtlChar = goog.i18n.bidi.hasAnyRtl;
goog.i18n.bidi.hasAnyLtr = function(str, opt_isHtml) {
  return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml));
};
goog.i18n.bidi.ltrRe_ = new RegExp("^[" + goog.i18n.bidi.ltrChars_ + "]");
goog.i18n.bidi.rtlRe_ = new RegExp("^[" + goog.i18n.bidi.rtlChars_ + "]");
goog.i18n.bidi.isRtlChar = function(str) {
  return goog.i18n.bidi.rtlRe_.test(str);
};
goog.i18n.bidi.isLtrChar = function(str) {
  return goog.i18n.bidi.ltrRe_.test(str);
};
goog.i18n.bidi.isNeutralChar = function(str) {
  return !goog.i18n.bidi.isLtrChar(str) && !goog.i18n.bidi.isRtlChar(str);
};
goog.i18n.bidi.ltrDirCheckRe_ = new RegExp("^[^" + goog.i18n.bidi.rtlChars_ + "]*[" + goog.i18n.bidi.ltrChars_ + "]");
goog.i18n.bidi.rtlDirCheckRe_ = new RegExp("^[^" + goog.i18n.bidi.ltrChars_ + "]*[" + goog.i18n.bidi.rtlChars_ + "]");
goog.i18n.bidi.startsWithRtl = function(str, opt_isHtml) {
  return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml));
};
goog.i18n.bidi.isRtlText = goog.i18n.bidi.startsWithRtl;
goog.i18n.bidi.startsWithLtr = function(str, opt_isHtml) {
  return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml));
};
goog.i18n.bidi.isLtrText = goog.i18n.bidi.startsWithLtr;
goog.i18n.bidi.isRequiredLtrRe_ = /^http:\/\/.*/;
goog.i18n.bidi.isNeutralText = function(str, opt_isHtml) {
  str = goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml);
  return goog.i18n.bidi.isRequiredLtrRe_.test(str) || !goog.i18n.bidi.hasAnyLtr(str) && !goog.i18n.bidi.hasAnyRtl(str);
};
goog.i18n.bidi.ltrExitDirCheckRe_ = new RegExp("[" + goog.i18n.bidi.ltrChars_ + "][^" + goog.i18n.bidi.rtlChars_ + "]*$");
goog.i18n.bidi.rtlExitDirCheckRe_ = new RegExp("[" + goog.i18n.bidi.rtlChars_ + "][^" + goog.i18n.bidi.ltrChars_ + "]*$");
goog.i18n.bidi.endsWithLtr = function(str, opt_isHtml) {
  return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml));
};
goog.i18n.bidi.isLtrExitText = goog.i18n.bidi.endsWithLtr;
goog.i18n.bidi.endsWithRtl = function(str, opt_isHtml) {
  return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml));
};
goog.i18n.bidi.isRtlExitText = goog.i18n.bidi.endsWithRtl;
goog.i18n.bidi.rtlLocalesRe_ = new RegExp("^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|" + ".*[-_](Arab|Hebr|Thaa|Nkoo|Tfng))" + "(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)", "i");
goog.i18n.bidi.isRtlLanguage = function(lang) {
  return goog.i18n.bidi.rtlLocalesRe_.test(lang);
};
goog.i18n.bidi.bracketGuardTextRe_ = /(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g;
goog.i18n.bidi.guardBracketInText = function(s, opt_isRtlContext) {
  var useRtl = opt_isRtlContext === undefined ? goog.i18n.bidi.hasAnyRtl(s) : opt_isRtlContext;
  var mark = useRtl ? goog.i18n.bidi.Format.RLM : goog.i18n.bidi.Format.LRM;
  return s.replace(goog.i18n.bidi.bracketGuardTextRe_, mark + "$&" + mark);
};
goog.i18n.bidi.enforceRtlInHtml = function(html) {
  if (html.charAt(0) == "<") {
    return html.replace(/<\w+/, "$& dir=rtl");
  }
  return "\n<span dir=rtl>" + html + "</span>";
};
goog.i18n.bidi.enforceRtlInText = function(text) {
  return goog.i18n.bidi.Format.RLE + text + goog.i18n.bidi.Format.PDF;
};
goog.i18n.bidi.enforceLtrInHtml = function(html) {
  if (html.charAt(0) == "<") {
    return html.replace(/<\w+/, "$& dir=ltr");
  }
  return "\n<span dir=ltr>" + html + "</span>";
};
goog.i18n.bidi.enforceLtrInText = function(text) {
  return goog.i18n.bidi.Format.LRE + text + goog.i18n.bidi.Format.PDF;
};
goog.i18n.bidi.dimensionsRe_ = /:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g;
goog.i18n.bidi.leftRe_ = /left/gi;
goog.i18n.bidi.rightRe_ = /right/gi;
goog.i18n.bidi.tempRe_ = /%%%%/g;
goog.i18n.bidi.mirrorCSS = function(cssStr) {
  return cssStr.replace(goog.i18n.bidi.dimensionsRe_, ":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_, "%%%%").replace(goog.i18n.bidi.rightRe_, goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_, goog.i18n.bidi.RIGHT);
};
goog.i18n.bidi.doubleQuoteSubstituteRe_ = /([\u0591-\u05f2])"/g;
goog.i18n.bidi.singleQuoteSubstituteRe_ = /([\u0591-\u05f2])'/g;
goog.i18n.bidi.normalizeHebrewQuote = function(str) {
  return str.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_, "$1\u05f4").replace(goog.i18n.bidi.singleQuoteSubstituteRe_, "$1\u05f3");
};
goog.i18n.bidi.wordSeparatorRe_ = /\s+/;
goog.i18n.bidi.hasNumeralsRe_ = /[\d\u06f0-\u06f9]/;
goog.i18n.bidi.rtlDetectionThreshold_ = 0.40;
goog.i18n.bidi.estimateDirection = function(str, opt_isHtml) {
  var rtlCount = 0;
  var totalCount = 0;
  var hasWeaklyLtr = false;
  var tokens = goog.i18n.bidi.stripHtmlIfNeeded_(str, opt_isHtml).split(goog.i18n.bidi.wordSeparatorRe_);
  for (var i = 0; i < tokens.length; i++) {
    var token = tokens[i];
    if (goog.i18n.bidi.startsWithRtl(token)) {
      rtlCount++;
      totalCount++;
    } else {
      if (goog.i18n.bidi.isRequiredLtrRe_.test(token)) {
        hasWeaklyLtr = true;
      } else {
        if (goog.i18n.bidi.hasAnyLtr(token)) {
          totalCount++;
        } else {
          if (goog.i18n.bidi.hasNumeralsRe_.test(token)) {
            hasWeaklyLtr = true;
          }
        }
      }
    }
  }
  return totalCount == 0 ? hasWeaklyLtr ? goog.i18n.bidi.Dir.LTR : goog.i18n.bidi.Dir.NEUTRAL : rtlCount / totalCount > goog.i18n.bidi.rtlDetectionThreshold_ ? goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR;
};
goog.i18n.bidi.detectRtlDirectionality = function(str, opt_isHtml) {
  return goog.i18n.bidi.estimateDirection(str, opt_isHtml) == goog.i18n.bidi.Dir.RTL;
};
goog.i18n.bidi.setElementDirAndAlign = function(element, dir) {
  if (element) {
    dir = goog.i18n.bidi.toDir(dir);
    if (dir) {
      element.style.textAlign = dir == goog.i18n.bidi.Dir.RTL ? goog.i18n.bidi.RIGHT : goog.i18n.bidi.LEFT;
      element.dir = dir == goog.i18n.bidi.Dir.RTL ? "rtl" : "ltr";
    }
  }
};
goog.i18n.bidi.setElementDirByTextDirectionality = function(element, text) {
  switch(goog.i18n.bidi.estimateDirection(text)) {
    case goog.i18n.bidi.Dir.LTR:
      element.dir = "ltr";
      break;
    case goog.i18n.bidi.Dir.RTL:
      element.dir = "rtl";
      break;
    default:
      element.removeAttribute("dir");
  }
};
goog.i18n.bidi.DirectionalString = function() {
};
goog.i18n.bidi.DirectionalString.prototype.implementsGoogI18nBidiDirectionalString;
goog.i18n.bidi.DirectionalString.prototype.getDirection;
goog.provide("goog.html.TrustedResourceUrl");
goog.require("goog.asserts");
goog.require("goog.i18n.bidi.Dir");
goog.require("goog.i18n.bidi.DirectionalString");
goog.require("goog.string.Const");
goog.require("goog.string.TypedString");
goog.html.TrustedResourceUrl = function() {
  this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ = "";
  this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_;
};
goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString = true;
goog.html.TrustedResourceUrl.prototype.getTypedStringValue = function() {
  return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_;
};
goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString = true;
goog.html.TrustedResourceUrl.prototype.getDirection = function() {
  return goog.i18n.bidi.Dir.LTR;
};
if (goog.DEBUG) {
  goog.html.TrustedResourceUrl.prototype.toString = function() {
    return "TrustedResourceUrl{" + this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ + "}";
  };
}
goog.html.TrustedResourceUrl.unwrap = function(trustedResourceUrl) {
  if (trustedResourceUrl instanceof goog.html.TrustedResourceUrl && trustedResourceUrl.constructor === goog.html.TrustedResourceUrl && trustedResourceUrl.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) {
    return trustedResourceUrl.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_;
  } else {
    goog.asserts.fail("expected object of type TrustedResourceUrl, got '" + trustedResourceUrl + "' of type " + goog.typeOf(trustedResourceUrl));
    return "type_error:TrustedResourceUrl";
  }
};
goog.html.TrustedResourceUrl.format = function(format, args) {
  var formatStr = goog.string.Const.unwrap(format);
  if (!goog.html.TrustedResourceUrl.BASE_URL_.test(formatStr)) {
    throw new Error("Invalid TrustedResourceUrl format: " + formatStr);
  }
  var result = formatStr.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_, function(match, id) {
    if (!Object.prototype.hasOwnProperty.call(args, id)) {
      throw new Error('Found marker, "' + id + '", in format string, "' + formatStr + '", but no valid label mapping found ' + "in args: " + JSON.stringify(args));
    }
    var arg = args[id];
    if (arg instanceof goog.string.Const) {
      return goog.string.Const.unwrap(arg);
    } else {
      return encodeURIComponent(String(arg));
    }
  });
  return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(result);
};
goog.html.TrustedResourceUrl.FORMAT_MARKER_ = /%{(\w+)}/g;
goog.html.TrustedResourceUrl.BASE_URL_ = /^(?:https:)?\/\/[0-9a-z.:[\]-]+\/|^\/[^\/\\]|^about:blank(#|$)/i;
goog.html.TrustedResourceUrl.fromConstant = function(url) {
  return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(url));
};
goog.html.TrustedResourceUrl.fromConstants = function(parts) {
  var unwrapped = "";
  for (var i = 0; i < parts.length; i++) {
    unwrapped += goog.string.Const.unwrap(parts[i]);
  }
  return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(unwrapped);
};
goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse = function(url) {
  var trustedResourceUrl = new goog.html.TrustedResourceUrl;
  trustedResourceUrl.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ = url;
  return trustedResourceUrl;
};
goog.provide("goog.html.SafeUrl");
goog.require("goog.asserts");
goog.require("goog.fs.url");
goog.require("goog.html.TrustedResourceUrl");
goog.require("goog.i18n.bidi.Dir");
goog.require("goog.i18n.bidi.DirectionalString");
goog.require("goog.string");
goog.require("goog.string.Const");
goog.require("goog.string.TypedString");
goog.html.SafeUrl = function() {
  this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = "";
  this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_;
};
goog.html.SafeUrl.INNOCUOUS_STRING = "about:invalid#zClosurez";
goog.html.SafeUrl.prototype.implementsGoogStringTypedString = true;
goog.html.SafeUrl.prototype.getTypedStringValue = function() {
  return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_;
};
goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString = true;
goog.html.SafeUrl.prototype.getDirection = function() {
  return goog.i18n.bidi.Dir.LTR;
};
if (goog.DEBUG) {
  goog.html.SafeUrl.prototype.toString = function() {
    return "SafeUrl{" + this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ + "}";
  };
}
goog.html.SafeUrl.unwrap = function(safeUrl) {
  if (safeUrl instanceof goog.html.SafeUrl && safeUrl.constructor === goog.html.SafeUrl && safeUrl.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) {
    return safeUrl.privateDoNotAccessOrElseSafeHtmlWrappedValue_;
  } else {
    goog.asserts.fail("expected object of type SafeUrl, got '" + safeUrl + "' of type " + goog.typeOf(safeUrl));
    return "type_error:SafeUrl";
  }
};
goog.html.SafeUrl.fromConstant = function(url) {
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(url));
};
goog.html.SAFE_MIME_TYPE_PATTERN_ = /^(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm))$/i;
goog.html.SafeUrl.fromBlob = function(blob) {
  var url = goog.html.SAFE_MIME_TYPE_PATTERN_.test(blob.type) ? goog.fs.url.createObjectUrl(blob) : goog.html.SafeUrl.INNOCUOUS_STRING;
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url);
};
goog.html.DATA_URL_PATTERN_ = /^data:([^;,]*);base64,[a-z0-9+\/]+=*$/i;
goog.html.SafeUrl.fromDataUrl = function(dataUrl) {
  var match = dataUrl.match(goog.html.DATA_URL_PATTERN_);
  var valid = match && goog.html.SAFE_MIME_TYPE_PATTERN_.test(match[1]);
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(valid ? dataUrl : goog.html.SafeUrl.INNOCUOUS_STRING);
};
goog.html.SafeUrl.fromTelUrl = function(telUrl) {
  if (!goog.string.caseInsensitiveStartsWith(telUrl, "tel:")) {
    telUrl = goog.html.SafeUrl.INNOCUOUS_STRING;
  }
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(telUrl);
};
goog.html.SafeUrl.fromTrustedResourceUrl = function(trustedResourceUrl) {
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.html.TrustedResourceUrl.unwrap(trustedResourceUrl));
};
goog.html.SAFE_URL_PATTERN_ = /^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;
goog.html.SafeUrl.sanitize = function(url) {
  if (url instanceof goog.html.SafeUrl) {
    return url;
  } else {
    if (url.implementsGoogStringTypedString) {
      url = url.getTypedStringValue();
    } else {
      url = String(url);
    }
  }
  if (!goog.html.SAFE_URL_PATTERN_.test(url)) {
    url = goog.html.SafeUrl.INNOCUOUS_STRING;
  }
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url);
};
goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse = function(url) {
  var safeUrl = new goog.html.SafeUrl;
  safeUrl.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = url;
  return safeUrl;
};
goog.html.SafeUrl.ABOUT_BLANK = goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse("about:blank");
goog.provide("goog.html.SafeHtml");
goog.require("goog.array");
goog.require("goog.asserts");
goog.require("goog.dom.TagName");
goog.require("goog.dom.tags");
goog.require("goog.html.SafeScript");
goog.require("goog.html.SafeStyle");
goog.require("goog.html.SafeStyleSheet");
goog.require("goog.html.SafeUrl");
goog.require("goog.html.TrustedResourceUrl");
goog.require("goog.i18n.bidi.Dir");
goog.require("goog.i18n.bidi.DirectionalString");
goog.require("goog.labs.userAgent.browser");
goog.require("goog.object");
goog.require("goog.string");
goog.require("goog.string.Const");
goog.require("goog.string.TypedString");
goog.html.SafeHtml = function() {
  this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = "";
  this.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_;
  this.dir_ = null;
};
goog.html.SafeHtml.prototype.implementsGoogI18nBidiDirectionalString = true;
goog.html.SafeHtml.prototype.getDirection = function() {
  return this.dir_;
};
goog.html.SafeHtml.prototype.implementsGoogStringTypedString = true;
goog.html.SafeHtml.prototype.getTypedStringValue = function() {
  return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_;
};
if (goog.DEBUG) {
  goog.html.SafeHtml.prototype.toString = function() {
    return "SafeHtml{" + this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ + "}";
  };
}
goog.html.SafeHtml.unwrap = function(safeHtml) {
  if (safeHtml instanceof goog.html.SafeHtml && safeHtml.constructor === goog.html.SafeHtml && safeHtml.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) {
    return safeHtml.privateDoNotAccessOrElseSafeHtmlWrappedValue_;
  } else {
    goog.asserts.fail("expected object of type SafeHtml, got '" + safeHtml + "' of type " + goog.typeOf(safeHtml));
    return "type_error:SafeHtml";
  }
};
goog.html.SafeHtml.TextOrHtml_;
goog.html.SafeHtml.htmlEscape = function(textOrHtml) {
  if (textOrHtml instanceof goog.html.SafeHtml) {
    return textOrHtml;
  }
  var dir = null;
  if (textOrHtml.implementsGoogI18nBidiDirectionalString) {
    dir = textOrHtml.getDirection();
  }
  var textAsString;
  if (textOrHtml.implementsGoogStringTypedString) {
    textAsString = textOrHtml.getTypedStringValue();
  } else {
    textAsString = String(textOrHtml);
  }
  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.htmlEscape(textAsString), dir);
};
goog.html.SafeHtml.htmlEscapePreservingNewlines = function(textOrHtml) {
  if (textOrHtml instanceof goog.html.SafeHtml) {
    return textOrHtml;
  }
  var html = goog.html.SafeHtml.htmlEscape(textOrHtml);
  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.newLineToBr(goog.html.SafeHtml.unwrap(html)), html.getDirection());
};
goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces = function(textOrHtml) {
  if (textOrHtml instanceof goog.html.SafeHtml) {
    return textOrHtml;
  }
  var html = goog.html.SafeHtml.htmlEscape(textOrHtml);
  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.whitespaceEscape(goog.html.SafeHtml.unwrap(html)), html.getDirection());
};
goog.html.SafeHtml.from = goog.html.SafeHtml.htmlEscape;
goog.html.SafeHtml.VALID_NAMES_IN_TAG_ = /^[a-zA-Z0-9-]+$/;
goog.html.SafeHtml.URL_ATTRIBUTES_ = goog.object.createSet("action", "cite", "data", "formaction", "href", "manifest", "poster", "src");
goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_ = goog.object.createSet(goog.dom.TagName.APPLET, goog.dom.TagName.BASE, goog.dom.TagName.EMBED, goog.dom.TagName.IFRAME, goog.dom.TagName.LINK, goog.dom.TagName.MATH, goog.dom.TagName.META, goog.dom.TagName.OBJECT, goog.dom.TagName.SCRIPT, goog.dom.TagName.STYLE, goog.dom.TagName.SVG, goog.dom.TagName.TEMPLATE);
goog.html.SafeHtml.AttributeValue;
goog.html.SafeHtml.create = function(tagName, opt_attributes, opt_content) {
  goog.html.SafeHtml.verifyTagName(String(tagName));
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(String(tagName), opt_attributes, opt_content);
};
goog.html.SafeHtml.verifyTagName = function(tagName) {
  if (!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(tagName)) {
    throw Error("Invalid tag name <" + tagName + ">.");
  }
  if (tagName.toUpperCase() in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_) {
    throw Error("Tag name <" + tagName + "> is not allowed for SafeHtml.");
  }
};
goog.html.SafeHtml.createIframe = function(opt_src, opt_srcdoc, opt_attributes, opt_content) {
  if (opt_src) {
    goog.html.TrustedResourceUrl.unwrap(opt_src);
  }
  var fixedAttributes = {};
  fixedAttributes["src"] = opt_src || null;
  fixedAttributes["srcdoc"] = opt_srcdoc && goog.html.SafeHtml.unwrap(opt_srcdoc);
  var defaultAttributes = {"sandbox":""};
  var attributes = goog.html.SafeHtml.combineAttributes(fixedAttributes, defaultAttributes, opt_attributes);
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe", attributes, opt_content);
};
goog.html.SafeHtml.createSandboxIframe = function(opt_src, opt_srcdoc, opt_attributes, opt_content) {
  if (!goog.html.SafeHtml.canUseSandboxIframe()) {
    throw new Error("The browser does not support sandboxed iframes.");
  }
  var fixedAttributes = {};
  if (opt_src) {
    fixedAttributes["src"] = goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(opt_src));
  } else {
    fixedAttributes["src"] = null;
  }
  fixedAttributes["srcdoc"] = opt_srcdoc || null;
  fixedAttributes["sandbox"] = "";
  var attributes = goog.html.SafeHtml.combineAttributes(fixedAttributes, {}, opt_attributes);
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe", attributes, opt_content);
};
goog.html.SafeHtml.canUseSandboxIframe = function() {
  return goog.global["HTMLIFrameElement"] && "sandbox" in goog.global["HTMLIFrameElement"].prototype;
};
goog.html.SafeHtml.createScriptSrc = function(src, opt_attributes) {
  goog.html.TrustedResourceUrl.unwrap(src);
  var fixedAttributes = {"src":src};
  var defaultAttributes = {};
  var attributes = goog.html.SafeHtml.combineAttributes(fixedAttributes, defaultAttributes, opt_attributes);
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script", attributes);
};
goog.html.SafeHtml.createScript = function(script, opt_attributes) {
  for (var attr in opt_attributes) {
    var attrLower = attr.toLowerCase();
    if (attrLower == "language" || attrLower == "src" || attrLower == "text" || attrLower == "type") {
      throw Error('Cannot set "' + attrLower + '" attribute');
    }
  }
  var content = "";
  script = goog.array.concat(script);
  for (var i = 0; i < script.length; i++) {
    content += goog.html.SafeScript.unwrap(script[i]);
  }
  var htmlContent = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(content, goog.i18n.bidi.Dir.NEUTRAL);
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script", opt_attributes, htmlContent);
};
goog.html.SafeHtml.createStyle = function(styleSheet, opt_attributes) {
  var fixedAttributes = {"type":"text/css"};
  var defaultAttributes = {};
  var attributes = goog.html.SafeHtml.combineAttributes(fixedAttributes, defaultAttributes, opt_attributes);
  var content = "";
  styleSheet = goog.array.concat(styleSheet);
  for (var i = 0; i < styleSheet.length; i++) {
    content += goog.html.SafeStyleSheet.unwrap(styleSheet[i]);
  }
  var htmlContent = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(content, goog.i18n.bidi.Dir.NEUTRAL);
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("style", attributes, htmlContent);
};
goog.html.SafeHtml.createMetaRefresh = function(url, opt_secs) {
  var unwrappedUrl = goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(url));
  if (goog.labs.userAgent.browser.isIE() || goog.labs.userAgent.browser.isEdge()) {
    if (goog.string.contains(unwrappedUrl, ";")) {
      unwrappedUrl = "'" + unwrappedUrl.replace(/'/g, "%27") + "'";
    }
  }
  var attributes = {"http-equiv":"refresh", "content":(opt_secs || 0) + "; url=" + unwrappedUrl};
  return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("meta", attributes);
};
goog.html.SafeHtml.getAttrNameAndValue_ = function(tagName, name, value) {
  if (value instanceof goog.string.Const) {
    value = goog.string.Const.unwrap(value);
  } else {
    if (name.toLowerCase() == "style") {
      value = goog.html.SafeHtml.getStyleValue_(value);
    } else {
      if (/^on/i.test(name)) {
        throw Error('Attribute "' + name + '" requires goog.string.Const value, "' + value + '" given.');
      } else {
        if (name.toLowerCase() in goog.html.SafeHtml.URL_ATTRIBUTES_) {
          if (value instanceof goog.html.TrustedResourceUrl) {
            value = goog.html.TrustedResourceUrl.unwrap(value);
          } else {
            if (value instanceof goog.html.SafeUrl) {
              value = goog.html.SafeUrl.unwrap(value);
            } else {
              if (goog.isString(value)) {
                value = goog.html.SafeUrl.sanitize(value).getTypedStringValue();
              } else {
                throw Error('Attribute "' + name + '" on tag "' + tagName + '" requires goog.html.SafeUrl, goog.string.Const, or string,' + ' value "' + value + '" given.');
              }
            }
          }
        }
      }
    }
  }
  if (value.implementsGoogStringTypedString) {
    value = value.getTypedStringValue();
  }
  goog.asserts.assert(goog.isString(value) || goog.isNumber(value), "String or number value expected, got " + typeof value + " with value: " + value);
  return name + '="' + goog.string.htmlEscape(String(value)) + '"';
};
goog.html.SafeHtml.getStyleValue_ = function(value) {
  if (!goog.isObject(value)) {
    throw Error('The "style" attribute requires goog.html.SafeStyle or map ' + "of style properties, " + typeof value + " given: " + value);
  }
  if (!(value instanceof goog.html.SafeStyle)) {
    value = goog.html.SafeStyle.create(value);
  }
  return goog.html.SafeStyle.unwrap(value);
};
goog.html.SafeHtml.createWithDir = function(dir, tagName, opt_attributes, opt_content) {
  var html = goog.html.SafeHtml.create(tagName, opt_attributes, opt_content);
  html.dir_ = dir;
  return html;
};
goog.html.SafeHtml.concat = function(var_args) {
  var dir = goog.i18n.bidi.Dir.NEUTRAL;
  var content = "";
  var addArgument = function(argument) {
    if (goog.isArray(argument)) {
      goog.array.forEach(argument, addArgument);
    } else {
      var html = goog.html.SafeHtml.htmlEscape(argument);
      content += goog.html.SafeHtml.unwrap(html);
      var htmlDir = html.getDirection();
      if (dir == goog.i18n.bidi.Dir.NEUTRAL) {
        dir = htmlDir;
      } else {
        if (htmlDir != goog.i18n.bidi.Dir.NEUTRAL && dir != htmlDir) {
          dir = null;
        }
      }
    }
  };
  goog.array.forEach(arguments, addArgument);
  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(content, dir);
};
goog.html.SafeHtml.concatWithDir = function(dir, var_args) {
  var html = goog.html.SafeHtml.concat(goog.array.slice(arguments, 1));
  html.dir_ = dir;
  return html;
};
goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {};
goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse = function(html, dir) {
  return (new goog.html.SafeHtml).initSecurityPrivateDoNotAccessOrElse_(html, dir);
};
goog.html.SafeHtml.prototype.initSecurityPrivateDoNotAccessOrElse_ = function(html, dir) {
  this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = html;
  this.dir_ = dir;
  return this;
};
goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse = function(tagName, opt_attributes, opt_content) {
  var dir = null;
  var result = "<" + tagName;
  result += goog.html.SafeHtml.stringifyAttributes(tagName, opt_attributes);
  var content = opt_content;
  if (!goog.isDefAndNotNull(content)) {
    content = [];
  } else {
    if (!goog.isArray(content)) {
      content = [content];
    }
  }
  if (goog.dom.tags.isVoidTag(tagName.toLowerCase())) {
    goog.asserts.assert(!content.length, "Void tag <" + tagName + "> does not allow content.");
    result += ">";
  } else {
    var html = goog.html.SafeHtml.concat(content);
    result += ">" + goog.html.SafeHtml.unwrap(html) + "</" + tagName + ">";
    dir = html.getDirection();
  }
  var dirAttribute = opt_attributes && opt_attributes["dir"];
  if (dirAttribute) {
    if (/^(ltr|rtl|auto)$/i.test(dirAttribute)) {
      dir = goog.i18n.bidi.Dir.NEUTRAL;
    } else {
      dir = null;
    }
  }
  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(result, dir);
};
goog.html.SafeHtml.stringifyAttributes = function(tagName, opt_attributes) {
  var result = "";
  if (opt_attributes) {
    for (var name in opt_attributes) {
      if (!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(name)) {
        throw Error('Invalid attribute name "' + name + '".');
      }
      var value = opt_attributes[name];
      if (!goog.isDefAndNotNull(value)) {
        continue;
      }
      result += " " + goog.html.SafeHtml.getAttrNameAndValue_(tagName, name, value);
    }
  }
  return result;
};
goog.html.SafeHtml.combineAttributes = function(fixedAttributes, defaultAttributes, opt_attributes) {
  var combinedAttributes = {};
  var name;
  for (name in fixedAttributes) {
    goog.asserts.assert(name.toLowerCase() == name, "Must be lower case");
    combinedAttributes[name] = fixedAttributes[name];
  }
  for (name in defaultAttributes) {
    goog.asserts.assert(name.toLowerCase() == name, "Must be lower case");
    combinedAttributes[name] = defaultAttributes[name];
  }
  for (name in opt_attributes) {
    var nameLower = name.toLowerCase();
    if (nameLower in fixedAttributes) {
      throw Error('Cannot override "' + nameLower + '" attribute, got "' + name + '" with value "' + opt_attributes[name] + '"');
    }
    if (nameLower in defaultAttributes) {
      delete combinedAttributes[nameLower];
    }
    combinedAttributes[name] = opt_attributes[name];
  }
  return combinedAttributes;
};
goog.html.SafeHtml.DOCTYPE_HTML = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<!DOCTYPE html>", goog.i18n.bidi.Dir.NEUTRAL);
goog.html.SafeHtml.EMPTY = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("", goog.i18n.bidi.Dir.NEUTRAL);
goog.html.SafeHtml.BR = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<br>", goog.i18n.bidi.Dir.NEUTRAL);
goog.provide("goog.dom.safe");
goog.provide("goog.dom.safe.InsertAdjacentHtmlPosition");
goog.require("goog.asserts");
goog.require("goog.html.SafeHtml");
goog.require("goog.html.SafeScript");
goog.require("goog.html.SafeStyle");
goog.require("goog.html.SafeUrl");
goog.require("goog.html.TrustedResourceUrl");
goog.require("goog.string");
goog.require("goog.string.Const");
goog.dom.safe.InsertAdjacentHtmlPosition = {AFTERBEGIN:"afterbegin", AFTEREND:"afterend", BEFOREBEGIN:"beforebegin", BEFOREEND:"beforeend"};
goog.dom.safe.insertAdjacentHtml = function(node, position, html) {
  node.insertAdjacentHTML(position, goog.html.SafeHtml.unwrap(html));
};
goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_ = {"MATH":true, "SCRIPT":true, "STYLE":true, "SVG":true, "TEMPLATE":true};
goog.dom.safe.setInnerHtml = function(elem, html) {
  if (goog.asserts.ENABLE_ASSERTS) {
    var tagName = elem.tagName.toUpperCase();
    if (goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[tagName]) {
      throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of " + elem.tagName + ".");
    }
  }
  elem.innerHTML = goog.html.SafeHtml.unwrap(html);
};
goog.dom.safe.setOuterHtml = function(elem, html) {
  elem.outerHTML = goog.html.SafeHtml.unwrap(html);
};
goog.dom.safe.setStyle = function(elem, style) {
  elem.style.cssText = goog.html.SafeStyle.unwrap(style);
};
goog.dom.safe.documentWrite = function(doc, html) {
  doc.write(goog.html.SafeHtml.unwrap(html));
};
goog.dom.safe.setAnchorHref = function(anchor, url) {
  goog.dom.safe.assertIsHTMLAnchorElement_(anchor);
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    safeUrl = goog.html.SafeUrl.sanitize(url);
  }
  anchor.href = goog.html.SafeUrl.unwrap(safeUrl);
};
goog.dom.safe.setImageSrc = function(imageElement, url) {
  goog.dom.safe.assertIsHTMLImageElement_(imageElement);
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    safeUrl = goog.html.SafeUrl.sanitize(url);
  }
  imageElement.src = goog.html.SafeUrl.unwrap(safeUrl);
};
goog.dom.safe.setEmbedSrc = function(embed, url) {
  goog.dom.safe.assertIsHTMLEmbedElement_(embed);
  embed.src = goog.html.TrustedResourceUrl.unwrap(url);
};
goog.dom.safe.setFrameSrc = function(frame, url) {
  goog.dom.safe.assertIsHTMLFrameElement_(frame);
  frame.src = goog.html.TrustedResourceUrl.unwrap(url);
};
goog.dom.safe.setIframeSrc = function(iframe, url) {
  goog.dom.safe.assertIsHTMLIFrameElement_(iframe);
  iframe.src = goog.html.TrustedResourceUrl.unwrap(url);
};
goog.dom.safe.setIframeSrcdoc = function(iframe, html) {
  goog.dom.safe.assertIsHTMLIFrameElement_(iframe);
  iframe.srcdoc = goog.html.SafeHtml.unwrap(html);
};
goog.dom.safe.setLinkHrefAndRel = function(link, url, rel) {
  goog.dom.safe.assertIsHTMLLinkElement_(link);
  link.rel = rel;
  if (goog.string.caseInsensitiveContains(rel, "stylesheet")) {
    goog.asserts.assert(url instanceof goog.html.TrustedResourceUrl, 'URL must be TrustedResourceUrl because "rel" contains "stylesheet"');
    link.href = goog.html.TrustedResourceUrl.unwrap(url);
  } else {
    if (url instanceof goog.html.TrustedResourceUrl) {
      link.href = goog.html.TrustedResourceUrl.unwrap(url);
    } else {
      if (url instanceof goog.html.SafeUrl) {
        link.href = goog.html.SafeUrl.unwrap(url);
      } else {
        link.href = goog.html.SafeUrl.sanitize(url).getTypedStringValue();
      }
    }
  }
};
goog.dom.safe.setObjectData = function(object, url) {
  goog.dom.safe.assertIsHTMLObjectElement_(object);
  object.data = goog.html.TrustedResourceUrl.unwrap(url);
};
goog.dom.safe.setScriptSrc = function(script, url) {
  goog.dom.safe.assertIsHTMLScriptElement_(script);
  script.src = goog.html.TrustedResourceUrl.unwrap(url);
};
goog.dom.safe.setScriptContent = function(script, content) {
  goog.dom.safe.assertIsHTMLScriptElement_(script);
  script.text = goog.html.SafeScript.unwrap(content);
};
goog.dom.safe.setLocationHref = function(loc, url) {
  goog.dom.safe.assertIsLocation_(loc);
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    safeUrl = goog.html.SafeUrl.sanitize(url);
  }
  loc.href = goog.html.SafeUrl.unwrap(safeUrl);
};
goog.dom.safe.openInWindow = function(url, opt_openerWin, opt_name, opt_specs, opt_replace) {
  var safeUrl;
  if (url instanceof goog.html.SafeUrl) {
    safeUrl = url;
  } else {
    safeUrl = goog.html.SafeUrl.sanitize(url);
  }
  var win = opt_openerWin || window;
  return win.open(goog.html.SafeUrl.unwrap(safeUrl), opt_name ? goog.string.Const.unwrap(opt_name) : "", opt_specs, opt_replace);
};
goog.dom.safe.assertIsLocation_ = function(o) {
  if (goog.asserts.ENABLE_ASSERTS && typeof Location != "undefined" && typeof Element != "undefined") {
    goog.asserts.assert(o && (o instanceof Location || !(o instanceof Element)), "Argument is not a Location (or a non-Element mock); got: %s", goog.dom.safe.debugStringForType_(o));
  }
  return o;
};
goog.dom.safe.assertIsHTMLAnchorElement_ = function(o) {
  if (goog.asserts.ENABLE_ASSERTS && typeof HTMLAnchorElement != "undefined" && typeof Location != "undefined" && typeof Element != "undefined") {
    goog.asserts.assert(o && (o instanceof HTMLAnchorElement || !(o instanceof Location || o instanceof Element)), "Argument is not a HTMLAnchorElement (or a non-Element mock); got: %s", goog.dom.safe.debugStringForType_(o));
  }
  return o;
};
goog.dom.safe.assertIsHTMLLinkElement_ = function(o) {
  if (goog.asserts.ENABLE_ASSERTS && typeof HTMLLinkElement != "undefined" && typeof Location != "undefined" && typeof Element != "undefined") {
    goog.asserts.assert(o && (o instanceof HTMLLinkElement || !(o instanceof Location || o instanceof Element)), "Argument is not a HTMLLinkElement (or a non-Element mock); got: %s", goog.dom.safe.debugStringForType_(o));
  }
  return o;
};
goog.dom.safe.assertIsHTMLImageElement_ = function(o) {
  if (goog.asserts.ENABLE_ASSERTS && typeof HTMLImageElement != "undefined" && typeof Element != "undefined") {
    goog.asserts.assert(o && (o instanceof HTMLImageElement || !(o instanceof Element)), "Argument is not a HTMLImageElement (or a non-Element mock); got: %s", goog.dom.safe.debugStringForType_(o));
  }
  return o;
};
goog.dom.safe.assertIsHTMLEmbedElement_ = function(o) {
  if (goog.asserts.ENABLE_ASSERTS && typeof HTMLEmbedElement != "undefined" && typeof Element != "undefined") {
    goog.asserts.assert(o && (o instanceof HTMLEmbedElement || !(o instanceof Element)), "Argument is not a HTMLEmbedElement (or a non-Element mock); got: %s", goog.dom.safe.debugStringForType_(o));
  }
  return o;
};
goog.dom.safe.assertIsHTMLFrameElement_ = function(o) {
  if (goog.asserts.ENABLE_ASSERTS && typeof HTMLFrameElement != "undefined" && typeof Element != "undefined") {
    goog.asserts.assert(o && (o instanceof HTMLFrameElement || !(o instanceof Element)), "Argument is not a HTMLFrameElement (or a non-Element mock); got: %s", goog.dom.safe.debugStringForType_(o));
  }
  return o;
};
goog.dom.safe.assertIsHTMLIFrameElement_ = function(o) {
  if (goog.asserts.ENABLE_ASSERTS && typeof HTMLIFrameElement != "undefined" && typeof Element != "undefined") {
    goog.asserts.assert(o && (o instanceof HTMLIFrameElement || !(o instanceof Element)), "Argument is not a HTMLIFrameElement (or a non-Element mock); got: %s", goog.dom.safe.debugStringForType_(o));
  }
  return o;
};
goog.dom.safe.assertIsHTMLObjectElement_ = function(o) {
  if (goog.asserts.ENABLE_ASSERTS && typeof HTMLObjectElement != "undefined" && typeof Element != "undefined") {
    goog.asserts.assert(o && (o instanceof HTMLObjectElement || !(o instanceof Element)), "Argument is not a HTMLObjectElement (or a non-Element mock); got: %s", goog.dom.safe.debugStringForType_(o));
  }
  return o;
};
goog.dom.safe.assertIsHTMLScriptElement_ = function(o) {
  if (goog.asserts.ENABLE_ASSERTS && typeof HTMLScriptElement != "undefined" && typeof Element != "undefined") {
    goog.asserts.assert(o && (o instanceof HTMLScriptElement || !(o instanceof Element)), "Argument is not a HTMLScriptElement (or a non-Element mock); got: %s", goog.dom.safe.debugStringForType_(o));
  }
  return o;
};
goog.dom.safe.debugStringForType_ = function(value) {
  if (goog.isObject(value)) {
    return value.constructor.displayName || value.constructor.name || Object.prototype.toString.call(value);
  } else {
    return value === undefined ? "undefined" : value === null ? "null" : typeof value;
  }
};
goog.provide("goog.html.uncheckedconversions");
goog.require("goog.asserts");
goog.require("goog.html.SafeHtml");
goog.require("goog.html.SafeScript");
goog.require("goog.html.SafeStyle");
goog.require("goog.html.SafeStyleSheet");
goog.require("goog.html.SafeUrl");
goog.require("goog.html.TrustedResourceUrl");
goog.require("goog.string");
goog.require("goog.string.Const");
goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract = function(justification, html, opt_dir) {
  goog.asserts.assertString(goog.string.Const.unwrap(justification), "must provide justification");
  goog.asserts.assert(!goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(justification)), "must provide non-empty justification");
  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(html, opt_dir || null);
};
goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract = function(justification, script) {
  goog.asserts.assertString(goog.string.Const.unwrap(justification), "must provide justification");
  goog.asserts.assert(!goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(justification)), "must provide non-empty justification");
  return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(script);
};
goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract = function(justification, style) {
  goog.asserts.assertString(goog.string.Const.unwrap(justification), "must provide justification");
  goog.asserts.assert(!goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(justification)), "must provide non-empty justification");
  return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(style);
};
goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract = function(justification, styleSheet) {
  goog.asserts.assertString(goog.string.Const.unwrap(justification), "must provide justification");
  goog.asserts.assert(!goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(justification)), "must provide non-empty justification");
  return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(styleSheet);
};
goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract = function(justification, url) {
  goog.asserts.assertString(goog.string.Const.unwrap(justification), "must provide justification");
  goog.asserts.assert(!goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(justification)), "must provide non-empty justification");
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url);
};
goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract = function(justification, url) {
  goog.asserts.assertString(goog.string.Const.unwrap(justification), "must provide justification");
  goog.asserts.assert(!goog.string.isEmptyOrWhitespace(goog.string.Const.unwrap(justification)), "must provide non-empty justification");
  return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(url);
};
goog.provide("goog.math");
goog.require("goog.array");
goog.require("goog.asserts");
goog.math.randomInt = function(a) {
  return Math.floor(Math.random() * a);
};
goog.math.uniformRandom = function(a, b) {
  return a + Math.random() * (b - a);
};
goog.math.clamp = function(value, min, max) {
  return Math.min(Math.max(value, min), max);
};
goog.math.modulo = function(a, b) {
  var r = a % b;
  return r * b < 0 ? r + b : r;
};
goog.math.lerp = function(a, b, x) {
  return a + x * (b - a);
};
goog.math.nearlyEquals = function(a, b, opt_tolerance) {
  return Math.abs(a - b) <= (opt_tolerance || 0.000001);
};
goog.math.standardAngle = function(angle) {
  return goog.math.modulo(angle, 360);
};
goog.math.standardAngleInRadians = function(angle) {
  return goog.math.modulo(angle, 2 * Math.PI);
};
goog.math.toRadians = function(angleDegrees) {
  return angleDegrees * Math.PI / 180;
};
goog.math.toDegrees = function(angleRadians) {
  return angleRadians * 180 / Math.PI;
};
goog.math.angleDx = function(degrees, radius) {
  return radius * Math.cos(goog.math.toRadians(degrees));
};
goog.math.angleDy = function(degrees, radius) {
  return radius * Math.sin(goog.math.toRadians(degrees));
};
goog.math.angle = function(x1, y1, x2, y2) {
  return goog.math.standardAngle(goog.math.toDegrees(Math.atan2(y2 - y1, x2 - x1)));
};
goog.math.angleDifference = function(startAngle, endAngle) {
  var d = goog.math.standardAngle(endAngle) - goog.math.standardAngle(startAngle);
  if (d > 180) {
    d = d - 360;
  } else {
    if (d <= -180) {
      d = 360 + d;
    }
  }
  return d;
};
goog.math.sign = function(x) {
  if (x > 0) {
    return 1;
  }
  if (x < 0) {
    return -1;
  }
  return x;
};
goog.math.longestCommonSubsequence = function(array1, array2, opt_compareFn, opt_collectorFn) {
  var compare = opt_compareFn || function(a, b) {
    return a == b;
  };
  var collect = opt_collectorFn || function(i1, i2) {
    return array1[i1];
  };
  var length1 = array1.length;
  var length2 = array2.length;
  var arr = [];
  for (var i = 0; i < length1 + 1; i++) {
    arr[i] = [];
    arr[i][0] = 0;
  }
  for (var j = 0; j < length2 + 1; j++) {
    arr[0][j] = 0;
  }
  for (i = 1; i <= length1; i++) {
    for (j = 1; j <= length2; j++) {
      if (compare(array1[i - 1], array2[j - 1])) {
        arr[i][j] = arr[i - 1][j - 1] + 1;
      } else {
        arr[i][j] = Math.max(arr[i - 1][j], arr[i][j - 1]);
      }
    }
  }
  var result = [];
  var i = length1, j = length2;
  while (i > 0 && j > 0) {
    if (compare(array1[i - 1], array2[j - 1])) {
      result.unshift(collect(i - 1, j - 1));
      i--;
      j--;
    } else {
      if (arr[i - 1][j] > arr[i][j - 1]) {
        i--;
      } else {
        j--;
      }
    }
  }
  return result;
};
goog.math.sum = function(var_args) {
  return goog.array.reduce(arguments, function(sum, value) {
    return sum + value;
  }, 0);
};
goog.math.average = function(var_args) {
  return goog.math.sum.apply(null, arguments) / arguments.length;
};
goog.math.sampleVariance = function(var_args) {
  var sampleSize = arguments.length;
  if (sampleSize < 2) {
    return 0;
  }
  var mean = goog.math.average.apply(null, arguments);
  var variance = goog.math.sum.apply(null, goog.array.map(arguments, function(val) {
    return Math.pow(val - mean, 2);
  })) / (sampleSize - 1);
  return variance;
};
goog.math.standardDeviation = function(var_args) {
  return Math.sqrt(goog.math.sampleVariance.apply(null, arguments));
};
goog.math.isInt = function(num) {
  return isFinite(num) && num % 1 == 0;
};
goog.math.isFiniteNumber = function(num) {
  return isFinite(num);
};
goog.math.isNegativeZero = function(num) {
  return num == 0 && 1 / num < 0;
};
goog.math.log10Floor = function(num) {
  if (num > 0) {
    var x = Math.round(Math.log(num) * Math.LOG10E);
    return x - (parseFloat("1e" + x) > num ? 1 : 0);
  }
  return num == 0 ? -Infinity : NaN;
};
goog.math.safeFloor = function(num, opt_epsilon) {
  goog.asserts.assert(!goog.isDef(opt_epsilon) || opt_epsilon > 0);
  return Math.floor(num + (opt_epsilon || 2e-15));
};
goog.math.safeCeil = function(num, opt_epsilon) {
  goog.asserts.assert(!goog.isDef(opt_epsilon) || opt_epsilon > 0);
  return Math.ceil(num - (opt_epsilon || 2e-15));
};
goog.provide("goog.math.Coordinate");
goog.require("goog.math");
goog.math.Coordinate = function(opt_x, opt_y) {
  this.x = goog.isDef(opt_x) ? opt_x : 0;
  this.y = goog.isDef(opt_y) ? opt_y : 0;
};
goog.math.Coordinate.prototype.clone = function() {
  return new goog.math.Coordinate(this.x, this.y);
};
if (goog.DEBUG) {
  goog.math.Coordinate.prototype.toString = function() {
    return "(" + this.x + ", " + this.y + ")";
  };
}
goog.math.Coordinate.prototype.equals = function(other) {
  return other instanceof goog.math.Coordinate && goog.math.Coordinate.equals(this, other);
};
goog.math.Coordinate.equals = function(a, b) {
  if (a == b) {
    return true;
  }
  if (!a || !b) {
    return false;
  }
  return a.x == b.x && a.y == b.y;
};
goog.math.Coordinate.distance = function(a, b) {
  var dx = a.x - b.x;
  var dy = a.y - b.y;
  return Math.sqrt(dx * dx + dy * dy);
};
goog.math.Coordinate.magnitude = function(a) {
  return Math.sqrt(a.x * a.x + a.y * a.y);
};
goog.math.Coordinate.azimuth = function(a) {
  return goog.math.angle(0, 0, a.x, a.y);
};
goog.math.Coordinate.squaredDistance = function(a, b) {
  var dx = a.x - b.x;
  var dy = a.y - b.y;
  return dx * dx + dy * dy;
};
goog.math.Coordinate.difference = function(a, b) {
  return new goog.math.Coordinate(a.x - b.x, a.y - b.y);
};
goog.math.Coordinate.sum = function(a, b) {
  return new goog.math.Coordinate(a.x + b.x, a.y + b.y);
};
goog.math.Coordinate.prototype.ceil = function() {
  this.x = Math.ceil(this.x);
  this.y = Math.ceil(this.y);
  return this;
};
goog.math.Coordinate.prototype.floor = function() {
  this.x = Math.floor(this.x);
  this.y = Math.floor(this.y);
  return this;
};
goog.math.Coordinate.prototype.round = function() {
  this.x = Math.round(this.x);
  this.y = Math.round(this.y);
  return this;
};
goog.math.Coordinate.prototype.translate = function(tx, opt_ty) {
  if (tx instanceof goog.math.Coordinate) {
    this.x += tx.x;
    this.y += tx.y;
  } else {
    this.x += Number(tx);
    if (goog.isNumber(opt_ty)) {
      this.y += opt_ty;
    }
  }
  return this;
};
goog.math.Coordinate.prototype.scale = function(sx, opt_sy) {
  var sy = goog.isNumber(opt_sy) ? opt_sy : sx;
  this.x *= sx;
  this.y *= sy;
  return this;
};
goog.math.Coordinate.prototype.rotateRadians = function(radians, opt_center) {
  var center = opt_center || new goog.math.Coordinate(0, 0);
  var x = this.x;
  var y = this.y;
  var cos = Math.cos(radians);
  var sin = Math.sin(radians);
  this.x = (x - center.x) * cos - (y - center.y) * sin + center.x;
  this.y = (x - center.x) * sin + (y - center.y) * cos + center.y;
};
goog.math.Coordinate.prototype.rotateDegrees = function(degrees, opt_center) {
  this.rotateRadians(goog.math.toRadians(degrees), opt_center);
};
goog.provide("goog.math.Size");
goog.math.Size = function(width, height) {
  this.width = width;
  this.height = height;
};
goog.math.Size.equals = function(a, b) {
  if (a == b) {
    return true;
  }
  if (!a || !b) {
    return false;
  }
  return a.width == b.width && a.height == b.height;
};
goog.math.Size.prototype.clone = function() {
  return new goog.math.Size(this.width, this.height);
};
if (goog.DEBUG) {
  goog.math.Size.prototype.toString = function() {
    return "(" + this.width + " x " + this.height + ")";
  };
}
goog.math.Size.prototype.getLongest = function() {
  return Math.max(this.width, this.height);
};
goog.math.Size.prototype.getShortest = function() {
  return Math.min(this.width, this.height);
};
goog.math.Size.prototype.area = function() {
  return this.width * this.height;
};
goog.math.Size.prototype.perimeter = function() {
  return (this.width + this.height) * 2;
};
goog.math.Size.prototype.aspectRatio = function() {
  return this.width / this.height;
};
goog.math.Size.prototype.isEmpty = function() {
  return !this.area();
};
goog.math.Size.prototype.ceil = function() {
  this.width = Math.ceil(this.width);
  this.height = Math.ceil(this.height);
  return this;
};
goog.math.Size.prototype.fitsInside = function(target) {
  return this.width <= target.width && this.height <= target.height;
};
goog.math.Size.prototype.floor = function() {
  this.width = Math.floor(this.width);
  this.height = Math.floor(this.height);
  return this;
};
goog.math.Size.prototype.round = function() {
  this.width = Math.round(this.width);
  this.height = Math.round(this.height);
  return this;
};
goog.math.Size.prototype.scale = function(sx, opt_sy) {
  var sy = goog.isNumber(opt_sy) ? opt_sy : sx;
  this.width *= sx;
  this.height *= sy;
  return this;
};
goog.math.Size.prototype.scaleToCover = function(target) {
  var s = this.aspectRatio() <= target.aspectRatio() ? target.width / this.width : target.height / this.height;
  return this.scale(s);
};
goog.math.Size.prototype.scaleToFit = function(target) {
  var s = this.aspectRatio() > target.aspectRatio() ? target.width / this.width : target.height / this.height;
  return this.scale(s);
};
goog.provide("goog.dom");
goog.provide("goog.dom.Appendable");
goog.provide("goog.dom.DomHelper");
goog.require("goog.array");
goog.require("goog.asserts");
goog.require("goog.dom.BrowserFeature");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.TagName");
goog.require("goog.dom.safe");
goog.require("goog.html.SafeHtml");
goog.require("goog.html.uncheckedconversions");
goog.require("goog.math.Coordinate");
goog.require("goog.math.Size");
goog.require("goog.object");
goog.require("goog.string");
goog.require("goog.string.Unicode");
goog.require("goog.userAgent");
goog.define("goog.dom.ASSUME_QUIRKS_MODE", false);
goog.define("goog.dom.ASSUME_STANDARDS_MODE", false);
goog.dom.COMPAT_MODE_KNOWN_ = goog.dom.ASSUME_QUIRKS_MODE || goog.dom.ASSUME_STANDARDS_MODE;
goog.dom.getDomHelper = function(opt_element) {
  return opt_element ? new goog.dom.DomHelper(goog.dom.getOwnerDocument(opt_element)) : goog.dom.defaultDomHelper_ || (goog.dom.defaultDomHelper_ = new goog.dom.DomHelper);
};
goog.dom.defaultDomHelper_;
goog.dom.getDocument = function() {
  return document;
};
goog.dom.getElement = function(element) {
  return goog.dom.getElementHelper_(document, element);
};
goog.dom.getElementHelper_ = function(doc, element) {
  return goog.isString(element) ? doc.getElementById(element) : element;
};
goog.dom.getRequiredElement = function(id) {
  return goog.dom.getRequiredElementHelper_(document, id);
};
goog.dom.getRequiredElementHelper_ = function(doc, id) {
  goog.asserts.assertString(id);
  var element = goog.dom.getElementHelper_(doc, id);
  element = goog.asserts.assertElement(element, "No element found with id: " + id);
  return element;
};
goog.dom.$ = goog.dom.getElement;
goog.dom.getElementsByTagName = function(tagName, opt_parent) {
  var parent = opt_parent || document;
  return parent.getElementsByTagName(String(tagName));
};
goog.dom.getElementsByTagNameAndClass = function(opt_tag, opt_class, opt_el) {
  return goog.dom.getElementsByTagNameAndClass_(document, opt_tag, opt_class, opt_el);
};
goog.dom.getElementsByClass = function(className, opt_el) {
  var parent = opt_el || document;
  if (goog.dom.canUseQuerySelector_(parent)) {
    return parent.querySelectorAll("." + className);
  }
  return goog.dom.getElementsByTagNameAndClass_(document, "*", className, opt_el);
};
goog.dom.getElementByClass = function(className, opt_el) {
  var parent = opt_el || document;
  var retVal = null;
  if (parent.getElementsByClassName) {
    retVal = parent.getElementsByClassName(className)[0];
  } else {
    if (goog.dom.canUseQuerySelector_(parent)) {
      retVal = parent.querySelector("." + className);
    } else {
      retVal = goog.dom.getElementsByTagNameAndClass_(document, "*", className, opt_el)[0];
    }
  }
  return retVal || null;
};
goog.dom.getRequiredElementByClass = function(className, opt_root) {
  var retValue = goog.dom.getElementByClass(className, opt_root);
  return goog.asserts.assert(retValue, "No element found with className: " + className);
};
goog.dom.canUseQuerySelector_ = function(parent) {
  return !!(parent.querySelectorAll && parent.querySelector);
};
goog.dom.getElementsByTagNameAndClass_ = function(doc, opt_tag, opt_class, opt_el) {
  var parent = opt_el || doc;
  var tagName = opt_tag && opt_tag != "*" ? String(opt_tag).toUpperCase() : "";
  if (goog.dom.canUseQuerySelector_(parent) && (tagName || opt_class)) {
    var query = tagName + (opt_class ? "." + opt_class : "");
    return parent.querySelectorAll(query);
  }
  if (opt_class && parent.getElementsByClassName) {
    var els = parent.getElementsByClassName(opt_class);
    if (tagName) {
      var arrayLike = {};
      var len = 0;
      for (var i = 0, el; el = els[i]; i++) {
        if (tagName == el.nodeName) {
          arrayLike[len++] = el;
        }
      }
      arrayLike.length = len;
      return arrayLike;
    } else {
      return els;
    }
  }
  var els = parent.getElementsByTagName(tagName || "*");
  if (opt_class) {
    var arrayLike = {};
    var len = 0;
    for (var i = 0, el; el = els[i]; i++) {
      var className = el.className;
      if (typeof className.split == "function" && goog.array.contains(className.split(/\s+/), opt_class)) {
        arrayLike[len++] = el;
      }
    }
    arrayLike.length = len;
    return arrayLike;
  } else {
    return els;
  }
};
goog.dom.$$ = goog.dom.getElementsByTagNameAndClass;
goog.dom.setProperties = function(element, properties) {
  goog.object.forEach(properties, function(val, key) {
    if (val && val.implementsGoogStringTypedString) {
      val = val.getTypedStringValue();
    }
    if (key == "style") {
      element.style.cssText = val;
    } else {
      if (key == "class") {
        element.className = val;
      } else {
        if (key == "for") {
          element.htmlFor = val;
        } else {
          if (goog.dom.DIRECT_ATTRIBUTE_MAP_.hasOwnProperty(key)) {
            element.setAttribute(goog.dom.DIRECT_ATTRIBUTE_MAP_[key], val);
          } else {
            if (goog.string.startsWith(key, "aria-") || goog.string.startsWith(key, "data-")) {
              element.setAttribute(key, val);
            } else {
              element[key] = val;
            }
          }
        }
      }
    }
  });
};
goog.dom.DIRECT_ATTRIBUTE_MAP_ = {"cellpadding":"cellPadding", "cellspacing":"cellSpacing", "colspan":"colSpan", "frameborder":"frameBorder", "height":"height", "maxlength":"maxLength", "nonce":"nonce", "role":"role", "rowspan":"rowSpan", "type":"type", "usemap":"useMap", "valign":"vAlign", "width":"width"};
goog.dom.getViewportSize = function(opt_window) {
  return goog.dom.getViewportSize_(opt_window || window);
};
goog.dom.getViewportSize_ = function(win) {
  var doc = win.document;
  var el = goog.dom.isCss1CompatMode_(doc) ? doc.documentElement : doc.body;
  return new goog.math.Size(el.clientWidth, el.clientHeight);
};
goog.dom.getDocumentHeight = function() {
  return goog.dom.getDocumentHeight_(window);
};
goog.dom.getDocumentHeightForWindow = function(win) {
  return goog.dom.getDocumentHeight_(win);
};
goog.dom.getDocumentHeight_ = function(win) {
  var doc = win.document;
  var height = 0;
  if (doc) {
    var body = doc.body;
    var docEl = doc.documentElement;
    if (!(docEl && body)) {
      return 0;
    }
    var vh = goog.dom.getViewportSize_(win).height;
    if (goog.dom.isCss1CompatMode_(doc) && docEl.scrollHeight) {
      height = docEl.scrollHeight != vh ? docEl.scrollHeight : docEl.offsetHeight;
    } else {
      var sh = docEl.scrollHeight;
      var oh = docEl.offsetHeight;
      if (docEl.clientHeight != oh) {
        sh = body.scrollHeight;
        oh = body.offsetHeight;
      }
      if (sh > vh) {
        height = sh > oh ? sh : oh;
      } else {
        height = sh < oh ? sh : oh;
      }
    }
  }
  return height;
};
goog.dom.getPageScroll = function(opt_window) {
  var win = opt_window || goog.global || window;
  return goog.dom.getDomHelper(win.document).getDocumentScroll();
};
goog.dom.getDocumentScroll = function() {
  return goog.dom.getDocumentScroll_(document);
};
goog.dom.getDocumentScroll_ = function(doc) {
  var el = goog.dom.getDocumentScrollElement_(doc);
  var win = goog.dom.getWindow_(doc);
  if (goog.userAgent.IE && goog.userAgent.isVersionOrHigher("10") && win.pageYOffset != el.scrollTop) {
    return new goog.math.Coordinate(el.scrollLeft, el.scrollTop);
  }
  return new goog.math.Coordinate(win.pageXOffset || el.scrollLeft, win.pageYOffset || el.scrollTop);
};
goog.dom.getDocumentScrollElement = function() {
  return goog.dom.getDocumentScrollElement_(document);
};
goog.dom.getDocumentScrollElement_ = function(doc) {
  if (doc.scrollingElement) {
    return doc.scrollingElement;
  }
  if (!goog.userAgent.WEBKIT && goog.dom.isCss1CompatMode_(doc)) {
    return doc.documentElement;
  }
  return doc.body || doc.documentElement;
};
goog.dom.getWindow = function(opt_doc) {
  return opt_doc ? goog.dom.getWindow_(opt_doc) : window;
};
goog.dom.getWindow_ = function(doc) {
  return doc.parentWindow || doc.defaultView;
};
goog.dom.createDom = function(tagName, opt_properties, var_args) {
  return goog.dom.createDom_(document, arguments);
};
goog.dom.createDom_ = function(doc, args) {
  var tagName = String(args[0]);
  var attributes = args[1];
  if (!goog.dom.BrowserFeature.CAN_ADD_NAME_OR_TYPE_ATTRIBUTES && attributes && (attributes.name || attributes.type)) {
    var tagNameArr = ["<", tagName];
    if (attributes.name) {
      tagNameArr.push(' name="', goog.string.htmlEscape(attributes.name), '"');
    }
    if (attributes.type) {
      tagNameArr.push(' type="', goog.string.htmlEscape(attributes.type), '"');
      var clone = {};
      goog.object.extend(clone, attributes);
      delete clone["type"];
      attributes = clone;
    }
    tagNameArr.push(">");
    tagName = tagNameArr.join("");
  }
  var element = doc.createElement(tagName);
  if (attributes) {
    if (goog.isString(attributes)) {
      element.className = attributes;
    } else {
      if (goog.isArray(attributes)) {
        element.className = attributes.join(" ");
      } else {
        goog.dom.setProperties(element, attributes);
      }
    }
  }
  if (args.length > 2) {
    goog.dom.append_(doc, element, args, 2);
  }
  return element;
};
goog.dom.append_ = function(doc, parent, args, startIndex) {
  function childHandler(child) {
    if (child) {
      parent.appendChild(goog.isString(child) ? doc.createTextNode(child) : child);
    }
  }
  for (var i = startIndex; i < args.length; i++) {
    var arg = args[i];
    if (goog.isArrayLike(arg) && !goog.dom.isNodeLike(arg)) {
      goog.array.forEach(goog.dom.isNodeList(arg) ? goog.array.toArray(arg) : arg, childHandler);
    } else {
      childHandler(arg);
    }
  }
};
goog.dom.$dom = goog.dom.createDom;
goog.dom.createElement = function(name) {
  return goog.dom.createElement_(document, name);
};
goog.dom.createElement_ = function(doc, name) {
  return doc.createElement(String(name));
};
goog.dom.createTextNode = function(content) {
  return document.createTextNode(String(content));
};
goog.dom.createTable = function(rows, columns, opt_fillWithNbsp) {
  return goog.dom.createTable_(document, rows, columns, !!opt_fillWithNbsp);
};
goog.dom.createTable_ = function(doc, rows, columns, fillWithNbsp) {
  var table = goog.dom.createElement_(doc, goog.dom.TagName.TABLE);
  var tbody = table.appendChild(goog.dom.createElement_(doc, goog.dom.TagName.TBODY));
  for (var i = 0; i < rows; i++) {
    var tr = goog.dom.createElement_(doc, goog.dom.TagName.TR);
    for (var j = 0; j < columns; j++) {
      var td = goog.dom.createElement_(doc, goog.dom.TagName.TD);
      if (fillWithNbsp) {
        goog.dom.setTextContent(td, goog.string.Unicode.NBSP);
      }
      tr.appendChild(td);
    }
    tbody.appendChild(tr);
  }
  return table;
};
goog.dom.constHtmlToNode = function(var_args) {
  var stringArray = goog.array.map(arguments, goog.string.Const.unwrap);
  var safeHtml = goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Constant HTML string, that gets turned into a " + "Node later, so it will be automatically balanced."), stringArray.join(""));
  return goog.dom.safeHtmlToNode(safeHtml);
};
goog.dom.safeHtmlToNode = function(html) {
  return goog.dom.safeHtmlToNode_(document, html);
};
goog.dom.safeHtmlToNode_ = function(doc, html) {
  var tempDiv = goog.dom.createElement_(doc, goog.dom.TagName.DIV);
  if (goog.dom.BrowserFeature.INNER_HTML_NEEDS_SCOPED_ELEMENT) {
    goog.dom.safe.setInnerHtml(tempDiv, goog.html.SafeHtml.concat(goog.html.SafeHtml.BR, html));
    tempDiv.removeChild(tempDiv.firstChild);
  } else {
    goog.dom.safe.setInnerHtml(tempDiv, html);
  }
  return goog.dom.childrenToNode_(doc, tempDiv);
};
goog.dom.childrenToNode_ = function(doc, tempDiv) {
  if (tempDiv.childNodes.length == 1) {
    return tempDiv.removeChild(tempDiv.firstChild);
  } else {
    var fragment = doc.createDocumentFragment();
    while (tempDiv.firstChild) {
      fragment.appendChild(tempDiv.firstChild);
    }
    return fragment;
  }
};
goog.dom.isCss1CompatMode = function() {
  return goog.dom.isCss1CompatMode_(document);
};
goog.dom.isCss1CompatMode_ = function(doc) {
  if (goog.dom.COMPAT_MODE_KNOWN_) {
    return goog.dom.ASSUME_STANDARDS_MODE;
  }
  return doc.compatMode == "CSS1Compat";
};
goog.dom.canHaveChildren = function(node) {
  if (node.nodeType != goog.dom.NodeType.ELEMENT) {
    return false;
  }
  switch(node.tagName) {
    case String(goog.dom.TagName.APPLET):
    case String(goog.dom.TagName.AREA):
    case String(goog.dom.TagName.BASE):
    case String(goog.dom.TagName.BR):
    case String(goog.dom.TagName.COL):
    case String(goog.dom.TagName.COMMAND):
    case String(goog.dom.TagName.EMBED):
    case String(goog.dom.TagName.FRAME):
    case String(goog.dom.TagName.HR):
    case String(goog.dom.TagName.IMG):
    case String(goog.dom.TagName.INPUT):
    case String(goog.dom.TagName.IFRAME):
    case String(goog.dom.TagName.ISINDEX):
    case String(goog.dom.TagName.KEYGEN):
    case String(goog.dom.TagName.LINK):
    case String(goog.dom.TagName.NOFRAMES):
    case String(goog.dom.TagName.NOSCRIPT):
    case String(goog.dom.TagName.META):
    case String(goog.dom.TagName.OBJECT):
    case String(goog.dom.TagName.PARAM):
    case String(goog.dom.TagName.SCRIPT):
    case String(goog.dom.TagName.SOURCE):
    case String(goog.dom.TagName.STYLE):
    case String(goog.dom.TagName.TRACK):
    case String(goog.dom.TagName.WBR):
      return false;
  }
  return true;
};
goog.dom.appendChild = function(parent, child) {
  parent.appendChild(child);
};
goog.dom.append = function(parent, var_args) {
  goog.dom.append_(goog.dom.getOwnerDocument(parent), parent, arguments, 1);
};
goog.dom.removeChildren = function(node) {
  var child;
  while (child = node.firstChild) {
    node.removeChild(child);
  }
};
goog.dom.insertSiblingBefore = function(newNode, refNode) {
  if (refNode.parentNode) {
    refNode.parentNode.insertBefore(newNode, refNode);
  }
};
goog.dom.insertSiblingAfter = function(newNode, refNode) {
  if (refNode.parentNode) {
    refNode.parentNode.insertBefore(newNode, refNode.nextSibling);
  }
};
goog.dom.insertChildAt = function(parent, child, index) {
  parent.insertBefore(child, parent.childNodes[index] || null);
};
goog.dom.removeNode = function(node) {
  return node && node.parentNode ? node.parentNode.removeChild(node) : null;
};
goog.dom.replaceNode = function(newNode, oldNode) {
  var parent = oldNode.parentNode;
  if (parent) {
    parent.replaceChild(newNode, oldNode);
  }
};
goog.dom.flattenElement = function(element) {
  var child, parent = element.parentNode;
  if (parent && parent.nodeType != goog.dom.NodeType.DOCUMENT_FRAGMENT) {
    if (element.removeNode) {
      return element.removeNode(false);
    } else {
      while (child = element.firstChild) {
        parent.insertBefore(child, element);
      }
      return goog.dom.removeNode(element);
    }
  }
};
goog.dom.getChildren = function(element) {
  if (goog.dom.BrowserFeature.CAN_USE_CHILDREN_ATTRIBUTE && element.children != undefined) {
    return element.children;
  }
  return goog.array.filter(element.childNodes, function(node) {
    return node.nodeType == goog.dom.NodeType.ELEMENT;
  });
};
goog.dom.getFirstElementChild = function(node) {
  if (goog.isDef(node.firstElementChild)) {
    return node.firstElementChild;
  }
  return goog.dom.getNextElementNode_(node.firstChild, true);
};
goog.dom.getLastElementChild = function(node) {
  if (goog.isDef(node.lastElementChild)) {
    return node.lastElementChild;
  }
  return goog.dom.getNextElementNode_(node.lastChild, false);
};
goog.dom.getNextElementSibling = function(node) {
  if (goog.isDef(node.nextElementSibling)) {
    return node.nextElementSibling;
  }
  return goog.dom.getNextElementNode_(node.nextSibling, true);
};
goog.dom.getPreviousElementSibling = function(node) {
  if (goog.isDef(node.previousElementSibling)) {
    return node.previousElementSibling;
  }
  return goog.dom.getNextElementNode_(node.previousSibling, false);
};
goog.dom.getNextElementNode_ = function(node, forward) {
  while (node && node.nodeType != goog.dom.NodeType.ELEMENT) {
    node = forward ? node.nextSibling : node.previousSibling;
  }
  return node;
};
goog.dom.getNextNode = function(node) {
  if (!node) {
    return null;
  }
  if (node.firstChild) {
    return node.firstChild;
  }
  while (node && !node.nextSibling) {
    node = node.parentNode;
  }
  return node ? node.nextSibling : null;
};
goog.dom.getPreviousNode = function(node) {
  if (!node) {
    return null;
  }
  if (!node.previousSibling) {
    return node.parentNode;
  }
  node = node.previousSibling;
  while (node && node.lastChild) {
    node = node.lastChild;
  }
  return node;
};
goog.dom.isNodeLike = function(obj) {
  return goog.isObject(obj) && obj.nodeType > 0;
};
goog.dom.isElement = function(obj) {
  return goog.isObject(obj) && obj.nodeType == goog.dom.NodeType.ELEMENT;
};
goog.dom.isWindow = function(obj) {
  return goog.isObject(obj) && obj["window"] == obj;
};
goog.dom.getParentElement = function(element) {
  var parent;
  if (goog.dom.BrowserFeature.CAN_USE_PARENT_ELEMENT_PROPERTY) {
    var isIe9 = goog.userAgent.IE && goog.userAgent.isVersionOrHigher("9") && !goog.userAgent.isVersionOrHigher("10");
    if (!(isIe9 && goog.global["SVGElement"] && element instanceof goog.global["SVGElement"])) {
      parent = element.parentElement;
      if (parent) {
        return parent;
      }
    }
  }
  parent = element.parentNode;
  return goog.dom.isElement(parent) ? parent : null;
};
goog.dom.contains = function(parent, descendant) {
  if (!parent || !descendant) {
    return false;
  }
  if (parent.contains && descendant.nodeType == goog.dom.NodeType.ELEMENT) {
    return parent == descendant || parent.contains(descendant);
  }
  if (typeof parent.compareDocumentPosition != "undefined") {
    return parent == descendant || Boolean(parent.compareDocumentPosition(descendant) & 16);
  }
  while (descendant && parent != descendant) {
    descendant = descendant.parentNode;
  }
  return descendant == parent;
};
goog.dom.compareNodeOrder = function(node1, node2) {
  if (node1 == node2) {
    return 0;
  }
  if (node1.compareDocumentPosition) {
    return node1.compareDocumentPosition(node2) & 2 ? 1 : -1;
  }
  if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) {
    if (node1.nodeType == goog.dom.NodeType.DOCUMENT) {
      return -1;
    }
    if (node2.nodeType == goog.dom.NodeType.DOCUMENT) {
      return 1;
    }
  }
  if ("sourceIndex" in node1 || node1.parentNode && "sourceIndex" in node1.parentNode) {
    var isElement1 = node1.nodeType == goog.dom.NodeType.ELEMENT;
    var isElement2 = node2.nodeType == goog.dom.NodeType.ELEMENT;
    if (isElement1 && isElement2) {
      return node1.sourceIndex - node2.sourceIndex;
    } else {
      var parent1 = node1.parentNode;
      var parent2 = node2.parentNode;
      if (parent1 == parent2) {
        return goog.dom.compareSiblingOrder_(node1, node2);
      }
      if (!isElement1 && goog.dom.contains(parent1, node2)) {
        return -1 * goog.dom.compareParentsDescendantNodeIe_(node1, node2);
      }
      if (!isElement2 && goog.dom.contains(parent2, node1)) {
        return goog.dom.compareParentsDescendantNodeIe_(node2, node1);
      }
      return (isElement1 ? node1.sourceIndex : parent1.sourceIndex) - (isElement2 ? node2.sourceIndex : parent2.sourceIndex);
    }
  }
  var doc = goog.dom.getOwnerDocument(node1);
  var range1, range2;
  range1 = doc.createRange();
  range1.selectNode(node1);
  range1.collapse(true);
  range2 = doc.createRange();
  range2.selectNode(node2);
  range2.collapse(true);
  return range1.compareBoundaryPoints(goog.global["Range"].START_TO_END, range2);
};
goog.dom.compareParentsDescendantNodeIe_ = function(textNode, node) {
  var parent = textNode.parentNode;
  if (parent == node) {
    return -1;
  }
  var sibling = node;
  while (sibling.parentNode != parent) {
    sibling = sibling.parentNode;
  }
  return goog.dom.compareSiblingOrder_(sibling, textNode);
};
goog.dom.compareSiblingOrder_ = function(node1, node2) {
  var s = node2;
  while (s = s.previousSibling) {
    if (s == node1) {
      return -1;
    }
  }
  return 1;
};
goog.dom.findCommonAncestor = function(var_args) {
  var i, count = arguments.length;
  if (!count) {
    return null;
  } else {
    if (count == 1) {
      return arguments[0];
    }
  }
  var paths = [];
  var minLength = Infinity;
  for (i = 0; i < count; i++) {
    var ancestors = [];
    var node = arguments[i];
    while (node) {
      ancestors.unshift(node);
      node = node.parentNode;
    }
    paths.push(ancestors);
    minLength = Math.min(minLength, ancestors.length);
  }
  var output = null;
  for (i = 0; i < minLength; i++) {
    var first = paths[0][i];
    for (var j = 1; j < count; j++) {
      if (first != paths[j][i]) {
        return output;
      }
    }
    output = first;
  }
  return output;
};
goog.dom.getOwnerDocument = function(node) {
  goog.asserts.assert(node, "Node cannot be null or undefined.");
  return node.nodeType == goog.dom.NodeType.DOCUMENT ? node : node.ownerDocument || node.document;
};
goog.dom.getFrameContentDocument = function(frame) {
  return frame.contentDocument || frame.contentWindow.document;
};
goog.dom.getFrameContentWindow = function(frame) {
  try {
    return frame.contentWindow || (frame.contentDocument ? goog.dom.getWindow(frame.contentDocument) : null);
  } catch (e) {
  }
  return null;
};
goog.dom.setTextContent = function(node, text) {
  goog.asserts.assert(node != null, "goog.dom.setTextContent expects a non-null value for node");
  if ("textContent" in node) {
    node.textContent = text;
  } else {
    if (node.nodeType == goog.dom.NodeType.TEXT) {
      node.data = text;
    } else {
      if (node.firstChild && node.firstChild.nodeType == goog.dom.NodeType.TEXT) {
        while (node.lastChild != node.firstChild) {
          node.removeChild(node.lastChild);
        }
        node.firstChild.data = text;
      } else {
        goog.dom.removeChildren(node);
        var doc = goog.dom.getOwnerDocument(node);
        node.appendChild(doc.createTextNode(String(text)));
      }
    }
  }
};
goog.dom.getOuterHtml = function(element) {
  goog.asserts.assert(element !== null, "goog.dom.getOuterHtml expects a non-null value for element");
  if ("outerHTML" in element) {
    return element.outerHTML;
  } else {
    var doc = goog.dom.getOwnerDocument(element);
    var div = goog.dom.createElement_(doc, goog.dom.TagName.DIV);
    div.appendChild(element.cloneNode(true));
    return div.innerHTML;
  }
};
goog.dom.findNode = function(root, p) {
  var rv = [];
  var found = goog.dom.findNodes_(root, p, rv, true);
  return found ? rv[0] : undefined;
};
goog.dom.findNodes = function(root, p) {
  var rv = [];
  goog.dom.findNodes_(root, p, rv, false);
  return rv;
};
goog.dom.findNodes_ = function(root, p, rv, findOne) {
  if (root != null) {
    var child = root.firstChild;
    while (child) {
      if (p(child)) {
        rv.push(child);
        if (findOne) {
          return true;
        }
      }
      if (goog.dom.findNodes_(child, p, rv, findOne)) {
        return true;
      }
      child = child.nextSibling;
    }
  }
  return false;
};
goog.dom.TAGS_TO_IGNORE_ = {"SCRIPT":1, "STYLE":1, "HEAD":1, "IFRAME":1, "OBJECT":1};
goog.dom.PREDEFINED_TAG_VALUES_ = {"IMG":" ", "BR":"\n"};
goog.dom.isFocusableTabIndex = function(element) {
  return goog.dom.hasSpecifiedTabIndex_(element) && goog.dom.isTabIndexFocusable_(element);
};
goog.dom.setFocusableTabIndex = function(element, enable) {
  if (enable) {
    element.tabIndex = 0;
  } else {
    element.tabIndex = -1;
    element.removeAttribute("tabIndex");
  }
};
goog.dom.isFocusable = function(element) {
  var focusable;
  if (goog.dom.nativelySupportsFocus_(element)) {
    focusable = !element.disabled && (!goog.dom.hasSpecifiedTabIndex_(element) || goog.dom.isTabIndexFocusable_(element));
  } else {
    focusable = goog.dom.isFocusableTabIndex(element);
  }
  return focusable && goog.userAgent.IE ? goog.dom.hasNonZeroBoundingRect_(element) : focusable;
};
goog.dom.hasSpecifiedTabIndex_ = function(element) {
  if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9")) {
    var attrNode = element.getAttributeNode("tabindex");
    return goog.isDefAndNotNull(attrNode) && attrNode.specified;
  } else {
    return element.hasAttribute("tabindex");
  }
};
goog.dom.isTabIndexFocusable_ = function(element) {
  var index = element.tabIndex;
  return goog.isNumber(index) && index >= 0 && index < 32768;
};
goog.dom.nativelySupportsFocus_ = function(element) {
  return element.tagName == goog.dom.TagName.A || element.tagName == goog.dom.TagName.INPUT || element.tagName == goog.dom.TagName.TEXTAREA || element.tagName == goog.dom.TagName.SELECT || element.tagName == goog.dom.TagName.BUTTON;
};
goog.dom.hasNonZeroBoundingRect_ = function(element) {
  var rect;
  if (!goog.isFunction(element["getBoundingClientRect"]) || goog.userAgent.IE && element.parentElement == null) {
    rect = {"height":element.offsetHeight, "width":element.offsetWidth};
  } else {
    rect = element.getBoundingClientRect();
  }
  return goog.isDefAndNotNull(rect) && rect.height > 0 && rect.width > 0;
};
goog.dom.getTextContent = function(node) {
  var textContent;
  if (goog.dom.BrowserFeature.CAN_USE_INNER_TEXT && node !== null && "innerText" in node) {
    textContent = goog.string.canonicalizeNewlines(node.innerText);
  } else {
    var buf = [];
    goog.dom.getTextContent_(node, buf, true);
    textContent = buf.join("");
  }
  textContent = textContent.replace(/ \xAD /g, " ").replace(/\xAD/g, "");
  textContent = textContent.replace(/\u200B/g, "");
  if (!goog.dom.BrowserFeature.CAN_USE_INNER_TEXT) {
    textContent = textContent.replace(/ +/g, " ");
  }
  if (textContent != " ") {
    textContent = textContent.replace(/^\s*/, "");
  }
  return textContent;
};
goog.dom.getRawTextContent = function(node) {
  var buf = [];
  goog.dom.getTextContent_(node, buf, false);
  return buf.join("");
};
goog.dom.getTextContent_ = function(node, buf, normalizeWhitespace) {
  if (node.nodeName in goog.dom.TAGS_TO_IGNORE_) {
  } else {
    if (node.nodeType == goog.dom.NodeType.TEXT) {
      if (normalizeWhitespace) {
        buf.push(String(node.nodeValue).replace(/(\r\n|\r|\n)/g, ""));
      } else {
        buf.push(node.nodeValue);
      }
    } else {
      if (node.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) {
        buf.push(goog.dom.PREDEFINED_TAG_VALUES_[node.nodeName]);
      } else {
        var child = node.firstChild;
        while (child) {
          goog.dom.getTextContent_(child, buf, normalizeWhitespace);
          child = child.nextSibling;
        }
      }
    }
  }
};
goog.dom.getNodeTextLength = function(node) {
  return goog.dom.getTextContent(node).length;
};
goog.dom.getNodeTextOffset = function(node, opt_offsetParent) {
  var root = opt_offsetParent || goog.dom.getOwnerDocument(node).body;
  var buf = [];
  while (node && node != root) {
    var cur = node;
    while (cur = cur.previousSibling) {
      buf.unshift(goog.dom.getTextContent(cur));
    }
    node = node.parentNode;
  }
  return goog.string.trimLeft(buf.join("")).replace(/ +/g, " ").length;
};
goog.dom.getNodeAtOffset = function(parent, offset, opt_result) {
  var stack = [parent], pos = 0, cur = null;
  while (stack.length > 0 && pos < offset) {
    cur = stack.pop();
    if (cur.nodeName in goog.dom.TAGS_TO_IGNORE_) {
    } else {
      if (cur.nodeType == goog.dom.NodeType.TEXT) {
        var text = cur.nodeValue.replace(/(\r\n|\r|\n)/g, "").replace(/ +/g, " ");
        pos += text.length;
      } else {
        if (cur.nodeName in goog.dom.PREDEFINED_TAG_VALUES_) {
          pos += goog.dom.PREDEFINED_TAG_VALUES_[cur.nodeName].length;
        } else {
          for (var i = cur.childNodes.length - 1; i >= 0; i--) {
            stack.push(cur.childNodes[i]);
          }
        }
      }
    }
  }
  if (goog.isObject(opt_result)) {
    opt_result.remainder = cur ? cur.nodeValue.length + offset - pos - 1 : 0;
    opt_result.node = cur;
  }
  return cur;
};
goog.dom.isNodeList = function(val) {
  if (val && typeof val.length == "number") {
    if (goog.isObject(val)) {
      return typeof val.item == "function" || typeof val.item == "string";
    } else {
      if (goog.isFunction(val)) {
        return typeof val.item == "function";
      }
    }
  }
  return false;
};
goog.dom.getAncestorByTagNameAndClass = function(element, opt_tag, opt_class, opt_maxSearchSteps) {
  if (!opt_tag && !opt_class) {
    return null;
  }
  var tagName = opt_tag ? String(opt_tag).toUpperCase() : null;
  return goog.dom.getAncestor(element, function(node) {
    return (!tagName || node.nodeName == tagName) && (!opt_class || goog.isString(node.className) && goog.array.contains(node.className.split(/\s+/), opt_class));
  }, true, opt_maxSearchSteps);
};
goog.dom.getAncestorByClass = function(element, className, opt_maxSearchSteps) {
  return goog.dom.getAncestorByTagNameAndClass(element, null, className, opt_maxSearchSteps);
};
goog.dom.getAncestor = function(element, matcher, opt_includeNode, opt_maxSearchSteps) {
  if (element && !opt_includeNode) {
    element = element.parentNode;
  }
  var steps = 0;
  while (element && (opt_maxSearchSteps == null || steps <= opt_maxSearchSteps)) {
    goog.asserts.assert(element.name != "parentNode");
    if (matcher(element)) {
      return element;
    }
    element = element.parentNode;
    steps++;
  }
  return null;
};
goog.dom.getActiveElement = function(doc) {
  try {
    return doc && doc.activeElement;
  } catch (e) {
  }
  return null;
};
goog.dom.getPixelRatio = function() {
  var win = goog.dom.getWindow();
  if (goog.isDef(win.devicePixelRatio)) {
    return win.devicePixelRatio;
  } else {
    if (win.matchMedia) {
      return goog.dom.matchesPixelRatio_(3) || goog.dom.matchesPixelRatio_(2) || goog.dom.matchesPixelRatio_(1.5) || goog.dom.matchesPixelRatio_(1) || .75;
    }
  }
  return 1;
};
goog.dom.matchesPixelRatio_ = function(pixelRatio) {
  var win = goog.dom.getWindow();
  var dpiPerDppx = 96;
  var query = "(min-resolution: " + pixelRatio + "dppx)," + "(min--moz-device-pixel-ratio: " + pixelRatio + ")," + "(min-resolution: " + pixelRatio * dpiPerDppx + "dpi)";
  return win.matchMedia(query).matches ? pixelRatio : 0;
};
goog.dom.getCanvasContext2D = function(canvas) {
  return canvas.getContext("2d");
};
goog.dom.DomHelper = function(opt_document) {
  this.document_ = opt_document || goog.global.document || document;
};
goog.dom.DomHelper.prototype.getDomHelper = goog.dom.getDomHelper;
goog.dom.DomHelper.prototype.setDocument = function(document) {
  this.document_ = document;
};
goog.dom.DomHelper.prototype.getDocument = function() {
  return this.document_;
};
goog.dom.DomHelper.prototype.getElement = function(element) {
  return goog.dom.getElementHelper_(this.document_, element);
};
goog.dom.DomHelper.prototype.getRequiredElement = function(id) {
  return goog.dom.getRequiredElementHelper_(this.document_, id);
};
goog.dom.DomHelper.prototype.$ = goog.dom.DomHelper.prototype.getElement;
goog.dom.DomHelper.prototype.getElementsByTagName = function(tagName, opt_parent) {
  var parent = opt_parent || this.document_;
  return parent.getElementsByTagName(String(tagName));
};
goog.dom.DomHelper.prototype.getElementsByTagNameAndClass = function(opt_tag, opt_class, opt_el) {
  return goog.dom.getElementsByTagNameAndClass_(this.document_, opt_tag, opt_class, opt_el);
};
goog.dom.DomHelper.prototype.getElementsByClass = function(className, opt_el) {
  var doc = opt_el || this.document_;
  return goog.dom.getElementsByClass(className, doc);
};
goog.dom.DomHelper.prototype.getElementByClass = function(className, opt_el) {
  var doc = opt_el || this.document_;
  return goog.dom.getElementByClass(className, doc);
};
goog.dom.DomHelper.prototype.getRequiredElementByClass = function(className, opt_root) {
  var root = opt_root || this.document_;
  return goog.dom.getRequiredElementByClass(className, root);
};
goog.dom.DomHelper.prototype.$$ = goog.dom.DomHelper.prototype.getElementsByTagNameAndClass;
goog.dom.DomHelper.prototype.setProperties = goog.dom.setProperties;
goog.dom.DomHelper.prototype.getViewportSize = function(opt_window) {
  return goog.dom.getViewportSize(opt_window || this.getWindow());
};
goog.dom.DomHelper.prototype.getDocumentHeight = function() {
  return goog.dom.getDocumentHeight_(this.getWindow());
};
goog.dom.Appendable;
goog.dom.DomHelper.prototype.createDom = function(tagName, opt_attributes, var_args) {
  return goog.dom.createDom_(this.document_, arguments);
};
goog.dom.DomHelper.prototype.$dom = goog.dom.DomHelper.prototype.createDom;
goog.dom.DomHelper.prototype.createElement = function(name) {
  return goog.dom.createElement_(this.document_, name);
};
goog.dom.DomHelper.prototype.createTextNode = function(content) {
  return this.document_.createTextNode(String(content));
};
goog.dom.DomHelper.prototype.createTable = function(rows, columns, opt_fillWithNbsp) {
  return goog.dom.createTable_(this.document_, rows, columns, !!opt_fillWithNbsp);
};
goog.dom.DomHelper.prototype.safeHtmlToNode = function(html) {
  return goog.dom.safeHtmlToNode_(this.document_, html);
};
goog.dom.DomHelper.prototype.isCss1CompatMode = function() {
  return goog.dom.isCss1CompatMode_(this.document_);
};
goog.dom.DomHelper.prototype.getWindow = function() {
  return goog.dom.getWindow_(this.document_);
};
goog.dom.DomHelper.prototype.getDocumentScrollElement = function() {
  return goog.dom.getDocumentScrollElement_(this.document_);
};
goog.dom.DomHelper.prototype.getDocumentScroll = function() {
  return goog.dom.getDocumentScroll_(this.document_);
};
goog.dom.DomHelper.prototype.getActiveElement = function(opt_doc) {
  return goog.dom.getActiveElement(opt_doc || this.document_);
};
goog.dom.DomHelper.prototype.appendChild = goog.dom.appendChild;
goog.dom.DomHelper.prototype.append = goog.dom.append;
goog.dom.DomHelper.prototype.canHaveChildren = goog.dom.canHaveChildren;
goog.dom.DomHelper.prototype.removeChildren = goog.dom.removeChildren;
goog.dom.DomHelper.prototype.insertSiblingBefore = goog.dom.insertSiblingBefore;
goog.dom.DomHelper.prototype.insertSiblingAfter = goog.dom.insertSiblingAfter;
goog.dom.DomHelper.prototype.insertChildAt = goog.dom.insertChildAt;
goog.dom.DomHelper.prototype.removeNode = goog.dom.removeNode;
goog.dom.DomHelper.prototype.replaceNode = goog.dom.replaceNode;
goog.dom.DomHelper.prototype.flattenElement = goog.dom.flattenElement;
goog.dom.DomHelper.prototype.getChildren = goog.dom.getChildren;
goog.dom.DomHelper.prototype.getFirstElementChild = goog.dom.getFirstElementChild;
goog.dom.DomHelper.prototype.getLastElementChild = goog.dom.getLastElementChild;
goog.dom.DomHelper.prototype.getNextElementSibling = goog.dom.getNextElementSibling;
goog.dom.DomHelper.prototype.getPreviousElementSibling = goog.dom.getPreviousElementSibling;
goog.dom.DomHelper.prototype.getNextNode = goog.dom.getNextNode;
goog.dom.DomHelper.prototype.getPreviousNode = goog.dom.getPreviousNode;
goog.dom.DomHelper.prototype.isNodeLike = goog.dom.isNodeLike;
goog.dom.DomHelper.prototype.isElement = goog.dom.isElement;
goog.dom.DomHelper.prototype.isWindow = goog.dom.isWindow;
goog.dom.DomHelper.prototype.getParentElement = goog.dom.getParentElement;
goog.dom.DomHelper.prototype.contains = goog.dom.contains;
goog.dom.DomHelper.prototype.compareNodeOrder = goog.dom.compareNodeOrder;
goog.dom.DomHelper.prototype.findCommonAncestor = goog.dom.findCommonAncestor;
goog.dom.DomHelper.prototype.getOwnerDocument = goog.dom.getOwnerDocument;
goog.dom.DomHelper.prototype.getFrameContentDocument = goog.dom.getFrameContentDocument;
goog.dom.DomHelper.prototype.getFrameContentWindow = goog.dom.getFrameContentWindow;
goog.dom.DomHelper.prototype.setTextContent = goog.dom.setTextContent;
goog.dom.DomHelper.prototype.getOuterHtml = goog.dom.getOuterHtml;
goog.dom.DomHelper.prototype.findNode = goog.dom.findNode;
goog.dom.DomHelper.prototype.findNodes = goog.dom.findNodes;
goog.dom.DomHelper.prototype.isFocusableTabIndex = goog.dom.isFocusableTabIndex;
goog.dom.DomHelper.prototype.setFocusableTabIndex = goog.dom.setFocusableTabIndex;
goog.dom.DomHelper.prototype.isFocusable = goog.dom.isFocusable;
goog.dom.DomHelper.prototype.getTextContent = goog.dom.getTextContent;
goog.dom.DomHelper.prototype.getNodeTextLength = goog.dom.getNodeTextLength;
goog.dom.DomHelper.prototype.getNodeTextOffset = goog.dom.getNodeTextOffset;
goog.dom.DomHelper.prototype.getNodeAtOffset = goog.dom.getNodeAtOffset;
goog.dom.DomHelper.prototype.isNodeList = goog.dom.isNodeList;
goog.dom.DomHelper.prototype.getAncestorByTagNameAndClass = goog.dom.getAncestorByTagNameAndClass;
goog.dom.DomHelper.prototype.getAncestorByClass = goog.dom.getAncestorByClass;
goog.dom.DomHelper.prototype.getAncestor = goog.dom.getAncestor;
goog.dom.DomHelper.prototype.getCanvasContext2D = goog.dom.getCanvasContext2D;
goog.provide("goog.dom.classlist");
goog.require("goog.array");
goog.define("goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST", false);
goog.dom.classlist.get = function(element) {
  if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
    return element.classList;
  }
  var className = element.className;
  return goog.isString(className) && className.match(/\S+/g) || [];
};
goog.dom.classlist.set = function(element, className) {
  element.className = className;
};
goog.dom.classlist.contains = function(element, className) {
  if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
    return element.classList.contains(className);
  }
  return goog.array.contains(goog.dom.classlist.get(element), className);
};
goog.dom.classlist.add = function(element, className) {
  if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
    element.classList.add(className);
    return;
  }
  if (!goog.dom.classlist.contains(element, className)) {
    element.className += element.className.length > 0 ? " " + className : className;
  }
};
goog.dom.classlist.addAll = function(element, classesToAdd) {
  if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
    goog.array.forEach(classesToAdd, function(className) {
      goog.dom.classlist.add(element, className);
    });
    return;
  }
  var classMap = {};
  goog.array.forEach(goog.dom.classlist.get(element), function(className) {
    classMap[className] = true;
  });
  goog.array.forEach(classesToAdd, function(className) {
    classMap[className] = true;
  });
  element.className = "";
  for (var className in classMap) {
    element.className += element.className.length > 0 ? " " + className : className;
  }
};
goog.dom.classlist.remove = function(element, className) {
  if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
    element.classList.remove(className);
    return;
  }
  if (goog.dom.classlist.contains(element, className)) {
    element.className = goog.array.filter(goog.dom.classlist.get(element), function(c) {
      return c != className;
    }).join(" ");
  }
};
goog.dom.classlist.removeAll = function(element, classesToRemove) {
  if (goog.dom.classlist.ALWAYS_USE_DOM_TOKEN_LIST || element.classList) {
    goog.array.forEach(classesToRemove, function(className) {
      goog.dom.classlist.remove(element, className);
    });
    return;
  }
  element.className = goog.array.filter(goog.dom.classlist.get(element), function(className) {
    return !goog.array.contains(classesToRemove, className);
  }).join(" ");
};
goog.dom.classlist.enable = function(element, className, enabled) {
  if (enabled) {
    goog.dom.classlist.add(element, className);
  } else {
    goog.dom.classlist.remove(element, className);
  }
};
goog.dom.classlist.enableAll = function(element, classesToEnable, enabled) {
  var f = enabled ? goog.dom.classlist.addAll : goog.dom.classlist.removeAll;
  f(element, classesToEnable);
};
goog.dom.classlist.swap = function(element, fromClass, toClass) {
  if (goog.dom.classlist.contains(element, fromClass)) {
    goog.dom.classlist.remove(element, fromClass);
    goog.dom.classlist.add(element, toClass);
    return true;
  }
  return false;
};
goog.dom.classlist.toggle = function(element, className) {
  var add = !goog.dom.classlist.contains(element, className);
  goog.dom.classlist.enable(element, className, add);
  return add;
};
goog.dom.classlist.addRemove = function(element, classToRemove, classToAdd) {
  goog.dom.classlist.remove(element, classToRemove);
  goog.dom.classlist.add(element, classToAdd);
};
goog.provide("goog.dom.vendor");
goog.require("goog.string");
goog.require("goog.userAgent");
goog.dom.vendor.getVendorJsPrefix = function() {
  if (goog.userAgent.WEBKIT) {
    return "Webkit";
  } else {
    if (goog.userAgent.GECKO) {
      return "Moz";
    } else {
      if (goog.userAgent.IE) {
        return "ms";
      } else {
        if (goog.userAgent.OPERA) {
          return "O";
        }
      }
    }
  }
  return null;
};
goog.dom.vendor.getVendorPrefix = function() {
  if (goog.userAgent.WEBKIT) {
    return "-webkit";
  } else {
    if (goog.userAgent.GECKO) {
      return "-moz";
    } else {
      if (goog.userAgent.IE) {
        return "-ms";
      } else {
        if (goog.userAgent.OPERA) {
          return "-o";
        }
      }
    }
  }
  return null;
};
goog.dom.vendor.getPrefixedPropertyName = function(propertyName, opt_object) {
  if (opt_object && propertyName in opt_object) {
    return propertyName;
  }
  var prefix = goog.dom.vendor.getVendorJsPrefix();
  if (prefix) {
    prefix = prefix.toLowerCase();
    var prefixedPropertyName = prefix + goog.string.toTitleCase(propertyName);
    return !goog.isDef(opt_object) || prefixedPropertyName in opt_object ? prefixedPropertyName : null;
  }
  return null;
};
goog.dom.vendor.getPrefixedEventType = function(eventType) {
  var prefix = goog.dom.vendor.getVendorJsPrefix() || "";
  return (prefix + eventType).toLowerCase();
};
goog.provide("goog.html.legacyconversions");
goog.require("goog.html.SafeHtml");
goog.require("goog.html.SafeStyle");
goog.require("goog.html.SafeStyleSheet");
goog.require("goog.html.SafeUrl");
goog.require("goog.html.TrustedResourceUrl");
goog.html.legacyconversions.safeHtmlFromString = function(html) {
  goog.html.legacyconversions.reportCallback_();
  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(html, null);
};
goog.html.legacyconversions.safeStyleFromString = function(style) {
  goog.html.legacyconversions.reportCallback_();
  return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(style);
};
goog.html.legacyconversions.safeStyleSheetFromString = function(styleSheet) {
  goog.html.legacyconversions.reportCallback_();
  return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(styleSheet);
};
goog.html.legacyconversions.safeUrlFromString = function(url) {
  goog.html.legacyconversions.reportCallback_();
  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(url);
};
goog.html.legacyconversions.trustedResourceUrlFromString = function(url) {
  goog.html.legacyconversions.reportCallback_();
  return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(url);
};
goog.html.legacyconversions.reportCallback_ = goog.nullFunction;
goog.html.legacyconversions.setReportCallback = function(callback) {
  goog.html.legacyconversions.reportCallback_ = callback;
};
goog.provide("goog.math.Box");
goog.require("goog.asserts");
goog.require("goog.math.Coordinate");
goog.math.Box = function(top, right, bottom, left) {
  this.top = top;
  this.right = right;
  this.bottom = bottom;
  this.left = left;
};
goog.math.Box.boundingBox = function(var_args) {
  var box = new goog.math.Box(arguments[0].y, arguments[0].x, arguments[0].y, arguments[0].x);
  for (var i = 1; i < arguments.length; i++) {
    box.expandToIncludeCoordinate(arguments[i]);
  }
  return box;
};
goog.math.Box.prototype.getWidth = function() {
  return this.right - this.left;
};
goog.math.Box.prototype.getHeight = function() {
  return this.bottom - this.top;
};
goog.math.Box.prototype.clone = function() {
  return new goog.math.Box(this.top, this.right, this.bottom, this.left);
};
if (goog.DEBUG) {
  goog.math.Box.prototype.toString = function() {
    return "(" + this.top + "t, " + this.right + "r, " + this.bottom + "b, " + this.left + "l)";
  };
}
goog.math.Box.prototype.contains = function(other) {
  return goog.math.Box.contains(this, other);
};
goog.math.Box.prototype.expand = function(top, opt_right, opt_bottom, opt_left) {
  if (goog.isObject(top)) {
    this.top -= top.top;
    this.right += top.right;
    this.bottom += top.bottom;
    this.left -= top.left;
  } else {
    this.top -= top;
    this.right += Number(opt_right);
    this.bottom += Number(opt_bottom);
    this.left -= Number(opt_left);
  }
  return this;
};
goog.math.Box.prototype.expandToInclude = function(box) {
  this.left = Math.min(this.left, box.left);
  this.top = Math.min(this.top, box.top);
  this.right = Math.max(this.right, box.right);
  this.bottom = Math.max(this.bottom, box.bottom);
};
goog.math.Box.prototype.expandToIncludeCoordinate = function(coord) {
  this.top = Math.min(this.top, coord.y);
  this.right = Math.max(this.right, coord.x);
  this.bottom = Math.max(this.bottom, coord.y);
  this.left = Math.min(this.left, coord.x);
};
goog.math.Box.equals = function(a, b) {
  if (a == b) {
    return true;
  }
  if (!a || !b) {
    return false;
  }
  return a.top == b.top && a.right == b.right && a.bottom == b.bottom && a.left == b.left;
};
goog.math.Box.contains = function(box, other) {
  if (!box || !other) {
    return false;
  }
  if (other instanceof goog.math.Box) {
    return other.left >= box.left && other.right <= box.right && other.top >= box.top && other.bottom <= box.bottom;
  }
  return other.x >= box.left && other.x <= box.right && other.y >= box.top && other.y <= box.bottom;
};
goog.math.Box.relativePositionX = function(box, coord) {
  if (coord.x < box.left) {
    return coord.x - box.left;
  } else {
    if (coord.x > box.right) {
      return coord.x - box.right;
    }
  }
  return 0;
};
goog.math.Box.relativePositionY = function(box, coord) {
  if (coord.y < box.top) {
    return coord.y - box.top;
  } else {
    if (coord.y > box.bottom) {
      return coord.y - box.bottom;
    }
  }
  return 0;
};
goog.math.Box.distance = function(box, coord) {
  var x = goog.math.Box.relativePositionX(box, coord);
  var y = goog.math.Box.relativePositionY(box, coord);
  return Math.sqrt(x * x + y * y);
};
goog.math.Box.intersects = function(a, b) {
  return a.left <= b.right && b.left <= a.right && a.top <= b.bottom && b.top <= a.bottom;
};
goog.math.Box.intersectsWithPadding = function(a, b, padding) {
  return a.left <= b.right + padding && b.left <= a.right + padding && a.top <= b.bottom + padding && b.top <= a.bottom + padding;
};
goog.math.Box.prototype.ceil = function() {
  this.top = Math.ceil(this.top);
  this.right = Math.ceil(this.right);
  this.bottom = Math.ceil(this.bottom);
  this.left = Math.ceil(this.left);
  return this;
};
goog.math.Box.prototype.floor = function() {
  this.top = Math.floor(this.top);
  this.right = Math.floor(this.right);
  this.bottom = Math.floor(this.bottom);
  this.left = Math.floor(this.left);
  return this;
};
goog.math.Box.prototype.round = function() {
  this.top = Math.round(this.top);
  this.right = Math.round(this.right);
  this.bottom = Math.round(this.bottom);
  this.left = Math.round(this.left);
  return this;
};
goog.math.Box.prototype.translate = function(tx, opt_ty) {
  if (tx instanceof goog.math.Coordinate) {
    this.left += tx.x;
    this.right += tx.x;
    this.top += tx.y;
    this.bottom += tx.y;
  } else {
    goog.asserts.assertNumber(tx);
    this.left += tx;
    this.right += tx;
    if (goog.isNumber(opt_ty)) {
      this.top += opt_ty;
      this.bottom += opt_ty;
    }
  }
  return this;
};
goog.math.Box.prototype.scale = function(sx, opt_sy) {
  var sy = goog.isNumber(opt_sy) ? opt_sy : sx;
  this.left *= sx;
  this.right *= sx;
  this.top *= sy;
  this.bottom *= sy;
  return this;
};
goog.provide("goog.math.IRect");
goog.math.IRect = function() {
};
goog.math.IRect.prototype.left;
goog.math.IRect.prototype.top;
goog.math.IRect.prototype.width;
goog.math.IRect.prototype.height;
goog.provide("goog.math.Rect");
goog.require("goog.asserts");
goog.require("goog.math.Box");
goog.require("goog.math.Coordinate");
goog.require("goog.math.IRect");
goog.require("goog.math.Size");
goog.math.Rect = function(x, y, w, h) {
  this.left = x;
  this.top = y;
  this.width = w;
  this.height = h;
};
goog.math.Rect.prototype.clone = function() {
  return new goog.math.Rect(this.left, this.top, this.width, this.height);
};
goog.math.Rect.prototype.toBox = function() {
  var right = this.left + this.width;
  var bottom = this.top + this.height;
  return new goog.math.Box(this.top, right, bottom, this.left);
};
goog.math.Rect.createFromPositionAndSize = function(position, size) {
  return new goog.math.Rect(position.x, position.y, size.width, size.height);
};
goog.math.Rect.createFromBox = function(box) {
  return new goog.math.Rect(box.left, box.top, box.right - box.left, box.bottom - box.top);
};
if (goog.DEBUG) {
  goog.math.Rect.prototype.toString = function() {
    return "(" + this.left + ", " + this.top + " - " + this.width + "w x " + this.height + "h)";
  };
}
goog.math.Rect.equals = function(a, b) {
  if (a == b) {
    return true;
  }
  if (!a || !b) {
    return false;
  }
  return a.left == b.left && a.width == b.width && a.top == b.top && a.height == b.height;
};
goog.math.Rect.prototype.intersection = function(rect) {
  var x0 = Math.max(this.left, rect.left);
  var x1 = Math.min(this.left + this.width, rect.left + rect.width);
  if (x0 <= x1) {
    var y0 = Math.max(this.top, rect.top);
    var y1 = Math.min(this.top + this.height, rect.top + rect.height);
    if (y0 <= y1) {
      this.left = x0;
      this.top = y0;
      this.width = x1 - x0;
      this.height = y1 - y0;
      return true;
    }
  }
  return false;
};
goog.math.Rect.intersection = function(a, b) {
  var x0 = Math.max(a.left, b.left);
  var x1 = Math.min(a.left + a.width, b.left + b.width);
  if (x0 <= x1) {
    var y0 = Math.max(a.top, b.top);
    var y1 = Math.min(a.top + a.height, b.top + b.height);
    if (y0 <= y1) {
      return new goog.math.Rect(x0, y0, x1 - x0, y1 - y0);
    }
  }
  return null;
};
goog.math.Rect.intersects = function(a, b) {
  return a.left <= b.left + b.width && b.left <= a.left + a.width && a.top <= b.top + b.height && b.top <= a.top + a.height;
};
goog.math.Rect.prototype.intersects = function(rect) {
  return goog.math.Rect.intersects(this, rect);
};
goog.math.Rect.difference = function(a, b) {
  var intersection = goog.math.Rect.intersection(a, b);
  if (!intersection || !intersection.height || !intersection.width) {
    return [a.clone()];
  }
  var result = [];
  var top = a.top;
  var height = a.height;
  var ar = a.left + a.width;
  var ab = a.top + a.height;
  var br = b.left + b.width;
  var bb = b.top + b.height;
  if (b.top > a.top) {
    result.push(new goog.math.Rect(a.left, a.top, a.width, b.top - a.top));
    top = b.top;
    height -= b.top - a.top;
  }
  if (bb < ab) {
    result.push(new goog.math.Rect(a.left, bb, a.width, ab - bb));
    height = bb - top;
  }
  if (b.left > a.left) {
    result.push(new goog.math.Rect(a.left, top, b.left - a.left, height));
  }
  if (br < ar) {
    result.push(new goog.math.Rect(br, top, ar - br, height));
  }
  return result;
};
goog.math.Rect.prototype.difference = function(rect) {
  return goog.math.Rect.difference(this, rect);
};
goog.math.Rect.prototype.boundingRect = function(rect) {
  var right = Math.max(this.left + this.width, rect.left + rect.width);
  var bottom = Math.max(this.top + this.height, rect.top + rect.height);
  this.left = Math.min(this.left, rect.left);
  this.top = Math.min(this.top, rect.top);
  this.width = right - this.left;
  this.height = bottom - this.top;
};
goog.math.Rect.boundingRect = function(a, b) {
  if (!a || !b) {
    return null;
  }
  var newRect = new goog.math.Rect(a.left, a.top, a.width, a.height);
  newRect.boundingRect(b);
  return newRect;
};
goog.math.Rect.prototype.contains = function(another) {
  if (another instanceof goog.math.Coordinate) {
    return another.x >= this.left && another.x <= this.left + this.width && another.y >= this.top && another.y <= this.top + this.height;
  } else {
    return this.left <= another.left && this.left + this.width >= another.left + another.width && this.top <= another.top && this.top + this.height >= another.top + another.height;
  }
};
goog.math.Rect.prototype.squaredDistance = function(point) {
  var dx = point.x < this.left ? this.left - point.x : Math.max(point.x - (this.left + this.width), 0);
  var dy = point.y < this.top ? this.top - point.y : Math.max(point.y - (this.top + this.height), 0);
  return dx * dx + dy * dy;
};
goog.math.Rect.prototype.distance = function(point) {
  return Math.sqrt(this.squaredDistance(point));
};
goog.math.Rect.prototype.getSize = function() {
  return new goog.math.Size(this.width, this.height);
};
goog.math.Rect.prototype.getTopLeft = function() {
  return new goog.math.Coordinate(this.left, this.top);
};
goog.math.Rect.prototype.getCenter = function() {
  return new goog.math.Coordinate(this.left + this.width / 2, this.top + this.height / 2);
};
goog.math.Rect.prototype.getBottomRight = function() {
  return new goog.math.Coordinate(this.left + this.width, this.top + this.height);
};
goog.math.Rect.prototype.ceil = function() {
  this.left = Math.ceil(this.left);
  this.top = Math.ceil(this.top);
  this.width = Math.ceil(this.width);
  this.height = Math.ceil(this.height);
  return this;
};
goog.math.Rect.prototype.floor = function() {
  this.left = Math.floor(this.left);
  this.top = Math.floor(this.top);
  this.width = Math.floor(this.width);
  this.height = Math.floor(this.height);
  return this;
};
goog.math.Rect.prototype.round = function() {
  this.left = Math.round(this.left);
  this.top = Math.round(this.top);
  this.width = Math.round(this.width);
  this.height = Math.round(this.height);
  return this;
};
goog.math.Rect.prototype.translate = function(tx, opt_ty) {
  if (tx instanceof goog.math.Coordinate) {
    this.left += tx.x;
    this.top += tx.y;
  } else {
    this.left += goog.asserts.assertNumber(tx);
    if (goog.isNumber(opt_ty)) {
      this.top += opt_ty;
    }
  }
  return this;
};
goog.math.Rect.prototype.scale = function(sx, opt_sy) {
  var sy = goog.isNumber(opt_sy) ? opt_sy : sx;
  this.left *= sx;
  this.width *= sx;
  this.top *= sy;
  this.height *= sy;
  return this;
};
goog.provide("goog.style");
goog.require("goog.array");
goog.require("goog.asserts");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.TagName");
goog.require("goog.dom.vendor");
goog.require("goog.html.SafeStyleSheet");
goog.require("goog.html.legacyconversions");
goog.require("goog.math.Box");
goog.require("goog.math.Coordinate");
goog.require("goog.math.Rect");
goog.require("goog.math.Size");
goog.require("goog.object");
goog.require("goog.reflect");
goog.require("goog.string");
goog.require("goog.userAgent");
goog.forwardDeclare("goog.events.Event");
goog.style.setStyle = function(element, style, opt_value) {
  if (goog.isString(style)) {
    goog.style.setStyle_(element, opt_value, style);
  } else {
    for (var key in style) {
      goog.style.setStyle_(element, style[key], key);
    }
  }
};
goog.style.setStyle_ = function(element, value, style) {
  var propertyName = goog.style.getVendorJsStyleName_(element, style);
  if (propertyName) {
    element.style[propertyName] = value;
  }
};
goog.style.styleNameCache_ = {};
goog.style.getVendorJsStyleName_ = function(element, style) {
  var propertyName = goog.style.styleNameCache_[style];
  if (!propertyName) {
    var camelStyle = goog.string.toCamelCase(style);
    propertyName = camelStyle;
    if (element.style[camelStyle] === undefined) {
      var prefixedStyle = goog.dom.vendor.getVendorJsPrefix() + goog.string.toTitleCase(camelStyle);
      if (element.style[prefixedStyle] !== undefined) {
        propertyName = prefixedStyle;
      }
    }
    goog.style.styleNameCache_[style] = propertyName;
  }
  return propertyName;
};
goog.style.getVendorStyleName_ = function(element, style) {
  var camelStyle = goog.string.toCamelCase(style);
  if (element.style[camelStyle] === undefined) {
    var prefixedStyle = goog.dom.vendor.getVendorJsPrefix() + goog.string.toTitleCase(camelStyle);
    if (element.style[prefixedStyle] !== undefined) {
      return goog.dom.vendor.getVendorPrefix() + "-" + style;
    }
  }
  return style;
};
goog.style.getStyle = function(element, property) {
  var styleValue = element.style[goog.string.toCamelCase(property)];
  if (typeof styleValue !== "undefined") {
    return styleValue;
  }
  return element.style[goog.style.getVendorJsStyleName_(element, property)] || "";
};
goog.style.getComputedStyle = function(element, property) {
  var doc = goog.dom.getOwnerDocument(element);
  if (doc.defaultView && doc.defaultView.getComputedStyle) {
    var styles = doc.defaultView.getComputedStyle(element, null);
    if (styles) {
      return styles[property] || styles.getPropertyValue(property) || "";
    }
  }
  return "";
};
goog.style.getCascadedStyle = function(element, style) {
  return element.currentStyle ? element.currentStyle[style] : null;
};
goog.style.getStyle_ = function(element, style) {
  return goog.style.getComputedStyle(element, style) || goog.style.getCascadedStyle(element, style) || element.style && element.style[style];
};
goog.style.getComputedBoxSizing = function(element) {
  return goog.style.getStyle_(element, "boxSizing") || goog.style.getStyle_(element, "MozBoxSizing") || goog.style.getStyle_(element, "WebkitBoxSizing") || null;
};
goog.style.getComputedPosition = function(element) {
  return goog.style.getStyle_(element, "position");
};
goog.style.getBackgroundColor = function(element) {
  return goog.style.getStyle_(element, "backgroundColor");
};
goog.style.getComputedOverflowX = function(element) {
  return goog.style.getStyle_(element, "overflowX");
};
goog.style.getComputedOverflowY = function(element) {
  return goog.style.getStyle_(element, "overflowY");
};
goog.style.getComputedZIndex = function(element) {
  return goog.style.getStyle_(element, "zIndex");
};
goog.style.getComputedTextAlign = function(element) {
  return goog.style.getStyle_(element, "textAlign");
};
goog.style.getComputedCursor = function(element) {
  return goog.style.getStyle_(element, "cursor");
};
goog.style.getComputedTransform = function(element) {
  var property = goog.style.getVendorStyleName_(element, "transform");
  return goog.style.getStyle_(element, property) || goog.style.getStyle_(element, "transform");
};
goog.style.setPosition = function(el, arg1, opt_arg2) {
  var x, y;
  if (arg1 instanceof goog.math.Coordinate) {
    x = arg1.x;
    y = arg1.y;
  } else {
    x = arg1;
    y = opt_arg2;
  }
  el.style.left = goog.style.getPixelStyleValue_(x, false);
  el.style.top = goog.style.getPixelStyleValue_(y, false);
};
goog.style.getPosition = function(element) {
  return new goog.math.Coordinate(element.offsetLeft, element.offsetTop);
};
goog.style.getClientViewportElement = function(opt_node) {
  var doc;
  if (opt_node) {
    doc = goog.dom.getOwnerDocument(opt_node);
  } else {
    doc = goog.dom.getDocument();
  }
  if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9) && !goog.dom.getDomHelper(doc).isCss1CompatMode()) {
    return doc.body;
  }
  return doc.documentElement;
};
goog.style.getViewportPageOffset = function(doc) {
  var body = doc.body;
  var documentElement = doc.documentElement;
  var scrollLeft = body.scrollLeft || documentElement.scrollLeft;
  var scrollTop = body.scrollTop || documentElement.scrollTop;
  return new goog.math.Coordinate(scrollLeft, scrollTop);
};
goog.style.getBoundingClientRect_ = function(el) {
  var rect;
  try {
    rect = el.getBoundingClientRect();
  } catch (e) {
    return {"left":0, "top":0, "right":0, "bottom":0};
  }
  if (goog.userAgent.IE && el.ownerDocument.body) {
    var doc = el.ownerDocument;
    rect.left -= doc.documentElement.clientLeft + doc.body.clientLeft;
    rect.top -= doc.documentElement.clientTop + doc.body.clientTop;
  }
  return rect;
};
goog.style.getOffsetParent = function(element) {
  if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(8)) {
    goog.asserts.assert(element && "offsetParent" in element);
    return element.offsetParent;
  }
  var doc = goog.dom.getOwnerDocument(element);
  var positionStyle = goog.style.getStyle_(element, "position");
  var skipStatic = positionStyle == "fixed" || positionStyle == "absolute";
  for (var parent = element.parentNode; parent && parent != doc; parent = parent.parentNode) {
    if (parent.nodeType == goog.dom.NodeType.DOCUMENT_FRAGMENT && parent.host) {
      parent = parent.host;
    }
    positionStyle = goog.style.getStyle_(parent, "position");
    skipStatic = skipStatic && positionStyle == "static" && parent != doc.documentElement && parent != doc.body;
    if (!skipStatic && (parent.scrollWidth > parent.clientWidth || parent.scrollHeight > parent.clientHeight || positionStyle == "fixed" || positionStyle == "absolute" || positionStyle == "relative")) {
      return parent;
    }
  }
  return null;
};
goog.style.getVisibleRectForElement = function(element) {
  var visibleRect = new goog.math.Box(0, Infinity, Infinity, 0);
  var dom = goog.dom.getDomHelper(element);
  var body = dom.getDocument().body;
  var documentElement = dom.getDocument().documentElement;
  var scrollEl = dom.getDocumentScrollElement();
  for (var el = element; el = goog.style.getOffsetParent(el);) {
    if ((!goog.userAgent.IE || el.clientWidth != 0) && (!goog.userAgent.WEBKIT || el.clientHeight != 0 || el != body) && (el != body && el != documentElement && goog.style.getStyle_(el, "overflow") != "visible")) {
      var pos = goog.style.getPageOffset(el);
      var client = goog.style.getClientLeftTop(el);
      pos.x += client.x;
      pos.y += client.y;
      visibleRect.top = Math.max(visibleRect.top, pos.y);
      visibleRect.right = Math.min(visibleRect.right, pos.x + el.clientWidth);
      visibleRect.bottom = Math.min(visibleRect.bottom, pos.y + el.clientHeight);
      visibleRect.left = Math.max(visibleRect.left, pos.x);
    }
  }
  var scrollX = scrollEl.scrollLeft, scrollY = scrollEl.scrollTop;
  visibleRect.left = Math.max(visibleRect.left, scrollX);
  visibleRect.top = Math.max(visibleRect.top, scrollY);
  var winSize = dom.getViewportSize();
  visibleRect.right = Math.min(visibleRect.right, scrollX + winSize.width);
  visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + winSize.height);
  return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null;
};
goog.style.getContainerOffsetToScrollInto = function(element, opt_container, opt_center) {
  var container = opt_container || goog.dom.getDocumentScrollElement();
  var elementPos = goog.style.getPageOffset(element);
  var containerPos = goog.style.getPageOffset(container);
  var containerBorder = goog.style.getBorderBox(container);
  if (container == goog.dom.getDocumentScrollElement()) {
    var relX = elementPos.x - container.scrollLeft;
    var relY = elementPos.y - container.scrollTop;
    if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(10)) {
      relX += containerBorder.left;
      relY += containerBorder.top;
    }
  } else {
    var relX = elementPos.x - containerPos.x - containerBorder.left;
    var relY = elementPos.y - containerPos.y - containerBorder.top;
  }
  var elementSize = goog.style.getSizeWithDisplay_(element);
  var spaceX = container.clientWidth - elementSize.width;
  var spaceY = container.clientHeight - elementSize.height;
  var scrollLeft = container.scrollLeft;
  var scrollTop = container.scrollTop;
  if (opt_center) {
    scrollLeft += relX - spaceX / 2;
    scrollTop += relY - spaceY / 2;
  } else {
    scrollLeft += Math.min(relX, Math.max(relX - spaceX, 0));
    scrollTop += Math.min(relY, Math.max(relY - spaceY, 0));
  }
  return new goog.math.Coordinate(scrollLeft, scrollTop);
};
goog.style.scrollIntoContainerView = function(element, opt_container, opt_center) {
  var container = opt_container || goog.dom.getDocumentScrollElement();
  var offset = goog.style.getContainerOffsetToScrollInto(element, container, opt_center);
  container.scrollLeft = offset.x;
  container.scrollTop = offset.y;
};
goog.style.getClientLeftTop = function(el) {
  return new goog.math.Coordinate(el.clientLeft, el.clientTop);
};
goog.style.getPageOffset = function(el) {
  var doc = goog.dom.getOwnerDocument(el);
  goog.asserts.assertObject(el, "Parameter is required");
  var pos = new goog.math.Coordinate(0, 0);
  var viewportElement = goog.style.getClientViewportElement(doc);
  if (el == viewportElement) {
    return pos;
  }
  var box = goog.style.getBoundingClientRect_(el);
  var scrollCoord = goog.dom.getDomHelper(doc).getDocumentScroll();
  pos.x = box.left + scrollCoord.x;
  pos.y = box.top + scrollCoord.y;
  return pos;
};
goog.style.getPageOffsetLeft = function(el) {
  return goog.style.getPageOffset(el).x;
};
goog.style.getPageOffsetTop = function(el) {
  return goog.style.getPageOffset(el).y;
};
goog.style.getFramedPageOffset = function(el, relativeWin) {
  var position = new goog.math.Coordinate(0, 0);
  var currentWin = goog.dom.getWindow(goog.dom.getOwnerDocument(el));
  if (!goog.reflect.canAccessProperty(currentWin, "parent")) {
    return position;
  }
  var currentEl = el;
  do {
    var offset = currentWin == relativeWin ? goog.style.getPageOffset(currentEl) : goog.style.getClientPositionForElement_(goog.asserts.assert(currentEl));
    position.x += offset.x;
    position.y += offset.y;
  } while (currentWin && currentWin != relativeWin && currentWin != currentWin.parent && (currentEl = currentWin.frameElement) && (currentWin = currentWin.parent));
  return position;
};
goog.style.translateRectForAnotherFrame = function(rect, origBase, newBase) {
  if (origBase.getDocument() != newBase.getDocument()) {
    var body = origBase.getDocument().body;
    var pos = goog.style.getFramedPageOffset(body, newBase.getWindow());
    pos = goog.math.Coordinate.difference(pos, goog.style.getPageOffset(body));
    if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9) && !origBase.isCss1CompatMode()) {
      pos = goog.math.Coordinate.difference(pos, origBase.getDocumentScroll());
    }
    rect.left += pos.x;
    rect.top += pos.y;
  }
};
goog.style.getRelativePosition = function(a, b) {
  var ap = goog.style.getClientPosition(a);
  var bp = goog.style.getClientPosition(b);
  return new goog.math.Coordinate(ap.x - bp.x, ap.y - bp.y);
};
goog.style.getClientPositionForElement_ = function(el) {
  var box = goog.style.getBoundingClientRect_(el);
  return new goog.math.Coordinate(box.left, box.top);
};
goog.style.getClientPosition = function(el) {
  goog.asserts.assert(el);
  if (el.nodeType == goog.dom.NodeType.ELEMENT) {
    return goog.style.getClientPositionForElement_(el);
  } else {
    var targetEvent = el.changedTouches ? el.changedTouches[0] : el;
    return new goog.math.Coordinate(targetEvent.clientX, targetEvent.clientY);
  }
};
goog.style.setPageOffset = function(el, x, opt_y) {
  var cur = goog.style.getPageOffset(el);
  if (x instanceof goog.math.Coordinate) {
    opt_y = x.y;
    x = x.x;
  }
  var dx = goog.asserts.assertNumber(x) - cur.x;
  var dy = Number(opt_y) - cur.y;
  goog.style.setPosition(el, el.offsetLeft + dx, el.offsetTop + dy);
};
goog.style.setSize = function(element, w, opt_h) {
  var h;
  if (w instanceof goog.math.Size) {
    h = w.height;
    w = w.width;
  } else {
    if (opt_h == undefined) {
      throw Error("missing height argument");
    }
    h = opt_h;
  }
  goog.style.setWidth(element, w);
  goog.style.setHeight(element, h);
};
goog.style.getPixelStyleValue_ = function(value, round) {
  if (typeof value == "number") {
    value = (round ? Math.round(value) : value) + "px";
  }
  return value;
};
goog.style.setHeight = function(element, height) {
  element.style.height = goog.style.getPixelStyleValue_(height, true);
};
goog.style.setWidth = function(element, width) {
  element.style.width = goog.style.getPixelStyleValue_(width, true);
};
goog.style.getSize = function(element) {
  return goog.style.evaluateWithTemporaryDisplay_(goog.style.getSizeWithDisplay_, element);
};
goog.style.evaluateWithTemporaryDisplay_ = function(fn, element) {
  if (goog.style.getStyle_(element, "display") != "none") {
    return fn(element);
  }
  var style = element.style;
  var originalDisplay = style.display;
  var originalVisibility = style.visibility;
  var originalPosition = style.position;
  style.visibility = "hidden";
  style.position = "absolute";
  style.display = "inline";
  var retVal = fn(element);
  style.display = originalDisplay;
  style.position = originalPosition;
  style.visibility = originalVisibility;
  return retVal;
};
goog.style.getSizeWithDisplay_ = function(element) {
  var offsetWidth = element.offsetWidth;
  var offsetHeight = element.offsetHeight;
  var webkitOffsetsZero = goog.userAgent.WEBKIT && !offsetWidth && !offsetHeight;
  if ((!goog.isDef(offsetWidth) || webkitOffsetsZero) && element.getBoundingClientRect) {
    var clientRect = goog.style.getBoundingClientRect_(element);
    return new goog.math.Size(clientRect.right - clientRect.left, clientRect.bottom - clientRect.top);
  }
  return new goog.math.Size(offsetWidth, offsetHeight);
};
goog.style.getTransformedSize = function(element) {
  if (!element.getBoundingClientRect) {
    return null;
  }
  var clientRect = goog.style.evaluateWithTemporaryDisplay_(goog.style.getBoundingClientRect_, element);
  return new goog.math.Size(clientRect.right - clientRect.left, clientRect.bottom - clientRect.top);
};
goog.style.getBounds = function(element) {
  var o = goog.style.getPageOffset(element);
  var s = goog.style.getSize(element);
  return new goog.math.Rect(o.x, o.y, s.width, s.height);
};
goog.style.toCamelCase = function(selector) {
  return goog.string.toCamelCase(String(selector));
};
goog.style.toSelectorCase = function(selector) {
  return goog.string.toSelectorCase(selector);
};
goog.style.getOpacity = function(el) {
  goog.asserts.assert(el);
  var style = el.style;
  var result = "";
  if ("opacity" in style) {
    result = style.opacity;
  } else {
    if ("MozOpacity" in style) {
      result = style.MozOpacity;
    } else {
      if ("filter" in style) {
        var match = style.filter.match(/alpha\(opacity=([\d.]+)\)/);
        if (match) {
          result = String(match[1] / 100);
        }
      }
    }
  }
  return result == "" ? result : Number(result);
};
goog.style.setOpacity = function(el, alpha) {
  goog.asserts.assert(el);
  var style = el.style;
  if ("opacity" in style) {
    style.opacity = alpha;
  } else {
    if ("MozOpacity" in style) {
      style.MozOpacity = alpha;
    } else {
      if ("filter" in style) {
        if (alpha === "") {
          style.filter = "";
        } else {
          style.filter = "alpha(opacity=" + Number(alpha) * 100 + ")";
        }
      }
    }
  }
};
goog.style.setTransparentBackgroundImage = function(el, src) {
  var style = el.style;
  if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("8")) {
    style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(" + 'src="' + src + '", sizingMethod="crop")';
  } else {
    style.backgroundImage = "url(" + src + ")";
    style.backgroundPosition = "top left";
    style.backgroundRepeat = "no-repeat";
  }
};
goog.style.clearTransparentBackgroundImage = function(el) {
  var style = el.style;
  if ("filter" in style) {
    style.filter = "";
  } else {
    style.backgroundImage = "none";
  }
};
goog.style.showElement = function(el, display) {
  goog.style.setElementShown(el, display);
};
goog.style.setElementShown = function(el, isShown) {
  el.style.display = isShown ? "" : "none";
};
goog.style.isElementShown = function(el) {
  return el.style.display != "none";
};
goog.style.installStyles = function(stylesString, opt_node) {
  return goog.style.installSafeStyleSheet(goog.html.legacyconversions.safeStyleSheetFromString(stylesString), opt_node);
};
goog.style.installSafeStyleSheet = function(safeStyleSheet, opt_node) {
  var dh = goog.dom.getDomHelper(opt_node);
  var styleSheet = null;
  var doc = dh.getDocument();
  if (goog.userAgent.IE && doc.createStyleSheet) {
    styleSheet = doc.createStyleSheet();
    goog.style.setSafeStyleSheet(styleSheet, safeStyleSheet);
  } else {
    var head = dh.getElementsByTagNameAndClass(goog.dom.TagName.HEAD)[0];
    if (!head) {
      var body = dh.getElementsByTagNameAndClass(goog.dom.TagName.BODY)[0];
      head = dh.createDom(goog.dom.TagName.HEAD);
      body.parentNode.insertBefore(head, body);
    }
    styleSheet = dh.createDom(goog.dom.TagName.STYLE);
    goog.style.setSafeStyleSheet(styleSheet, safeStyleSheet);
    dh.appendChild(head, styleSheet);
  }
  return styleSheet;
};
goog.style.uninstallStyles = function(styleSheet) {
  var node = styleSheet.ownerNode || styleSheet.owningElement || styleSheet;
  goog.dom.removeNode(node);
};
goog.style.setStyles = function(element, stylesString) {
  goog.style.setSafeStyleSheet(element, goog.html.legacyconversions.safeStyleSheetFromString(stylesString));
};
goog.style.setSafeStyleSheet = function(element, safeStyleSheet) {
  var stylesString = goog.html.SafeStyleSheet.unwrap(safeStyleSheet);
  if (goog.userAgent.IE && goog.isDef(element.cssText)) {
    element.cssText = stylesString;
  } else {
    element.innerHTML = stylesString;
  }
};
goog.style.setPreWrap = function(el) {
  var style = el.style;
  if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("8")) {
    style.whiteSpace = "pre";
    style.wordWrap = "break-word";
  } else {
    if (goog.userAgent.GECKO) {
      style.whiteSpace = "-moz-pre-wrap";
    } else {
      style.whiteSpace = "pre-wrap";
    }
  }
};
goog.style.setInlineBlock = function(el) {
  var style = el.style;
  style.position = "relative";
  if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("8")) {
    style.zoom = "1";
    style.display = "inline";
  } else {
    style.display = "inline-block";
  }
};
goog.style.isRightToLeft = function(el) {
  return "rtl" == goog.style.getStyle_(el, "direction");
};
goog.style.unselectableStyle_ = goog.userAgent.GECKO ? "MozUserSelect" : goog.userAgent.WEBKIT || goog.userAgent.EDGE ? "WebkitUserSelect" : null;
goog.style.isUnselectable = function(el) {
  if (goog.style.unselectableStyle_) {
    return el.style[goog.style.unselectableStyle_].toLowerCase() == "none";
  } else {
    if (goog.userAgent.IE || goog.userAgent.OPERA) {
      return el.getAttribute("unselectable") == "on";
    }
  }
  return false;
};
goog.style.setUnselectable = function(el, unselectable, opt_noRecurse) {
  var descendants = !opt_noRecurse ? el.getElementsByTagName("*") : null;
  var name = goog.style.unselectableStyle_;
  if (name) {
    var value = unselectable ? "none" : "";
    if (el.style) {
      el.style[name] = value;
    }
    if (descendants) {
      for (var i = 0, descendant; descendant = descendants[i]; i++) {
        if (descendant.style) {
          descendant.style[name] = value;
        }
      }
    }
  } else {
    if (goog.userAgent.IE || goog.userAgent.OPERA) {
      var value = unselectable ? "on" : "";
      el.setAttribute("unselectable", value);
      if (descendants) {
        for (var i = 0, descendant; descendant = descendants[i]; i++) {
          descendant.setAttribute("unselectable", value);
        }
      }
    }
  }
};
goog.style.getBorderBoxSize = function(element) {
  return new goog.math.Size(element.offsetWidth, element.offsetHeight);
};
goog.style.setBorderBoxSize = function(element, size) {
  var doc = goog.dom.getOwnerDocument(element);
  var isCss1CompatMode = goog.dom.getDomHelper(doc).isCss1CompatMode();
  if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("10") && (!isCss1CompatMode || !goog.userAgent.isVersionOrHigher("8"))) {
    var style = element.style;
    if (isCss1CompatMode) {
      var paddingBox = goog.style.getPaddingBox(element);
      var borderBox = goog.style.getBorderBox(element);
      style.pixelWidth = size.width - borderBox.left - paddingBox.left - paddingBox.right - borderBox.right;
      style.pixelHeight = size.height - borderBox.top - paddingBox.top - paddingBox.bottom - borderBox.bottom;
    } else {
      style.pixelWidth = size.width;
      style.pixelHeight = size.height;
    }
  } else {
    goog.style.setBoxSizingSize_(element, size, "border-box");
  }
};
goog.style.getContentBoxSize = function(element) {
  var doc = goog.dom.getOwnerDocument(element);
  var ieCurrentStyle = goog.userAgent.IE && element.currentStyle;
  if (ieCurrentStyle && goog.dom.getDomHelper(doc).isCss1CompatMode() && ieCurrentStyle.width != "auto" && ieCurrentStyle.height != "auto" && !ieCurrentStyle.boxSizing) {
    var width = goog.style.getIePixelValue_(element, ieCurrentStyle.width, "width", "pixelWidth");
    var height = goog.style.getIePixelValue_(element, ieCurrentStyle.height, "height", "pixelHeight");
    return new goog.math.Size(width, height);
  } else {
    var borderBoxSize = goog.style.getBorderBoxSize(element);
    var paddingBox = goog.style.getPaddingBox(element);
    var borderBox = goog.style.getBorderBox(element);
    return new goog.math.Size(borderBoxSize.width - borderBox.left - paddingBox.left - paddingBox.right - borderBox.right, borderBoxSize.height - borderBox.top - paddingBox.top - paddingBox.bottom - borderBox.bottom);
  }
};
goog.style.setContentBoxSize = function(element, size) {
  var doc = goog.dom.getOwnerDocument(element);
  var isCss1CompatMode = goog.dom.getDomHelper(doc).isCss1CompatMode();
  if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("10") && (!isCss1CompatMode || !goog.userAgent.isVersionOrHigher("8"))) {
    var style = element.style;
    if (isCss1CompatMode) {
      style.pixelWidth = size.width;
      style.pixelHeight = size.height;
    } else {
      var paddingBox = goog.style.getPaddingBox(element);
      var borderBox = goog.style.getBorderBox(element);
      style.pixelWidth = size.width + borderBox.left + paddingBox.left + paddingBox.right + borderBox.right;
      style.pixelHeight = size.height + borderBox.top + paddingBox.top + paddingBox.bottom + borderBox.bottom;
    }
  } else {
    goog.style.setBoxSizingSize_(element, size, "content-box");
  }
};
goog.style.setBoxSizingSize_ = function(element, size, boxSizing) {
  var style = element.style;
  if (goog.userAgent.GECKO) {
    style.MozBoxSizing = boxSizing;
  } else {
    if (goog.userAgent.WEBKIT) {
      style.WebkitBoxSizing = boxSizing;
    } else {
      style.boxSizing = boxSizing;
    }
  }
  style.width = Math.max(size.width, 0) + "px";
  style.height = Math.max(size.height, 0) + "px";
};
goog.style.getIePixelValue_ = function(element, value, name, pixelName) {
  if (/^\d+px?$/.test(value)) {
    return parseInt(value, 10);
  } else {
    var oldStyleValue = element.style[name];
    var oldRuntimeValue = element.runtimeStyle[name];
    element.runtimeStyle[name] = element.currentStyle[name];
    element.style[name] = value;
    var pixelValue = element.style[pixelName];
    element.style[name] = oldStyleValue;
    element.runtimeStyle[name] = oldRuntimeValue;
    return +pixelValue;
  }
};
goog.style.getIePixelDistance_ = function(element, propName) {
  var value = goog.style.getCascadedStyle(element, propName);
  return value ? goog.style.getIePixelValue_(element, value, "left", "pixelLeft") : 0;
};
goog.style.getBox_ = function(element, stylePrefix) {
  if (goog.userAgent.IE) {
    var left = goog.style.getIePixelDistance_(element, stylePrefix + "Left");
    var right = goog.style.getIePixelDistance_(element, stylePrefix + "Right");
    var top = goog.style.getIePixelDistance_(element, stylePrefix + "Top");
    var bottom = goog.style.getIePixelDistance_(element, stylePrefix + "Bottom");
    return new goog.math.Box(top, right, bottom, left);
  } else {
    var left = goog.style.getComputedStyle(element, stylePrefix + "Left");
    var right = goog.style.getComputedStyle(element, stylePrefix + "Right");
    var top = goog.style.getComputedStyle(element, stylePrefix + "Top");
    var bottom = goog.style.getComputedStyle(element, stylePrefix + "Bottom");
    return new goog.math.Box(parseFloat(top), parseFloat(right), parseFloat(bottom), parseFloat(left));
  }
};
goog.style.getPaddingBox = function(element) {
  return goog.style.getBox_(element, "padding");
};
goog.style.getMarginBox = function(element) {
  return goog.style.getBox_(element, "margin");
};
goog.style.ieBorderWidthKeywords_ = {"thin":2, "medium":4, "thick":6};
goog.style.getIePixelBorder_ = function(element, prop) {
  if (goog.style.getCascadedStyle(element, prop + "Style") == "none") {
    return 0;
  }
  var width = goog.style.getCascadedStyle(element, prop + "Width");
  if (width in goog.style.ieBorderWidthKeywords_) {
    return goog.style.ieBorderWidthKeywords_[width];
  }
  return goog.style.getIePixelValue_(element, width, "left", "pixelLeft");
};
goog.style.getBorderBox = function(element) {
  if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) {
    var left = goog.style.getIePixelBorder_(element, "borderLeft");
    var right = goog.style.getIePixelBorder_(element, "borderRight");
    var top = goog.style.getIePixelBorder_(element, "borderTop");
    var bottom = goog.style.getIePixelBorder_(element, "borderBottom");
    return new goog.math.Box(top, right, bottom, left);
  } else {
    var left = goog.style.getComputedStyle(element, "borderLeftWidth");
    var right = goog.style.getComputedStyle(element, "borderRightWidth");
    var top = goog.style.getComputedStyle(element, "borderTopWidth");
    var bottom = goog.style.getComputedStyle(element, "borderBottomWidth");
    return new goog.math.Box(parseFloat(top), parseFloat(right), parseFloat(bottom), parseFloat(left));
  }
};
goog.style.getFontFamily = function(el) {
  var doc = goog.dom.getOwnerDocument(el);
  var font = "";
  if (doc.body.createTextRange && goog.dom.contains(doc, el)) {
    var range = doc.body.createTextRange();
    range.moveToElementText(el);
    try {
      font = range.queryCommandValue("FontName");
    } catch (e) {
      font = "";
    }
  }
  if (!font) {
    font = goog.style.getStyle_(el, "fontFamily");
  }
  var fontsArray = font.split(",");
  if (fontsArray.length > 1) {
    font = fontsArray[0];
  }
  return goog.string.stripQuotes(font, "\"'");
};
goog.style.lengthUnitRegex_ = /[^\d]+$/;
goog.style.getLengthUnits = function(value) {
  var units = value.match(goog.style.lengthUnitRegex_);
  return units && units[0] || null;
};
goog.style.ABSOLUTE_CSS_LENGTH_UNITS_ = {"cm":1, "in":1, "mm":1, "pc":1, "pt":1};
goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_ = {"em":1, "ex":1};
goog.style.getFontSize = function(el) {
  var fontSize = goog.style.getStyle_(el, "fontSize");
  var sizeUnits = goog.style.getLengthUnits(fontSize);
  if (fontSize && "px" == sizeUnits) {
    return parseInt(fontSize, 10);
  }
  if (goog.userAgent.IE) {
    if (String(sizeUnits) in goog.style.ABSOLUTE_CSS_LENGTH_UNITS_) {
      return goog.style.getIePixelValue_(el, fontSize, "left", "pixelLeft");
    } else {
      if (el.parentNode && el.parentNode.nodeType == goog.dom.NodeType.ELEMENT && String(sizeUnits) in goog.style.CONVERTIBLE_RELATIVE_CSS_UNITS_) {
        var parentElement = el.parentNode;
        var parentSize = goog.style.getStyle_(parentElement, "fontSize");
        return goog.style.getIePixelValue_(parentElement, fontSize == parentSize ? "1em" : fontSize, "left", "pixelLeft");
      }
    }
  }
  var sizeElement = goog.dom.createDom(goog.dom.TagName.SPAN, {"style":"visibility:hidden;position:absolute;" + "line-height:0;padding:0;margin:0;border:0;height:1em;"});
  goog.dom.appendChild(el, sizeElement);
  fontSize = sizeElement.offsetHeight;
  goog.dom.removeNode(sizeElement);
  return fontSize;
};
goog.style.parseStyleAttribute = function(value) {
  var result = {};
  goog.array.forEach(value.split(/\s*;\s*/), function(pair) {
    var keyValue = pair.match(/\s*([\w-]+)\s*\:(.+)/);
    if (keyValue) {
      var styleName = keyValue[1];
      var styleValue = goog.string.trim(keyValue[2]);
      result[goog.string.toCamelCase(styleName.toLowerCase())] = styleValue;
    }
  });
  return result;
};
goog.style.toStyleAttribute = function(obj) {
  var buffer = [];
  goog.object.forEach(obj, function(value, key) {
    buffer.push(goog.string.toSelectorCase(key), ":", value, ";");
  });
  return buffer.join("");
};
goog.style.setFloat = function(el, value) {
  el.style[goog.userAgent.IE ? "styleFloat" : "cssFloat"] = value;
};
goog.style.getFloat = function(el) {
  return el.style[goog.userAgent.IE ? "styleFloat" : "cssFloat"] || "";
};
goog.style.getScrollbarWidth = function(opt_className) {
  var outerDiv = goog.dom.createElement(goog.dom.TagName.DIV);
  if (opt_className) {
    outerDiv.className = opt_className;
  }
  outerDiv.style.cssText = "overflow:auto;" + "position:absolute;top:0;width:100px;height:100px";
  var innerDiv = goog.dom.createElement(goog.dom.TagName.DIV);
  goog.style.setSize(innerDiv, "200px", "200px");
  outerDiv.appendChild(innerDiv);
  goog.dom.appendChild(goog.dom.getDocument().body, outerDiv);
  var width = outerDiv.offsetWidth - outerDiv.clientWidth;
  goog.dom.removeNode(outerDiv);
  return width;
};
goog.style.MATRIX_TRANSLATION_REGEX_ = new RegExp("matrix\\([0-9\\.\\-]+, [0-9\\.\\-]+, " + "[0-9\\.\\-]+, [0-9\\.\\-]+, " + "([0-9\\.\\-]+)p?x?, ([0-9\\.\\-]+)p?x?\\)");
goog.style.getCssTranslation = function(element) {
  var transform = goog.style.getComputedTransform(element);
  if (!transform) {
    return new goog.math.Coordinate(0, 0);
  }
  var matches = transform.match(goog.style.MATRIX_TRANSLATION_REGEX_);
  if (!matches) {
    return new goog.math.Coordinate(0, 0);
  }
  return new goog.math.Coordinate(parseFloat(matches[1]), parseFloat(matches[2]));
};
goog.provide("goog.editor.Command");
goog.editor.Command = {UNDO:"+undo", REDO:"+redo", LINK:"+link", FORMAT_BLOCK:"+formatBlock", INDENT:"+indent", OUTDENT:"+outdent", REMOVE_FORMAT:"+removeFormat", STRIKE_THROUGH:"+strikeThrough", HORIZONTAL_RULE:"+insertHorizontalRule", SUBSCRIPT:"+subscript", SUPERSCRIPT:"+superscript", UNDERLINE:"+underline", BOLD:"+bold", ITALIC:"+italic", FONT_SIZE:"+fontSize", FONT_FACE:"+fontName", FONT_COLOR:"+foreColor", EMOTICON:"+emoticon", EQUATION:"+equation", BACKGROUND_COLOR:"+backColor", ORDERED_LIST:"+insertOrderedList", 
UNORDERED_LIST:"+insertUnorderedList", TABLE:"+table", JUSTIFY_CENTER:"+justifyCenter", JUSTIFY_FULL:"+justifyFull", JUSTIFY_RIGHT:"+justifyRight", JUSTIFY_LEFT:"+justifyLeft", BLOCKQUOTE:"+BLOCKQUOTE", DIR_LTR:"ltr", DIR_RTL:"rtl", IMAGE:"image", EDIT_HTML:"editHtml", UPDATE_LINK_BUBBLE:"updateLinkBubble", DEFAULT_TAG:"+defaultTag", CLEAR_LOREM:"clearlorem", UPDATE_LOREM:"updatelorem", USING_LOREM:"usinglorem", MODAL_LINK_EDITOR:"link"};
goog.provide("goog.debug.EntryPointMonitor");
goog.provide("goog.debug.entryPointRegistry");
goog.require("goog.asserts");
goog.debug.EntryPointMonitor = function() {
};
goog.debug.EntryPointMonitor.prototype.wrap;
goog.debug.EntryPointMonitor.prototype.unwrap;
goog.debug.entryPointRegistry.refList_ = [];
goog.debug.entryPointRegistry.monitors_ = [];
goog.debug.entryPointRegistry.monitorsMayExist_ = false;
goog.debug.entryPointRegistry.register = function(callback) {
  goog.debug.entryPointRegistry.refList_[goog.debug.entryPointRegistry.refList_.length] = callback;
  if (goog.debug.entryPointRegistry.monitorsMayExist_) {
    var monitors = goog.debug.entryPointRegistry.monitors_;
    for (var i = 0; i < monitors.length; i++) {
      callback(goog.bind(monitors[i].wrap, monitors[i]));
    }
  }
};
goog.debug.entryPointRegistry.monitorAll = function(monitor) {
  goog.debug.entryPointRegistry.monitorsMayExist_ = true;
  var transformer = goog.bind(monitor.wrap, monitor);
  for (var i = 0; i < goog.debug.entryPointRegistry.refList_.length; i++) {
    goog.debug.entryPointRegistry.refList_[i](transformer);
  }
  goog.debug.entryPointRegistry.monitors_.push(monitor);
};
goog.debug.entryPointRegistry.unmonitorAllIfPossible = function(monitor) {
  var monitors = goog.debug.entryPointRegistry.monitors_;
  goog.asserts.assert(monitor == monitors[monitors.length - 1], "Only the most recent monitor can be unwrapped.");
  var transformer = goog.bind(monitor.unwrap, monitor);
  for (var i = 0; i < goog.debug.entryPointRegistry.refList_.length; i++) {
    goog.debug.entryPointRegistry.refList_[i](transformer);
  }
  monitors.length--;
};
goog.provide("goog.events.BrowserFeature");
goog.require("goog.userAgent");
goog.events.BrowserFeature = {HAS_W3C_BUTTON:!goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9), HAS_W3C_EVENT_SUPPORT:!goog.userAgent.IE || goog.userAgent.isDocumentModeOrHigher(9), SET_KEY_CODE_TO_PREVENT_DEFAULT:goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9"), HAS_NAVIGATOR_ONLINE_PROPERTY:!goog.userAgent.WEBKIT || goog.userAgent.isVersionOrHigher("528"), HAS_HTML5_NETWORK_EVENT_SUPPORT:goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("1.9b") || goog.userAgent.IE && 
goog.userAgent.isVersionOrHigher("8") || goog.userAgent.OPERA && goog.userAgent.isVersionOrHigher("9.5") || goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher("528"), HTML5_NETWORK_EVENTS_FIRE_ON_BODY:goog.userAgent.GECKO && !goog.userAgent.isVersionOrHigher("8") || goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9"), TOUCH_ENABLED:"ontouchstart" in goog.global || !!(goog.global["document"] && document.documentElement && "ontouchstart" in document.documentElement) || !!(goog.global["navigator"] && 
goog.global["navigator"]["msMaxTouchPoints"])};
goog.provide("goog.disposable.IDisposable");
goog.disposable.IDisposable = function() {
};
goog.disposable.IDisposable.prototype.dispose = goog.abstractMethod;
goog.disposable.IDisposable.prototype.isDisposed = goog.abstractMethod;
goog.provide("goog.Disposable");
goog.provide("goog.dispose");
goog.provide("goog.disposeAll");
goog.require("goog.disposable.IDisposable");
goog.Disposable = function() {
  this.creationStack;
  if (goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF) {
    if (goog.Disposable.INCLUDE_STACK_ON_CREATION) {
      this.creationStack = (new Error).stack;
    }
    goog.Disposable.instances_[goog.getUid(this)] = this;
  }
  this.disposed_ = this.disposed_;
  this.onDisposeCallbacks_ = this.onDisposeCallbacks_;
};
goog.Disposable.MonitoringMode = {OFF:0, PERMANENT:1, INTERACTIVE:2};
goog.define("goog.Disposable.MONITORING_MODE", 0);
goog.define("goog.Disposable.INCLUDE_STACK_ON_CREATION", true);
goog.Disposable.instances_ = {};
goog.Disposable.getUndisposedObjects = function() {
  var ret = [];
  for (var id in goog.Disposable.instances_) {
    if (goog.Disposable.instances_.hasOwnProperty(id)) {
      ret.push(goog.Disposable.instances_[Number(id)]);
    }
  }
  return ret;
};
goog.Disposable.clearUndisposedObjects = function() {
  goog.Disposable.instances_ = {};
};
goog.Disposable.prototype.disposed_ = false;
goog.Disposable.prototype.onDisposeCallbacks_;
goog.Disposable.prototype.isDisposed = function() {
  return this.disposed_;
};
goog.Disposable.prototype.getDisposed = goog.Disposable.prototype.isDisposed;
goog.Disposable.prototype.dispose = function() {
  if (!this.disposed_) {
    this.disposed_ = true;
    this.disposeInternal();
    if (goog.Disposable.MONITORING_MODE != goog.Disposable.MonitoringMode.OFF) {
      var uid = goog.getUid(this);
      if (goog.Disposable.MONITORING_MODE == goog.Disposable.MonitoringMode.PERMANENT && !goog.Disposable.instances_.hasOwnProperty(uid)) {
        throw Error(this + " did not call the goog.Disposable base " + "constructor or was disposed of after a clearUndisposedObjects " + "call");
      }
      delete goog.Disposable.instances_[uid];
    }
  }
};
goog.Disposable.prototype.registerDisposable = function(disposable) {
  this.addOnDisposeCallback(goog.partial(goog.dispose, disposable));
};
goog.Disposable.prototype.addOnDisposeCallback = function(callback, opt_scope) {
  if (this.disposed_) {
    goog.isDef(opt_scope) ? callback.call(opt_scope) : callback();
    return;
  }
  if (!this.onDisposeCallbacks_) {
    this.onDisposeCallbacks_ = [];
  }
  this.onDisposeCallbacks_.push(goog.isDef(opt_scope) ? goog.bind(callback, opt_scope) : callback);
};
goog.Disposable.prototype.disposeInternal = function() {
  if (this.onDisposeCallbacks_) {
    while (this.onDisposeCallbacks_.length) {
      this.onDisposeCallbacks_.shift()();
    }
  }
};
goog.Disposable.isDisposed = function(obj) {
  if (obj && typeof obj.isDisposed == "function") {
    return obj.isDisposed();
  }
  return false;
};
goog.dispose = function(obj) {
  if (obj && typeof obj.dispose == "function") {
    obj.dispose();
  }
};
goog.disposeAll = function(var_args) {
  for (var i = 0, len = arguments.length; i < len; ++i) {
    var disposable = arguments[i];
    if (goog.isArrayLike(disposable)) {
      goog.disposeAll.apply(null, disposable);
    } else {
      goog.dispose(disposable);
    }
  }
};
goog.provide("goog.events.EventId");
goog.events.EventId = function(eventId) {
  this.id = eventId;
};
goog.events.EventId.prototype.toString = function() {
  return this.id;
};
goog.provide("goog.events.Event");
goog.provide("goog.events.EventLike");
goog.require("goog.Disposable");
goog.require("goog.events.EventId");
goog.events.EventLike;
goog.events.Event = function(type, opt_target) {
  this.type = type instanceof goog.events.EventId ? String(type) : type;
  this.target = opt_target;
  this.currentTarget = this.target;
  this.propagationStopped_ = false;
  this.defaultPrevented = false;
  this.returnValue_ = true;
};
goog.events.Event.prototype.stopPropagation = function() {
  this.propagationStopped_ = true;
};
goog.events.Event.prototype.preventDefault = function() {
  this.defaultPrevented = true;
  this.returnValue_ = false;
};
goog.events.Event.stopPropagation = function(e) {
  e.stopPropagation();
};
goog.events.Event.preventDefault = function(e) {
  e.preventDefault();
};
goog.provide("goog.events.EventType");
goog.require("goog.userAgent");
goog.events.getVendorPrefixedName_ = function(eventName) {
  return goog.userAgent.WEBKIT ? "webkit" + eventName : goog.userAgent.OPERA ? "o" + eventName.toLowerCase() : eventName.toLowerCase();
};
goog.events.EventType = {CLICK:"click", RIGHTCLICK:"rightclick", DBLCLICK:"dblclick", MOUSEDOWN:"mousedown", MOUSEUP:"mouseup", MOUSEOVER:"mouseover", MOUSEOUT:"mouseout", MOUSEMOVE:"mousemove", MOUSEENTER:"mouseenter", MOUSELEAVE:"mouseleave", SELECTIONCHANGE:"selectionchange", SELECTSTART:"selectstart", WHEEL:"wheel", KEYPRESS:"keypress", KEYDOWN:"keydown", KEYUP:"keyup", BLUR:"blur", FOCUS:"focus", DEACTIVATE:"deactivate", FOCUSIN:goog.userAgent.IE ? "focusin" : "DOMFocusIn", FOCUSOUT:goog.userAgent.IE ? 
"focusout" : "DOMFocusOut", CHANGE:"change", RESET:"reset", SELECT:"select", SUBMIT:"submit", INPUT:"input", PROPERTYCHANGE:"propertychange", DRAGSTART:"dragstart", DRAG:"drag", DRAGENTER:"dragenter", DRAGOVER:"dragover", DRAGLEAVE:"dragleave", DROP:"drop", DRAGEND:"dragend", TOUCHSTART:"touchstart", TOUCHMOVE:"touchmove", TOUCHEND:"touchend", TOUCHCANCEL:"touchcancel", BEFOREUNLOAD:"beforeunload", CONSOLEMESSAGE:"consolemessage", CONTEXTMENU:"contextmenu", DEVICEMOTION:"devicemotion", DEVICEORIENTATION:"deviceorientation", 
DOMCONTENTLOADED:"DOMContentLoaded", ERROR:"error", HELP:"help", LOAD:"load", LOSECAPTURE:"losecapture", ORIENTATIONCHANGE:"orientationchange", READYSTATECHANGE:"readystatechange", RESIZE:"resize", SCROLL:"scroll", UNLOAD:"unload", CANPLAY:"canplay", CANPLAYTHROUGH:"canplaythrough", DURATIONCHANGE:"durationchange", EMPTIED:"emptied", ENDED:"ended", LOADEDDATA:"loadeddata", LOADEDMETADATA:"loadedmetadata", PAUSE:"pause", PLAY:"play", PLAYING:"playing", RATECHANGE:"ratechange", SEEKED:"seeked", SEEKING:"seeking", 
STALLED:"stalled", SUSPEND:"suspend", TIMEUPDATE:"timeupdate", VOLUMECHANGE:"volumechange", WAITING:"waiting", SOURCEOPEN:"sourceopen", SOURCEENDED:"sourceended", SOURCECLOSED:"sourceclosed", ABORT:"abort", UPDATE:"update", UPDATESTART:"updatestart", UPDATEEND:"updateend", HASHCHANGE:"hashchange", PAGEHIDE:"pagehide", PAGESHOW:"pageshow", POPSTATE:"popstate", COPY:"copy", PASTE:"paste", CUT:"cut", BEFORECOPY:"beforecopy", BEFORECUT:"beforecut", BEFOREPASTE:"beforepaste", ONLINE:"online", OFFLINE:"offline", 
MESSAGE:"message", CONNECT:"connect", INSTALL:"install", ACTIVATE:"activate", FETCH:"fetch", FOREIGNFETCH:"foreignfetch", MESSAGEERROR:"messageerror", STATECHANGE:"statechange", UPDATEFOUND:"updatefound", CONTROLLERCHANGE:"controllerchange", ANIMATIONSTART:goog.events.getVendorPrefixedName_("AnimationStart"), ANIMATIONEND:goog.events.getVendorPrefixedName_("AnimationEnd"), ANIMATIONITERATION:goog.events.getVendorPrefixedName_("AnimationIteration"), TRANSITIONEND:goog.events.getVendorPrefixedName_("TransitionEnd"), 
POINTERDOWN:"pointerdown", POINTERUP:"pointerup", POINTERCANCEL:"pointercancel", POINTERMOVE:"pointermove", POINTEROVER:"pointerover", POINTEROUT:"pointerout", POINTERENTER:"pointerenter", POINTERLEAVE:"pointerleave", GOTPOINTERCAPTURE:"gotpointercapture", LOSTPOINTERCAPTURE:"lostpointercapture", MSGESTURECHANGE:"MSGestureChange", MSGESTUREEND:"MSGestureEnd", MSGESTUREHOLD:"MSGestureHold", MSGESTURESTART:"MSGestureStart", MSGESTURETAP:"MSGestureTap", MSGOTPOINTERCAPTURE:"MSGotPointerCapture", MSINERTIASTART:"MSInertiaStart", 
MSLOSTPOINTERCAPTURE:"MSLostPointerCapture", MSPOINTERCANCEL:"MSPointerCancel", MSPOINTERDOWN:"MSPointerDown", MSPOINTERENTER:"MSPointerEnter", MSPOINTERHOVER:"MSPointerHover", MSPOINTERLEAVE:"MSPointerLeave", MSPOINTERMOVE:"MSPointerMove", MSPOINTEROUT:"MSPointerOut", MSPOINTEROVER:"MSPointerOver", MSPOINTERUP:"MSPointerUp", TEXT:"text", TEXTINPUT:goog.userAgent.IE ? "textinput" : "textInput", COMPOSITIONSTART:"compositionstart", COMPOSITIONUPDATE:"compositionupdate", COMPOSITIONEND:"compositionend", 
BEFOREINPUT:"beforeinput", EXIT:"exit", LOADABORT:"loadabort", LOADCOMMIT:"loadcommit", LOADREDIRECT:"loadredirect", LOADSTART:"loadstart", LOADSTOP:"loadstop", RESPONSIVE:"responsive", SIZECHANGED:"sizechanged", UNRESPONSIVE:"unresponsive", VISIBILITYCHANGE:"visibilitychange", STORAGE:"storage", DOMSUBTREEMODIFIED:"DOMSubtreeModified", DOMNODEINSERTED:"DOMNodeInserted", DOMNODEREMOVED:"DOMNodeRemoved", DOMNODEREMOVEDFROMDOCUMENT:"DOMNodeRemovedFromDocument", DOMNODEINSERTEDINTODOCUMENT:"DOMNodeInsertedIntoDocument", 
DOMATTRMODIFIED:"DOMAttrModified", DOMCHARACTERDATAMODIFIED:"DOMCharacterDataModified", BEFOREPRINT:"beforeprint", AFTERPRINT:"afterprint"};
goog.provide("goog.events.BrowserEvent");
goog.provide("goog.events.BrowserEvent.MouseButton");
goog.require("goog.events.BrowserFeature");
goog.require("goog.events.Event");
goog.require("goog.events.EventType");
goog.require("goog.reflect");
goog.require("goog.userAgent");
goog.events.BrowserEvent = function(opt_e, opt_currentTarget) {
  goog.events.BrowserEvent.base(this, "constructor", opt_e ? opt_e.type : "");
  this.target = null;
  this.currentTarget = null;
  this.relatedTarget = null;
  this.offsetX = 0;
  this.offsetY = 0;
  this.clientX = 0;
  this.clientY = 0;
  this.screenX = 0;
  this.screenY = 0;
  this.button = 0;
  this.key = "";
  this.keyCode = 0;
  this.charCode = 0;
  this.ctrlKey = false;
  this.altKey = false;
  this.shiftKey = false;
  this.metaKey = false;
  this.state = null;
  this.platformModifierKey = false;
  this.event_ = null;
  if (opt_e) {
    this.init(opt_e, opt_currentTarget);
  }
};
goog.inherits(goog.events.BrowserEvent, goog.events.Event);
goog.events.BrowserEvent.MouseButton = {LEFT:0, MIDDLE:1, RIGHT:2};
goog.events.BrowserEvent.IEButtonMap = [1, 4, 2];
goog.events.BrowserEvent.prototype.init = function(e, opt_currentTarget) {
  var type = this.type = e.type;
  var relevantTouch = e.changedTouches ? e.changedTouches[0] : null;
  this.target = e.target || e.srcElement;
  this.currentTarget = opt_currentTarget;
  var relatedTarget = e.relatedTarget;
  if (relatedTarget) {
    if (goog.userAgent.GECKO) {
      if (!goog.reflect.canAccessProperty(relatedTarget, "nodeName")) {
        relatedTarget = null;
      }
    }
  } else {
    if (type == goog.events.EventType.MOUSEOVER) {
      relatedTarget = e.fromElement;
    } else {
      if (type == goog.events.EventType.MOUSEOUT) {
        relatedTarget = e.toElement;
      }
    }
  }
  this.relatedTarget = relatedTarget;
  if (!goog.isNull(relevantTouch)) {
    this.clientX = relevantTouch.clientX !== undefined ? relevantTouch.clientX : relevantTouch.pageX;
    this.clientY = relevantTouch.clientY !== undefined ? relevantTouch.clientY : relevantTouch.pageY;
    this.screenX = relevantTouch.screenX || 0;
    this.screenY = relevantTouch.screenY || 0;
  } else {
    this.offsetX = goog.userAgent.WEBKIT || e.offsetX !== undefined ? e.offsetX : e.layerX;
    this.offsetY = goog.userAgent.WEBKIT || e.offsetY !== undefined ? e.offsetY : e.layerY;
    this.clientX = e.clientX !== undefined ? e.clientX : e.pageX;
    this.clientY = e.clientY !== undefined ? e.clientY : e.pageY;
    this.screenX = e.screenX || 0;
    this.screenY = e.screenY || 0;
  }
  this.button = e.button;
  this.keyCode = e.keyCode || 0;
  this.key = e.key || "";
  this.charCode = e.charCode || (type == "keypress" ? e.keyCode : 0);
  this.ctrlKey = e.ctrlKey;
  this.altKey = e.altKey;
  this.shiftKey = e.shiftKey;
  this.metaKey = e.metaKey;
  this.platformModifierKey = goog.userAgent.MAC ? e.metaKey : e.ctrlKey;
  this.state = e.state;
  this.event_ = e;
  if (e.defaultPrevented) {
    this.preventDefault();
  }
};
goog.events.BrowserEvent.prototype.isButton = function(button) {
  if (!goog.events.BrowserFeature.HAS_W3C_BUTTON) {
    if (this.type == "click") {
      return button == goog.events.BrowserEvent.MouseButton.LEFT;
    } else {
      return !!(this.event_.button & goog.events.BrowserEvent.IEButtonMap[button]);
    }
  } else {
    return this.event_.button == button;
  }
};
goog.events.BrowserEvent.prototype.isMouseActionButton = function() {
  return this.isButton(goog.events.BrowserEvent.MouseButton.LEFT) && !(goog.userAgent.WEBKIT && goog.userAgent.MAC && this.ctrlKey);
};
goog.events.BrowserEvent.prototype.stopPropagation = function() {
  goog.events.BrowserEvent.superClass_.stopPropagation.call(this);
  if (this.event_.stopPropagation) {
    this.event_.stopPropagation();
  } else {
    this.event_.cancelBubble = true;
  }
};
goog.events.BrowserEvent.prototype.preventDefault = function() {
  goog.events.BrowserEvent.superClass_.preventDefault.call(this);
  var be = this.event_;
  if (!be.preventDefault) {
    be.returnValue = false;
    if (goog.events.BrowserFeature.SET_KEY_CODE_TO_PREVENT_DEFAULT) {
      try {
        var VK_F1 = 112;
        var VK_F12 = 123;
        if (be.ctrlKey || be.keyCode >= VK_F1 && be.keyCode <= VK_F12) {
          be.keyCode = -1;
        }
      } catch (ex) {
      }
    }
  } else {
    be.preventDefault();
  }
};
goog.events.BrowserEvent.prototype.getBrowserEvent = function() {
  return this.event_;
};
goog.provide("goog.events.Listenable");
goog.provide("goog.events.ListenableKey");
goog.require("goog.events.EventId");
goog.forwardDeclare("goog.events.EventLike");
goog.forwardDeclare("goog.events.EventTarget");
goog.events.Listenable = function() {
};
goog.events.Listenable.IMPLEMENTED_BY_PROP = "closure_listenable_" + (Math.random() * 1e6 | 0);
goog.events.Listenable.addImplementation = function(cls) {
  cls.prototype[goog.events.Listenable.IMPLEMENTED_BY_PROP] = true;
};
goog.events.Listenable.isImplementedBy = function(obj) {
  return !!(obj && obj[goog.events.Listenable.IMPLEMENTED_BY_PROP]);
};
goog.events.Listenable.prototype.listen;
goog.events.Listenable.prototype.listenOnce;
goog.events.Listenable.prototype.unlisten;
goog.events.Listenable.prototype.unlistenByKey;
goog.events.Listenable.prototype.dispatchEvent;
goog.events.Listenable.prototype.removeAllListeners;
goog.events.Listenable.prototype.getParentEventTarget;
goog.events.Listenable.prototype.fireListeners;
goog.events.Listenable.prototype.getListeners;
goog.events.Listenable.prototype.getListener;
goog.events.Listenable.prototype.hasListener;
goog.events.ListenableKey = function() {
};
goog.events.ListenableKey.counter_ = 0;
goog.events.ListenableKey.reserveKey = function() {
  return ++goog.events.ListenableKey.counter_;
};
goog.events.ListenableKey.prototype.src;
goog.events.ListenableKey.prototype.type;
goog.events.ListenableKey.prototype.listener;
goog.events.ListenableKey.prototype.capture;
goog.events.ListenableKey.prototype.handler;
goog.events.ListenableKey.prototype.key;
goog.provide("goog.events.Listener");
goog.require("goog.events.ListenableKey");
goog.events.Listener = function(listener, proxy, src, type, capture, opt_handler) {
  if (goog.events.Listener.ENABLE_MONITORING) {
    this.creationStack = (new Error).stack;
  }
  this.listener = listener;
  this.proxy = proxy;
  this.src = src;
  this.type = type;
  this.capture = !!capture;
  this.handler = opt_handler;
  this.key = goog.events.ListenableKey.reserveKey();
  this.callOnce = false;
  this.removed = false;
};
goog.define("goog.events.Listener.ENABLE_MONITORING", false);
goog.events.Listener.prototype.creationStack;
goog.events.Listener.prototype.markAsRemoved = function() {
  this.removed = true;
  this.listener = null;
  this.proxy = null;
  this.src = null;
  this.handler = null;
};
goog.provide("goog.events.ListenerMap");
goog.require("goog.array");
goog.require("goog.events.Listener");
goog.require("goog.object");
goog.events.ListenerMap = function(src) {
  this.src = src;
  this.listeners = {};
  this.typeCount_ = 0;
};
goog.events.ListenerMap.prototype.getTypeCount = function() {
  return this.typeCount_;
};
goog.events.ListenerMap.prototype.getListenerCount = function() {
  var count = 0;
  for (var type in this.listeners) {
    count += this.listeners[type].length;
  }
  return count;
};
goog.events.ListenerMap.prototype.add = function(type, listener, callOnce, opt_useCapture, opt_listenerScope) {
  var typeStr = type.toString();
  var listenerArray = this.listeners[typeStr];
  if (!listenerArray) {
    listenerArray = this.listeners[typeStr] = [];
    this.typeCount_++;
  }
  var listenerObj;
  var index = goog.events.ListenerMap.findListenerIndex_(listenerArray, listener, opt_useCapture, opt_listenerScope);
  if (index > -1) {
    listenerObj = listenerArray[index];
    if (!callOnce) {
      listenerObj.callOnce = false;
    }
  } else {
    listenerObj = new goog.events.Listener(listener, null, this.src, typeStr, !!opt_useCapture, opt_listenerScope);
    listenerObj.callOnce = callOnce;
    listenerArray.push(listenerObj);
  }
  return listenerObj;
};
goog.events.ListenerMap.prototype.remove = function(type, listener, opt_useCapture, opt_listenerScope) {
  var typeStr = type.toString();
  if (!(typeStr in this.listeners)) {
    return false;
  }
  var listenerArray = this.listeners[typeStr];
  var index = goog.events.ListenerMap.findListenerIndex_(listenerArray, listener, opt_useCapture, opt_listenerScope);
  if (index > -1) {
    var listenerObj = listenerArray[index];
    listenerObj.markAsRemoved();
    goog.array.removeAt(listenerArray, index);
    if (listenerArray.length == 0) {
      delete this.listeners[typeStr];
      this.typeCount_--;
    }
    return true;
  }
  return false;
};
goog.events.ListenerMap.prototype.removeByKey = function(listener) {
  var type = listener.type;
  if (!(type in this.listeners)) {
    return false;
  }
  var removed = goog.array.remove(this.listeners[type], listener);
  if (removed) {
    listener.markAsRemoved();
    if (this.listeners[type].length == 0) {
      delete this.listeners[type];
      this.typeCount_--;
    }
  }
  return removed;
};
goog.events.ListenerMap.prototype.removeAll = function(opt_type) {
  var typeStr = opt_type && opt_type.toString();
  var count = 0;
  for (var type in this.listeners) {
    if (!typeStr || type == typeStr) {
      var listenerArray = this.listeners[type];
      for (var i = 0; i < listenerArray.length; i++) {
        ++count;
        listenerArray[i].markAsRemoved();
      }
      delete this.listeners[type];
      this.typeCount_--;
    }
  }
  return count;
};
goog.events.ListenerMap.prototype.getListeners = function(type, capture) {
  var listenerArray = this.listeners[type.toString()];
  var rv = [];
  if (listenerArray) {
    for (var i = 0; i < listenerArray.length; ++i) {
      var listenerObj = listenerArray[i];
      if (listenerObj.capture == capture) {
        rv.push(listenerObj);
      }
    }
  }
  return rv;
};
goog.events.ListenerMap.prototype.getListener = function(type, listener, capture, opt_listenerScope) {
  var listenerArray = this.listeners[type.toString()];
  var i = -1;
  if (listenerArray) {
    i = goog.events.ListenerMap.findListenerIndex_(listenerArray, listener, capture, opt_listenerScope);
  }
  return i > -1 ? listenerArray[i] : null;
};
goog.events.ListenerMap.prototype.hasListener = function(opt_type, opt_capture) {
  var hasType = goog.isDef(opt_type);
  var typeStr = hasType ? opt_type.toString() : "";
  var hasCapture = goog.isDef(opt_capture);
  return goog.object.some(this.listeners, function(listenerArray, type) {
    for (var i = 0; i < listenerArray.length; ++i) {
      if ((!hasType || listenerArray[i].type == typeStr) && (!hasCapture || listenerArray[i].capture == opt_capture)) {
        return true;
      }
    }
    return false;
  });
};
goog.events.ListenerMap.findListenerIndex_ = function(listenerArray, listener, opt_useCapture, opt_listenerScope) {
  for (var i = 0; i < listenerArray.length; ++i) {
    var listenerObj = listenerArray[i];
    if (!listenerObj.removed && listenerObj.listener == listener && listenerObj.capture == !!opt_useCapture && listenerObj.handler == opt_listenerScope) {
      return i;
    }
  }
  return -1;
};
goog.provide("goog.events");
goog.provide("goog.events.CaptureSimulationMode");
goog.provide("goog.events.Key");
goog.provide("goog.events.ListenableType");
goog.require("goog.asserts");
goog.require("goog.debug.entryPointRegistry");
goog.require("goog.events.BrowserEvent");
goog.require("goog.events.BrowserFeature");
goog.require("goog.events.Listenable");
goog.require("goog.events.ListenerMap");
goog.forwardDeclare("goog.debug.ErrorHandler");
goog.forwardDeclare("goog.events.EventWrapper");
goog.events.Key;
goog.events.ListenableType;
goog.events.LISTENER_MAP_PROP_ = "closure_lm_" + (Math.random() * 1e6 | 0);
goog.events.onString_ = "on";
goog.events.onStringMap_ = {};
goog.events.CaptureSimulationMode = {OFF_AND_FAIL:0, OFF_AND_SILENT:1, ON:2};
goog.define("goog.events.CAPTURE_SIMULATION_MODE", 2);
goog.events.listenerCountEstimate_ = 0;
goog.events.listen = function(src, type, listener, opt_capt, opt_handler) {
  if (goog.isArray(type)) {
    for (var i = 0; i < type.length; i++) {
      goog.events.listen(src, type[i], listener, opt_capt, opt_handler);
    }
    return null;
  }
  listener = goog.events.wrapListener(listener);
  if (goog.events.Listenable.isImplementedBy(src)) {
    return src.listen(type, listener, opt_capt, opt_handler);
  } else {
    return goog.events.listen_(src, type, listener, false, opt_capt, opt_handler);
  }
};
goog.events.listen_ = function(src, type, listener, callOnce, opt_capt, opt_handler) {
  if (!type) {
    throw Error("Invalid event type");
  }
  var capture = !!opt_capt;
  if (capture && !goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT) {
    if (goog.events.CAPTURE_SIMULATION_MODE == goog.events.CaptureSimulationMode.OFF_AND_FAIL) {
      goog.asserts.fail("Can not register capture listener in IE8-.");
      return null;
    } else {
      if (goog.events.CAPTURE_SIMULATION_MODE == goog.events.CaptureSimulationMode.OFF_AND_SILENT) {
        return null;
      }
    }
  }
  var listenerMap = goog.events.getListenerMap_(src);
  if (!listenerMap) {
    src[goog.events.LISTENER_MAP_PROP_] = listenerMap = new goog.events.ListenerMap(src);
  }
  var listenerObj = listenerMap.add(type, listener, callOnce, opt_capt, opt_handler);
  if (listenerObj.proxy) {
    return listenerObj;
  }
  var proxy = goog.events.getProxy();
  listenerObj.proxy = proxy;
  proxy.src = src;
  proxy.listener = listenerObj;
  if (src.addEventListener) {
    src.addEventListener(type.toString(), proxy, capture);
  } else {
    if (src.attachEvent) {
      src.attachEvent(goog.events.getOnString_(type.toString()), proxy);
    } else {
      throw Error("addEventListener and attachEvent are unavailable.");
    }
  }
  goog.events.listenerCountEstimate_++;
  return listenerObj;
};
goog.events.getProxy = function() {
  var proxyCallbackFunction = goog.events.handleBrowserEvent_;
  var f = goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT ? function(eventObject) {
    return proxyCallbackFunction.call(f.src, f.listener, eventObject);
  } : function(eventObject) {
    var v = proxyCallbackFunction.call(f.src, f.listener, eventObject);
    if (!v) {
      return v;
    }
  };
  return f;
};
goog.events.listenOnce = function(src, type, listener, opt_capt, opt_handler) {
  if (goog.isArray(type)) {
    for (var i = 0; i < type.length; i++) {
      goog.events.listenOnce(src, type[i], listener, opt_capt, opt_handler);
    }
    return null;
  }
  listener = goog.events.wrapListener(listener);
  if (goog.events.Listenable.isImplementedBy(src)) {
    return src.listenOnce(type, listener, opt_capt, opt_handler);
  } else {
    return goog.events.listen_(src, type, listener, true, opt_capt, opt_handler);
  }
};
goog.events.listenWithWrapper = function(src, wrapper, listener, opt_capt, opt_handler) {
  wrapper.listen(src, listener, opt_capt, opt_handler);
};
goog.events.unlisten = function(src, type, listener, opt_capt, opt_handler) {
  if (goog.isArray(type)) {
    for (var i = 0; i < type.length; i++) {
      goog.events.unlisten(src, type[i], listener, opt_capt, opt_handler);
    }
    return null;
  }
  listener = goog.events.wrapListener(listener);
  if (goog.events.Listenable.isImplementedBy(src)) {
    return src.unlisten(type, listener, opt_capt, opt_handler);
  }
  if (!src) {
    return false;
  }
  var capture = !!opt_capt;
  var listenerMap = goog.events.getListenerMap_(src);
  if (listenerMap) {
    var listenerObj = listenerMap.getListener(type, listener, capture, opt_handler);
    if (listenerObj) {
      return goog.events.unlistenByKey(listenerObj);
    }
  }
  return false;
};
goog.events.unlistenByKey = function(key) {
  if (goog.isNumber(key)) {
    return false;
  }
  var listener = key;
  if (!listener || listener.removed) {
    return false;
  }
  var src = listener.src;
  if (goog.events.Listenable.isImplementedBy(src)) {
    return src.unlistenByKey(listener);
  }
  var type = listener.type;
  var proxy = listener.proxy;
  if (src.removeEventListener) {
    src.removeEventListener(type, proxy, listener.capture);
  } else {
    if (src.detachEvent) {
      src.detachEvent(goog.events.getOnString_(type), proxy);
    }
  }
  goog.events.listenerCountEstimate_--;
  var listenerMap = goog.events.getListenerMap_(src);
  if (listenerMap) {
    listenerMap.removeByKey(listener);
    if (listenerMap.getTypeCount() == 0) {
      listenerMap.src = null;
      src[goog.events.LISTENER_MAP_PROP_] = null;
    }
  } else {
    listener.markAsRemoved();
  }
  return true;
};
goog.events.unlistenWithWrapper = function(src, wrapper, listener, opt_capt, opt_handler) {
  wrapper.unlisten(src, listener, opt_capt, opt_handler);
};
goog.events.removeAll = function(obj, opt_type) {
  if (!obj) {
    return 0;
  }
  if (goog.events.Listenable.isImplementedBy(obj)) {
    return obj.removeAllListeners(opt_type);
  }
  var listenerMap = goog.events.getListenerMap_(obj);
  if (!listenerMap) {
    return 0;
  }
  var count = 0;
  var typeStr = opt_type && opt_type.toString();
  for (var type in listenerMap.listeners) {
    if (!typeStr || type == typeStr) {
      var listeners = listenerMap.listeners[type].concat();
      for (var i = 0; i < listeners.length; ++i) {
        if (goog.events.unlistenByKey(listeners[i])) {
          ++count;
        }
      }
    }
  }
  return count;
};
goog.events.getListeners = function(obj, type, capture) {
  if (goog.events.Listenable.isImplementedBy(obj)) {
    return obj.getListeners(type, capture);
  } else {
    if (!obj) {
      return [];
    }
    var listenerMap = goog.events.getListenerMap_(obj);
    return listenerMap ? listenerMap.getListeners(type, capture) : [];
  }
};
goog.events.getListener = function(src, type, listener, opt_capt, opt_handler) {
  type = type;
  listener = goog.events.wrapListener(listener);
  var capture = !!opt_capt;
  if (goog.events.Listenable.isImplementedBy(src)) {
    return src.getListener(type, listener, capture, opt_handler);
  }
  if (!src) {
    return null;
  }
  var listenerMap = goog.events.getListenerMap_(src);
  if (listenerMap) {
    return listenerMap.getListener(type, listener, capture, opt_handler);
  }
  return null;
};
goog.events.hasListener = function(obj, opt_type, opt_capture) {
  if (goog.events.Listenable.isImplementedBy(obj)) {
    return obj.hasListener(opt_type, opt_capture);
  }
  var listenerMap = goog.events.getListenerMap_(obj);
  return !!listenerMap && listenerMap.hasListener(opt_type, opt_capture);
};
goog.events.expose = function(e) {
  var str = [];
  for (var key in e) {
    if (e[key] && e[key].id) {
      str.push(key + " = " + e[key] + " (" + e[key].id + ")");
    } else {
      str.push(key + " = " + e[key]);
    }
  }
  return str.join("\n");
};
goog.events.getOnString_ = function(type) {
  if (type in goog.events.onStringMap_) {
    return goog.events.onStringMap_[type];
  }
  return goog.events.onStringMap_[type] = goog.events.onString_ + type;
};
goog.events.fireListeners = function(obj, type, capture, eventObject) {
  if (goog.events.Listenable.isImplementedBy(obj)) {
    return obj.fireListeners(type, capture, eventObject);
  }
  return goog.events.fireListeners_(obj, type, capture, eventObject);
};
goog.events.fireListeners_ = function(obj, type, capture, eventObject) {
  var retval = true;
  var listenerMap = goog.events.getListenerMap_(obj);
  if (listenerMap) {
    var listenerArray = listenerMap.listeners[type.toString()];
    if (listenerArray) {
      listenerArray = listenerArray.concat();
      for (var i = 0; i < listenerArray.length; i++) {
        var listener = listenerArray[i];
        if (listener && listener.capture == capture && !listener.removed) {
          var result = goog.events.fireListener(listener, eventObject);
          retval = retval && result !== false;
        }
      }
    }
  }
  return retval;
};
goog.events.fireListener = function(listener, eventObject) {
  var listenerFn = listener.listener;
  var listenerHandler = listener.handler || listener.src;
  if (listener.callOnce) {
    goog.events.unlistenByKey(listener);
  }
  return listenerFn.call(listenerHandler, eventObject);
};
goog.events.getTotalListenerCount = function() {
  return goog.events.listenerCountEstimate_;
};
goog.events.dispatchEvent = function(src, e) {
  goog.asserts.assert(goog.events.Listenable.isImplementedBy(src), "Can not use goog.events.dispatchEvent with " + "non-goog.events.Listenable instance.");
  return src.dispatchEvent(e);
};
goog.events.protectBrowserEventEntryPoint = function(errorHandler) {
  goog.events.handleBrowserEvent_ = errorHandler.protectEntryPoint(goog.events.handleBrowserEvent_);
};
goog.events.handleBrowserEvent_ = function(listener, opt_evt) {
  if (listener.removed) {
    return true;
  }
  if (!goog.events.BrowserFeature.HAS_W3C_EVENT_SUPPORT) {
    var ieEvent = opt_evt || goog.getObjectByName("window.event");
    var evt = new goog.events.BrowserEvent(ieEvent, this);
    var retval = true;
    if (goog.events.CAPTURE_SIMULATION_MODE == goog.events.CaptureSimulationMode.ON) {
      if (!goog.events.isMarkedIeEvent_(ieEvent)) {
        goog.events.markIeEvent_(ieEvent);
        var ancestors = [];
        for (var parent = evt.currentTarget; parent; parent = parent.parentNode) {
          ancestors.push(parent);
        }
        var type = listener.type;
        for (var i = ancestors.length - 1; !evt.propagationStopped_ && i >= 0; i--) {
          evt.currentTarget = ancestors[i];
          var result = goog.events.fireListeners_(ancestors[i], type, true, evt);
          retval = retval && result;
        }
        for (var i = 0; !evt.propagationStopped_ && i < ancestors.length; i++) {
          evt.currentTarget = ancestors[i];
          var result = goog.events.fireListeners_(ancestors[i], type, false, evt);
          retval = retval && result;
        }
      }
    } else {
      retval = goog.events.fireListener(listener, evt);
    }
    return retval;
  }
  return goog.events.fireListener(listener, new goog.events.BrowserEvent(opt_evt, this));
};
goog.events.markIeEvent_ = function(e) {
  var useReturnValue = false;
  if (e.keyCode == 0) {
    try {
      e.keyCode = -1;
      return;
    } catch (ex) {
      useReturnValue = true;
    }
  }
  if (useReturnValue || e.returnValue == undefined) {
    e.returnValue = true;
  }
};
goog.events.isMarkedIeEvent_ = function(e) {
  return e.keyCode < 0 || e.returnValue != undefined;
};
goog.events.uniqueIdCounter_ = 0;
goog.events.getUniqueId = function(identifier) {
  return identifier + "_" + goog.events.uniqueIdCounter_++;
};
goog.events.getListenerMap_ = function(src) {
  var listenerMap = src[goog.events.LISTENER_MAP_PROP_];
  return listenerMap instanceof goog.events.ListenerMap ? listenerMap : null;
};
goog.events.LISTENER_WRAPPER_PROP_ = "__closure_events_fn_" + (Math.random() * 1e9 >>> 0);
goog.events.wrapListener = function(listener) {
  goog.asserts.assert(listener, "Listener can not be null.");
  if (goog.isFunction(listener)) {
    return listener;
  }
  goog.asserts.assert(listener.handleEvent, "An object listener must have handleEvent method.");
  if (!listener[goog.events.LISTENER_WRAPPER_PROP_]) {
    listener[goog.events.LISTENER_WRAPPER_PROP_] = function(e) {
      return listener.handleEvent(e);
    };
  }
  return listener[goog.events.LISTENER_WRAPPER_PROP_];
};
goog.debug.entryPointRegistry.register(function(transformer) {
  goog.events.handleBrowserEvent_ = transformer(goog.events.handleBrowserEvent_);
});
goog.provide("goog.debug.RelativeTimeProvider");
goog.debug.RelativeTimeProvider = function() {
  this.relativeTimeStart_ = goog.now();
};
goog.debug.RelativeTimeProvider.defaultInstance_ = new goog.debug.RelativeTimeProvider;
goog.debug.RelativeTimeProvider.prototype.set = function(timeStamp) {
  this.relativeTimeStart_ = timeStamp;
};
goog.debug.RelativeTimeProvider.prototype.reset = function() {
  this.set(goog.now());
};
goog.debug.RelativeTimeProvider.prototype.get = function() {
  return this.relativeTimeStart_;
};
goog.debug.RelativeTimeProvider.getDefaultInstance = function() {
  return goog.debug.RelativeTimeProvider.defaultInstance_;
};
goog.provide("goog.debug.Formatter");
goog.provide("goog.debug.HtmlFormatter");
goog.provide("goog.debug.TextFormatter");
goog.require("goog.debug");
goog.require("goog.debug.Logger");
goog.require("goog.debug.RelativeTimeProvider");
goog.require("goog.html.SafeHtml");
goog.require("goog.html.SafeUrl");
goog.require("goog.html.uncheckedconversions");
goog.require("goog.string.Const");
goog.debug.Formatter = function(opt_prefix) {
  this.prefix_ = opt_prefix || "";
  this.startTimeProvider_ = goog.debug.RelativeTimeProvider.getDefaultInstance();
};
goog.debug.Formatter.prototype.appendNewline = true;
goog.debug.Formatter.prototype.showAbsoluteTime = true;
goog.debug.Formatter.prototype.showRelativeTime = true;
goog.debug.Formatter.prototype.showLoggerName = true;
goog.debug.Formatter.prototype.showExceptionText = false;
goog.debug.Formatter.prototype.showSeverityLevel = false;
goog.debug.Formatter.prototype.formatRecord = goog.abstractMethod;
goog.debug.Formatter.prototype.formatRecordAsHtml = goog.abstractMethod;
goog.debug.Formatter.prototype.setStartTimeProvider = function(provider) {
  this.startTimeProvider_ = provider;
};
goog.debug.Formatter.prototype.getStartTimeProvider = function() {
  return this.startTimeProvider_;
};
goog.debug.Formatter.prototype.resetRelativeTimeStart = function() {
  this.startTimeProvider_.reset();
};
goog.debug.Formatter.getDateTimeStamp_ = function(logRecord) {
  var time = new Date(logRecord.getMillis());
  return goog.debug.Formatter.getTwoDigitString_(time.getFullYear() - 2000) + goog.debug.Formatter.getTwoDigitString_(time.getMonth() + 1) + goog.debug.Formatter.getTwoDigitString_(time.getDate()) + " " + goog.debug.Formatter.getTwoDigitString_(time.getHours()) + ":" + goog.debug.Formatter.getTwoDigitString_(time.getMinutes()) + ":" + goog.debug.Formatter.getTwoDigitString_(time.getSeconds()) + "." + goog.debug.Formatter.getTwoDigitString_(Math.floor(time.getMilliseconds() / 10));
};
goog.debug.Formatter.getTwoDigitString_ = function(n) {
  if (n < 10) {
    return "0" + n;
  }
  return String(n);
};
goog.debug.Formatter.getRelativeTime_ = function(logRecord, relativeTimeStart) {
  var ms = logRecord.getMillis() - relativeTimeStart;
  var sec = ms / 1000;
  var str = sec.toFixed(3);
  var spacesToPrepend = 0;
  if (sec < 1) {
    spacesToPrepend = 2;
  } else {
    while (sec < 100) {
      spacesToPrepend++;
      sec *= 10;
    }
  }
  while (spacesToPrepend-- > 0) {
    str = " " + str;
  }
  return str;
};
goog.debug.HtmlFormatter = function(opt_prefix) {
  goog.debug.Formatter.call(this, opt_prefix);
};
goog.inherits(goog.debug.HtmlFormatter, goog.debug.Formatter);
goog.debug.HtmlFormatter.exposeException = function(err, fn) {
  var html = goog.debug.HtmlFormatter.exposeExceptionAsHtml(err, fn);
  return goog.html.SafeHtml.unwrap(html);
};
goog.debug.HtmlFormatter.exposeExceptionAsHtml = function(err, fn) {
  try {
    var e = goog.debug.normalizeErrorObject(err);
    var viewSourceUrl = goog.debug.HtmlFormatter.createViewSourceUrl_(e.fileName);
    var error = goog.html.SafeHtml.concat(goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces("Message: " + e.message + "\nUrl: "), goog.html.SafeHtml.create("a", {href:viewSourceUrl, target:"_new"}, e.fileName), goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces("\nLine: " + e.lineNumber + "\n\nBrowser stack:\n" + e.stack + "-> " + "[end]\n\nJS stack traversal:\n" + goog.debug.getStacktrace(fn) + "-> "));
    return error;
  } catch (e2) {
    return goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces("Exception trying to expose exception! You win, we lose. " + e2);
  }
};
goog.debug.HtmlFormatter.createViewSourceUrl_ = function(fileName) {
  if (!goog.isDefAndNotNull(fileName)) {
    fileName = "";
  }
  if (!/^https?:\/\//i.test(fileName)) {
    return goog.html.SafeUrl.fromConstant(goog.string.Const.from("sanitizedviewsrc"));
  }
  var sanitizedFileName = goog.html.SafeUrl.sanitize(fileName);
  return goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("view-source scheme plus HTTP/HTTPS URL"), "view-source:" + goog.html.SafeUrl.unwrap(sanitizedFileName));
};
goog.debug.HtmlFormatter.prototype.showExceptionText = true;
goog.debug.HtmlFormatter.prototype.formatRecord = function(logRecord) {
  if (!logRecord) {
    return "";
  }
  return this.formatRecordAsHtml(logRecord).getTypedStringValue();
};
goog.debug.HtmlFormatter.prototype.formatRecordAsHtml = function(logRecord) {
  if (!logRecord) {
    return goog.html.SafeHtml.EMPTY;
  }
  var className;
  switch(logRecord.getLevel().value) {
    case goog.debug.Logger.Level.SHOUT.value:
      className = "dbg-sh";
      break;
    case goog.debug.Logger.Level.SEVERE.value:
      className = "dbg-sev";
      break;
    case goog.debug.Logger.Level.WARNING.value:
      className = "dbg-w";
      break;
    case goog.debug.Logger.Level.INFO.value:
      className = "dbg-i";
      break;
    case goog.debug.Logger.Level.FINE.value:
    default:
      className = "dbg-f";
      break;
  }
  var sb = [];
  sb.push(this.prefix_, " ");
  if (this.showAbsoluteTime) {
    sb.push("[", goog.debug.Formatter.getDateTimeStamp_(logRecord), "] ");
  }
  if (this.showRelativeTime) {
    sb.push("[", goog.debug.Formatter.getRelativeTime_(logRecord, this.startTimeProvider_.get()), "s] ");
  }
  if (this.showLoggerName) {
    sb.push("[", logRecord.getLoggerName(), "] ");
  }
  if (this.showSeverityLevel) {
    sb.push("[", logRecord.getLevel().name, "] ");
  }
  var fullPrefixHtml = goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces(sb.join(""));
  var exceptionHtml = goog.html.SafeHtml.EMPTY;
  if (this.showExceptionText && logRecord.getException()) {
    exceptionHtml = goog.html.SafeHtml.concat(goog.html.SafeHtml.BR, goog.debug.HtmlFormatter.exposeExceptionAsHtml(logRecord.getException()));
  }
  var logRecordHtml = goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces(logRecord.getMessage());
  var recordAndExceptionHtml = goog.html.SafeHtml.create("span", {"class":className}, goog.html.SafeHtml.concat(logRecordHtml, exceptionHtml));
  var html;
  if (this.appendNewline) {
    html = goog.html.SafeHtml.concat(fullPrefixHtml, recordAndExceptionHtml, goog.html.SafeHtml.BR);
  } else {
    html = goog.html.SafeHtml.concat(fullPrefixHtml, recordAndExceptionHtml);
  }
  return html;
};
goog.debug.TextFormatter = function(opt_prefix) {
  goog.debug.Formatter.call(this, opt_prefix);
};
goog.inherits(goog.debug.TextFormatter, goog.debug.Formatter);
goog.debug.TextFormatter.prototype.formatRecord = function(logRecord) {
  var sb = [];
  sb.push(this.prefix_, " ");
  if (this.showAbsoluteTime) {
    sb.push("[", goog.debug.Formatter.getDateTimeStamp_(logRecord), "] ");
  }
  if (this.showRelativeTime) {
    sb.push("[", goog.debug.Formatter.getRelativeTime_(logRecord, this.startTimeProvider_.get()), "s] ");
  }
  if (this.showLoggerName) {
    sb.push("[", logRecord.getLoggerName(), "] ");
  }
  if (this.showSeverityLevel) {
    sb.push("[", logRecord.getLevel().name, "] ");
  }
  sb.push(logRecord.getMessage());
  if (this.showExceptionText) {
    var exception = logRecord.getException();
    if (exception) {
      var exceptionText = exception instanceof Error ? exception.message : exception.toString();
      sb.push("\n", exceptionText);
    }
  }
  if (this.appendNewline) {
    sb.push("\n");
  }
  return sb.join("");
};
goog.debug.TextFormatter.prototype.formatRecordAsHtml = function(logRecord) {
  return goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces(goog.debug.TextFormatter.prototype.formatRecord(logRecord));
};
goog.provide("goog.debug.Console");
goog.require("goog.debug.LogManager");
goog.require("goog.debug.Logger");
goog.require("goog.debug.TextFormatter");
goog.debug.Console = function() {
  this.publishHandler_ = goog.bind(this.addLogRecord, this);
  this.formatter_ = new goog.debug.TextFormatter;
  this.formatter_.showAbsoluteTime = false;
  this.formatter_.showExceptionText = false;
  this.formatter_.appendNewline = false;
  this.isCapturing_ = false;
  this.logBuffer_ = "";
  this.filteredLoggers_ = {};
};
goog.debug.Console.prototype.getFormatter = function() {
  return this.formatter_;
};
goog.debug.Console.prototype.setCapturing = function(capturing) {
  if (capturing == this.isCapturing_) {
    return;
  }
  var rootLogger = goog.debug.LogManager.getRoot();
  if (capturing) {
    rootLogger.addHandler(this.publishHandler_);
  } else {
    rootLogger.removeHandler(this.publishHandler_);
    this.logBuffer = "";
  }
  this.isCapturing_ = capturing;
};
goog.debug.Console.prototype.addLogRecord = function(logRecord) {
  if (this.filteredLoggers_[logRecord.getLoggerName()]) {
    return;
  }
  var record = this.formatter_.formatRecord(logRecord);
  var console = goog.debug.Console.console_;
  if (console) {
    switch(logRecord.getLevel()) {
      case goog.debug.Logger.Level.SHOUT:
        goog.debug.Console.logToConsole_(console, "info", record);
        break;
      case goog.debug.Logger.Level.SEVERE:
        goog.debug.Console.logToConsole_(console, "error", record);
        break;
      case goog.debug.Logger.Level.WARNING:
        goog.debug.Console.logToConsole_(console, "warn", record);
        break;
      default:
        goog.debug.Console.logToConsole_(console, "debug", record);
        break;
    }
  } else {
    this.logBuffer_ += record;
  }
};
goog.debug.Console.prototype.addFilter = function(loggerName) {
  this.filteredLoggers_[loggerName] = true;
};
goog.debug.Console.prototype.removeFilter = function(loggerName) {
  delete this.filteredLoggers_[loggerName];
};
goog.debug.Console.instance = null;
goog.debug.Console.console_ = goog.global["console"];
goog.debug.Console.setConsole = function(console) {
  goog.debug.Console.console_ = console;
};
goog.debug.Console.autoInstall = function() {
  if (!goog.debug.Console.instance) {
    goog.debug.Console.instance = new goog.debug.Console;
  }
  if (goog.global.location && goog.global.location.href.indexOf("Debug=true") != -1) {
    goog.debug.Console.instance.setCapturing(true);
  }
};
goog.debug.Console.show = function() {
  alert(goog.debug.Console.instance.logBuffer_);
};
goog.debug.Console.logToConsole_ = function(console, fnName, record) {
  if (console[fnName]) {
    console[fnName](record);
  } else {
    console.log(record);
  }
};
goog.provide("uno.ConsoleLogger");
goog.require("goog.debug.Console");
(function() {
  var ConsoleLogger = uno.ConsoleLogger = function(opt) {
    goog.debug.Console.call(this);
    this.cache = [];
    this.cachingEnabled = true;
    this.maxEntries = null;
    this.configure(opt);
  };
  goog.inherits(uno.ConsoleLogger, goog.debug.Console);
  ConsoleLogger.prototype.configure = function(opt) {
    opt = opt || {};
    if (typeof opt.cachingEnabled !== "undefined") {
      this.cachingEnabled = !!opt.cachingEnabled;
    }
    this.maxEntries = opt.maxEntries;
    if (!this.cachingEnabled) {
      this.clear();
    }
    if (this.maxEntries != null && this.cache.length > this.maxEntries) {
      this.cache = this.cache.slice(this.cache.length - this.maxEntries);
    }
  };
  ConsoleLogger.prototype.addLogRecord = function(logRecord) {
    if (this.filteredLoggers_[logRecord.getLoggerName()]) {
      return;
    }
    logRecord.formattedText = this.formatter_.formatRecord(logRecord);
    var level = logRecord.getLevel();
    var formattedText = logRecord.formattedText;
    this.print(level, formattedText);
    if (this.cachingEnabled) {
      if (this.maxEntries != null && this.maxEntries <= this.cache.length) {
        this.cache.shift();
      }
      this.cache.push({level:level, formattedText:formattedText});
    }
  };
  ConsoleLogger.prototype.print = function(level, formattedText) {
    var console = goog.debug.Console.console_;
    if (console) {
      switch(level) {
        case goog.debug.Logger.Level.SHOUT:
          goog.debug.Console.logToConsole_(console, "info", formattedText);
          break;
        case goog.debug.Logger.Level.SEVERE:
          goog.debug.Console.logToConsole_(console, "error", formattedText);
          break;
        case goog.debug.Logger.Level.WARNING:
          goog.debug.Console.logToConsole_(console, "warn", formattedText);
          break;
        default:
          goog.debug.Console.logToConsole_(console, "debug", formattedText);
          break;
      }
    }
  };
  ConsoleLogger.prototype.dump = function() {
    var me = this;
    this.cache.forEach(function(record) {
      me.print(record.level, record.formattedText);
    });
  };
  ConsoleLogger.prototype.clear = function() {
    this.cache = [];
  };
})();
goog.provide("uno.NetworkLogger");
goog.require("goog.debug.Console");
(function() {
  var NetworkLogger = uno.NetworkLogger = function(opt) {
    goog.debug.Console.call(this);
    this.formatter_ = new goog.debug.TextFormatter;
    this.formatter_.showAbsoluteTime = false;
    this.formatter_.showExceptionText = false;
    this.formatter_.appendNewline = false;
    this.url = null;
    this.client = null;
    this.useWhitelist = false;
    this.whitelistedLoggers = {};
    this.configure(opt);
  };
  goog.inherits(uno.NetworkLogger, goog.debug.Console);
  NetworkLogger.prototype.configure = function(opt) {
    opt = opt || {};
    if (opt.url) {
      this.url = opt.url;
    }
    this.useWhitelist = opt.whitelist != null;
    this.whitelistedLoggers = (opt.whitelist || []).reduce(function(obj, key) {
      obj[key] = true;
      return obj;
    }, {});
  };
  NetworkLogger.prototype.addLogRecord = function(logRecord) {
    var name = logRecord.getLoggerName();
    if (this.filteredLoggers_[name]) {
      return;
    }
    if (this.useWhitelist > 0 && !this.whitelistedLoggers[name]) {
      return;
    }
    var json = logRecord.getMessage();
    var xhr = new XMLHttpRequest;
    xhr.open("POST", this.url, true);
    xhr.setRequestHeader("Content-type", "application/json");
    xhr.send(json);
  };
})();
goog.provide("uno.Auth");
goog.require("goog.debug.Logger");
(function() {
  var log = goog.debug.Logger.getLogger("uno.Auth");
  var Auth = uno.Auth = function(options) {
    this.router = options.router;
    this.providers = {};
  };
  Auth.ERROR_CODE_NO_AUTH = 2001;
  Auth.ERROR_CODE_INVALID_AUTH = 2002;
  Auth.ERROR_CODE_NETWORK_ERROR = 2003;
  Auth.ERROR_CODE_UNKNOWN = 2004;
  Auth.prototype.getTokenAsync = function(providerName, refresh, askUserForPermission) {
    var provider = this.providers[providerName] || this.addProvider(providerName);
    if (refresh) {
      provider.token = null;
    }
    if (provider.token) {
      return Promise.resolve(provider.token);
    }
    if (provider.request) {
      return provider.request;
    }
    provider.request = this.router.toHostAsync("requestAuth", {serviceName:provider.name, refresh:!!refresh, askUserForPermission:!!askUserForPermission}).then(function(response) {
      provider.request = null;
      provider.token = response.token;
      provider.lastRefreshed = response.lastRefreshed;
      provider.lastErrorCode = provider.errorCode;
      provider.errorCode = response.errorCode;
      if (response.errorCode) {
        var err = new Error("Auth Error");
        err.provider = providerName;
        err.errorCode = response.errorCode;
        throw err;
      } else {
        return response.token;
      }
    }).catch(function(error) {
      provider.request = null;
      provider.errorCode = error.errorCode;
      throw error;
    });
    return provider.request;
  };
  Auth.prototype.getLastErrorCode = function(providerName) {
    var provider = this.providers[providerName];
    return provider && provider.lastErrorCode;
  };
  Auth.prototype.addProvider = function(name) {
    this.providers[name] = {name:name, request:null, token:null, lastErrorCode:null, errorCode:null, lastRefreshed:null};
    return this.providers[name];
  };
})();
goog.provide("uno.Cache");
goog.require("goog.debug.Logger");
(function() {
  var log = goog.debug.Logger.getLogger("uno.Cache");
  var Cache = uno.Cache = function(options) {
    this.router = options.router;
    this.diskEnabled = false;
    this.memCache = {};
  };
  Cache.prototype.readMem = function(key) {
    return this.memCache[key];
  };
  Cache.prototype.writeMem = function(key, value) {
    this.memCache[key] = value;
  };
  Cache.prototype.readDiskAsync = function(key) {
    if (this.diskEnabled) {
      return this.router.toHostAsync("getFromCache", {href:key}).then(function(result) {
        return result.data ? result.data.data || result.data : result.data;
      });
    }
    return Promise.resolve();
  };
  Cache.prototype.writeDisk = function(key, value) {
    if (this.diskEnabled) {
      this.router.toHostAsync("saveInCache", {href:key, data:value});
    }
  };
  Cache.prototype.write = function(key, value) {
    this.writeMem(key, value);
    this.writeDisk(key, value);
  };
  Cache.prototype.enableDisk = function() {
    this.diskEnabled = true;
  };
  Cache.prototype.disableDisk = function() {
    this.diskEnabled = false;
  };
})();
goog.provide("uno.debug");
(function() {
  var __timers__ = [];
  window.__timers__ = __timers__;
  window.start = function(name) {
    if (!DEBUG) {
      return;
    }
    console.log(pad(__timers__.length) + "%c [START TIMER] [%s]", "color: #aaa;", name);
    __timers__.push({name:name, time:performance.now()});
  };
  window.stop = function(name) {
    if (!DEBUG) {
      return;
    }
    var timer = __timers__.pop() || {};
    if (timer.name !== name) {
      console.warn('Timer name "' + name + '" did not match "' + timer.name + '"! Are you missing a call to start or stop?');
    }
    var duration = performance.now() - timer.time;
    var color = duration < 0.5 ? "#aaa" : duration < 50 ? "green" : duration < 500 ? "darkorange" : "red";
    console.log(pad(__timers__.length) + "%c [%c%s sec%c] [%s]", "color: " + color + ";", "color: " + color + ";font-weight: bold;", format(duration), "color: " + color + ";", timer.name);
  };
  function pad(depth) {
    var padding = "";
    for (var i = 0; i < depth; i++) {
      padding += "\t";
    }
    return padding;
  }
  function format(num) {
    var text = (num / 1000).toFixed(3);
    return text.length === 5 ? "  " + text : text.length === 6 ? " " + text : text;
  }
})();
goog.provide("goog.dom.classes");
goog.require("goog.array");
goog.dom.classes.set = function(element, className) {
  element.className = className;
};
goog.dom.classes.get = function(element) {
  var className = element.className;
  return goog.isString(className) && className.match(/\S+/g) || [];
};
goog.dom.classes.add = function(element, var_args) {
  var classes = goog.dom.classes.get(element);
  var args = goog.array.slice(arguments, 1);
  var expectedCount = classes.length + args.length;
  goog.dom.classes.add_(classes, args);
  goog.dom.classes.set(element, classes.join(" "));
  return classes.length == expectedCount;
};
goog.dom.classes.remove = function(element, var_args) {
  var classes = goog.dom.classes.get(element);
  var args = goog.array.slice(arguments, 1);
  var newClasses = goog.dom.classes.getDifference_(classes, args);
  goog.dom.classes.set(element, newClasses.join(" "));
  return newClasses.length == classes.length - args.length;
};
goog.dom.classes.add_ = function(classes, args) {
  for (var i = 0; i < args.length; i++) {
    if (!goog.array.contains(classes, args[i])) {
      classes.push(args[i]);
    }
  }
};
goog.dom.classes.getDifference_ = function(arr1, arr2) {
  return goog.array.filter(arr1, function(item) {
    return !goog.array.contains(arr2, item);
  });
};
goog.dom.classes.swap = function(element, fromClass, toClass) {
  var classes = goog.dom.classes.get(element);
  var removed = false;
  for (var i = 0; i < classes.length; i++) {
    if (classes[i] == fromClass) {
      goog.array.splice(classes, i--, 1);
      removed = true;
    }
  }
  if (removed) {
    classes.push(toClass);
    goog.dom.classes.set(element, classes.join(" "));
  }
  return removed;
};
goog.dom.classes.addRemove = function(element, classesToRemove, classesToAdd) {
  var classes = goog.dom.classes.get(element);
  if (goog.isString(classesToRemove)) {
    goog.array.remove(classes, classesToRemove);
  } else {
    if (goog.isArray(classesToRemove)) {
      classes = goog.dom.classes.getDifference_(classes, classesToRemove);
    }
  }
  if (goog.isString(classesToAdd) && !goog.array.contains(classes, classesToAdd)) {
    classes.push(classesToAdd);
  } else {
    if (goog.isArray(classesToAdd)) {
      goog.dom.classes.add_(classes, classesToAdd);
    }
  }
  goog.dom.classes.set(element, classes.join(" "));
};
goog.dom.classes.has = function(element, className) {
  return goog.array.contains(goog.dom.classes.get(element), className);
};
goog.dom.classes.enable = function(element, className, enabled) {
  if (enabled) {
    goog.dom.classes.add(element, className);
  } else {
    goog.dom.classes.remove(element, className);
  }
};
goog.dom.classes.toggle = function(element, className) {
  var add = !goog.dom.classes.has(element, className);
  goog.dom.classes.enable(element, className, add);
  return add;
};
goog.provide("goog.log");
goog.provide("goog.log.Level");
goog.provide("goog.log.LogRecord");
goog.provide("goog.log.Logger");
goog.require("goog.debug");
goog.require("goog.debug.LogManager");
goog.require("goog.debug.LogRecord");
goog.require("goog.debug.Logger");
goog.define("goog.log.ENABLED", goog.debug.LOGGING_ENABLED);
goog.log.ROOT_LOGGER_NAME = goog.debug.Logger.ROOT_LOGGER_NAME;
goog.log.Logger = goog.debug.Logger;
goog.log.Level = goog.debug.Logger.Level;
goog.log.LogRecord = goog.debug.LogRecord;
goog.log.getLogger = function(name, opt_level) {
  if (goog.log.ENABLED) {
    var logger = goog.debug.LogManager.getLogger(name);
    if (opt_level && logger) {
      logger.setLevel(opt_level);
    }
    return logger;
  } else {
    return null;
  }
};
goog.log.addHandler = function(logger, handler) {
  if (goog.log.ENABLED && logger) {
    logger.addHandler(handler);
  }
};
goog.log.removeHandler = function(logger, handler) {
  if (goog.log.ENABLED && logger) {
    return logger.removeHandler(handler);
  } else {
    return false;
  }
};
goog.log.log = function(logger, level, msg, opt_exception) {
  if (goog.log.ENABLED && logger) {
    logger.log(level, msg, opt_exception);
  }
};
goog.log.error = function(logger, msg, opt_exception) {
  if (goog.log.ENABLED && logger) {
    logger.severe(msg, opt_exception);
  }
};
goog.log.warning = function(logger, msg, opt_exception) {
  if (goog.log.ENABLED && logger) {
    logger.warning(msg, opt_exception);
  }
};
goog.log.info = function(logger, msg, opt_exception) {
  if (goog.log.ENABLED && logger) {
    logger.info(msg, opt_exception);
  }
};
goog.log.fine = function(logger, msg, opt_exception) {
  if (goog.log.ENABLED && logger) {
    logger.fine(msg, opt_exception);
  }
};
goog.provide("goog.dom.SavedRange");
goog.require("goog.Disposable");
goog.require("goog.log");
goog.dom.SavedRange = function() {
  goog.Disposable.call(this);
};
goog.inherits(goog.dom.SavedRange, goog.Disposable);
goog.dom.SavedRange.logger_ = goog.log.getLogger("goog.dom.SavedRange");
goog.dom.SavedRange.prototype.restore = function(opt_stayAlive) {
  if (this.isDisposed()) {
    goog.log.error(goog.dom.SavedRange.logger_, "Disposed SavedRange objects cannot be restored.");
  }
  var range = this.restoreInternal();
  if (!opt_stayAlive) {
    this.dispose();
  }
  return range;
};
goog.dom.SavedRange.prototype.restoreInternal = goog.abstractMethod;
goog.provide("goog.dom.SavedCaretRange");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.dom.SavedRange");
goog.require("goog.dom.TagName");
goog.require("goog.string");
goog.dom.SavedCaretRange = function(range) {
  goog.dom.SavedRange.call(this);
  this.startCaretId_ = goog.string.createUniqueString();
  this.endCaretId_ = goog.string.createUniqueString();
  this.reversed_ = range.isReversed();
  this.dom_ = goog.dom.getDomHelper(range.getDocument());
  range.surroundWithNodes(this.createCaret_(true), this.createCaret_(false));
};
goog.inherits(goog.dom.SavedCaretRange, goog.dom.SavedRange);
goog.dom.SavedCaretRange.prototype.toAbstractRange = function() {
  var range = null;
  var startCaret = this.getCaret(true);
  var endCaret = this.getCaret(false);
  if (startCaret && endCaret) {
    range = goog.dom.Range.createFromNodes(startCaret, 0, endCaret, 0);
  }
  return range;
};
goog.dom.SavedCaretRange.prototype.getCaret = function(start) {
  return this.dom_.getElement(start ? this.startCaretId_ : this.endCaretId_);
};
goog.dom.SavedCaretRange.prototype.removeCarets = function(opt_range) {
  goog.dom.removeNode(this.getCaret(true));
  goog.dom.removeNode(this.getCaret(false));
  return opt_range;
};
goog.dom.SavedCaretRange.prototype.setRestorationDocument = function(doc) {
  this.dom_.setDocument(doc);
};
goog.dom.SavedCaretRange.prototype.restoreInternal = function() {
  var range = null;
  var anchorCaret = this.getCaret(!this.reversed_);
  var focusCaret = this.getCaret(this.reversed_);
  if (anchorCaret && focusCaret) {
    var anchorNode = anchorCaret.parentNode;
    var anchorOffset = goog.array.indexOf(anchorNode.childNodes, anchorCaret);
    var focusNode = focusCaret.parentNode;
    var focusOffset = goog.array.indexOf(focusNode.childNodes, focusCaret);
    if (focusNode == anchorNode) {
      if (this.reversed_) {
        anchorOffset--;
      } else {
        focusOffset--;
      }
    }
    range = goog.dom.Range.createFromNodes(anchorNode, anchorOffset, focusNode, focusOffset);
    range = this.removeCarets(range);
    range.select();
  } else {
    this.removeCarets();
  }
  return range;
};
goog.dom.SavedCaretRange.prototype.disposeInternal = function() {
  this.removeCarets();
  this.dom_ = null;
};
goog.dom.SavedCaretRange.prototype.createCaret_ = function(start) {
  return this.dom_.createDom(goog.dom.TagName.SPAN, {"id":start ? this.startCaretId_ : this.endCaretId_});
};
goog.dom.SavedCaretRange.CARET_REGEX = /<span\s+id="?goog_\d+"?><\/span>/ig;
goog.dom.SavedCaretRange.htmlEqual = function(str1, str2) {
  return str1 == str2 || str1.replace(goog.dom.SavedCaretRange.CARET_REGEX, "") == str2.replace(goog.dom.SavedCaretRange.CARET_REGEX, "");
};
goog.provide("goog.functions");
goog.functions.constant = function(retValue) {
  return function() {
    return retValue;
  };
};
goog.functions.FALSE = goog.functions.constant(false);
goog.functions.TRUE = goog.functions.constant(true);
goog.functions.NULL = goog.functions.constant(null);
goog.functions.identity = function(opt_returnValue, var_args) {
  return opt_returnValue;
};
goog.functions.error = function(message) {
  return function() {
    throw Error(message);
  };
};
goog.functions.fail = function(err) {
  return function() {
    throw err;
  };
};
goog.functions.lock = function(f, opt_numArgs) {
  opt_numArgs = opt_numArgs || 0;
  return function() {
    return f.apply(this, Array.prototype.slice.call(arguments, 0, opt_numArgs));
  };
};
goog.functions.nth = function(n) {
  return function() {
    return arguments[n];
  };
};
goog.functions.partialRight = function(fn, var_args) {
  var rightArgs = Array.prototype.slice.call(arguments, 1);
  return function() {
    var newArgs = Array.prototype.slice.call(arguments);
    newArgs.push.apply(newArgs, rightArgs);
    return fn.apply(this, newArgs);
  };
};
goog.functions.withReturnValue = function(f, retValue) {
  return goog.functions.sequence(f, goog.functions.constant(retValue));
};
goog.functions.equalTo = function(value, opt_useLooseComparison) {
  return function(other) {
    return opt_useLooseComparison ? value == other : value === other;
  };
};
goog.functions.compose = function(fn, var_args) {
  var functions = arguments;
  var length = functions.length;
  return function() {
    var result;
    if (length) {
      result = functions[length - 1].apply(this, arguments);
    }
    for (var i = length - 2; i >= 0; i--) {
      result = functions[i].call(this, result);
    }
    return result;
  };
};
goog.functions.sequence = function(var_args) {
  var functions = arguments;
  var length = functions.length;
  return function() {
    var result;
    for (var i = 0; i < length; i++) {
      result = functions[i].apply(this, arguments);
    }
    return result;
  };
};
goog.functions.and = function(var_args) {
  var functions = arguments;
  var length = functions.length;
  return function() {
    for (var i = 0; i < length; i++) {
      if (!functions[i].apply(this, arguments)) {
        return false;
      }
    }
    return true;
  };
};
goog.functions.or = function(var_args) {
  var functions = arguments;
  var length = functions.length;
  return function() {
    for (var i = 0; i < length; i++) {
      if (functions[i].apply(this, arguments)) {
        return true;
      }
    }
    return false;
  };
};
goog.functions.not = function(f) {
  return function() {
    return !f.apply(this, arguments);
  };
};
goog.functions.create = function(constructor, var_args) {
  var temp = function() {
  };
  temp.prototype = constructor.prototype;
  var obj = new temp;
  constructor.apply(obj, Array.prototype.slice.call(arguments, 1));
  return obj;
};
goog.define("goog.functions.CACHE_RETURN_VALUE", true);
goog.functions.cacheReturnValue = function(fn) {
  var called = false;
  var value;
  return function() {
    if (!goog.functions.CACHE_RETURN_VALUE) {
      return fn();
    }
    if (!called) {
      value = fn();
      called = true;
    }
    return value;
  };
};
goog.functions.once = function(f) {
  var inner = f;
  return function() {
    if (inner) {
      var tmp = inner;
      inner = null;
      tmp();
    }
  };
};
goog.functions.debounce = function(f, interval, opt_scope) {
  var timeout = 0;
  return function(var_args) {
    goog.global.clearTimeout(timeout);
    var args = arguments;
    timeout = goog.global.setTimeout(function() {
      f.apply(opt_scope, args);
    }, interval);
  };
};
goog.functions.throttle = function(f, interval, opt_scope) {
  var timeout = 0;
  var shouldFire = false;
  var args = [];
  var handleTimeout = function() {
    timeout = 0;
    if (shouldFire) {
      shouldFire = false;
      fire();
    }
  };
  var fire = function() {
    timeout = goog.global.setTimeout(handleTimeout, interval);
    f.apply(opt_scope, args);
  };
  return function(var_args) {
    args = arguments;
    if (!timeout) {
      fire();
    } else {
      shouldFire = true;
    }
  };
};
goog.functions.rateLimit = function(f, interval, opt_scope) {
  var timeout = 0;
  var handleTimeout = function() {
    timeout = 0;
  };
  return function(var_args) {
    if (!timeout) {
      timeout = goog.global.setTimeout(handleTimeout, interval);
      f.apply(opt_scope, arguments);
    }
  };
};
goog.provide("goog.iter");
goog.provide("goog.iter.Iterable");
goog.provide("goog.iter.Iterator");
goog.provide("goog.iter.StopIteration");
goog.require("goog.array");
goog.require("goog.asserts");
goog.require("goog.functions");
goog.require("goog.math");
goog.iter.Iterable;
goog.iter.StopIteration = "StopIteration" in goog.global ? goog.global["StopIteration"] : {message:"StopIteration", stack:""};
goog.iter.Iterator = function() {
};
goog.iter.Iterator.prototype.next = function() {
  throw goog.iter.StopIteration;
};
goog.iter.Iterator.prototype.__iterator__ = function(opt_keys) {
  return this;
};
goog.iter.toIterator = function(iterable) {
  if (iterable instanceof goog.iter.Iterator) {
    return iterable;
  }
  if (typeof iterable.__iterator__ == "function") {
    return iterable.__iterator__(false);
  }
  if (goog.isArrayLike(iterable)) {
    var i = 0;
    var newIter = new goog.iter.Iterator;
    newIter.next = function() {
      while (true) {
        if (i >= iterable.length) {
          throw goog.iter.StopIteration;
        }
        if (!(i in iterable)) {
          i++;
          continue;
        }
        return iterable[i++];
      }
    };
    return newIter;
  }
  throw Error("Not implemented");
};
goog.iter.forEach = function(iterable, f, opt_obj) {
  if (goog.isArrayLike(iterable)) {
    try {
      goog.array.forEach(iterable, f, opt_obj);
    } catch (ex) {
      if (ex !== goog.iter.StopIteration) {
        throw ex;
      }
    }
  } else {
    iterable = goog.iter.toIterator(iterable);
    try {
      while (true) {
        f.call(opt_obj, iterable.next(), undefined, iterable);
      }
    } catch (ex$1) {
      if (ex$1 !== goog.iter.StopIteration) {
        throw ex$1;
      }
    }
  }
};
goog.iter.filter = function(iterable, f, opt_obj) {
  var iterator = goog.iter.toIterator(iterable);
  var newIter = new goog.iter.Iterator;
  newIter.next = function() {
    while (true) {
      var val = iterator.next();
      if (f.call(opt_obj, val, undefined, iterator)) {
        return val;
      }
    }
  };
  return newIter;
};
goog.iter.filterFalse = function(iterable, f, opt_obj) {
  return goog.iter.filter(iterable, goog.functions.not(f), opt_obj);
};
goog.iter.range = function(startOrStop, opt_stop, opt_step) {
  var start = 0;
  var stop = startOrStop;
  var step = opt_step || 1;
  if (arguments.length > 1) {
    start = startOrStop;
    stop = opt_stop;
  }
  if (step == 0) {
    throw Error("Range step argument must not be zero");
  }
  var newIter = new goog.iter.Iterator;
  newIter.next = function() {
    if (step > 0 && start >= stop || step < 0 && start <= stop) {
      throw goog.iter.StopIteration;
    }
    var rv = start;
    start += step;
    return rv;
  };
  return newIter;
};
goog.iter.join = function(iterable, deliminator) {
  return goog.iter.toArray(iterable).join(deliminator);
};
goog.iter.map = function(iterable, f, opt_obj) {
  var iterator = goog.iter.toIterator(iterable);
  var newIter = new goog.iter.Iterator;
  newIter.next = function() {
    var val = iterator.next();
    return f.call(opt_obj, val, undefined, iterator);
  };
  return newIter;
};
goog.iter.reduce = function(iterable, f, val, opt_obj) {
  var rval = val;
  goog.iter.forEach(iterable, function(val) {
    rval = f.call(opt_obj, rval, val);
  });
  return rval;
};
goog.iter.some = function(iterable, f, opt_obj) {
  iterable = goog.iter.toIterator(iterable);
  try {
    while (true) {
      if (f.call(opt_obj, iterable.next(), undefined, iterable)) {
        return true;
      }
    }
  } catch (ex) {
    if (ex !== goog.iter.StopIteration) {
      throw ex;
    }
  }
  return false;
};
goog.iter.every = function(iterable, f, opt_obj) {
  iterable = goog.iter.toIterator(iterable);
  try {
    while (true) {
      if (!f.call(opt_obj, iterable.next(), undefined, iterable)) {
        return false;
      }
    }
  } catch (ex) {
    if (ex !== goog.iter.StopIteration) {
      throw ex;
    }
  }
  return true;
};
goog.iter.chain = function(var_args) {
  return goog.iter.chainFromIterable(arguments);
};
goog.iter.chainFromIterable = function(iterable) {
  var iterator = goog.iter.toIterator(iterable);
  var iter = new goog.iter.Iterator;
  var current = null;
  iter.next = function() {
    while (true) {
      if (current == null) {
        var it = iterator.next();
        current = goog.iter.toIterator(it);
      }
      try {
        return current.next();
      } catch (ex) {
        if (ex !== goog.iter.StopIteration) {
          throw ex;
        }
        current = null;
      }
    }
  };
  return iter;
};
goog.iter.dropWhile = function(iterable, f, opt_obj) {
  var iterator = goog.iter.toIterator(iterable);
  var newIter = new goog.iter.Iterator;
  var dropping = true;
  newIter.next = function() {
    while (true) {
      var val = iterator.next();
      if (dropping && f.call(opt_obj, val, undefined, iterator)) {
        continue;
      } else {
        dropping = false;
      }
      return val;
    }
  };
  return newIter;
};
goog.iter.takeWhile = function(iterable, f, opt_obj) {
  var iterator = goog.iter.toIterator(iterable);
  var iter = new goog.iter.Iterator;
  iter.next = function() {
    var val = iterator.next();
    if (f.call(opt_obj, val, undefined, iterator)) {
      return val;
    }
    throw goog.iter.StopIteration;
  };
  return iter;
};
goog.iter.toArray = function(iterable) {
  if (goog.isArrayLike(iterable)) {
    return goog.array.toArray(iterable);
  }
  iterable = goog.iter.toIterator(iterable);
  var array = [];
  goog.iter.forEach(iterable, function(val) {
    array.push(val);
  });
  return array;
};
goog.iter.equals = function(iterable1, iterable2, opt_equalsFn) {
  var fillValue = {};
  var pairs = goog.iter.zipLongest(fillValue, iterable1, iterable2);
  var equalsFn = opt_equalsFn || goog.array.defaultCompareEquality;
  return goog.iter.every(pairs, function(pair) {
    return equalsFn(pair[0], pair[1]);
  });
};
goog.iter.nextOrValue = function(iterable, defaultValue) {
  try {
    return goog.iter.toIterator(iterable).next();
  } catch (e) {
    if (e != goog.iter.StopIteration) {
      throw e;
    }
    return defaultValue;
  }
};
goog.iter.product = function(var_args) {
  var someArrayEmpty = goog.array.some(arguments, function(arr) {
    return !arr.length;
  });
  if (someArrayEmpty || !arguments.length) {
    return new goog.iter.Iterator;
  }
  var iter = new goog.iter.Iterator;
  var arrays = arguments;
  var indicies = goog.array.repeat(0, arrays.length);
  iter.next = function() {
    if (indicies) {
      var retVal = goog.array.map(indicies, function(valueIndex, arrayIndex) {
        return arrays[arrayIndex][valueIndex];
      });
      for (var i = indicies.length - 1; i >= 0; i--) {
        goog.asserts.assert(indicies);
        if (indicies[i] < arrays[i].length - 1) {
          indicies[i]++;
          break;
        }
        if (i == 0) {
          indicies = null;
          break;
        }
        indicies[i] = 0;
      }
      return retVal;
    }
    throw goog.iter.StopIteration;
  };
  return iter;
};
goog.iter.cycle = function(iterable) {
  var baseIterator = goog.iter.toIterator(iterable);
  var cache = [];
  var cacheIndex = 0;
  var iter = new goog.iter.Iterator;
  var useCache = false;
  iter.next = function() {
    var returnElement = null;
    if (!useCache) {
      try {
        returnElement = baseIterator.next();
        cache.push(returnElement);
        return returnElement;
      } catch (e) {
        if (e != goog.iter.StopIteration || goog.array.isEmpty(cache)) {
          throw e;
        }
        useCache = true;
      }
    }
    returnElement = cache[cacheIndex];
    cacheIndex = (cacheIndex + 1) % cache.length;
    return returnElement;
  };
  return iter;
};
goog.iter.count = function(opt_start, opt_step) {
  var counter = opt_start || 0;
  var step = goog.isDef(opt_step) ? opt_step : 1;
  var iter = new goog.iter.Iterator;
  iter.next = function() {
    var returnValue = counter;
    counter += step;
    return returnValue;
  };
  return iter;
};
goog.iter.repeat = function(value) {
  var iter = new goog.iter.Iterator;
  iter.next = goog.functions.constant(value);
  return iter;
};
goog.iter.accumulate = function(iterable) {
  var iterator = goog.iter.toIterator(iterable);
  var total = 0;
  var iter = new goog.iter.Iterator;
  iter.next = function() {
    total += iterator.next();
    return total;
  };
  return iter;
};
goog.iter.zip = function(var_args) {
  var args = arguments;
  var iter = new goog.iter.Iterator;
  if (args.length > 0) {
    var iterators = goog.array.map(args, goog.iter.toIterator);
    iter.next = function() {
      var arr = goog.array.map(iterators, function(it) {
        return it.next();
      });
      return arr;
    };
  }
  return iter;
};
goog.iter.zipLongest = function(fillValue, var_args) {
  var args = goog.array.slice(arguments, 1);
  var iter = new goog.iter.Iterator;
  if (args.length > 0) {
    var iterators = goog.array.map(args, goog.iter.toIterator);
    iter.next = function() {
      var iteratorsHaveValues = false;
      var arr = goog.array.map(iterators, function(it) {
        var returnValue;
        try {
          returnValue = it.next();
          iteratorsHaveValues = true;
        } catch (ex) {
          if (ex !== goog.iter.StopIteration) {
            throw ex;
          }
          returnValue = fillValue;
        }
        return returnValue;
      });
      if (!iteratorsHaveValues) {
        throw goog.iter.StopIteration;
      }
      return arr;
    };
  }
  return iter;
};
goog.iter.compress = function(iterable, selectors) {
  var selectorIterator = goog.iter.toIterator(selectors);
  return goog.iter.filter(iterable, function() {
    return !!selectorIterator.next();
  });
};
goog.iter.GroupByIterator_ = function(iterable, opt_keyFunc) {
  this.iterator = goog.iter.toIterator(iterable);
  this.keyFunc = opt_keyFunc || goog.functions.identity;
  this.targetKey;
  this.currentKey;
  this.currentValue;
};
goog.inherits(goog.iter.GroupByIterator_, goog.iter.Iterator);
goog.iter.GroupByIterator_.prototype.next = function() {
  while (this.currentKey == this.targetKey) {
    this.currentValue = this.iterator.next();
    this.currentKey = this.keyFunc(this.currentValue);
  }
  this.targetKey = this.currentKey;
  return [this.currentKey, this.groupItems_(this.targetKey)];
};
goog.iter.GroupByIterator_.prototype.groupItems_ = function(targetKey) {
  var arr = [];
  while (this.currentKey == targetKey) {
    arr.push(this.currentValue);
    try {
      this.currentValue = this.iterator.next();
    } catch (ex) {
      if (ex !== goog.iter.StopIteration) {
        throw ex;
      }
      break;
    }
    this.currentKey = this.keyFunc(this.currentValue);
  }
  return arr;
};
goog.iter.groupBy = function(iterable, opt_keyFunc) {
  return new goog.iter.GroupByIterator_(iterable, opt_keyFunc);
};
goog.iter.starMap = function(iterable, f, opt_obj) {
  var iterator = goog.iter.toIterator(iterable);
  var iter = new goog.iter.Iterator;
  iter.next = function() {
    var args = goog.iter.toArray(iterator.next());
    return f.apply(opt_obj, goog.array.concat(args, undefined, iterator));
  };
  return iter;
};
goog.iter.tee = function(iterable, opt_num) {
  var iterator = goog.iter.toIterator(iterable);
  var num = goog.isNumber(opt_num) ? opt_num : 2;
  var buffers = goog.array.map(goog.array.range(num), function() {
    return [];
  });
  var addNextIteratorValueToBuffers = function() {
    var val = iterator.next();
    goog.array.forEach(buffers, function(buffer) {
      buffer.push(val);
    });
  };
  var createIterator = function(buffer) {
    var iter = new goog.iter.Iterator;
    iter.next = function() {
      if (goog.array.isEmpty(buffer)) {
        addNextIteratorValueToBuffers();
      }
      goog.asserts.assert(!goog.array.isEmpty(buffer));
      return buffer.shift();
    };
    return iter;
  };
  return goog.array.map(buffers, createIterator);
};
goog.iter.enumerate = function(iterable, opt_start) {
  return goog.iter.zip(goog.iter.count(opt_start), iterable);
};
goog.iter.limit = function(iterable, limitSize) {
  goog.asserts.assert(goog.math.isInt(limitSize) && limitSize >= 0);
  var iterator = goog.iter.toIterator(iterable);
  var iter = new goog.iter.Iterator;
  var remaining = limitSize;
  iter.next = function() {
    if (remaining-- > 0) {
      return iterator.next();
    }
    throw goog.iter.StopIteration;
  };
  return iter;
};
goog.iter.consume = function(iterable, count) {
  goog.asserts.assert(goog.math.isInt(count) && count >= 0);
  var iterator = goog.iter.toIterator(iterable);
  while (count-- > 0) {
    goog.iter.nextOrValue(iterator, null);
  }
  return iterator;
};
goog.iter.slice = function(iterable, start, opt_end) {
  goog.asserts.assert(goog.math.isInt(start) && start >= 0);
  var iterator = goog.iter.consume(iterable, start);
  if (goog.isNumber(opt_end)) {
    goog.asserts.assert(goog.math.isInt(opt_end) && opt_end >= start);
    iterator = goog.iter.limit(iterator, opt_end - start);
  }
  return iterator;
};
goog.iter.hasDuplicates_ = function(arr) {
  var deduped = [];
  goog.array.removeDuplicates(arr, deduped);
  return arr.length != deduped.length;
};
goog.iter.permutations = function(iterable, opt_length) {
  var elements = goog.iter.toArray(iterable);
  var length = goog.isNumber(opt_length) ? opt_length : elements.length;
  var sets = goog.array.repeat(elements, length);
  var product = goog.iter.product.apply(undefined, sets);
  return goog.iter.filter(product, function(arr) {
    return !goog.iter.hasDuplicates_(arr);
  });
};
goog.iter.combinations = function(iterable, length) {
  var elements = goog.iter.toArray(iterable);
  var indexes = goog.iter.range(elements.length);
  var indexIterator = goog.iter.permutations(indexes, length);
  var sortedIndexIterator = goog.iter.filter(indexIterator, function(arr) {
    return goog.array.isSorted(arr);
  });
  var iter = new goog.iter.Iterator;
  function getIndexFromElements(index) {
    return elements[index];
  }
  iter.next = function() {
    return goog.array.map(sortedIndexIterator.next(), getIndexFromElements);
  };
  return iter;
};
goog.iter.combinationsWithReplacement = function(iterable, length) {
  var elements = goog.iter.toArray(iterable);
  var indexes = goog.array.range(elements.length);
  var sets = goog.array.repeat(indexes, length);
  var indexIterator = goog.iter.product.apply(undefined, sets);
  var sortedIndexIterator = goog.iter.filter(indexIterator, function(arr) {
    return goog.array.isSorted(arr);
  });
  var iter = new goog.iter.Iterator;
  function getIndexFromElements(index) {
    return elements[index];
  }
  iter.next = function() {
    return goog.array.map(sortedIndexIterator.next(), getIndexFromElements);
  };
  return iter;
};
goog.provide("goog.dom.TagIterator");
goog.provide("goog.dom.TagWalkType");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.iter.Iterator");
goog.require("goog.iter.StopIteration");
goog.dom.TagWalkType = {START_TAG:1, OTHER:0, END_TAG:-1};
goog.dom.TagIterator = function(opt_node, opt_reversed, opt_unconstrained, opt_tagType, opt_depth) {
  this.reversed = !!opt_reversed;
  this.node = null;
  this.tagType = goog.dom.TagWalkType.OTHER;
  this.depth;
  this.started_ = false;
  this.constrained = !opt_unconstrained;
  if (opt_node) {
    this.setPosition(opt_node, opt_tagType);
  }
  this.depth = opt_depth != undefined ? opt_depth : this.tagType || 0;
  if (this.reversed) {
    this.depth *= -1;
  }
};
goog.inherits(goog.dom.TagIterator, goog.iter.Iterator);
goog.dom.TagIterator.prototype.setPosition = function(node, opt_tagType, opt_depth) {
  this.node = node;
  if (node) {
    if (goog.isNumber(opt_tagType)) {
      this.tagType = opt_tagType;
    } else {
      this.tagType = this.node.nodeType != goog.dom.NodeType.ELEMENT ? goog.dom.TagWalkType.OTHER : this.reversed ? goog.dom.TagWalkType.END_TAG : goog.dom.TagWalkType.START_TAG;
    }
  }
  if (goog.isNumber(opt_depth)) {
    this.depth = opt_depth;
  }
};
goog.dom.TagIterator.prototype.copyFrom = function(other) {
  this.node = other.node;
  this.tagType = other.tagType;
  this.depth = other.depth;
  this.reversed = other.reversed;
  this.constrained = other.constrained;
};
goog.dom.TagIterator.prototype.clone = function() {
  return new goog.dom.TagIterator(this.node, this.reversed, !this.constrained, this.tagType, this.depth);
};
goog.dom.TagIterator.prototype.skipTag = function() {
  var check = this.reversed ? goog.dom.TagWalkType.END_TAG : goog.dom.TagWalkType.START_TAG;
  if (this.tagType == check) {
    this.tagType = check * -1;
    this.depth += this.tagType * (this.reversed ? -1 : 1);
  }
};
goog.dom.TagIterator.prototype.restartTag = function() {
  var check = this.reversed ? goog.dom.TagWalkType.START_TAG : goog.dom.TagWalkType.END_TAG;
  if (this.tagType == check) {
    this.tagType = check * -1;
    this.depth += this.tagType * (this.reversed ? -1 : 1);
  }
};
goog.dom.TagIterator.prototype.next = function() {
  var node;
  if (this.started_) {
    if (!this.node || this.constrained && this.depth == 0) {
      throw goog.iter.StopIteration;
    }
    node = this.node;
    var startType = this.reversed ? goog.dom.TagWalkType.END_TAG : goog.dom.TagWalkType.START_TAG;
    if (this.tagType == startType) {
      var child = this.reversed ? node.lastChild : node.firstChild;
      if (child) {
        this.setPosition(child);
      } else {
        this.setPosition(node, startType * -1);
      }
    } else {
      var sibling = this.reversed ? node.previousSibling : node.nextSibling;
      if (sibling) {
        this.setPosition(sibling);
      } else {
        this.setPosition(node.parentNode, startType * -1);
      }
    }
    this.depth += this.tagType * (this.reversed ? -1 : 1);
  } else {
    this.started_ = true;
  }
  node = this.node;
  if (!this.node) {
    throw goog.iter.StopIteration;
  }
  return node;
};
goog.dom.TagIterator.prototype.isStarted = function() {
  return this.started_;
};
goog.dom.TagIterator.prototype.isStartTag = function() {
  return this.tagType == goog.dom.TagWalkType.START_TAG;
};
goog.dom.TagIterator.prototype.isEndTag = function() {
  return this.tagType == goog.dom.TagWalkType.END_TAG;
};
goog.dom.TagIterator.prototype.isNonElement = function() {
  return this.tagType == goog.dom.TagWalkType.OTHER;
};
goog.dom.TagIterator.prototype.equals = function(other) {
  return other.node == this.node && (!this.node || other.tagType == this.tagType);
};
goog.dom.TagIterator.prototype.splice = function(var_args) {
  var node = this.node;
  this.restartTag();
  this.reversed = !this.reversed;
  goog.dom.TagIterator.prototype.next.call(this);
  this.reversed = !this.reversed;
  var arr = goog.isArrayLike(arguments[0]) ? arguments[0] : arguments;
  for (var i = arr.length - 1; i >= 0; i--) {
    goog.dom.insertSiblingAfter(arr[i], node);
  }
  goog.dom.removeNode(node);
};
goog.provide("goog.dom.AbstractRange");
goog.provide("goog.dom.RangeIterator");
goog.provide("goog.dom.RangeType");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.SavedCaretRange");
goog.require("goog.dom.TagIterator");
goog.require("goog.userAgent");
goog.dom.RangeType = {TEXT:"text", CONTROL:"control", MULTI:"mutli"};
goog.dom.AbstractRange = function() {
};
goog.dom.AbstractRange.getBrowserSelectionForWindow = function(win) {
  if (win.getSelection) {
    return win.getSelection();
  } else {
    var doc = win.document;
    var sel = doc.selection;
    if (sel) {
      try {
        var range = sel.createRange();
        if (range.parentElement) {
          if (range.parentElement().document != doc) {
            return null;
          }
        } else {
          if (!range.length || range.item(0).document != doc) {
            return null;
          }
        }
      } catch (e) {
        return null;
      }
      return sel;
    }
    return null;
  }
};
goog.dom.AbstractRange.isNativeControlRange = function(range) {
  return !!range && !!range.addElement;
};
goog.dom.AbstractRange.prototype.clone = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getType = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getBrowserRangeObject = goog.abstractMethod;
goog.dom.AbstractRange.prototype.setBrowserRangeObject = function(nativeRange) {
  return false;
};
goog.dom.AbstractRange.prototype.getTextRangeCount = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getTextRange = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getTextRanges = function() {
  var output = [];
  for (var i = 0, len = this.getTextRangeCount(); i < len; i++) {
    output.push(this.getTextRange(i));
  }
  return output;
};
goog.dom.AbstractRange.prototype.getContainer = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getContainerElement = function() {
  var node = this.getContainer();
  return node.nodeType == goog.dom.NodeType.ELEMENT ? node : node.parentNode;
};
goog.dom.AbstractRange.prototype.getStartNode = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getStartOffset = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getStartPosition = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getEndNode = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getEndOffset = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getEndPosition = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getAnchorNode = function() {
  return this.isReversed() ? this.getEndNode() : this.getStartNode();
};
goog.dom.AbstractRange.prototype.getAnchorOffset = function() {
  return this.isReversed() ? this.getEndOffset() : this.getStartOffset();
};
goog.dom.AbstractRange.prototype.getFocusNode = function() {
  return this.isReversed() ? this.getStartNode() : this.getEndNode();
};
goog.dom.AbstractRange.prototype.getFocusOffset = function() {
  return this.isReversed() ? this.getStartOffset() : this.getEndOffset();
};
goog.dom.AbstractRange.prototype.isReversed = function() {
  return false;
};
goog.dom.AbstractRange.prototype.getDocument = function() {
  return goog.dom.getOwnerDocument(goog.userAgent.IE ? this.getContainer() : this.getStartNode());
};
goog.dom.AbstractRange.prototype.getWindow = function() {
  return goog.dom.getWindow(this.getDocument());
};
goog.dom.AbstractRange.prototype.containsRange = goog.abstractMethod;
goog.dom.AbstractRange.prototype.containsNode = goog.abstractMethod;
goog.dom.AbstractRange.prototype.isRangeInDocument = goog.abstractMethod;
goog.dom.AbstractRange.prototype.isCollapsed = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getText = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getHtmlFragment = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getValidHtml = goog.abstractMethod;
goog.dom.AbstractRange.prototype.getPastableHtml = goog.abstractMethod;
goog.dom.AbstractRange.prototype.__iterator__ = goog.abstractMethod;
goog.dom.AbstractRange.prototype.select = goog.abstractMethod;
goog.dom.AbstractRange.prototype.removeContents = goog.abstractMethod;
goog.dom.AbstractRange.prototype.insertNode = goog.abstractMethod;
goog.dom.AbstractRange.prototype.replaceContentsWithNode = function(node) {
  if (!this.isCollapsed()) {
    this.removeContents();
  }
  return this.insertNode(node, true);
};
goog.dom.AbstractRange.prototype.surroundWithNodes = goog.abstractMethod;
goog.dom.AbstractRange.prototype.saveUsingDom = goog.abstractMethod;
goog.dom.AbstractRange.prototype.saveUsingCarets = function() {
  return this.getStartNode() && this.getEndNode() ? new goog.dom.SavedCaretRange(this) : null;
};
goog.dom.AbstractRange.prototype.collapse = goog.abstractMethod;
goog.dom.RangeIterator = function(node, opt_reverse) {
  goog.dom.TagIterator.call(this, node, opt_reverse, true);
};
goog.inherits(goog.dom.RangeIterator, goog.dom.TagIterator);
goog.dom.RangeIterator.prototype.getStartTextOffset = goog.abstractMethod;
goog.dom.RangeIterator.prototype.getEndTextOffset = goog.abstractMethod;
goog.dom.RangeIterator.prototype.getStartNode = goog.abstractMethod;
goog.dom.RangeIterator.prototype.getEndNode = goog.abstractMethod;
goog.dom.RangeIterator.prototype.isLast = goog.abstractMethod;
goog.provide("goog.dom.TextRangeIterator");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.RangeIterator");
goog.require("goog.dom.TagName");
goog.require("goog.iter.StopIteration");
goog.dom.TextRangeIterator = function(startNode, startOffset, endNode, endOffset, opt_reverse) {
  this.startNode_ = null;
  this.endNode_ = null;
  this.startOffset_ = 0;
  this.endOffset_ = 0;
  var goNext;
  if (startNode) {
    this.startNode_ = startNode;
    this.startOffset_ = startOffset;
    this.endNode_ = endNode;
    this.endOffset_ = endOffset;
    if (startNode.nodeType == goog.dom.NodeType.ELEMENT && startNode.tagName != goog.dom.TagName.BR) {
      var startChildren = startNode.childNodes;
      var candidate = startChildren[startOffset];
      if (candidate) {
        this.startNode_ = candidate;
        this.startOffset_ = 0;
      } else {
        if (startChildren.length) {
          this.startNode_ = goog.array.peek(startChildren);
        }
        goNext = true;
      }
    }
    if (endNode.nodeType == goog.dom.NodeType.ELEMENT) {
      this.endNode_ = endNode.childNodes[endOffset];
      if (this.endNode_) {
        this.endOffset_ = 0;
      } else {
        this.endNode_ = endNode;
      }
    }
  }
  goog.dom.TextRangeIterator.base(this, "constructor", opt_reverse ? this.endNode_ : this.startNode_, opt_reverse);
  if (goNext) {
    try {
      this.next();
    } catch (e) {
      if (e != goog.iter.StopIteration) {
        throw e;
      }
    }
  }
};
goog.inherits(goog.dom.TextRangeIterator, goog.dom.RangeIterator);
goog.dom.TextRangeIterator.prototype.getStartTextOffset = function() {
  return this.node.nodeType != goog.dom.NodeType.TEXT ? -1 : this.node == this.startNode_ ? this.startOffset_ : 0;
};
goog.dom.TextRangeIterator.prototype.getEndTextOffset = function() {
  return this.node.nodeType != goog.dom.NodeType.TEXT ? -1 : this.node == this.endNode_ ? this.endOffset_ : this.node.nodeValue.length;
};
goog.dom.TextRangeIterator.prototype.getStartNode = function() {
  return this.startNode_;
};
goog.dom.TextRangeIterator.prototype.setStartNode = function(node) {
  if (!this.isStarted()) {
    this.setPosition(node);
  }
  this.startNode_ = node;
  this.startOffset_ = 0;
};
goog.dom.TextRangeIterator.prototype.getEndNode = function() {
  return this.endNode_;
};
goog.dom.TextRangeIterator.prototype.setEndNode = function(node) {
  this.endNode_ = node;
  this.endOffset_ = 0;
};
goog.dom.TextRangeIterator.prototype.isLast = function() {
  return this.isStarted() && this.node == this.endNode_ && (!this.endOffset_ || !this.isStartTag());
};
goog.dom.TextRangeIterator.prototype.next = function() {
  if (this.isLast()) {
    throw goog.iter.StopIteration;
  }
  return goog.dom.TextRangeIterator.superClass_.next.call(this);
};
goog.dom.TextRangeIterator.prototype.skipTag = function() {
  goog.dom.TextRangeIterator.superClass_.skipTag.apply(this);
  if (goog.dom.contains(this.node, this.endNode_)) {
    throw goog.iter.StopIteration;
  }
};
goog.dom.TextRangeIterator.prototype.copyFrom = function(other) {
  this.startNode_ = other.startNode_;
  this.endNode_ = other.endNode_;
  this.startOffset_ = other.startOffset_;
  this.endOffset_ = other.endOffset_;
  this.isReversed_ = other.isReversed_;
  goog.dom.TextRangeIterator.superClass_.copyFrom.call(this, other);
};
goog.dom.TextRangeIterator.prototype.clone = function() {
  var copy = new goog.dom.TextRangeIterator(this.startNode_, this.startOffset_, this.endNode_, this.endOffset_, this.isReversed_);
  copy.copyFrom(this);
  return copy;
};
goog.provide("goog.dom.RangeEndpoint");
goog.dom.RangeEndpoint = {START:1, END:0};
goog.provide("goog.string.StringBuffer");
goog.string.StringBuffer = function(opt_a1, var_args) {
  if (opt_a1 != null) {
    this.append.apply(this, arguments);
  }
};
goog.string.StringBuffer.prototype.buffer_ = "";
goog.string.StringBuffer.prototype.set = function(s) {
  this.buffer_ = "" + s;
};
goog.string.StringBuffer.prototype.append = function(a1, opt_a2, var_args) {
  this.buffer_ += String(a1);
  if (opt_a2 != null) {
    for (var i = 1; i < arguments.length; i++) {
      this.buffer_ += arguments[i];
    }
  }
  return this;
};
goog.string.StringBuffer.prototype.clear = function() {
  this.buffer_ = "";
};
goog.string.StringBuffer.prototype.getLength = function() {
  return this.buffer_.length;
};
goog.string.StringBuffer.prototype.toString = function() {
  return this.buffer_;
};
goog.provide("goog.dom.browserrange.AbstractRange");
goog.require("goog.array");
goog.require("goog.asserts");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.RangeEndpoint");
goog.require("goog.dom.TagName");
goog.require("goog.dom.TextRangeIterator");
goog.require("goog.iter");
goog.require("goog.math.Coordinate");
goog.require("goog.string");
goog.require("goog.string.StringBuffer");
goog.require("goog.userAgent");
goog.dom.browserrange.AbstractRange = function() {
};
goog.dom.browserrange.AbstractRange.prototype.clone = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.getBrowserRange = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.getContainer = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.getStartNode = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.getStartOffset = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.getStartPosition = function() {
  return this.getPosition_(true);
};
goog.dom.browserrange.AbstractRange.prototype.getEndNode = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.getEndOffset = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.getEndPosition = function() {
  return this.getPosition_(false);
};
goog.dom.browserrange.AbstractRange.prototype.getPosition_ = function(start) {
  goog.asserts.assert(this.range_.getClientRects, "Getting selection coordinates is not supported.");
  var rects = this.range_.getClientRects();
  if (rects.length) {
    var r = start ? rects[0] : goog.array.peek(rects);
    return new goog.math.Coordinate(start ? r.left : r.right, start ? r.top : r.bottom);
  }
  return null;
};
goog.dom.browserrange.AbstractRange.prototype.compareBrowserRangeEndpoints = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.containsRange = function(abstractRange, opt_allowPartial) {
  var checkPartial = opt_allowPartial && !abstractRange.isCollapsed();
  var range = abstractRange.getBrowserRange();
  var start = goog.dom.RangeEndpoint.START, end = goog.dom.RangeEndpoint.END;
  try {
    if (checkPartial) {
      return this.compareBrowserRangeEndpoints(range, end, start) >= 0 && this.compareBrowserRangeEndpoints(range, start, end) <= 0;
    } else {
      return this.compareBrowserRangeEndpoints(range, end, end) >= 0 && this.compareBrowserRangeEndpoints(range, start, start) <= 0;
    }
  } catch (e) {
    if (!goog.userAgent.IE) {
      throw e;
    }
    return false;
  }
};
goog.dom.browserrange.AbstractRange.prototype.containsNode = function(node, opt_allowPartial) {
  return this.containsRange(goog.dom.browserrange.createRangeFromNodeContents(node), opt_allowPartial);
};
goog.dom.browserrange.AbstractRange.prototype.isCollapsed = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.getText = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.getHtmlFragment = function() {
  var output = new goog.string.StringBuffer;
  goog.iter.forEach(this, function(node, ignore, it) {
    if (node.nodeType == goog.dom.NodeType.TEXT) {
      output.append(goog.string.htmlEscape(node.nodeValue.substring(it.getStartTextOffset(), it.getEndTextOffset())));
    } else {
      if (node.nodeType == goog.dom.NodeType.ELEMENT) {
        if (it.isEndTag()) {
          if (goog.dom.canHaveChildren(node)) {
            output.append("</" + node.tagName + ">");
          }
        } else {
          var shallow = node.cloneNode(false);
          var html = goog.dom.getOuterHtml(shallow);
          if (goog.userAgent.IE && node.tagName == goog.dom.TagName.LI) {
            output.append(html);
          } else {
            var index = html.lastIndexOf("<");
            output.append(index ? html.substr(0, index) : html);
          }
        }
      }
    }
  }, this);
  return output.toString();
};
goog.dom.browserrange.AbstractRange.prototype.getValidHtml = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.__iterator__ = function(opt_keys) {
  return new goog.dom.TextRangeIterator(this.getStartNode(), this.getStartOffset(), this.getEndNode(), this.getEndOffset());
};
goog.dom.browserrange.AbstractRange.prototype.select = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.removeContents = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.surroundContents = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.insertNode = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.surroundWithNodes = goog.abstractMethod;
goog.dom.browserrange.AbstractRange.prototype.collapse = goog.abstractMethod;
goog.provide("goog.dom.browserrange.W3cRange");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.RangeEndpoint");
goog.require("goog.dom.TagName");
goog.require("goog.dom.browserrange.AbstractRange");
goog.require("goog.string");
goog.require("goog.userAgent");
goog.dom.browserrange.W3cRange = function(range) {
  this.range_ = range;
};
goog.inherits(goog.dom.browserrange.W3cRange, goog.dom.browserrange.AbstractRange);
goog.dom.browserrange.W3cRange.getBrowserRangeForNode = function(node) {
  var nodeRange = goog.dom.getOwnerDocument(node).createRange();
  if (node.nodeType == goog.dom.NodeType.TEXT) {
    nodeRange.setStart(node, 0);
    nodeRange.setEnd(node, node.length);
  } else {
    if (!goog.dom.browserrange.canContainRangeEndpoint(node)) {
      var rangeParent = node.parentNode;
      var rangeStartOffset = goog.array.indexOf(rangeParent.childNodes, node);
      nodeRange.setStart(rangeParent, rangeStartOffset);
      nodeRange.setEnd(rangeParent, rangeStartOffset + 1);
    } else {
      var tempNode, leaf = node;
      while ((tempNode = leaf.firstChild) && goog.dom.browserrange.canContainRangeEndpoint(tempNode)) {
        leaf = tempNode;
      }
      nodeRange.setStart(leaf, 0);
      leaf = node;
      while ((tempNode = leaf.lastChild) && goog.dom.browserrange.canContainRangeEndpoint(tempNode)) {
        leaf = tempNode;
      }
      nodeRange.setEnd(leaf, leaf.nodeType == goog.dom.NodeType.ELEMENT ? leaf.childNodes.length : leaf.length);
    }
  }
  return nodeRange;
};
goog.dom.browserrange.W3cRange.getBrowserRangeForNodes = function(startNode, startOffset, endNode, endOffset) {
  var nodeRange = goog.dom.getOwnerDocument(startNode).createRange();
  nodeRange.setStart(startNode, startOffset);
  nodeRange.setEnd(endNode, endOffset);
  return nodeRange;
};
goog.dom.browserrange.W3cRange.createFromNodeContents = function(node) {
  return new goog.dom.browserrange.W3cRange(goog.dom.browserrange.W3cRange.getBrowserRangeForNode(node));
};
goog.dom.browserrange.W3cRange.createFromNodes = function(startNode, startOffset, endNode, endOffset) {
  return new goog.dom.browserrange.W3cRange(goog.dom.browserrange.W3cRange.getBrowserRangeForNodes(startNode, startOffset, endNode, endOffset));
};
goog.dom.browserrange.W3cRange.prototype.clone = function() {
  return new this.constructor(this.range_.cloneRange());
};
goog.dom.browserrange.W3cRange.prototype.getBrowserRange = function() {
  return this.range_;
};
goog.dom.browserrange.W3cRange.prototype.getContainer = function() {
  return this.range_.commonAncestorContainer;
};
goog.dom.browserrange.W3cRange.prototype.getStartNode = function() {
  return this.range_.startContainer;
};
goog.dom.browserrange.W3cRange.prototype.getStartOffset = function() {
  return this.range_.startOffset;
};
goog.dom.browserrange.W3cRange.prototype.getEndNode = function() {
  return this.range_.endContainer;
};
goog.dom.browserrange.W3cRange.prototype.getEndOffset = function() {
  return this.range_.endOffset;
};
goog.dom.browserrange.W3cRange.prototype.compareBrowserRangeEndpoints = function(range, thisEndpoint, otherEndpoint) {
  return this.range_.compareBoundaryPoints(otherEndpoint == goog.dom.RangeEndpoint.START ? thisEndpoint == goog.dom.RangeEndpoint.START ? goog.global["Range"].START_TO_START : goog.global["Range"].START_TO_END : thisEndpoint == goog.dom.RangeEndpoint.START ? goog.global["Range"].END_TO_START : goog.global["Range"].END_TO_END, range);
};
goog.dom.browserrange.W3cRange.prototype.isCollapsed = function() {
  return this.range_.collapsed;
};
goog.dom.browserrange.W3cRange.prototype.getText = function() {
  return this.range_.toString();
};
goog.dom.browserrange.W3cRange.prototype.getValidHtml = function() {
  var div = goog.dom.getDomHelper(this.range_.startContainer).createDom(goog.dom.TagName.DIV);
  div.appendChild(this.range_.cloneContents());
  var result = div.innerHTML;
  if (goog.string.startsWith(result, "<") || !this.isCollapsed() && !goog.string.contains(result, "<")) {
    return result;
  }
  var container = this.getContainer();
  container = container.nodeType == goog.dom.NodeType.ELEMENT ? container : container.parentNode;
  var html = goog.dom.getOuterHtml(container.cloneNode(false));
  return html.replace(">", ">" + result);
};
goog.dom.browserrange.W3cRange.prototype.select = function(reverse) {
  var win = goog.dom.getWindow(goog.dom.getOwnerDocument(this.getStartNode()));
  this.selectInternal(win.getSelection(), reverse);
};
goog.dom.browserrange.W3cRange.prototype.selectInternal = function(selection, reverse) {
  selection.removeAllRanges();
  selection.addRange(this.range_);
};
goog.dom.browserrange.W3cRange.prototype.removeContents = function() {
  var range = this.range_;
  range.extractContents();
  if (range.startContainer.hasChildNodes()) {
    var rangeStartContainer = range.startContainer.childNodes[range.startOffset];
    if (rangeStartContainer) {
      var rangePrevious = rangeStartContainer.previousSibling;
      if (goog.dom.getRawTextContent(rangeStartContainer) == "") {
        goog.dom.removeNode(rangeStartContainer);
      }
      if (rangePrevious && goog.dom.getRawTextContent(rangePrevious) == "") {
        goog.dom.removeNode(rangePrevious);
      }
    }
  }
  if (goog.userAgent.EDGE_OR_IE) {
    var startNode = this.getStartNode();
    var startOffset = this.getStartOffset();
    var endNode = this.getEndNode();
    var endOffset = this.getEndOffset();
    var sibling = startNode.nextSibling;
    if (startNode == endNode && startNode.parentNode && startNode.nodeType == goog.dom.NodeType.TEXT && sibling && sibling.nodeType == goog.dom.NodeType.TEXT) {
      startNode.nodeValue += sibling.nodeValue;
      goog.dom.removeNode(sibling);
      range.setStart(startNode, startOffset);
      range.setEnd(endNode, endOffset);
    }
  }
};
goog.dom.browserrange.W3cRange.prototype.surroundContents = function(element) {
  this.range_.surroundContents(element);
  return element;
};
goog.dom.browserrange.W3cRange.prototype.insertNode = function(node, before) {
  var range = this.range_.cloneRange();
  range.collapse(before);
  range.insertNode(node);
  range.detach();
  return node;
};
goog.dom.browserrange.W3cRange.prototype.surroundWithNodes = function(startNode, endNode) {
  var win = goog.dom.getWindow(goog.dom.getOwnerDocument(this.getStartNode()));
  var selectionRange = goog.dom.Range.createFromWindow(win);
  if (selectionRange) {
    var sNode = selectionRange.getStartNode();
    var eNode = selectionRange.getEndNode();
    var sOffset = selectionRange.getStartOffset();
    var eOffset = selectionRange.getEndOffset();
  }
  var clone1 = this.range_.cloneRange();
  var clone2 = this.range_.cloneRange();
  clone1.collapse(false);
  clone2.collapse(true);
  clone1.insertNode(endNode);
  clone2.insertNode(startNode);
  clone1.detach();
  clone2.detach();
  if (selectionRange) {
    var isInsertedNode = function(n) {
      return n == startNode || n == endNode;
    };
    if (sNode.nodeType == goog.dom.NodeType.TEXT) {
      while (sOffset > sNode.length) {
        sOffset -= sNode.length;
        do {
          sNode = sNode.nextSibling;
        } while (isInsertedNode(sNode));
      }
    }
    if (eNode.nodeType == goog.dom.NodeType.TEXT) {
      while (eOffset > eNode.length) {
        eOffset -= eNode.length;
        do {
          eNode = eNode.nextSibling;
        } while (isInsertedNode(eNode));
      }
    }
    goog.dom.Range.createFromNodes(sNode, sOffset, eNode, eOffset).select();
  }
};
goog.dom.browserrange.W3cRange.prototype.collapse = function(toStart) {
  this.range_.collapse(toStart);
};
goog.provide("goog.dom.browserrange.GeckoRange");
goog.require("goog.dom.browserrange.W3cRange");
goog.dom.browserrange.GeckoRange = function(range) {
  goog.dom.browserrange.W3cRange.call(this, range);
};
goog.inherits(goog.dom.browserrange.GeckoRange, goog.dom.browserrange.W3cRange);
goog.dom.browserrange.GeckoRange.createFromNodeContents = function(node) {
  return new goog.dom.browserrange.GeckoRange(goog.dom.browserrange.W3cRange.getBrowserRangeForNode(node));
};
goog.dom.browserrange.GeckoRange.createFromNodes = function(startNode, startOffset, endNode, endOffset) {
  return new goog.dom.browserrange.GeckoRange(goog.dom.browserrange.W3cRange.getBrowserRangeForNodes(startNode, startOffset, endNode, endOffset));
};
goog.dom.browserrange.GeckoRange.prototype.selectInternal = function(selection, reversed) {
  if (!reversed || this.isCollapsed()) {
    goog.dom.browserrange.GeckoRange.base(this, "selectInternal", selection, reversed);
  } else {
    selection.collapse(this.getEndNode(), this.getEndOffset());
    selection.extend(this.getStartNode(), this.getStartOffset());
  }
};
goog.provide("goog.dom.browserrange.IeRange");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.RangeEndpoint");
goog.require("goog.dom.TagName");
goog.require("goog.dom.browserrange.AbstractRange");
goog.require("goog.log");
goog.require("goog.string");
goog.dom.browserrange.IeRange = function(range, doc) {
  this.parentNode_ = null;
  this.startNode_ = null;
  this.endNode_ = null;
  this.startOffset_ = -1;
  this.endOffset_ = -1;
  this.range_ = range;
  this.doc_ = doc;
};
goog.inherits(goog.dom.browserrange.IeRange, goog.dom.browserrange.AbstractRange);
goog.dom.browserrange.IeRange.logger_ = goog.log.getLogger("goog.dom.browserrange.IeRange");
goog.dom.browserrange.IeRange.getBrowserRangeForNode_ = function(node) {
  var nodeRange = goog.dom.getOwnerDocument(node).body.createTextRange();
  if (node.nodeType == goog.dom.NodeType.ELEMENT) {
    nodeRange.moveToElementText(node);
    if (goog.dom.browserrange.canContainRangeEndpoint(node) && !node.childNodes.length) {
      nodeRange.collapse(false);
    }
  } else {
    var offset = 0;
    var sibling = node;
    while (sibling = sibling.previousSibling) {
      var nodeType = sibling.nodeType;
      if (nodeType == goog.dom.NodeType.TEXT) {
        offset += sibling.length;
      } else {
        if (nodeType == goog.dom.NodeType.ELEMENT) {
          nodeRange.moveToElementText(sibling);
          break;
        }
      }
    }
    if (!sibling) {
      nodeRange.moveToElementText(node.parentNode);
    }
    nodeRange.collapse(!sibling);
    if (offset) {
      nodeRange.move("character", offset);
    }
    nodeRange.moveEnd("character", node.length);
  }
  return nodeRange;
};
goog.dom.browserrange.IeRange.getBrowserRangeForNodes_ = function(startNode, startOffset, endNode, endOffset) {
  var child, collapse = false;
  if (startNode.nodeType == goog.dom.NodeType.ELEMENT) {
    if (startOffset > startNode.childNodes.length) {
      goog.log.error(goog.dom.browserrange.IeRange.logger_, "Cannot have startOffset > startNode child count");
    }
    child = startNode.childNodes[startOffset];
    collapse = !child;
    startNode = child || startNode.lastChild || startNode;
    startOffset = 0;
  }
  var leftRange = goog.dom.browserrange.IeRange.getBrowserRangeForNode_(startNode);
  if (startOffset) {
    leftRange.move("character", startOffset);
  }
  if (startNode == endNode && startOffset == endOffset) {
    leftRange.collapse(true);
    return leftRange;
  }
  if (collapse) {
    leftRange.collapse(false);
  }
  collapse = false;
  if (endNode.nodeType == goog.dom.NodeType.ELEMENT) {
    if (endOffset > endNode.childNodes.length) {
      goog.log.error(goog.dom.browserrange.IeRange.logger_, "Cannot have endOffset > endNode child count");
    }
    child = endNode.childNodes[endOffset];
    endNode = child || endNode.lastChild || endNode;
    endOffset = 0;
    collapse = !child;
  }
  var rightRange = goog.dom.browserrange.IeRange.getBrowserRangeForNode_(endNode);
  rightRange.collapse(!collapse);
  if (endOffset) {
    rightRange.moveEnd("character", endOffset);
  }
  leftRange.setEndPoint("EndToEnd", rightRange);
  return leftRange;
};
goog.dom.browserrange.IeRange.createFromNodeContents = function(node) {
  var range = new goog.dom.browserrange.IeRange(goog.dom.browserrange.IeRange.getBrowserRangeForNode_(node), goog.dom.getOwnerDocument(node));
  if (!goog.dom.browserrange.canContainRangeEndpoint(node)) {
    range.startNode_ = range.endNode_ = range.parentNode_ = node.parentNode;
    range.startOffset_ = goog.array.indexOf(range.parentNode_.childNodes, node);
    range.endOffset_ = range.startOffset_ + 1;
  } else {
    var tempNode, leaf = node;
    while ((tempNode = leaf.firstChild) && goog.dom.browserrange.canContainRangeEndpoint(tempNode)) {
      leaf = tempNode;
    }
    range.startNode_ = leaf;
    range.startOffset_ = 0;
    leaf = node;
    while ((tempNode = leaf.lastChild) && goog.dom.browserrange.canContainRangeEndpoint(tempNode)) {
      leaf = tempNode;
    }
    range.endNode_ = leaf;
    range.endOffset_ = leaf.nodeType == goog.dom.NodeType.ELEMENT ? leaf.childNodes.length : leaf.length;
    range.parentNode_ = node;
  }
  return range;
};
goog.dom.browserrange.IeRange.createFromNodes = function(startNode, startOffset, endNode, endOffset) {
  var range = new goog.dom.browserrange.IeRange(goog.dom.browserrange.IeRange.getBrowserRangeForNodes_(startNode, startOffset, endNode, endOffset), goog.dom.getOwnerDocument(startNode));
  range.startNode_ = startNode;
  range.startOffset_ = startOffset;
  range.endNode_ = endNode;
  range.endOffset_ = endOffset;
  return range;
};
goog.dom.browserrange.IeRange.prototype.clone = function() {
  var range = new goog.dom.browserrange.IeRange(this.range_.duplicate(), this.doc_);
  range.parentNode_ = this.parentNode_;
  range.startNode_ = this.startNode_;
  range.endNode_ = this.endNode_;
  return range;
};
goog.dom.browserrange.IeRange.prototype.getBrowserRange = function() {
  return this.range_;
};
goog.dom.browserrange.IeRange.prototype.clearCachedValues_ = function() {
  this.parentNode_ = this.startNode_ = this.endNode_ = null;
  this.startOffset_ = this.endOffset_ = -1;
};
goog.dom.browserrange.IeRange.prototype.getContainer = function() {
  if (!this.parentNode_) {
    var selectText = this.range_.text;
    var range = this.range_.duplicate();
    var rightTrimmedSelectText = selectText.replace(/ +$/, "");
    var numSpacesAtEnd = selectText.length - rightTrimmedSelectText.length;
    if (numSpacesAtEnd) {
      range.moveEnd("character", -numSpacesAtEnd);
    }
    var parent = range.parentElement();
    var htmlText = range.htmlText;
    var htmlTextLen = goog.string.stripNewlines(htmlText).length;
    if (this.isCollapsed() && htmlTextLen > 0) {
      return this.parentNode_ = parent;
    }
    while (htmlTextLen > goog.string.stripNewlines(parent.outerHTML).length) {
      parent = parent.parentNode;
    }
    while (parent.childNodes.length == 1 && parent.innerText == goog.dom.browserrange.IeRange.getNodeText_(parent.firstChild)) {
      if (!goog.dom.browserrange.canContainRangeEndpoint(parent.firstChild)) {
        break;
      }
      parent = parent.firstChild;
    }
    if (selectText.length == 0) {
      parent = this.findDeepestContainer_(parent);
    }
    this.parentNode_ = parent;
  }
  return this.parentNode_;
};
goog.dom.browserrange.IeRange.prototype.findDeepestContainer_ = function(node) {
  var childNodes = node.childNodes;
  for (var i = 0, len = childNodes.length; i < len; i++) {
    var child = childNodes[i];
    if (goog.dom.browserrange.canContainRangeEndpoint(child)) {
      var childRange = goog.dom.browserrange.IeRange.getBrowserRangeForNode_(child);
      var start = goog.dom.RangeEndpoint.START;
      var end = goog.dom.RangeEndpoint.END;
      var isChildRangeErratic = childRange.htmlText != child.outerHTML;
      var isNativeInRangeErratic = this.isCollapsed() && isChildRangeErratic;
      var inChildRange = isNativeInRangeErratic ? this.compareBrowserRangeEndpoints(childRange, start, start) >= 0 && this.compareBrowserRangeEndpoints(childRange, start, end) <= 0 : this.range_.inRange(childRange);
      if (inChildRange) {
        return this.findDeepestContainer_(child);
      }
    }
  }
  return node;
};
goog.dom.browserrange.IeRange.prototype.getStartNode = function() {
  if (!this.startNode_) {
    this.startNode_ = this.getEndpointNode_(goog.dom.RangeEndpoint.START);
    if (this.isCollapsed()) {
      this.endNode_ = this.startNode_;
    }
  }
  return this.startNode_;
};
goog.dom.browserrange.IeRange.prototype.getStartOffset = function() {
  if (this.startOffset_ < 0) {
    this.startOffset_ = this.getOffset_(goog.dom.RangeEndpoint.START);
    if (this.isCollapsed()) {
      this.endOffset_ = this.startOffset_;
    }
  }
  return this.startOffset_;
};
goog.dom.browserrange.IeRange.prototype.getEndNode = function() {
  if (this.isCollapsed()) {
    return this.getStartNode();
  }
  if (!this.endNode_) {
    this.endNode_ = this.getEndpointNode_(goog.dom.RangeEndpoint.END);
  }
  return this.endNode_;
};
goog.dom.browserrange.IeRange.prototype.getEndOffset = function() {
  if (this.isCollapsed()) {
    return this.getStartOffset();
  }
  if (this.endOffset_ < 0) {
    this.endOffset_ = this.getOffset_(goog.dom.RangeEndpoint.END);
    if (this.isCollapsed()) {
      this.startOffset_ = this.endOffset_;
    }
  }
  return this.endOffset_;
};
goog.dom.browserrange.IeRange.prototype.compareBrowserRangeEndpoints = function(range, thisEndpoint, otherEndpoint) {
  return this.range_.compareEndPoints((thisEndpoint == goog.dom.RangeEndpoint.START ? "Start" : "End") + "To" + (otherEndpoint == goog.dom.RangeEndpoint.START ? "Start" : "End"), range);
};
goog.dom.browserrange.IeRange.prototype.getEndpointNode_ = function(endpoint, opt_node) {
  var node = opt_node || this.getContainer();
  if (!node || !node.firstChild) {
    return node;
  }
  var start = goog.dom.RangeEndpoint.START, end = goog.dom.RangeEndpoint.END;
  var isStartEndpoint = endpoint == start;
  for (var j = 0, length = node.childNodes.length; j < length; j++) {
    var i = isStartEndpoint ? j : length - j - 1;
    var child = node.childNodes[i];
    var childRange;
    try {
      childRange = goog.dom.browserrange.createRangeFromNodeContents(child);
    } catch (e) {
      continue;
    }
    var ieRange = childRange.getBrowserRange();
    if (this.isCollapsed()) {
      if (!goog.dom.browserrange.canContainRangeEndpoint(child)) {
        if (this.compareBrowserRangeEndpoints(ieRange, start, start) == 0) {
          this.startOffset_ = this.endOffset_ = i;
          return node;
        }
      } else {
        if (childRange.containsRange(this)) {
          return this.getEndpointNode_(endpoint, child);
        }
      }
    } else {
      if (this.containsRange(childRange)) {
        if (!goog.dom.browserrange.canContainRangeEndpoint(child)) {
          if (isStartEndpoint) {
            this.startOffset_ = i;
          } else {
            this.endOffset_ = i + 1;
          }
          return node;
        }
        return this.getEndpointNode_(endpoint, child);
      } else {
        if (this.compareBrowserRangeEndpoints(ieRange, start, end) < 0 && this.compareBrowserRangeEndpoints(ieRange, end, start) > 0) {
          return this.getEndpointNode_(endpoint, child);
        }
      }
    }
  }
  return node;
};
goog.dom.browserrange.IeRange.prototype.compareNodeEndpoints_ = function(node, thisEndpoint, otherEndpoint) {
  return this.range_.compareEndPoints((thisEndpoint == goog.dom.RangeEndpoint.START ? "Start" : "End") + "To" + (otherEndpoint == goog.dom.RangeEndpoint.START ? "Start" : "End"), goog.dom.browserrange.createRangeFromNodeContents(node).getBrowserRange());
};
goog.dom.browserrange.IeRange.prototype.getOffset_ = function(endpoint, opt_container) {
  var isStartEndpoint = endpoint == goog.dom.RangeEndpoint.START;
  var container = opt_container || (isStartEndpoint ? this.getStartNode() : this.getEndNode());
  if (container.nodeType == goog.dom.NodeType.ELEMENT) {
    var children = container.childNodes;
    var len = children.length;
    var edge = isStartEndpoint ? 0 : len - 1;
    var sign = isStartEndpoint ? 1 : -1;
    for (var i = edge; i >= 0 && i < len; i += sign) {
      var child = children[i];
      if (goog.dom.browserrange.canContainRangeEndpoint(child)) {
        continue;
      }
      var endPointCompare = this.compareNodeEndpoints_(child, endpoint, endpoint);
      if (endPointCompare == 0) {
        return isStartEndpoint ? i : i + 1;
      }
    }
    return i == -1 ? 0 : i;
  } else {
    var range = this.range_.duplicate();
    var nodeRange = goog.dom.browserrange.IeRange.getBrowserRangeForNode_(container);
    range.setEndPoint(isStartEndpoint ? "EndToEnd" : "StartToStart", nodeRange);
    var rangeLength = range.text.length;
    return isStartEndpoint ? container.length - rangeLength : rangeLength;
  }
};
goog.dom.browserrange.IeRange.getNodeText_ = function(node) {
  return node.nodeType == goog.dom.NodeType.TEXT ? node.nodeValue : node.innerText;
};
goog.dom.browserrange.IeRange.prototype.isRangeInDocument = function() {
  var range = this.doc_.body.createTextRange();
  range.moveToElementText(this.doc_.body);
  return this.containsRange(new goog.dom.browserrange.IeRange(range, this.doc_), true);
};
goog.dom.browserrange.IeRange.prototype.isCollapsed = function() {
  return this.range_.compareEndPoints("StartToEnd", this.range_) == 0;
};
goog.dom.browserrange.IeRange.prototype.getText = function() {
  return this.range_.text;
};
goog.dom.browserrange.IeRange.prototype.getValidHtml = function() {
  return this.range_.htmlText;
};
goog.dom.browserrange.IeRange.prototype.select = function(opt_reverse) {
  this.range_.select();
};
goog.dom.browserrange.IeRange.prototype.removeContents = function() {
  if (!this.isCollapsed() && this.range_.htmlText) {
    var startNode = this.getStartNode();
    var endNode = this.getEndNode();
    var oldText = this.range_.text;
    var clone = this.range_.duplicate();
    clone.moveStart("character", 1);
    clone.moveStart("character", -1);
    if (clone.text == oldText) {
      this.range_ = clone;
    }
    this.range_.text = "";
    this.clearCachedValues_();
    var newStartNode = this.getStartNode();
    var newStartOffset = this.getStartOffset();
    try {
      var sibling = startNode.nextSibling;
      if (startNode == endNode && startNode.parentNode && startNode.nodeType == goog.dom.NodeType.TEXT && sibling && sibling.nodeType == goog.dom.NodeType.TEXT) {
        startNode.nodeValue += sibling.nodeValue;
        goog.dom.removeNode(sibling);
        this.range_ = goog.dom.browserrange.IeRange.getBrowserRangeForNode_(newStartNode);
        this.range_.move("character", newStartOffset);
        this.clearCachedValues_();
      }
    } catch (e) {
    }
  }
};
goog.dom.browserrange.IeRange.getDomHelper_ = function(range) {
  return goog.dom.getDomHelper(range.parentElement());
};
goog.dom.browserrange.IeRange.pasteElement_ = function(range, element, opt_domHelper) {
  opt_domHelper = opt_domHelper || goog.dom.browserrange.IeRange.getDomHelper_(range);
  var id;
  var originalId = id = element.id;
  if (!id) {
    id = element.id = goog.string.createUniqueString();
  }
  range.pasteHTML(element.outerHTML);
  element = opt_domHelper.getElement(id);
  if (element) {
    if (!originalId) {
      element.removeAttribute("id");
    }
  }
  return element;
};
goog.dom.browserrange.IeRange.prototype.surroundContents = function(element) {
  goog.dom.removeNode(element);
  element.innerHTML = this.range_.htmlText;
  element = goog.dom.browserrange.IeRange.pasteElement_(this.range_, element);
  if (element) {
    this.range_.moveToElementText(element);
  }
  this.clearCachedValues_();
  return element;
};
goog.dom.browserrange.IeRange.insertNode_ = function(clone, node, before, opt_domHelper) {
  opt_domHelper = opt_domHelper || goog.dom.browserrange.IeRange.getDomHelper_(clone);
  var isNonElement;
  if (node.nodeType != goog.dom.NodeType.ELEMENT) {
    isNonElement = true;
    node = opt_domHelper.createDom(goog.dom.TagName.DIV, null, node);
  }
  clone.collapse(before);
  node = goog.dom.browserrange.IeRange.pasteElement_(clone, node, opt_domHelper);
  if (isNonElement) {
    var newNonElement = node.firstChild;
    opt_domHelper.flattenElement(node);
    node = newNonElement;
  }
  return node;
};
goog.dom.browserrange.IeRange.prototype.insertNode = function(node, before) {
  var output = goog.dom.browserrange.IeRange.insertNode_(this.range_.duplicate(), node, before);
  this.clearCachedValues_();
  return output;
};
goog.dom.browserrange.IeRange.prototype.surroundWithNodes = function(startNode, endNode) {
  var clone1 = this.range_.duplicate();
  var clone2 = this.range_.duplicate();
  goog.dom.browserrange.IeRange.insertNode_(clone1, startNode, true);
  goog.dom.browserrange.IeRange.insertNode_(clone2, endNode, false);
  this.clearCachedValues_();
};
goog.dom.browserrange.IeRange.prototype.collapse = function(toStart) {
  this.range_.collapse(toStart);
  if (toStart) {
    this.endNode_ = this.startNode_;
    this.endOffset_ = this.startOffset_;
  } else {
    this.startNode_ = this.endNode_;
    this.startOffset_ = this.endOffset_;
  }
};
goog.provide("goog.dom.browserrange.OperaRange");
goog.require("goog.dom.browserrange.W3cRange");
goog.dom.browserrange.OperaRange = function(range) {
  goog.dom.browserrange.W3cRange.call(this, range);
};
goog.inherits(goog.dom.browserrange.OperaRange, goog.dom.browserrange.W3cRange);
goog.dom.browserrange.OperaRange.createFromNodeContents = function(node) {
  return new goog.dom.browserrange.OperaRange(goog.dom.browserrange.W3cRange.getBrowserRangeForNode(node));
};
goog.dom.browserrange.OperaRange.createFromNodes = function(startNode, startOffset, endNode, endOffset) {
  return new goog.dom.browserrange.OperaRange(goog.dom.browserrange.W3cRange.getBrowserRangeForNodes(startNode, startOffset, endNode, endOffset));
};
goog.dom.browserrange.OperaRange.prototype.selectInternal = function(selection, reversed) {
  selection.collapse(this.getStartNode(), this.getStartOffset());
  if (this.getEndNode() != this.getStartNode() || this.getEndOffset() != this.getStartOffset()) {
    selection.extend(this.getEndNode(), this.getEndOffset());
  }
  if (selection.rangeCount == 0) {
    selection.addRange(this.range_);
  }
};
goog.provide("goog.dom.browserrange.WebKitRange");
goog.require("goog.dom.RangeEndpoint");
goog.require("goog.dom.browserrange.W3cRange");
goog.require("goog.userAgent");
goog.dom.browserrange.WebKitRange = function(range) {
  goog.dom.browserrange.W3cRange.call(this, range);
};
goog.inherits(goog.dom.browserrange.WebKitRange, goog.dom.browserrange.W3cRange);
goog.dom.browserrange.WebKitRange.createFromNodeContents = function(node) {
  return new goog.dom.browserrange.WebKitRange(goog.dom.browserrange.W3cRange.getBrowserRangeForNode(node));
};
goog.dom.browserrange.WebKitRange.createFromNodes = function(startNode, startOffset, endNode, endOffset) {
  return new goog.dom.browserrange.WebKitRange(goog.dom.browserrange.W3cRange.getBrowserRangeForNodes(startNode, startOffset, endNode, endOffset));
};
goog.dom.browserrange.WebKitRange.prototype.compareBrowserRangeEndpoints = function(range, thisEndpoint, otherEndpoint) {
  if (goog.userAgent.isVersionOrHigher("528")) {
    return goog.dom.browserrange.WebKitRange.superClass_.compareBrowserRangeEndpoints.call(this, range, thisEndpoint, otherEndpoint);
  }
  return this.range_.compareBoundaryPoints(otherEndpoint == goog.dom.RangeEndpoint.START ? thisEndpoint == goog.dom.RangeEndpoint.START ? goog.global["Range"].START_TO_START : goog.global["Range"].END_TO_START : thisEndpoint == goog.dom.RangeEndpoint.START ? goog.global["Range"].START_TO_END : goog.global["Range"].END_TO_END, range);
};
goog.dom.browserrange.WebKitRange.prototype.selectInternal = function(selection, reversed) {
  if (reversed) {
    selection.setBaseAndExtent(this.getEndNode(), this.getEndOffset(), this.getStartNode(), this.getStartOffset());
  } else {
    selection.setBaseAndExtent(this.getStartNode(), this.getStartOffset(), this.getEndNode(), this.getEndOffset());
  }
};
goog.provide("goog.dom.browserrange");
goog.provide("goog.dom.browserrange.Error");
goog.require("goog.dom");
goog.require("goog.dom.BrowserFeature");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.browserrange.GeckoRange");
goog.require("goog.dom.browserrange.IeRange");
goog.require("goog.dom.browserrange.OperaRange");
goog.require("goog.dom.browserrange.W3cRange");
goog.require("goog.dom.browserrange.WebKitRange");
goog.require("goog.userAgent");
goog.dom.browserrange.Error = {NOT_IMPLEMENTED:"Not Implemented"};
goog.dom.browserrange.createRange = function(range) {
  if (goog.dom.BrowserFeature.LEGACY_IE_RANGES) {
    return new goog.dom.browserrange.IeRange(range, goog.dom.getOwnerDocument(range.parentElement()));
  } else {
    if (goog.userAgent.WEBKIT) {
      return new goog.dom.browserrange.WebKitRange(range);
    } else {
      if (goog.userAgent.GECKO) {
        return new goog.dom.browserrange.GeckoRange(range);
      } else {
        if (goog.userAgent.OPERA) {
          return new goog.dom.browserrange.OperaRange(range);
        } else {
          return new goog.dom.browserrange.W3cRange(range);
        }
      }
    }
  }
};
goog.dom.browserrange.createRangeFromNodeContents = function(node) {
  if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) {
    return goog.dom.browserrange.IeRange.createFromNodeContents(node);
  } else {
    if (goog.userAgent.WEBKIT) {
      return goog.dom.browserrange.WebKitRange.createFromNodeContents(node);
    } else {
      if (goog.userAgent.GECKO) {
        return goog.dom.browserrange.GeckoRange.createFromNodeContents(node);
      } else {
        if (goog.userAgent.OPERA) {
          return goog.dom.browserrange.OperaRange.createFromNodeContents(node);
        } else {
          return goog.dom.browserrange.W3cRange.createFromNodeContents(node);
        }
      }
    }
  }
};
goog.dom.browserrange.createRangeFromNodes = function(startNode, startOffset, endNode, endOffset) {
  if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) {
    return goog.dom.browserrange.IeRange.createFromNodes(startNode, startOffset, endNode, endOffset);
  } else {
    if (goog.userAgent.WEBKIT) {
      return goog.dom.browserrange.WebKitRange.createFromNodes(startNode, startOffset, endNode, endOffset);
    } else {
      if (goog.userAgent.GECKO) {
        return goog.dom.browserrange.GeckoRange.createFromNodes(startNode, startOffset, endNode, endOffset);
      } else {
        if (goog.userAgent.OPERA) {
          return goog.dom.browserrange.OperaRange.createFromNodes(startNode, startOffset, endNode, endOffset);
        } else {
          return goog.dom.browserrange.W3cRange.createFromNodes(startNode, startOffset, endNode, endOffset);
        }
      }
    }
  }
};
goog.dom.browserrange.canContainRangeEndpoint = function(node) {
  return goog.dom.canHaveChildren(node) || node.nodeType == goog.dom.NodeType.TEXT;
};
goog.provide("goog.dom.TextRange");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.dom.AbstractRange");
goog.require("goog.dom.RangeType");
goog.require("goog.dom.SavedRange");
goog.require("goog.dom.TagName");
goog.require("goog.dom.TextRangeIterator");
goog.require("goog.dom.browserrange");
goog.require("goog.string");
goog.require("goog.userAgent");
goog.dom.TextRange = function() {
  this.browserRangeWrapper_ = null;
  this.startNode_ = null;
  this.startOffset_ = null;
  this.endNode_ = null;
  this.endOffset_ = null;
  this.isReversed_ = false;
};
goog.inherits(goog.dom.TextRange, goog.dom.AbstractRange);
goog.dom.TextRange.createFromBrowserRange = function(range, opt_isReversed) {
  return goog.dom.TextRange.createFromBrowserRangeWrapper_(goog.dom.browserrange.createRange(range), opt_isReversed);
};
goog.dom.TextRange.createFromBrowserRangeWrapper_ = function(browserRange, opt_isReversed) {
  var range = new goog.dom.TextRange;
  range.browserRangeWrapper_ = browserRange;
  range.isReversed_ = !!opt_isReversed;
  return range;
};
goog.dom.TextRange.createFromNodeContents = function(node, opt_isReversed) {
  return goog.dom.TextRange.createFromBrowserRangeWrapper_(goog.dom.browserrange.createRangeFromNodeContents(node), opt_isReversed);
};
goog.dom.TextRange.createFromNodes = function(anchorNode, anchorOffset, focusNode, focusOffset) {
  var range = new goog.dom.TextRange;
  range.isReversed_ = goog.dom.Range.isReversed(anchorNode, anchorOffset, focusNode, focusOffset);
  if (goog.dom.isElement(anchorNode) && !goog.dom.canHaveChildren(anchorNode)) {
    var parent = anchorNode.parentNode;
    anchorOffset = goog.array.indexOf(parent.childNodes, anchorNode);
    anchorNode = parent;
  }
  if (goog.dom.isElement(focusNode) && !goog.dom.canHaveChildren(focusNode)) {
    var parent = focusNode.parentNode;
    focusOffset = goog.array.indexOf(parent.childNodes, focusNode);
    focusNode = parent;
  }
  if (range.isReversed_) {
    range.startNode_ = focusNode;
    range.startOffset_ = focusOffset;
    range.endNode_ = anchorNode;
    range.endOffset_ = anchorOffset;
  } else {
    range.startNode_ = anchorNode;
    range.startOffset_ = anchorOffset;
    range.endNode_ = focusNode;
    range.endOffset_ = focusOffset;
  }
  return range;
};
goog.dom.TextRange.prototype.clone = function() {
  var range = new goog.dom.TextRange;
  range.browserRangeWrapper_ = this.browserRangeWrapper_ && this.browserRangeWrapper_.clone();
  range.startNode_ = this.startNode_;
  range.startOffset_ = this.startOffset_;
  range.endNode_ = this.endNode_;
  range.endOffset_ = this.endOffset_;
  range.isReversed_ = this.isReversed_;
  return range;
};
goog.dom.TextRange.prototype.getType = function() {
  return goog.dom.RangeType.TEXT;
};
goog.dom.TextRange.prototype.getBrowserRangeObject = function() {
  return this.getBrowserRangeWrapper_().getBrowserRange();
};
goog.dom.TextRange.prototype.setBrowserRangeObject = function(nativeRange) {
  if (goog.dom.AbstractRange.isNativeControlRange(nativeRange)) {
    return false;
  }
  this.browserRangeWrapper_ = goog.dom.browserrange.createRange(nativeRange);
  this.clearCachedValues_();
  return true;
};
goog.dom.TextRange.prototype.clearCachedValues_ = function() {
  this.startNode_ = this.startOffset_ = this.endNode_ = this.endOffset_ = null;
};
goog.dom.TextRange.prototype.getTextRangeCount = function() {
  return 1;
};
goog.dom.TextRange.prototype.getTextRange = function(i) {
  return this;
};
goog.dom.TextRange.prototype.getBrowserRangeWrapper_ = function() {
  return this.browserRangeWrapper_ || (this.browserRangeWrapper_ = goog.dom.browserrange.createRangeFromNodes(this.getStartNode(), this.getStartOffset(), this.getEndNode(), this.getEndOffset()));
};
goog.dom.TextRange.prototype.getContainer = function() {
  return this.getBrowserRangeWrapper_().getContainer();
};
goog.dom.TextRange.prototype.getStartNode = function() {
  return this.startNode_ || (this.startNode_ = this.getBrowserRangeWrapper_().getStartNode());
};
goog.dom.TextRange.prototype.getStartOffset = function() {
  return this.startOffset_ != null ? this.startOffset_ : this.startOffset_ = this.getBrowserRangeWrapper_().getStartOffset();
};
goog.dom.TextRange.prototype.getStartPosition = function() {
  return this.getBrowserRangeWrapper_().getStartPosition();
};
goog.dom.TextRange.prototype.getEndNode = function() {
  return this.endNode_ || (this.endNode_ = this.getBrowserRangeWrapper_().getEndNode());
};
goog.dom.TextRange.prototype.getEndOffset = function() {
  return this.endOffset_ != null ? this.endOffset_ : this.endOffset_ = this.getBrowserRangeWrapper_().getEndOffset();
};
goog.dom.TextRange.prototype.getEndPosition = function() {
  return this.getBrowserRangeWrapper_().getEndPosition();
};
goog.dom.TextRange.prototype.moveToNodes = function(startNode, startOffset, endNode, endOffset, isReversed) {
  this.startNode_ = startNode;
  this.startOffset_ = startOffset;
  this.endNode_ = endNode;
  this.endOffset_ = endOffset;
  this.isReversed_ = isReversed;
  this.browserRangeWrapper_ = null;
};
goog.dom.TextRange.prototype.isReversed = function() {
  return this.isReversed_;
};
goog.dom.TextRange.prototype.containsRange = function(otherRange, opt_allowPartial) {
  var otherRangeType = otherRange.getType();
  if (otherRangeType == goog.dom.RangeType.TEXT) {
    return this.getBrowserRangeWrapper_().containsRange(otherRange.getBrowserRangeWrapper_(), opt_allowPartial);
  } else {
    if (otherRangeType == goog.dom.RangeType.CONTROL) {
      var elements = otherRange.getElements();
      var fn = opt_allowPartial ? goog.array.some : goog.array.every;
      return fn(elements, function(el) {
        return this.containsNode(el, opt_allowPartial);
      }, this);
    }
  }
  return false;
};
goog.dom.TextRange.prototype.containsNode = function(node, opt_allowPartial) {
  return this.containsRange(goog.dom.TextRange.createFromNodeContents(node), opt_allowPartial);
};
goog.dom.TextRange.isAttachedNode = function(node) {
  if (goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) {
    var returnValue = false;
    try {
      returnValue = node.parentNode;
    } catch (e) {
    }
    return !!returnValue;
  } else {
    return goog.dom.contains(node.ownerDocument.body, node);
  }
};
goog.dom.TextRange.prototype.isRangeInDocument = function() {
  return (!this.startNode_ || goog.dom.TextRange.isAttachedNode(this.startNode_)) && (!this.endNode_ || goog.dom.TextRange.isAttachedNode(this.endNode_)) && (!(goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9)) || this.getBrowserRangeWrapper_().isRangeInDocument());
};
goog.dom.TextRange.prototype.isCollapsed = function() {
  return this.getBrowserRangeWrapper_().isCollapsed();
};
goog.dom.TextRange.prototype.getText = function() {
  return this.getBrowserRangeWrapper_().getText();
};
goog.dom.TextRange.prototype.getHtmlFragment = function() {
  return this.getBrowserRangeWrapper_().getHtmlFragment();
};
goog.dom.TextRange.prototype.getValidHtml = function() {
  return this.getBrowserRangeWrapper_().getValidHtml();
};
goog.dom.TextRange.prototype.getPastableHtml = function() {
  var html = this.getValidHtml();
  if (html.match(/^\s*<td\b/i)) {
    html = "<table><tbody><tr>" + html + "</tr></tbody></table>";
  } else {
    if (html.match(/^\s*<tr\b/i)) {
      html = "<table><tbody>" + html + "</tbody></table>";
    } else {
      if (html.match(/^\s*<tbody\b/i)) {
        html = "<table>" + html + "</table>";
      } else {
        if (html.match(/^\s*<li\b/i)) {
          var container = this.getContainer();
          var tagType = goog.dom.TagName.UL;
          while (container) {
            if (container.tagName == goog.dom.TagName.OL) {
              tagType = goog.dom.TagName.OL;
              break;
            } else {
              if (container.tagName == goog.dom.TagName.UL) {
                break;
              }
            }
            container = container.parentNode;
          }
          html = goog.string.buildString("<", tagType, ">", html, "</", tagType, ">");
        }
      }
    }
  }
  return html;
};
goog.dom.TextRange.prototype.__iterator__ = function(opt_keys) {
  return new goog.dom.TextRangeIterator(this.getStartNode(), this.getStartOffset(), this.getEndNode(), this.getEndOffset());
};
goog.dom.TextRange.prototype.select = function() {
  this.getBrowserRangeWrapper_().select(this.isReversed_);
};
goog.dom.TextRange.prototype.removeContents = function() {
  this.getBrowserRangeWrapper_().removeContents();
  this.clearCachedValues_();
};
goog.dom.TextRange.prototype.surroundContents = function(element) {
  var output = this.getBrowserRangeWrapper_().surroundContents(element);
  this.clearCachedValues_();
  return output;
};
goog.dom.TextRange.prototype.insertNode = function(node, before) {
  var output = this.getBrowserRangeWrapper_().insertNode(node, before);
  this.clearCachedValues_();
  return output;
};
goog.dom.TextRange.prototype.surroundWithNodes = function(startNode, endNode) {
  this.getBrowserRangeWrapper_().surroundWithNodes(startNode, endNode);
  this.clearCachedValues_();
};
goog.dom.TextRange.prototype.saveUsingDom = function() {
  return new goog.dom.DomSavedTextRange_(this);
};
goog.dom.TextRange.prototype.collapse = function(toAnchor) {
  var toStart = this.isReversed() ? !toAnchor : toAnchor;
  if (this.browserRangeWrapper_) {
    this.browserRangeWrapper_.collapse(toStart);
  }
  if (toStart) {
    this.endNode_ = this.startNode_;
    this.endOffset_ = this.startOffset_;
  } else {
    this.startNode_ = this.endNode_;
    this.startOffset_ = this.endOffset_;
  }
  this.isReversed_ = false;
};
goog.dom.DomSavedTextRange_ = function(range) {
  goog.dom.DomSavedTextRange_.base(this, "constructor");
  this.anchorNode_ = range.getAnchorNode();
  this.anchorOffset_ = range.getAnchorOffset();
  this.focusNode_ = range.getFocusNode();
  this.focusOffset_ = range.getFocusOffset();
};
goog.inherits(goog.dom.DomSavedTextRange_, goog.dom.SavedRange);
goog.dom.DomSavedTextRange_.prototype.restoreInternal = function() {
  return goog.dom.Range.createFromNodes(this.anchorNode_, this.anchorOffset_, this.focusNode_, this.focusOffset_);
};
goog.dom.DomSavedTextRange_.prototype.disposeInternal = function() {
  goog.dom.DomSavedTextRange_.superClass_.disposeInternal.call(this);
  this.anchorNode_ = null;
  this.focusNode_ = null;
};
goog.provide("goog.dom.AbstractMultiRange");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.dom.AbstractRange");
goog.require("goog.dom.TextRange");
goog.dom.AbstractMultiRange = function() {
};
goog.inherits(goog.dom.AbstractMultiRange, goog.dom.AbstractRange);
goog.dom.AbstractMultiRange.prototype.containsRange = function(otherRange, opt_allowPartial) {
  var ranges = this.getTextRanges();
  var otherRanges = otherRange.getTextRanges();
  var fn = opt_allowPartial ? goog.array.some : goog.array.every;
  return fn(otherRanges, function(otherRange) {
    return goog.array.some(ranges, function(range) {
      return range.containsRange(otherRange, opt_allowPartial);
    });
  });
};
goog.dom.AbstractMultiRange.prototype.containsNode = function(node, opt_allowPartial) {
  return this.containsRange(goog.dom.TextRange.createFromNodeContents(node), opt_allowPartial);
};
goog.dom.AbstractMultiRange.prototype.insertNode = function(node, before) {
  if (before) {
    goog.dom.insertSiblingBefore(node, this.getStartNode());
  } else {
    goog.dom.insertSiblingAfter(node, this.getEndNode());
  }
  return node;
};
goog.dom.AbstractMultiRange.prototype.surroundWithNodes = function(startNode, endNode) {
  this.insertNode(startNode, true);
  this.insertNode(endNode, false);
};
goog.provide("goog.dom.ControlRange");
goog.provide("goog.dom.ControlRangeIterator");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.dom.AbstractMultiRange");
goog.require("goog.dom.AbstractRange");
goog.require("goog.dom.RangeIterator");
goog.require("goog.dom.RangeType");
goog.require("goog.dom.SavedRange");
goog.require("goog.dom.TagWalkType");
goog.require("goog.dom.TextRange");
goog.require("goog.iter.StopIteration");
goog.require("goog.userAgent");
goog.dom.ControlRange = function() {
  this.range_ = null;
  this.elements_ = null;
  this.sortedElements_ = null;
};
goog.inherits(goog.dom.ControlRange, goog.dom.AbstractMultiRange);
goog.dom.ControlRange.createFromBrowserRange = function(controlRange) {
  var range = new goog.dom.ControlRange;
  range.range_ = controlRange;
  return range;
};
goog.dom.ControlRange.createFromElements = function(var_args) {
  var range = goog.dom.getOwnerDocument(arguments[0]).body.createControlRange();
  for (var i = 0, len = arguments.length; i < len; i++) {
    range.addElement(arguments[i]);
  }
  return goog.dom.ControlRange.createFromBrowserRange(range);
};
goog.dom.ControlRange.prototype.clearCachedValues_ = function() {
  this.elements_ = null;
  this.sortedElements_ = null;
};
goog.dom.ControlRange.prototype.clone = function() {
  return goog.dom.ControlRange.createFromElements.apply(this, this.getElements());
};
goog.dom.ControlRange.prototype.getType = function() {
  return goog.dom.RangeType.CONTROL;
};
goog.dom.ControlRange.prototype.getBrowserRangeObject = function() {
  return this.range_ || document.body.createControlRange();
};
goog.dom.ControlRange.prototype.setBrowserRangeObject = function(nativeRange) {
  if (!goog.dom.AbstractRange.isNativeControlRange(nativeRange)) {
    return false;
  }
  this.range_ = nativeRange;
  return true;
};
goog.dom.ControlRange.prototype.getTextRangeCount = function() {
  return this.range_ ? this.range_.length : 0;
};
goog.dom.ControlRange.prototype.getTextRange = function(i) {
  return goog.dom.TextRange.createFromNodeContents(this.range_.item(i));
};
goog.dom.ControlRange.prototype.getContainer = function() {
  return goog.dom.findCommonAncestor.apply(null, this.getElements());
};
goog.dom.ControlRange.prototype.getStartNode = function() {
  return this.getSortedElements()[0];
};
goog.dom.ControlRange.prototype.getStartOffset = function() {
  return 0;
};
goog.dom.ControlRange.prototype.getEndNode = function() {
  var sorted = this.getSortedElements();
  var startsLast = goog.array.peek(sorted);
  return goog.array.find(sorted, function(el) {
    return goog.dom.contains(el, startsLast);
  });
};
goog.dom.ControlRange.prototype.getEndOffset = function() {
  return this.getEndNode().childNodes.length;
};
goog.dom.ControlRange.prototype.getElements = function() {
  if (!this.elements_) {
    this.elements_ = [];
    if (this.range_) {
      for (var i = 0; i < this.range_.length; i++) {
        this.elements_.push(this.range_.item(i));
      }
    }
  }
  return this.elements_;
};
goog.dom.ControlRange.prototype.getSortedElements = function() {
  if (!this.sortedElements_) {
    this.sortedElements_ = this.getElements().concat();
    this.sortedElements_.sort(function(a, b) {
      return a.sourceIndex - b.sourceIndex;
    });
  }
  return this.sortedElements_;
};
goog.dom.ControlRange.prototype.isRangeInDocument = function() {
  var returnValue = false;
  try {
    returnValue = goog.array.every(this.getElements(), function(element) {
      return goog.userAgent.IE ? !!element.parentNode : goog.dom.contains(element.ownerDocument.body, element);
    });
  } catch (e) {
  }
  return returnValue;
};
goog.dom.ControlRange.prototype.isCollapsed = function() {
  return !this.range_ || !this.range_.length;
};
goog.dom.ControlRange.prototype.getText = function() {
  return "";
};
goog.dom.ControlRange.prototype.getHtmlFragment = function() {
  return goog.array.map(this.getSortedElements(), goog.dom.getOuterHtml).join("");
};
goog.dom.ControlRange.prototype.getValidHtml = function() {
  return this.getHtmlFragment();
};
goog.dom.ControlRange.prototype.getPastableHtml = goog.dom.ControlRange.prototype.getValidHtml;
goog.dom.ControlRange.prototype.__iterator__ = function(opt_keys) {
  return new goog.dom.ControlRangeIterator(this);
};
goog.dom.ControlRange.prototype.select = function() {
  if (this.range_) {
    this.range_.select();
  }
};
goog.dom.ControlRange.prototype.removeContents = function() {
  if (this.range_) {
    var nodes = [];
    for (var i = 0, len = this.range_.length; i < len; i++) {
      nodes.push(this.range_.item(i));
    }
    goog.array.forEach(nodes, goog.dom.removeNode);
    this.collapse(false);
  }
};
goog.dom.ControlRange.prototype.replaceContentsWithNode = function(node) {
  var result = this.insertNode(node, true);
  if (!this.isCollapsed()) {
    this.removeContents();
  }
  return result;
};
goog.dom.ControlRange.prototype.saveUsingDom = function() {
  return new goog.dom.DomSavedControlRange_(this);
};
goog.dom.ControlRange.prototype.collapse = function(toAnchor) {
  this.range_ = null;
  this.clearCachedValues_();
};
goog.dom.DomSavedControlRange_ = function(range) {
  this.elements_ = range.getElements();
};
goog.inherits(goog.dom.DomSavedControlRange_, goog.dom.SavedRange);
goog.dom.DomSavedControlRange_.prototype.restoreInternal = function() {
  var doc = this.elements_.length ? goog.dom.getOwnerDocument(this.elements_[0]) : document;
  var controlRange = doc.body.createControlRange();
  for (var i = 0, len = this.elements_.length; i < len; i++) {
    controlRange.addElement(this.elements_[i]);
  }
  return goog.dom.ControlRange.createFromBrowserRange(controlRange);
};
goog.dom.DomSavedControlRange_.prototype.disposeInternal = function() {
  goog.dom.DomSavedControlRange_.superClass_.disposeInternal.call(this);
  delete this.elements_;
};
goog.dom.ControlRangeIterator = function(range) {
  this.startNode_ = null;
  this.endNode_ = null;
  this.elements_ = null;
  if (range) {
    this.elements_ = range.getSortedElements();
    this.startNode_ = this.elements_.shift();
    this.endNode_ = goog.array.peek(this.elements_) || this.startNode_;
  }
  goog.dom.ControlRangeIterator.base(this, "constructor", this.startNode_, false);
};
goog.inherits(goog.dom.ControlRangeIterator, goog.dom.RangeIterator);
goog.dom.ControlRangeIterator.prototype.getStartTextOffset = function() {
  return 0;
};
goog.dom.ControlRangeIterator.prototype.getEndTextOffset = function() {
  return 0;
};
goog.dom.ControlRangeIterator.prototype.getStartNode = function() {
  return this.startNode_;
};
goog.dom.ControlRangeIterator.prototype.getEndNode = function() {
  return this.endNode_;
};
goog.dom.ControlRangeIterator.prototype.isLast = function() {
  return !this.depth && !this.elements_.length;
};
goog.dom.ControlRangeIterator.prototype.next = function() {
  if (this.isLast()) {
    throw goog.iter.StopIteration;
  } else {
    if (!this.depth) {
      var el = this.elements_.shift();
      this.setPosition(el, goog.dom.TagWalkType.START_TAG, goog.dom.TagWalkType.START_TAG);
      return el;
    }
  }
  return goog.dom.ControlRangeIterator.superClass_.next.call(this);
};
goog.dom.ControlRangeIterator.prototype.copyFrom = function(other) {
  this.elements_ = other.elements_;
  this.startNode_ = other.startNode_;
  this.endNode_ = other.endNode_;
  goog.dom.ControlRangeIterator.superClass_.copyFrom.call(this, other);
};
goog.dom.ControlRangeIterator.prototype.clone = function() {
  var copy = new goog.dom.ControlRangeIterator(null);
  copy.copyFrom(this);
  return copy;
};
goog.provide("goog.dom.MultiRange");
goog.provide("goog.dom.MultiRangeIterator");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.dom.AbstractMultiRange");
goog.require("goog.dom.AbstractRange");
goog.require("goog.dom.RangeIterator");
goog.require("goog.dom.RangeType");
goog.require("goog.dom.SavedRange");
goog.require("goog.dom.TextRange");
goog.require("goog.iter");
goog.require("goog.iter.StopIteration");
goog.require("goog.log");
goog.dom.MultiRange = function() {
  this.logger_ = goog.log.getLogger("goog.dom.MultiRange");
  this.browserRanges_ = [];
  this.ranges_ = [];
  this.sortedRanges_ = null;
  this.container_ = null;
};
goog.inherits(goog.dom.MultiRange, goog.dom.AbstractMultiRange);
goog.dom.MultiRange.createFromBrowserSelection = function(selection) {
  var range = new goog.dom.MultiRange;
  for (var i = 0, len = selection.rangeCount; i < len; i++) {
    range.browserRanges_.push(selection.getRangeAt(i));
  }
  return range;
};
goog.dom.MultiRange.createFromBrowserRanges = function(browserRanges) {
  var range = new goog.dom.MultiRange;
  range.browserRanges_ = goog.array.clone(browserRanges);
  return range;
};
goog.dom.MultiRange.createFromTextRanges = function(textRanges) {
  var range = new goog.dom.MultiRange;
  range.ranges_ = textRanges;
  range.browserRanges_ = goog.array.map(textRanges, function(range) {
    return range.getBrowserRangeObject();
  });
  return range;
};
goog.dom.MultiRange.prototype.clearCachedValues_ = function() {
  this.ranges_ = [];
  this.sortedRanges_ = null;
  this.container_ = null;
};
goog.dom.MultiRange.prototype.clone = function() {
  return goog.dom.MultiRange.createFromBrowserRanges(this.browserRanges_);
};
goog.dom.MultiRange.prototype.getType = function() {
  return goog.dom.RangeType.MULTI;
};
goog.dom.MultiRange.prototype.getBrowserRangeObject = function() {
  if (this.browserRanges_.length > 1) {
    goog.log.warning(this.logger_, "getBrowserRangeObject called on MultiRange with more than 1 range");
  }
  return this.browserRanges_[0];
};
goog.dom.MultiRange.prototype.setBrowserRangeObject = function(nativeRange) {
  return false;
};
goog.dom.MultiRange.prototype.getTextRangeCount = function() {
  return this.browserRanges_.length;
};
goog.dom.MultiRange.prototype.getTextRange = function(i) {
  if (!this.ranges_[i]) {
    this.ranges_[i] = goog.dom.TextRange.createFromBrowserRange(this.browserRanges_[i]);
  }
  return this.ranges_[i];
};
goog.dom.MultiRange.prototype.getContainer = function() {
  if (!this.container_) {
    var nodes = [];
    for (var i = 0, len = this.getTextRangeCount(); i < len; i++) {
      nodes.push(this.getTextRange(i).getContainer());
    }
    this.container_ = goog.dom.findCommonAncestor.apply(null, nodes);
  }
  return this.container_;
};
goog.dom.MultiRange.prototype.getSortedRanges = function() {
  if (!this.sortedRanges_) {
    this.sortedRanges_ = this.getTextRanges();
    this.sortedRanges_.sort(function(a, b) {
      var aStartNode = a.getStartNode();
      var aStartOffset = a.getStartOffset();
      var bStartNode = b.getStartNode();
      var bStartOffset = b.getStartOffset();
      if (aStartNode == bStartNode && aStartOffset == bStartOffset) {
        return 0;
      }
      return goog.dom.Range.isReversed(aStartNode, aStartOffset, bStartNode, bStartOffset) ? 1 : -1;
    });
  }
  return this.sortedRanges_;
};
goog.dom.MultiRange.prototype.getStartNode = function() {
  return this.getSortedRanges()[0].getStartNode();
};
goog.dom.MultiRange.prototype.getStartOffset = function() {
  return this.getSortedRanges()[0].getStartOffset();
};
goog.dom.MultiRange.prototype.getEndNode = function() {
  return goog.array.peek(this.getSortedRanges()).getEndNode();
};
goog.dom.MultiRange.prototype.getEndOffset = function() {
  return goog.array.peek(this.getSortedRanges()).getEndOffset();
};
goog.dom.MultiRange.prototype.isRangeInDocument = function() {
  return goog.array.every(this.getTextRanges(), function(range) {
    return range.isRangeInDocument();
  });
};
goog.dom.MultiRange.prototype.isCollapsed = function() {
  return this.browserRanges_.length == 0 || this.browserRanges_.length == 1 && this.getTextRange(0).isCollapsed();
};
goog.dom.MultiRange.prototype.getText = function() {
  return goog.array.map(this.getTextRanges(), function(range) {
    return range.getText();
  }).join("");
};
goog.dom.MultiRange.prototype.getHtmlFragment = function() {
  return this.getValidHtml();
};
goog.dom.MultiRange.prototype.getValidHtml = function() {
  return goog.array.map(this.getTextRanges(), function(range) {
    return range.getValidHtml();
  }).join("");
};
goog.dom.MultiRange.prototype.getPastableHtml = function() {
  return this.getValidHtml();
};
goog.dom.MultiRange.prototype.__iterator__ = function(opt_keys) {
  return new goog.dom.MultiRangeIterator(this);
};
goog.dom.MultiRange.prototype.select = function() {
  var selection = goog.dom.AbstractRange.getBrowserSelectionForWindow(this.getWindow());
  selection.removeAllRanges();
  for (var i = 0, len = this.getTextRangeCount(); i < len; i++) {
    selection.addRange(this.getTextRange(i).getBrowserRangeObject());
  }
};
goog.dom.MultiRange.prototype.removeContents = function() {
  goog.array.forEach(this.getTextRanges(), function(range) {
    range.removeContents();
  });
};
goog.dom.MultiRange.prototype.saveUsingDom = function() {
  return new goog.dom.DomSavedMultiRange_(this);
};
goog.dom.MultiRange.prototype.collapse = function(toAnchor) {
  if (!this.isCollapsed()) {
    var range = toAnchor ? this.getTextRange(0) : this.getTextRange(this.getTextRangeCount() - 1);
    this.clearCachedValues_();
    range.collapse(toAnchor);
    this.ranges_ = [range];
    this.sortedRanges_ = [range];
    this.browserRanges_ = [range.getBrowserRangeObject()];
  }
};
goog.dom.DomSavedMultiRange_ = function(range) {
  this.savedRanges_ = goog.array.map(range.getTextRanges(), function(range) {
    return range.saveUsingDom();
  });
};
goog.inherits(goog.dom.DomSavedMultiRange_, goog.dom.SavedRange);
goog.dom.DomSavedMultiRange_.prototype.restoreInternal = function() {
  var ranges = goog.array.map(this.savedRanges_, function(savedRange) {
    return savedRange.restore();
  });
  return goog.dom.MultiRange.createFromTextRanges(ranges);
};
goog.dom.DomSavedMultiRange_.prototype.disposeInternal = function() {
  goog.dom.DomSavedMultiRange_.superClass_.disposeInternal.call(this);
  goog.array.forEach(this.savedRanges_, function(savedRange) {
    savedRange.dispose();
  });
  delete this.savedRanges_;
};
goog.dom.MultiRangeIterator = function(range) {
  this.iterators_ = null;
  this.currentIdx_ = 0;
  if (range) {
    this.iterators_ = goog.array.map(range.getSortedRanges(), function(r) {
      return goog.iter.toIterator(r);
    });
  }
  goog.dom.MultiRangeIterator.base(this, "constructor", range ? this.getStartNode() : null, false);
};
goog.inherits(goog.dom.MultiRangeIterator, goog.dom.RangeIterator);
goog.dom.MultiRangeIterator.prototype.getStartTextOffset = function() {
  return this.iterators_[this.currentIdx_].getStartTextOffset();
};
goog.dom.MultiRangeIterator.prototype.getEndTextOffset = function() {
  return this.iterators_[this.currentIdx_].getEndTextOffset();
};
goog.dom.MultiRangeIterator.prototype.getStartNode = function() {
  return this.iterators_[0].getStartNode();
};
goog.dom.MultiRangeIterator.prototype.getEndNode = function() {
  return goog.array.peek(this.iterators_).getEndNode();
};
goog.dom.MultiRangeIterator.prototype.isLast = function() {
  return this.iterators_[this.currentIdx_].isLast();
};
goog.dom.MultiRangeIterator.prototype.next = function() {
  try {
    var it = this.iterators_[this.currentIdx_];
    var next = it.next();
    this.setPosition(it.node, it.tagType, it.depth);
    return next;
  } catch (ex) {
    if (ex !== goog.iter.StopIteration || this.iterators_.length - 1 == this.currentIdx_) {
      throw ex;
    } else {
      this.currentIdx_++;
      return this.next();
    }
  }
};
goog.dom.MultiRangeIterator.prototype.copyFrom = function(other) {
  this.iterators_ = goog.array.clone(other.iterators_);
  goog.dom.MultiRangeIterator.superClass_.copyFrom.call(this, other);
};
goog.dom.MultiRangeIterator.prototype.clone = function() {
  var copy = new goog.dom.MultiRangeIterator(null);
  copy.copyFrom(this);
  return copy;
};
goog.provide("goog.dom.Range");
goog.require("goog.dom");
goog.require("goog.dom.AbstractRange");
goog.require("goog.dom.BrowserFeature");
goog.require("goog.dom.ControlRange");
goog.require("goog.dom.MultiRange");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.TextRange");
goog.dom.Range.createFromWindow = function(opt_win) {
  var sel = goog.dom.AbstractRange.getBrowserSelectionForWindow(opt_win || window);
  return sel && goog.dom.Range.createFromBrowserSelection(sel);
};
goog.dom.Range.createFromBrowserSelection = function(selection) {
  var range;
  var isReversed = false;
  if (selection.createRange) {
    try {
      range = selection.createRange();
    } catch (e) {
      return null;
    }
  } else {
    if (selection.rangeCount) {
      if (selection.rangeCount > 1) {
        return goog.dom.MultiRange.createFromBrowserSelection(selection);
      } else {
        range = selection.getRangeAt(0);
        isReversed = goog.dom.Range.isReversed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
      }
    } else {
      return null;
    }
  }
  return goog.dom.Range.createFromBrowserRange(range, isReversed);
};
goog.dom.Range.createFromBrowserRange = function(range, opt_isReversed) {
  return goog.dom.AbstractRange.isNativeControlRange(range) ? goog.dom.ControlRange.createFromBrowserRange(range) : goog.dom.TextRange.createFromBrowserRange(range, opt_isReversed);
};
goog.dom.Range.createFromNodeContents = function(node, opt_isReversed) {
  return goog.dom.TextRange.createFromNodeContents(node, opt_isReversed);
};
goog.dom.Range.createCaret = function(node, offset) {
  return goog.dom.TextRange.createFromNodes(node, offset, node, offset);
};
goog.dom.Range.createFromNodes = function(anchorNode, anchorOffset, focusNode, focusOffset) {
  return goog.dom.TextRange.createFromNodes(anchorNode, anchorOffset, focusNode, focusOffset);
};
goog.dom.Range.clearSelection = function(opt_win) {
  var sel = goog.dom.AbstractRange.getBrowserSelectionForWindow(opt_win || window);
  if (!sel) {
    return;
  }
  if (sel.empty) {
    try {
      sel.empty();
    } catch (e) {
    }
  } else {
    try {
      sel.removeAllRanges();
    } catch (e$2) {
    }
  }
};
goog.dom.Range.hasSelection = function(opt_win) {
  var sel = goog.dom.AbstractRange.getBrowserSelectionForWindow(opt_win || window);
  return !!sel && (goog.dom.BrowserFeature.LEGACY_IE_RANGES ? sel.type != "None" : !!sel.rangeCount);
};
goog.dom.Range.isReversed = function(anchorNode, anchorOffset, focusNode, focusOffset) {
  if (anchorNode == focusNode) {
    return focusOffset < anchorOffset;
  }
  var child;
  if (anchorNode.nodeType == goog.dom.NodeType.ELEMENT && anchorOffset) {
    child = anchorNode.childNodes[anchorOffset];
    if (child) {
      anchorNode = child;
      anchorOffset = 0;
    } else {
      if (goog.dom.contains(anchorNode, focusNode)) {
        return true;
      }
    }
  }
  if (focusNode.nodeType == goog.dom.NodeType.ELEMENT && focusOffset) {
    child = focusNode.childNodes[focusOffset];
    if (child) {
      focusNode = child;
      focusOffset = 0;
    } else {
      if (goog.dom.contains(focusNode, anchorNode)) {
        return false;
      }
    }
  }
  return (goog.dom.compareNodeOrder(anchorNode, focusNode) || anchorOffset - focusOffset) > 0;
};
goog.provide("goog.a11y.aria.Role");
goog.a11y.aria.Role = {ALERT:"alert", ALERTDIALOG:"alertdialog", APPLICATION:"application", ARTICLE:"article", BANNER:"banner", BUTTON:"button", CHECKBOX:"checkbox", COLUMNHEADER:"columnheader", COMBOBOX:"combobox", COMPLEMENTARY:"complementary", CONTENTINFO:"contentinfo", DEFINITION:"definition", DIALOG:"dialog", DIRECTORY:"directory", DOCUMENT:"document", FORM:"form", GRID:"grid", GRIDCELL:"gridcell", GROUP:"group", HEADING:"heading", IMG:"img", LINK:"link", LIST:"list", LISTBOX:"listbox", LISTITEM:"listitem", 
LOG:"log", MAIN:"main", MARQUEE:"marquee", MATH:"math", MENU:"menu", MENUBAR:"menubar", MENU_ITEM:"menuitem", MENU_ITEM_CHECKBOX:"menuitemcheckbox", MENU_ITEM_RADIO:"menuitemradio", NAVIGATION:"navigation", NOTE:"note", OPTION:"option", PRESENTATION:"presentation", PROGRESSBAR:"progressbar", RADIO:"radio", RADIOGROUP:"radiogroup", REGION:"region", ROW:"row", ROWGROUP:"rowgroup", ROWHEADER:"rowheader", SCROLLBAR:"scrollbar", SEARCH:"search", SEPARATOR:"separator", SLIDER:"slider", SPINBUTTON:"spinbutton", 
STATUS:"status", TAB:"tab", TAB_LIST:"tablist", TAB_PANEL:"tabpanel", TEXTBOX:"textbox", TEXTINFO:"textinfo", TIMER:"timer", TOOLBAR:"toolbar", TOOLTIP:"tooltip", TREE:"tree", TREEGRID:"treegrid", TREEITEM:"treeitem"};
goog.provide("goog.a11y.aria.AutoCompleteValues");
goog.provide("goog.a11y.aria.CheckedValues");
goog.provide("goog.a11y.aria.DropEffectValues");
goog.provide("goog.a11y.aria.ExpandedValues");
goog.provide("goog.a11y.aria.GrabbedValues");
goog.provide("goog.a11y.aria.InvalidValues");
goog.provide("goog.a11y.aria.LivePriority");
goog.provide("goog.a11y.aria.OrientationValues");
goog.provide("goog.a11y.aria.PressedValues");
goog.provide("goog.a11y.aria.RelevantValues");
goog.provide("goog.a11y.aria.SelectedValues");
goog.provide("goog.a11y.aria.SortValues");
goog.provide("goog.a11y.aria.State");
goog.a11y.aria.State = {ACTIVEDESCENDANT:"activedescendant", ATOMIC:"atomic", AUTOCOMPLETE:"autocomplete", BUSY:"busy", CHECKED:"checked", CONTROLS:"controls", DESCRIBEDBY:"describedby", DISABLED:"disabled", DROPEFFECT:"dropeffect", EXPANDED:"expanded", FLOWTO:"flowto", GRABBED:"grabbed", HASPOPUP:"haspopup", HIDDEN:"hidden", INVALID:"invalid", LABEL:"label", LABELLEDBY:"labelledby", LEVEL:"level", LIVE:"live", MULTILINE:"multiline", MULTISELECTABLE:"multiselectable", ORIENTATION:"orientation", OWNS:"owns", 
POSINSET:"posinset", PRESSED:"pressed", READONLY:"readonly", RELEVANT:"relevant", REQUIRED:"required", SELECTED:"selected", SETSIZE:"setsize", SORT:"sort", VALUEMAX:"valuemax", VALUEMIN:"valuemin", VALUENOW:"valuenow", VALUETEXT:"valuetext"};
goog.a11y.aria.AutoCompleteValues = {INLINE:"inline", LIST:"list", BOTH:"both", NONE:"none"};
goog.a11y.aria.DropEffectValues = {COPY:"copy", MOVE:"move", LINK:"link", EXECUTE:"execute", POPUP:"popup", NONE:"none"};
goog.a11y.aria.LivePriority = {OFF:"off", POLITE:"polite", ASSERTIVE:"assertive"};
goog.a11y.aria.OrientationValues = {VERTICAL:"vertical", HORIZONTAL:"horizontal"};
goog.a11y.aria.RelevantValues = {ADDITIONS:"additions", REMOVALS:"removals", TEXT:"text", ALL:"all"};
goog.a11y.aria.SortValues = {ASCENDING:"ascending", DESCENDING:"descending", NONE:"none", OTHER:"other"};
goog.a11y.aria.CheckedValues = {TRUE:"true", FALSE:"false", MIXED:"mixed", UNDEFINED:"undefined"};
goog.a11y.aria.ExpandedValues = {TRUE:"true", FALSE:"false", UNDEFINED:"undefined"};
goog.a11y.aria.GrabbedValues = {TRUE:"true", FALSE:"false", UNDEFINED:"undefined"};
goog.a11y.aria.InvalidValues = {FALSE:"false", TRUE:"true", GRAMMAR:"grammar", SPELLING:"spelling"};
goog.a11y.aria.PressedValues = {TRUE:"true", FALSE:"false", MIXED:"mixed", UNDEFINED:"undefined"};
goog.a11y.aria.SelectedValues = {TRUE:"true", FALSE:"false", UNDEFINED:"undefined"};
goog.provide("goog.a11y.aria.datatables");
goog.require("goog.a11y.aria.State");
goog.require("goog.object");
goog.a11y.aria.DefaultStateValueMap_;
goog.a11y.aria.datatables.getDefaultValuesMap = function() {
  if (!goog.a11y.aria.DefaultStateValueMap_) {
    goog.a11y.aria.DefaultStateValueMap_ = goog.object.create(goog.a11y.aria.State.ATOMIC, false, goog.a11y.aria.State.AUTOCOMPLETE, "none", goog.a11y.aria.State.DROPEFFECT, "none", goog.a11y.aria.State.HASPOPUP, false, goog.a11y.aria.State.LIVE, "off", goog.a11y.aria.State.MULTILINE, false, goog.a11y.aria.State.MULTISELECTABLE, false, goog.a11y.aria.State.ORIENTATION, "vertical", goog.a11y.aria.State.READONLY, false, goog.a11y.aria.State.RELEVANT, "additions text", goog.a11y.aria.State.REQUIRED, 
    false, goog.a11y.aria.State.SORT, "none", goog.a11y.aria.State.BUSY, false, goog.a11y.aria.State.DISABLED, false, goog.a11y.aria.State.HIDDEN, false, goog.a11y.aria.State.INVALID, "false");
  }
  return goog.a11y.aria.DefaultStateValueMap_;
};
goog.provide("goog.a11y.aria");
goog.require("goog.a11y.aria.Role");
goog.require("goog.a11y.aria.State");
goog.require("goog.a11y.aria.datatables");
goog.require("goog.array");
goog.require("goog.asserts");
goog.require("goog.dom");
goog.require("goog.dom.TagName");
goog.require("goog.object");
goog.require("goog.string");
goog.a11y.aria.ARIA_PREFIX_ = "aria-";
goog.a11y.aria.ROLE_ATTRIBUTE_ = "role";
goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_ = goog.object.createSet([goog.dom.TagName.A, goog.dom.TagName.AREA, goog.dom.TagName.BUTTON, goog.dom.TagName.HEAD, goog.dom.TagName.INPUT, goog.dom.TagName.LINK, goog.dom.TagName.MENU, goog.dom.TagName.META, goog.dom.TagName.OPTGROUP, goog.dom.TagName.OPTION, goog.dom.TagName.PROGRESS, goog.dom.TagName.STYLE, goog.dom.TagName.SELECT, goog.dom.TagName.SOURCE, goog.dom.TagName.TEXTAREA, goog.dom.TagName.TITLE, goog.dom.TagName.TRACK]);
goog.a11y.aria.CONTAINER_ROLES_ = [goog.a11y.aria.Role.COMBOBOX, goog.a11y.aria.Role.GRID, goog.a11y.aria.Role.GROUP, goog.a11y.aria.Role.LISTBOX, goog.a11y.aria.Role.MENU, goog.a11y.aria.Role.MENUBAR, goog.a11y.aria.Role.RADIOGROUP, goog.a11y.aria.Role.ROW, goog.a11y.aria.Role.ROWGROUP, goog.a11y.aria.Role.TAB_LIST, goog.a11y.aria.Role.TEXTBOX, goog.a11y.aria.Role.TOOLBAR, goog.a11y.aria.Role.TREE, goog.a11y.aria.Role.TREEGRID];
goog.a11y.aria.setRole = function(element, roleName) {
  if (!roleName) {
    goog.a11y.aria.removeRole(element);
  } else {
    if (goog.asserts.ENABLE_ASSERTS) {
      goog.asserts.assert(goog.object.containsValue(goog.a11y.aria.Role, roleName), "No such ARIA role " + roleName);
    }
    element.setAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_, roleName);
  }
};
goog.a11y.aria.getRole = function(element) {
  var role = element.getAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_);
  return role || null;
};
goog.a11y.aria.removeRole = function(element) {
  element.removeAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_);
};
goog.a11y.aria.setState = function(element, stateName, value) {
  if (goog.isArray(value)) {
    value = value.join(" ");
  }
  var attrStateName = goog.a11y.aria.getAriaAttributeName_(stateName);
  if (value === "" || value == undefined) {
    var defaultValueMap = goog.a11y.aria.datatables.getDefaultValuesMap();
    if (stateName in defaultValueMap) {
      element.setAttribute(attrStateName, defaultValueMap[stateName]);
    } else {
      element.removeAttribute(attrStateName);
    }
  } else {
    element.setAttribute(attrStateName, value);
  }
};
goog.a11y.aria.toggleState = function(el, attr) {
  var val = goog.a11y.aria.getState(el, attr);
  if (!goog.string.isEmptyOrWhitespace(goog.string.makeSafe(val)) && !(val == "true" || val == "false")) {
    goog.a11y.aria.removeState(el, attr);
    return;
  }
  goog.a11y.aria.setState(el, attr, val == "true" ? "false" : "true");
};
goog.a11y.aria.removeState = function(element, stateName) {
  element.removeAttribute(goog.a11y.aria.getAriaAttributeName_(stateName));
};
goog.a11y.aria.getState = function(element, stateName) {
  var attr = element.getAttribute(goog.a11y.aria.getAriaAttributeName_(stateName));
  var isNullOrUndefined = attr == null || attr == undefined;
  return isNullOrUndefined ? "" : String(attr);
};
goog.a11y.aria.getActiveDescendant = function(element) {
  var id = goog.a11y.aria.getState(element, goog.a11y.aria.State.ACTIVEDESCENDANT);
  return goog.dom.getOwnerDocument(element).getElementById(id);
};
goog.a11y.aria.setActiveDescendant = function(element, activeElement) {
  var id = "";
  if (activeElement) {
    id = activeElement.id;
    goog.asserts.assert(id, "The active element should have an id.");
  }
  goog.a11y.aria.setState(element, goog.a11y.aria.State.ACTIVEDESCENDANT, id);
};
goog.a11y.aria.getLabel = function(element) {
  return goog.a11y.aria.getState(element, goog.a11y.aria.State.LABEL);
};
goog.a11y.aria.setLabel = function(element, label) {
  goog.a11y.aria.setState(element, goog.a11y.aria.State.LABEL, label);
};
goog.a11y.aria.assertRoleIsSetInternalUtil = function(element, allowedRoles) {
  if (goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_[element.tagName]) {
    return;
  }
  var elementRole = goog.a11y.aria.getRole(element);
  goog.asserts.assert(elementRole != null, "The element ARIA role cannot be null.");
  goog.asserts.assert(goog.array.contains(allowedRoles, elementRole), "Non existing or incorrect role set for element." + 'The role set is "' + elementRole + '". The role should be any of "' + allowedRoles + '". Check the ARIA specification for more details ' + "http://www.w3.org/TR/wai-aria/roles.");
};
goog.a11y.aria.getStateBoolean = function(element, stateName) {
  var attr = element.getAttribute(goog.a11y.aria.getAriaAttributeName_(stateName));
  goog.asserts.assert(goog.isBoolean(attr) || attr == null || attr == "true" || attr == "false");
  if (attr == null) {
    return attr;
  }
  return goog.isBoolean(attr) ? attr : attr == "true";
};
goog.a11y.aria.getStateNumber = function(element, stateName) {
  var attr = element.getAttribute(goog.a11y.aria.getAriaAttributeName_(stateName));
  goog.asserts.assert((attr == null || !isNaN(Number(attr))) && !goog.isBoolean(attr));
  return attr == null ? null : Number(attr);
};
goog.a11y.aria.getStateString = function(element, stateName) {
  var attr = element.getAttribute(goog.a11y.aria.getAriaAttributeName_(stateName));
  goog.asserts.assert((attr == null || goog.isString(attr)) && (attr == "" || isNaN(Number(attr))) && attr != "true" && attr != "false");
  return attr == null || attr == "" ? null : attr;
};
goog.a11y.aria.getStringArrayStateInternalUtil = function(element, stateName) {
  var attrValue = element.getAttribute(goog.a11y.aria.getAriaAttributeName_(stateName));
  return goog.a11y.aria.splitStringOnWhitespace_(attrValue);
};
goog.a11y.aria.hasState = function(element, stateName) {
  return element.hasAttribute(goog.a11y.aria.getAriaAttributeName_(stateName));
};
goog.a11y.aria.isContainerRole = function(element) {
  var role = goog.a11y.aria.getRole(element);
  return goog.array.contains(goog.a11y.aria.CONTAINER_ROLES_, role);
};
goog.a11y.aria.splitStringOnWhitespace_ = function(stringValue) {
  return stringValue ? stringValue.split(/\s+/) : [];
};
goog.a11y.aria.getAriaAttributeName_ = function(ariaName) {
  if (goog.asserts.ENABLE_ASSERTS) {
    goog.asserts.assert(ariaName, "ARIA attribute cannot be empty.");
    goog.asserts.assert(goog.object.containsValue(goog.a11y.aria.State, ariaName), "No such ARIA attribute " + ariaName);
  }
  return goog.a11y.aria.ARIA_PREFIX_ + ariaName;
};
goog.provide("goog.Thenable");
goog.forwardDeclare("goog.Promise");
goog.Thenable = function() {
};
goog.Thenable.prototype.then = function(opt_onFulfilled, opt_onRejected, opt_context) {
};
goog.Thenable.IMPLEMENTED_BY_PROP = "$goog_Thenable";
goog.Thenable.addImplementation = function(ctor) {
  ctor.prototype["then"] = ctor.prototype.then;
  if (COMPILED) {
    ctor.prototype[goog.Thenable.IMPLEMENTED_BY_PROP] = true;
  } else {
    ctor.prototype.$goog_Thenable = true;
  }
};
goog.Thenable.isImplementedBy = function(object) {
  if (!object) {
    return false;
  }
  try {
    if (COMPILED) {
      return !!object[goog.Thenable.IMPLEMENTED_BY_PROP];
    }
    return !!object.$goog_Thenable;
  } catch (e) {
    return false;
  }
};
goog.provide("goog.async.FreeList");
goog.async.FreeList = goog.defineClass(null, {constructor:function(create, reset, limit) {
  this.limit_ = limit;
  this.create_ = create;
  this.reset_ = reset;
  this.occupants_ = 0;
  this.head_ = null;
}, get:function() {
  var item;
  if (this.occupants_ > 0) {
    this.occupants_--;
    item = this.head_;
    this.head_ = item.next;
    item.next = null;
  } else {
    item = this.create_();
  }
  return item;
}, put:function(item) {
  this.reset_(item);
  if (this.occupants_ < this.limit_) {
    this.occupants_++;
    item.next = this.head_;
    this.head_ = item;
  }
}, occupants:function() {
  return this.occupants_;
}});
goog.provide("goog.async.WorkItem");
goog.provide("goog.async.WorkQueue");
goog.require("goog.asserts");
goog.require("goog.async.FreeList");
goog.async.WorkQueue = function() {
  this.workHead_ = null;
  this.workTail_ = null;
};
goog.define("goog.async.WorkQueue.DEFAULT_MAX_UNUSED", 100);
goog.async.WorkQueue.freelist_ = new goog.async.FreeList(function() {
  return new goog.async.WorkItem;
}, function(item) {
  item.reset();
}, goog.async.WorkQueue.DEFAULT_MAX_UNUSED);
goog.async.WorkQueue.prototype.add = function(fn, scope) {
  var item = this.getUnusedItem_();
  item.set(fn, scope);
  if (this.workTail_) {
    this.workTail_.next = item;
    this.workTail_ = item;
  } else {
    goog.asserts.assert(!this.workHead_);
    this.workHead_ = item;
    this.workTail_ = item;
  }
};
goog.async.WorkQueue.prototype.remove = function() {
  var item = null;
  if (this.workHead_) {
    item = this.workHead_;
    this.workHead_ = this.workHead_.next;
    if (!this.workHead_) {
      this.workTail_ = null;
    }
    item.next = null;
  }
  return item;
};
goog.async.WorkQueue.prototype.returnUnused = function(item) {
  goog.async.WorkQueue.freelist_.put(item);
};
goog.async.WorkQueue.prototype.getUnusedItem_ = function() {
  return goog.async.WorkQueue.freelist_.get();
};
goog.async.WorkItem = function() {
  this.fn = null;
  this.scope = null;
  this.next = null;
};
goog.async.WorkItem.prototype.set = function(fn, scope) {
  this.fn = fn;
  this.scope = scope;
  this.next = null;
};
goog.async.WorkItem.prototype.reset = function() {
  this.fn = null;
  this.scope = null;
  this.next = null;
};
goog.provide("goog.async.nextTick");
goog.provide("goog.async.throwException");
goog.require("goog.debug.entryPointRegistry");
goog.require("goog.dom.TagName");
goog.require("goog.functions");
goog.require("goog.labs.userAgent.browser");
goog.require("goog.labs.userAgent.engine");
goog.async.throwException = function(exception) {
  goog.global.setTimeout(function() {
    throw exception;
  }, 0);
};
goog.async.nextTick = function(callback, opt_context, opt_useSetImmediate) {
  var cb = callback;
  if (opt_context) {
    cb = goog.bind(callback, opt_context);
  }
  cb = goog.async.nextTick.wrapCallback_(cb);
  if (goog.isFunction(goog.global.setImmediate) && (opt_useSetImmediate || goog.async.nextTick.useSetImmediate_())) {
    goog.global.setImmediate(cb);
    return;
  }
  if (!goog.async.nextTick.setImmediate_) {
    goog.async.nextTick.setImmediate_ = goog.async.nextTick.getSetImmediateEmulator_();
  }
  goog.async.nextTick.setImmediate_(cb);
};
goog.async.nextTick.useSetImmediate_ = function() {
  if (!goog.global.Window || !goog.global.Window.prototype) {
    return true;
  }
  if (goog.labs.userAgent.browser.isEdge() || goog.global.Window.prototype.setImmediate != goog.global.setImmediate) {
    return true;
  }
  return false;
};
goog.async.nextTick.setImmediate_;
goog.async.nextTick.getSetImmediateEmulator_ = function() {
  var Channel = goog.global["MessageChannel"];
  if (typeof Channel === "undefined" && typeof window !== "undefined" && window.postMessage && window.addEventListener && !goog.labs.userAgent.engine.isPresto()) {
    Channel = function() {
      var iframe = document.createElement(String(goog.dom.TagName.IFRAME));
      iframe.style.display = "none";
      iframe.src = "";
      document.documentElement.appendChild(iframe);
      var win = iframe.contentWindow;
      var doc = win.document;
      doc.open();
      doc.write("");
      doc.close();
      var message = "callImmediate" + Math.random();
      var origin = win.location.protocol == "file:" ? "*" : win.location.protocol + "//" + win.location.host;
      var onmessage = goog.bind(function(e) {
        if (origin != "*" && e.origin != origin || e.data != message) {
          return;
        }
        this["port1"].onmessage();
      }, this);
      win.addEventListener("message", onmessage, false);
      this["port1"] = {};
      this["port2"] = {postMessage:function() {
        win.postMessage(message, origin);
      }};
    };
  }
  if (typeof Channel !== "undefined" && !goog.labs.userAgent.browser.isIE()) {
    var channel = new Channel;
    var head = {};
    var tail = head;
    channel["port1"].onmessage = function() {
      if (goog.isDef(head.next)) {
        head = head.next;
        var cb = head.cb;
        head.cb = null;
        cb();
      }
    };
    return function(cb) {
      tail.next = {cb:cb};
      tail = tail.next;
      channel["port2"].postMessage(0);
    };
  }
  if (typeof document !== "undefined" && "onreadystatechange" in document.createElement(String(goog.dom.TagName.SCRIPT))) {
    return function(cb) {
      var script = document.createElement(String(goog.dom.TagName.SCRIPT));
      script.onreadystatechange = function() {
        script.onreadystatechange = null;
        script.parentNode.removeChild(script);
        script = null;
        cb();
        cb = null;
      };
      document.documentElement.appendChild(script);
    };
  }
  return function(cb) {
    goog.global.setTimeout(cb, 0);
  };
};
goog.async.nextTick.wrapCallback_ = goog.functions.identity;
goog.debug.entryPointRegistry.register(function(transformer) {
  goog.async.nextTick.wrapCallback_ = transformer;
});
goog.provide("goog.async.run");
goog.require("goog.async.WorkQueue");
goog.require("goog.async.nextTick");
goog.require("goog.async.throwException");
goog.async.run = function(callback, opt_context) {
  if (!goog.async.run.schedule_) {
    goog.async.run.initializeRunner_();
  }
  if (!goog.async.run.workQueueScheduled_) {
    goog.async.run.schedule_();
    goog.async.run.workQueueScheduled_ = true;
  }
  goog.async.run.workQueue_.add(callback, opt_context);
};
goog.async.run.initializeRunner_ = function() {
  if (String(goog.global.Promise).indexOf("[native code]") != -1) {
    var promise = goog.global.Promise.resolve(undefined);
    goog.async.run.schedule_ = function() {
      promise.then(goog.async.run.processWorkQueue);
    };
  } else {
    goog.async.run.schedule_ = function() {
      goog.async.nextTick(goog.async.run.processWorkQueue);
    };
  }
};
goog.async.run.forceNextTick = function(opt_realSetTimeout) {
  goog.async.run.schedule_ = function() {
    goog.async.nextTick(goog.async.run.processWorkQueue);
    if (opt_realSetTimeout) {
      opt_realSetTimeout(goog.async.run.processWorkQueue);
    }
  };
};
goog.async.run.schedule_;
goog.async.run.workQueueScheduled_ = false;
goog.async.run.workQueue_ = new goog.async.WorkQueue;
if (goog.DEBUG) {
  goog.async.run.resetQueue = function() {
    goog.async.run.workQueueScheduled_ = false;
    goog.async.run.workQueue_ = new goog.async.WorkQueue;
  };
}
goog.async.run.processWorkQueue = function() {
  var item = null;
  while (item = goog.async.run.workQueue_.remove()) {
    try {
      item.fn.call(item.scope);
    } catch (e) {
      goog.async.throwException(e);
    }
    goog.async.run.workQueue_.returnUnused(item);
  }
  goog.async.run.workQueueScheduled_ = false;
};
goog.provide("goog.promise.Resolver");
goog.promise.Resolver = function() {
};
goog.promise.Resolver.prototype.promise;
goog.promise.Resolver.prototype.resolve;
goog.promise.Resolver.prototype.reject;
goog.provide("goog.Promise");
goog.require("goog.Thenable");
goog.require("goog.asserts");
goog.require("goog.async.FreeList");
goog.require("goog.async.run");
goog.require("goog.async.throwException");
goog.require("goog.debug.Error");
goog.require("goog.promise.Resolver");
goog.Promise = function(resolver, opt_context) {
  this.state_ = goog.Promise.State_.PENDING;
  this.result_ = undefined;
  this.parent_ = null;
  this.callbackEntries_ = null;
  this.callbackEntriesTail_ = null;
  this.executing_ = false;
  if (goog.Promise.UNHANDLED_REJECTION_DELAY > 0) {
    this.unhandledRejectionId_ = 0;
  } else {
    if (goog.Promise.UNHANDLED_REJECTION_DELAY == 0) {
      this.hadUnhandledRejection_ = false;
    }
  }
  if (goog.Promise.LONG_STACK_TRACES) {
    this.stack_ = [];
    this.addStackTrace_(new Error("created"));
    this.currentStep_ = 0;
  }
  if (resolver != goog.nullFunction) {
    try {
      var self = this;
      resolver.call(opt_context, function(value) {
        self.resolve_(goog.Promise.State_.FULFILLED, value);
      }, function(reason) {
        if (goog.DEBUG && !(reason instanceof goog.Promise.CancellationError)) {
          try {
            if (reason instanceof Error) {
              throw reason;
            } else {
              throw new Error("Promise rejected.");
            }
          } catch (e) {
          }
        }
        self.resolve_(goog.Promise.State_.REJECTED, reason);
      });
    } catch (e) {
      this.resolve_(goog.Promise.State_.REJECTED, e);
    }
  }
};
goog.define("goog.Promise.LONG_STACK_TRACES", false);
goog.define("goog.Promise.UNHANDLED_REJECTION_DELAY", 0);
goog.Promise.State_ = {PENDING:0, BLOCKED:1, FULFILLED:2, REJECTED:3};
goog.Promise.CallbackEntry_ = function() {
  this.child = null;
  this.onFulfilled = null;
  this.onRejected = null;
  this.context = null;
  this.next = null;
  this.always = false;
};
goog.Promise.CallbackEntry_.prototype.reset = function() {
  this.child = null;
  this.onFulfilled = null;
  this.onRejected = null;
  this.context = null;
  this.always = false;
};
goog.define("goog.Promise.DEFAULT_MAX_UNUSED", 100);
goog.Promise.freelist_ = new goog.async.FreeList(function() {
  return new goog.Promise.CallbackEntry_;
}, function(item) {
  item.reset();
}, goog.Promise.DEFAULT_MAX_UNUSED);
goog.Promise.getCallbackEntry_ = function(onFulfilled, onRejected, context) {
  var entry = goog.Promise.freelist_.get();
  entry.onFulfilled = onFulfilled;
  entry.onRejected = onRejected;
  entry.context = context;
  return entry;
};
goog.Promise.returnEntry_ = function(entry) {
  goog.Promise.freelist_.put(entry);
};
goog.Promise.resolve = function(opt_value) {
  if (opt_value instanceof goog.Promise) {
    return opt_value;
  }
  var promise = new goog.Promise(goog.nullFunction);
  promise.resolve_(goog.Promise.State_.FULFILLED, opt_value);
  return promise;
};
goog.Promise.reject = function(opt_reason) {
  return new goog.Promise(function(resolve, reject) {
    reject(opt_reason);
  });
};
goog.Promise.resolveThen_ = function(value, onFulfilled, onRejected) {
  var isThenable = goog.Promise.maybeThen_(value, onFulfilled, onRejected, null);
  if (!isThenable) {
    goog.async.run(goog.partial(onFulfilled, value));
  }
};
goog.Promise.race = function(promises) {
  return new goog.Promise(function(resolve, reject) {
    if (!promises.length) {
      resolve(undefined);
    }
    for (var i = 0, promise; i < promises.length; i++) {
      promise = promises[i];
      goog.Promise.resolveThen_(promise, resolve, reject);
    }
  });
};
goog.Promise.all = function(promises) {
  return new goog.Promise(function(resolve, reject) {
    var toFulfill = promises.length;
    var values = [];
    if (!toFulfill) {
      resolve(values);
      return;
    }
    var onFulfill = function(index, value) {
      toFulfill--;
      values[index] = value;
      if (toFulfill == 0) {
        resolve(values);
      }
    };
    var onReject = function(reason) {
      reject(reason);
    };
    for (var i = 0, promise; i < promises.length; i++) {
      promise = promises[i];
      goog.Promise.resolveThen_(promise, goog.partial(onFulfill, i), onReject);
    }
  });
};
goog.Promise.allSettled = function(promises) {
  return new goog.Promise(function(resolve, reject) {
    var toSettle = promises.length;
    var results = [];
    if (!toSettle) {
      resolve(results);
      return;
    }
    var onSettled = function(index, fulfilled, result) {
      toSettle--;
      results[index] = fulfilled ? {fulfilled:true, value:result} : {fulfilled:false, reason:result};
      if (toSettle == 0) {
        resolve(results);
      }
    };
    for (var i = 0, promise; i < promises.length; i++) {
      promise = promises[i];
      goog.Promise.resolveThen_(promise, goog.partial(onSettled, i, true), goog.partial(onSettled, i, false));
    }
  });
};
goog.Promise.firstFulfilled = function(promises) {
  return new goog.Promise(function(resolve, reject) {
    var toReject = promises.length;
    var reasons = [];
    if (!toReject) {
      resolve(undefined);
      return;
    }
    var onFulfill = function(value) {
      resolve(value);
    };
    var onReject = function(index, reason) {
      toReject--;
      reasons[index] = reason;
      if (toReject == 0) {
        reject(reasons);
      }
    };
    for (var i = 0, promise; i < promises.length; i++) {
      promise = promises[i];
      goog.Promise.resolveThen_(promise, onFulfill, goog.partial(onReject, i));
    }
  });
};
goog.Promise.withResolver = function() {
  var resolve, reject;
  var promise = new goog.Promise(function(rs, rj) {
    resolve = rs;
    reject = rj;
  });
  return new goog.Promise.Resolver_(promise, resolve, reject);
};
goog.Promise.prototype.then = function(opt_onFulfilled, opt_onRejected, opt_context) {
  if (opt_onFulfilled != null) {
    goog.asserts.assertFunction(opt_onFulfilled, "opt_onFulfilled should be a function.");
  }
  if (opt_onRejected != null) {
    goog.asserts.assertFunction(opt_onRejected, "opt_onRejected should be a function. Did you pass opt_context " + "as the second argument instead of the third?");
  }
  if (goog.Promise.LONG_STACK_TRACES) {
    this.addStackTrace_(new Error("then"));
  }
  return this.addChildPromise_(goog.isFunction(opt_onFulfilled) ? opt_onFulfilled : null, goog.isFunction(opt_onRejected) ? opt_onRejected : null, opt_context);
};
goog.Thenable.addImplementation(goog.Promise);
goog.Promise.prototype.thenVoid = function(opt_onFulfilled, opt_onRejected, opt_context) {
  if (opt_onFulfilled != null) {
    goog.asserts.assertFunction(opt_onFulfilled, "opt_onFulfilled should be a function.");
  }
  if (opt_onRejected != null) {
    goog.asserts.assertFunction(opt_onRejected, "opt_onRejected should be a function. Did you pass opt_context " + "as the second argument instead of the third?");
  }
  if (goog.Promise.LONG_STACK_TRACES) {
    this.addStackTrace_(new Error("then"));
  }
  this.addCallbackEntry_(goog.Promise.getCallbackEntry_(opt_onFulfilled || goog.nullFunction, opt_onRejected || null, opt_context));
};
goog.Promise.prototype.thenAlways = function(onSettled, opt_context) {
  if (goog.Promise.LONG_STACK_TRACES) {
    this.addStackTrace_(new Error("thenAlways"));
  }
  var entry = goog.Promise.getCallbackEntry_(onSettled, onSettled, opt_context);
  entry.always = true;
  this.addCallbackEntry_(entry);
  return this;
};
goog.Promise.prototype.thenCatch = function(onRejected, opt_context) {
  if (goog.Promise.LONG_STACK_TRACES) {
    this.addStackTrace_(new Error("thenCatch"));
  }
  return this.addChildPromise_(null, onRejected, opt_context);
};
goog.Promise.prototype.cancel = function(opt_message) {
  if (this.state_ == goog.Promise.State_.PENDING) {
    goog.async.run(function() {
      var err = new goog.Promise.CancellationError(opt_message);
      this.cancelInternal_(err);
    }, this);
  }
};
goog.Promise.prototype.cancelInternal_ = function(err) {
  if (this.state_ == goog.Promise.State_.PENDING) {
    if (this.parent_) {
      this.parent_.cancelChild_(this, err);
      this.parent_ = null;
    } else {
      this.resolve_(goog.Promise.State_.REJECTED, err);
    }
  }
};
goog.Promise.prototype.cancelChild_ = function(childPromise, err) {
  if (!this.callbackEntries_) {
    return;
  }
  var childCount = 0;
  var childEntry = null;
  var beforeChildEntry = null;
  for (var entry = this.callbackEntries_; entry; entry = entry.next) {
    if (!entry.always) {
      childCount++;
      if (entry.child == childPromise) {
        childEntry = entry;
      }
      if (childEntry && childCount > 1) {
        break;
      }
    }
    if (!childEntry) {
      beforeChildEntry = entry;
    }
  }
  if (childEntry) {
    if (this.state_ == goog.Promise.State_.PENDING && childCount == 1) {
      this.cancelInternal_(err);
    } else {
      if (beforeChildEntry) {
        this.removeEntryAfter_(beforeChildEntry);
      } else {
        this.popEntry_();
      }
      this.executeCallback_(childEntry, goog.Promise.State_.REJECTED, err);
    }
  }
};
goog.Promise.prototype.addCallbackEntry_ = function(callbackEntry) {
  if (!this.hasEntry_() && (this.state_ == goog.Promise.State_.FULFILLED || this.state_ == goog.Promise.State_.REJECTED)) {
    this.scheduleCallbacks_();
  }
  this.queueEntry_(callbackEntry);
};
goog.Promise.prototype.addChildPromise_ = function(onFulfilled, onRejected, opt_context) {
  var callbackEntry = goog.Promise.getCallbackEntry_(null, null, null);
  callbackEntry.child = new goog.Promise(function(resolve, reject) {
    callbackEntry.onFulfilled = onFulfilled ? function(value) {
      try {
        var result = onFulfilled.call(opt_context, value);
        resolve(result);
      } catch (err) {
        reject(err);
      }
    } : resolve;
    callbackEntry.onRejected = onRejected ? function(reason) {
      try {
        var result = onRejected.call(opt_context, reason);
        if (!goog.isDef(result) && reason instanceof goog.Promise.CancellationError) {
          reject(reason);
        } else {
          resolve(result);
        }
      } catch (err) {
        reject(err);
      }
    } : reject;
  });
  callbackEntry.child.parent_ = this;
  this.addCallbackEntry_(callbackEntry);
  return callbackEntry.child;
};
goog.Promise.prototype.unblockAndFulfill_ = function(value) {
  goog.asserts.assert(this.state_ == goog.Promise.State_.BLOCKED);
  this.state_ = goog.Promise.State_.PENDING;
  this.resolve_(goog.Promise.State_.FULFILLED, value);
};
goog.Promise.prototype.unblockAndReject_ = function(reason) {
  goog.asserts.assert(this.state_ == goog.Promise.State_.BLOCKED);
  this.state_ = goog.Promise.State_.PENDING;
  this.resolve_(goog.Promise.State_.REJECTED, reason);
};
goog.Promise.prototype.resolve_ = function(state, x) {
  if (this.state_ != goog.Promise.State_.PENDING) {
    return;
  }
  if (this === x) {
    state = goog.Promise.State_.REJECTED;
    x = new TypeError("Promise cannot resolve to itself");
  }
  this.state_ = goog.Promise.State_.BLOCKED;
  var isThenable = goog.Promise.maybeThen_(x, this.unblockAndFulfill_, this.unblockAndReject_, this);
  if (isThenable) {
    return;
  }
  this.result_ = x;
  this.state_ = state;
  this.parent_ = null;
  this.scheduleCallbacks_();
  if (state == goog.Promise.State_.REJECTED && !(x instanceof goog.Promise.CancellationError)) {
    goog.Promise.addUnhandledRejection_(this, x);
  }
};
goog.Promise.maybeThen_ = function(value, onFulfilled, onRejected, context) {
  if (value instanceof goog.Promise) {
    value.thenVoid(onFulfilled, onRejected, context);
    return true;
  } else {
    if (goog.Thenable.isImplementedBy(value)) {
      value = value;
      value.then(onFulfilled, onRejected, context);
      return true;
    } else {
      if (goog.isObject(value)) {
        try {
          var then = value["then"];
          if (goog.isFunction(then)) {
            goog.Promise.tryThen_(value, then, onFulfilled, onRejected, context);
            return true;
          }
        } catch (e) {
          onRejected.call(context, e);
          return true;
        }
      }
    }
  }
  return false;
};
goog.Promise.tryThen_ = function(thenable, then, onFulfilled, onRejected, context) {
  var called = false;
  var resolve = function(value) {
    if (!called) {
      called = true;
      onFulfilled.call(context, value);
    }
  };
  var reject = function(reason) {
    if (!called) {
      called = true;
      onRejected.call(context, reason);
    }
  };
  try {
    then.call(thenable, resolve, reject);
  } catch (e) {
    reject(e);
  }
};
goog.Promise.prototype.scheduleCallbacks_ = function() {
  if (!this.executing_) {
    this.executing_ = true;
    goog.async.run(this.executeCallbacks_, this);
  }
};
goog.Promise.prototype.hasEntry_ = function() {
  return !!this.callbackEntries_;
};
goog.Promise.prototype.queueEntry_ = function(entry) {
  goog.asserts.assert(entry.onFulfilled != null);
  if (this.callbackEntriesTail_) {
    this.callbackEntriesTail_.next = entry;
    this.callbackEntriesTail_ = entry;
  } else {
    this.callbackEntries_ = entry;
    this.callbackEntriesTail_ = entry;
  }
};
goog.Promise.prototype.popEntry_ = function() {
  var entry = null;
  if (this.callbackEntries_) {
    entry = this.callbackEntries_;
    this.callbackEntries_ = entry.next;
    entry.next = null;
  }
  if (!this.callbackEntries_) {
    this.callbackEntriesTail_ = null;
  }
  if (entry != null) {
    goog.asserts.assert(entry.onFulfilled != null);
  }
  return entry;
};
goog.Promise.prototype.removeEntryAfter_ = function(previous) {
  goog.asserts.assert(this.callbackEntries_);
  goog.asserts.assert(previous != null);
  if (previous.next == this.callbackEntriesTail_) {
    this.callbackEntriesTail_ = previous;
  }
  previous.next = previous.next.next;
};
goog.Promise.prototype.executeCallbacks_ = function() {
  var entry = null;
  while (entry = this.popEntry_()) {
    if (goog.Promise.LONG_STACK_TRACES) {
      this.currentStep_++;
    }
    this.executeCallback_(entry, this.state_, this.result_);
  }
  this.executing_ = false;
};
goog.Promise.prototype.executeCallback_ = function(callbackEntry, state, result) {
  if (state == goog.Promise.State_.REJECTED && callbackEntry.onRejected && !callbackEntry.always) {
    this.removeUnhandledRejection_();
  }
  if (callbackEntry.child) {
    callbackEntry.child.parent_ = null;
    goog.Promise.invokeCallback_(callbackEntry, state, result);
  } else {
    try {
      callbackEntry.always ? callbackEntry.onFulfilled.call(callbackEntry.context) : goog.Promise.invokeCallback_(callbackEntry, state, result);
    } catch (err) {
      goog.Promise.handleRejection_.call(null, err);
    }
  }
  goog.Promise.returnEntry_(callbackEntry);
};
goog.Promise.invokeCallback_ = function(callbackEntry, state, result) {
  if (state == goog.Promise.State_.FULFILLED) {
    callbackEntry.onFulfilled.call(callbackEntry.context, result);
  } else {
    if (callbackEntry.onRejected) {
      callbackEntry.onRejected.call(callbackEntry.context, result);
    }
  }
};
goog.Promise.prototype.addStackTrace_ = function(err) {
  if (goog.Promise.LONG_STACK_TRACES && goog.isString(err.stack)) {
    var trace = err.stack.split("\n", 4)[3];
    var message = err.message;
    message += Array(11 - message.length).join(" ");
    this.stack_.push(message + trace);
  }
};
goog.Promise.prototype.appendLongStack_ = function(err) {
  if (goog.Promise.LONG_STACK_TRACES && err && goog.isString(err.stack) && this.stack_.length) {
    var longTrace = ["Promise trace:"];
    for (var promise = this; promise; promise = promise.parent_) {
      for (var i = this.currentStep_; i >= 0; i--) {
        longTrace.push(promise.stack_[i]);
      }
      longTrace.push("Value: " + "[" + (promise.state_ == goog.Promise.State_.REJECTED ? "REJECTED" : "FULFILLED") + "] " + "<" + String(promise.result_) + ">");
    }
    err.stack += "\n\n" + longTrace.join("\n");
  }
};
goog.Promise.prototype.removeUnhandledRejection_ = function() {
  if (goog.Promise.UNHANDLED_REJECTION_DELAY > 0) {
    for (var p = this; p && p.unhandledRejectionId_; p = p.parent_) {
      goog.global.clearTimeout(p.unhandledRejectionId_);
      p.unhandledRejectionId_ = 0;
    }
  } else {
    if (goog.Promise.UNHANDLED_REJECTION_DELAY == 0) {
      for (var p = this; p && p.hadUnhandledRejection_; p = p.parent_) {
        p.hadUnhandledRejection_ = false;
      }
    }
  }
};
goog.Promise.addUnhandledRejection_ = function(promise, reason) {
  if (goog.Promise.UNHANDLED_REJECTION_DELAY > 0) {
    promise.unhandledRejectionId_ = goog.global.setTimeout(function() {
      promise.appendLongStack_(reason);
      goog.Promise.handleRejection_.call(null, reason);
    }, goog.Promise.UNHANDLED_REJECTION_DELAY);
  } else {
    if (goog.Promise.UNHANDLED_REJECTION_DELAY == 0) {
      promise.hadUnhandledRejection_ = true;
      goog.async.run(function() {
        if (promise.hadUnhandledRejection_) {
          promise.appendLongStack_(reason);
          goog.Promise.handleRejection_.call(null, reason);
        }
      });
    }
  }
};
goog.Promise.handleRejection_ = goog.async.throwException;
goog.Promise.setUnhandledRejectionHandler = function(handler) {
  goog.Promise.handleRejection_ = handler;
};
goog.Promise.CancellationError = function(opt_message) {
  goog.Promise.CancellationError.base(this, "constructor", opt_message);
};
goog.inherits(goog.Promise.CancellationError, goog.debug.Error);
goog.Promise.CancellationError.prototype.name = "cancel";
goog.Promise.Resolver_ = function(promise, resolve, reject) {
  this.promise = promise;
  this.resolve = resolve;
  this.reject = reject;
};
goog.provide("goog.events.EventTarget");
goog.require("goog.Disposable");
goog.require("goog.asserts");
goog.require("goog.events");
goog.require("goog.events.Event");
goog.require("goog.events.Listenable");
goog.require("goog.events.ListenerMap");
goog.require("goog.object");
goog.events.EventTarget = function() {
  goog.Disposable.call(this);
  this.eventTargetListeners_ = new goog.events.ListenerMap(this);
  this.actualEventTarget_ = this;
  this.parentEventTarget_ = null;
};
goog.inherits(goog.events.EventTarget, goog.Disposable);
goog.events.Listenable.addImplementation(goog.events.EventTarget);
goog.events.EventTarget.MAX_ANCESTORS_ = 1000;
goog.events.EventTarget.prototype.getParentEventTarget = function() {
  return this.parentEventTarget_;
};
goog.events.EventTarget.prototype.setParentEventTarget = function(parent) {
  this.parentEventTarget_ = parent;
};
goog.events.EventTarget.prototype.addEventListener = function(type, handler, opt_capture, opt_handlerScope) {
  goog.events.listen(this, type, handler, opt_capture, opt_handlerScope);
};
goog.events.EventTarget.prototype.removeEventListener = function(type, handler, opt_capture, opt_handlerScope) {
  goog.events.unlisten(this, type, handler, opt_capture, opt_handlerScope);
};
goog.events.EventTarget.prototype.dispatchEvent = function(e) {
  this.assertInitialized_();
  var ancestorsTree, ancestor = this.getParentEventTarget();
  if (ancestor) {
    ancestorsTree = [];
    var ancestorCount = 1;
    for (; ancestor; ancestor = ancestor.getParentEventTarget()) {
      ancestorsTree.push(ancestor);
      goog.asserts.assert(++ancestorCount < goog.events.EventTarget.MAX_ANCESTORS_, "infinite loop");
    }
  }
  return goog.events.EventTarget.dispatchEventInternal_(this.actualEventTarget_, e, ancestorsTree);
};
goog.events.EventTarget.prototype.disposeInternal = function() {
  goog.events.EventTarget.superClass_.disposeInternal.call(this);
  this.removeAllListeners();
  this.parentEventTarget_ = null;
};
goog.events.EventTarget.prototype.listen = function(type, listener, opt_useCapture, opt_listenerScope) {
  this.assertInitialized_();
  return this.eventTargetListeners_.add(String(type), listener, false, opt_useCapture, opt_listenerScope);
};
goog.events.EventTarget.prototype.listenOnce = function(type, listener, opt_useCapture, opt_listenerScope) {
  return this.eventTargetListeners_.add(String(type), listener, true, opt_useCapture, opt_listenerScope);
};
goog.events.EventTarget.prototype.unlisten = function(type, listener, opt_useCapture, opt_listenerScope) {
  return this.eventTargetListeners_.remove(String(type), listener, opt_useCapture, opt_listenerScope);
};
goog.events.EventTarget.prototype.unlistenByKey = function(key) {
  return this.eventTargetListeners_.removeByKey(key);
};
goog.events.EventTarget.prototype.removeAllListeners = function(opt_type) {
  if (!this.eventTargetListeners_) {
    return 0;
  }
  return this.eventTargetListeners_.removeAll(opt_type);
};
goog.events.EventTarget.prototype.fireListeners = function(type, capture, eventObject) {
  var listenerArray = this.eventTargetListeners_.listeners[String(type)];
  if (!listenerArray) {
    return true;
  }
  listenerArray = listenerArray.concat();
  var rv = true;
  for (var i = 0; i < listenerArray.length; ++i) {
    var listener = listenerArray[i];
    if (listener && !listener.removed && listener.capture == capture) {
      var listenerFn = listener.listener;
      var listenerHandler = listener.handler || listener.src;
      if (listener.callOnce) {
        this.unlistenByKey(listener);
      }
      rv = listenerFn.call(listenerHandler, eventObject) !== false && rv;
    }
  }
  return rv && eventObject.returnValue_ != false;
};
goog.events.EventTarget.prototype.getListeners = function(type, capture) {
  return this.eventTargetListeners_.getListeners(String(type), capture);
};
goog.events.EventTarget.prototype.getListener = function(type, listener, capture, opt_listenerScope) {
  return this.eventTargetListeners_.getListener(String(type), listener, capture, opt_listenerScope);
};
goog.events.EventTarget.prototype.hasListener = function(opt_type, opt_capture) {
  var id = goog.isDef(opt_type) ? String(opt_type) : undefined;
  return this.eventTargetListeners_.hasListener(id, opt_capture);
};
goog.events.EventTarget.prototype.setTargetForTesting = function(target) {
  this.actualEventTarget_ = target;
};
goog.events.EventTarget.prototype.assertInitialized_ = function() {
  goog.asserts.assert(this.eventTargetListeners_, "Event target is not initialized. Did you call the superclass " + "(goog.events.EventTarget) constructor?");
};
goog.events.EventTarget.dispatchEventInternal_ = function(target, e, opt_ancestorsTree) {
  var type = e.type || e;
  if (goog.isString(e)) {
    e = new goog.events.Event(e, target);
  } else {
    if (!(e instanceof goog.events.Event)) {
      var oldEvent = e;
      e = new goog.events.Event(type, target);
      goog.object.extend(e, oldEvent);
    } else {
      e.target = e.target || target;
    }
  }
  var rv = true, currentTarget;
  if (opt_ancestorsTree) {
    for (var i = opt_ancestorsTree.length - 1; !e.propagationStopped_ && i >= 0; i--) {
      currentTarget = e.currentTarget = opt_ancestorsTree[i];
      rv = currentTarget.fireListeners(type, true, e) && rv;
    }
  }
  if (!e.propagationStopped_) {
    currentTarget = e.currentTarget = target;
    rv = currentTarget.fireListeners(type, true, e) && rv;
    if (!e.propagationStopped_) {
      rv = currentTarget.fireListeners(type, false, e) && rv;
    }
  }
  if (opt_ancestorsTree) {
    for (i = 0; !e.propagationStopped_ && i < opt_ancestorsTree.length; i++) {
      currentTarget = e.currentTarget = opt_ancestorsTree[i];
      rv = currentTarget.fireListeners(type, false, e) && rv;
    }
  }
  return rv;
};
goog.provide("goog.Timer");
goog.require("goog.Promise");
goog.require("goog.events.EventTarget");
goog.Timer = function(opt_interval, opt_timerObject) {
  goog.events.EventTarget.call(this);
  this.interval_ = opt_interval || 1;
  this.timerObject_ = opt_timerObject || goog.Timer.defaultTimerObject;
  this.boundTick_ = goog.bind(this.tick_, this);
  this.last_ = goog.now();
};
goog.inherits(goog.Timer, goog.events.EventTarget);
goog.Timer.MAX_TIMEOUT_ = 2147483647;
goog.Timer.INVALID_TIMEOUT_ID_ = -1;
goog.Timer.prototype.enabled = false;
goog.Timer.defaultTimerObject = goog.global;
goog.Timer.intervalScale = 0.8;
goog.Timer.prototype.timer_ = null;
goog.Timer.prototype.getInterval = function() {
  return this.interval_;
};
goog.Timer.prototype.setInterval = function(interval) {
  this.interval_ = interval;
  if (this.timer_ && this.enabled) {
    this.stop();
    this.start();
  } else {
    if (this.timer_) {
      this.stop();
    }
  }
};
goog.Timer.prototype.tick_ = function() {
  if (this.enabled) {
    var elapsed = goog.now() - this.last_;
    if (elapsed > 0 && elapsed < this.interval_ * goog.Timer.intervalScale) {
      this.timer_ = this.timerObject_.setTimeout(this.boundTick_, this.interval_ - elapsed);
      return;
    }
    if (this.timer_) {
      this.timerObject_.clearTimeout(this.timer_);
      this.timer_ = null;
    }
    this.dispatchTick();
    if (this.enabled) {
      this.timer_ = this.timerObject_.setTimeout(this.boundTick_, this.interval_);
      this.last_ = goog.now();
    }
  }
};
goog.Timer.prototype.dispatchTick = function() {
  this.dispatchEvent(goog.Timer.TICK);
};
goog.Timer.prototype.start = function() {
  this.enabled = true;
  if (!this.timer_) {
    this.timer_ = this.timerObject_.setTimeout(this.boundTick_, this.interval_);
    this.last_ = goog.now();
  }
};
goog.Timer.prototype.stop = function() {
  this.enabled = false;
  if (this.timer_) {
    this.timerObject_.clearTimeout(this.timer_);
    this.timer_ = null;
  }
};
goog.Timer.prototype.disposeInternal = function() {
  goog.Timer.superClass_.disposeInternal.call(this);
  this.stop();
  delete this.timerObject_;
};
goog.Timer.TICK = "tick";
goog.Timer.callOnce = function(listener, opt_delay, opt_handler) {
  if (goog.isFunction(listener)) {
    if (opt_handler) {
      listener = goog.bind(listener, opt_handler);
    }
  } else {
    if (listener && typeof listener.handleEvent == "function") {
      listener = goog.bind(listener.handleEvent, listener);
    } else {
      throw Error("Invalid listener argument");
    }
  }
  if (Number(opt_delay) > goog.Timer.MAX_TIMEOUT_) {
    return goog.Timer.INVALID_TIMEOUT_ID_;
  } else {
    return goog.Timer.defaultTimerObject.setTimeout(listener, opt_delay || 0);
  }
};
goog.Timer.clear = function(timerId) {
  goog.Timer.defaultTimerObject.clearTimeout(timerId);
};
goog.Timer.promise = function(delay, opt_result) {
  var timerKey = null;
  return (new goog.Promise(function(resolve, reject) {
    timerKey = goog.Timer.callOnce(function() {
      resolve(opt_result);
    }, delay);
    if (timerKey == goog.Timer.INVALID_TIMEOUT_ID_) {
      reject(new Error("Failed to schedule timer."));
    }
  })).thenCatch(function(error) {
    goog.Timer.clear(timerKey);
    throw error;
  });
};
goog.provide("goog.Delay");
goog.provide("goog.async.Delay");
goog.require("goog.Disposable");
goog.require("goog.Timer");
goog.async.Delay = function(listener, opt_interval, opt_handler) {
  goog.async.Delay.base(this, "constructor");
  this.listener_ = listener;
  this.interval_ = opt_interval || 0;
  this.handler_ = opt_handler;
  this.callback_ = goog.bind(this.doAction_, this);
};
goog.inherits(goog.async.Delay, goog.Disposable);
goog.Delay = goog.async.Delay;
goog.async.Delay.prototype.id_ = 0;
goog.async.Delay.prototype.disposeInternal = function() {
  goog.async.Delay.base(this, "disposeInternal");
  this.stop();
  delete this.listener_;
  delete this.handler_;
};
goog.async.Delay.prototype.start = function(opt_interval) {
  this.stop();
  this.id_ = goog.Timer.callOnce(this.callback_, goog.isDef(opt_interval) ? opt_interval : this.interval_);
};
goog.async.Delay.prototype.startIfNotActive = function(opt_interval) {
  if (!this.isActive()) {
    this.start(opt_interval);
  }
};
goog.async.Delay.prototype.stop = function() {
  if (this.isActive()) {
    goog.Timer.clear(this.id_);
  }
  this.id_ = 0;
};
goog.async.Delay.prototype.fire = function() {
  this.stop();
  this.doAction_();
};
goog.async.Delay.prototype.fireIfActive = function() {
  if (this.isActive()) {
    this.fire();
  }
};
goog.async.Delay.prototype.isActive = function() {
  return this.id_ != 0;
};
goog.async.Delay.prototype.doAction_ = function() {
  this.id_ = 0;
  if (this.listener_) {
    this.listener_.call(this.handler_);
  }
};
goog.provide("goog.editor.defines");
goog.define("goog.editor.defines.USE_CONTENTEDITABLE_IN_FIREFOX_3", false);
goog.provide("goog.userAgent.product");
goog.require("goog.labs.userAgent.browser");
goog.require("goog.labs.userAgent.platform");
goog.require("goog.userAgent");
goog.define("goog.userAgent.product.ASSUME_FIREFOX", false);
goog.define("goog.userAgent.product.ASSUME_IPHONE", false);
goog.define("goog.userAgent.product.ASSUME_IPAD", false);
goog.define("goog.userAgent.product.ASSUME_ANDROID", false);
goog.define("goog.userAgent.product.ASSUME_CHROME", false);
goog.define("goog.userAgent.product.ASSUME_SAFARI", false);
goog.userAgent.product.PRODUCT_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUME_EDGE || goog.userAgent.ASSUME_OPERA || goog.userAgent.product.ASSUME_FIREFOX || goog.userAgent.product.ASSUME_IPHONE || goog.userAgent.product.ASSUME_IPAD || goog.userAgent.product.ASSUME_ANDROID || goog.userAgent.product.ASSUME_CHROME || goog.userAgent.product.ASSUME_SAFARI;
goog.userAgent.product.OPERA = goog.userAgent.OPERA;
goog.userAgent.product.IE = goog.userAgent.IE;
goog.userAgent.product.EDGE = goog.userAgent.EDGE;
goog.userAgent.product.FIREFOX = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_FIREFOX : goog.labs.userAgent.browser.isFirefox();
goog.userAgent.product.isIphoneOrIpod_ = function() {
  return goog.labs.userAgent.platform.isIphone() || goog.labs.userAgent.platform.isIpod();
};
goog.userAgent.product.IPHONE = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_IPHONE : goog.userAgent.product.isIphoneOrIpod_();
goog.userAgent.product.IPAD = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_IPAD : goog.labs.userAgent.platform.isIpad();
goog.userAgent.product.ANDROID = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_ANDROID : goog.labs.userAgent.browser.isAndroidBrowser();
goog.userAgent.product.CHROME = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_CHROME : goog.labs.userAgent.browser.isChrome();
goog.userAgent.product.isSafariDesktop_ = function() {
  return goog.labs.userAgent.browser.isSafari() && !goog.labs.userAgent.platform.isIos();
};
goog.userAgent.product.SAFARI = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_SAFARI : goog.userAgent.product.isSafariDesktop_();
goog.provide("goog.userAgent.product.isVersion");
goog.require("goog.labs.userAgent.platform");
goog.require("goog.string");
goog.require("goog.userAgent");
goog.require("goog.userAgent.product");
goog.userAgent.product.determineVersion_ = function() {
  if (goog.userAgent.product.FIREFOX) {
    return goog.userAgent.product.getFirstRegExpGroup_(/Firefox\/([0-9.]+)/);
  }
  if (goog.userAgent.product.IE || goog.userAgent.product.EDGE || goog.userAgent.product.OPERA) {
    return goog.userAgent.VERSION;
  }
  if (goog.userAgent.product.CHROME) {
    if (goog.labs.userAgent.platform.isIos()) {
      return goog.userAgent.product.getFirstRegExpGroup_(/CriOS\/([0-9.]+)/);
    }
    return goog.userAgent.product.getFirstRegExpGroup_(/Chrome\/([0-9.]+)/);
  }
  if (goog.userAgent.product.SAFARI && !goog.labs.userAgent.platform.isIos()) {
    return goog.userAgent.product.getFirstRegExpGroup_(/Version\/([0-9.]+)/);
  }
  if (goog.userAgent.product.IPHONE || goog.userAgent.product.IPAD) {
    var arr = goog.userAgent.product.execRegExp_(/Version\/(\S+).*Mobile\/(\S+)/);
    if (arr) {
      return arr[1] + "." + arr[2];
    }
  } else {
    if (goog.userAgent.product.ANDROID) {
      var version = goog.userAgent.product.getFirstRegExpGroup_(/Android\s+([0-9.]+)/);
      if (version) {
        return version;
      }
      return goog.userAgent.product.getFirstRegExpGroup_(/Version\/([0-9.]+)/);
    }
  }
  return "";
};
goog.userAgent.product.getFirstRegExpGroup_ = function(re) {
  var arr = goog.userAgent.product.execRegExp_(re);
  return arr ? arr[1] : "";
};
goog.userAgent.product.execRegExp_ = function(re) {
  return re.exec(goog.userAgent.getUserAgentString());
};
goog.userAgent.product.VERSION = goog.userAgent.product.determineVersion_();
goog.userAgent.product.isVersion = function(version) {
  return goog.string.compareVersions(goog.userAgent.product.VERSION, version) >= 0;
};
goog.provide("goog.editor.BrowserFeature");
goog.require("goog.editor.defines");
goog.require("goog.labs.userAgent.browser");
goog.require("goog.userAgent");
goog.require("goog.userAgent.product");
goog.require("goog.userAgent.product.isVersion");
goog.editor.BrowserFeature = {HAS_IE_RANGES:goog.userAgent.IE && !goog.userAgent.isDocumentModeOrHigher(9), HAS_W3C_RANGES:goog.userAgent.GECKO || goog.userAgent.WEBKIT || goog.userAgent.OPERA || goog.userAgent.EDGE || goog.userAgent.IE && goog.userAgent.isDocumentModeOrHigher(9), HAS_CONTENT_EDITABLE:goog.userAgent.IE || goog.userAgent.WEBKIT || goog.userAgent.OPERA || goog.userAgent.EDGE || goog.editor.defines.USE_CONTENTEDITABLE_IN_FIREFOX_3 && goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("1.9"), 
USE_MUTATION_EVENTS:goog.userAgent.GECKO, HAS_DOM_SUBTREE_MODIFIED_EVENT:goog.userAgent.WEBKIT || goog.editor.defines.USE_CONTENTEDITABLE_IN_FIREFOX_3 && goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("1.9"), HAS_DOCUMENT_INDEPENDENT_NODES:goog.userAgent.GECKO, PUTS_CURSOR_BEFORE_FIRST_BLOCK_ELEMENT_ON_FOCUS:goog.userAgent.GECKO, CLEARS_SELECTION_WHEN_FOCUS_LEAVES:goog.userAgent.IE || goog.userAgent.WEBKIT || goog.userAgent.OPERA, HAS_UNSELECTABLE_STYLE:goog.userAgent.GECKO || goog.userAgent.WEBKIT, 
FORMAT_BLOCK_WORKS_FOR_BLOCKQUOTES:goog.userAgent.GECKO || goog.userAgent.WEBKIT || goog.userAgent.OPERA, CREATES_MULTIPLE_BLOCKQUOTES:goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher("534.16") || goog.userAgent.OPERA, WRAPS_BLOCKQUOTE_IN_DIVS:goog.userAgent.OPERA, PREFERS_READY_STATE_CHANGE_EVENT:goog.userAgent.IE, TAB_FIRES_KEYPRESS:!goog.userAgent.IE, NEEDS_99_WIDTH_IN_STANDARDS_MODE:goog.userAgent.IE, USE_DOCUMENT_FOR_KEY_EVENTS:goog.userAgent.GECKO && !goog.editor.defines.USE_CONTENTEDITABLE_IN_FIREFOX_3, 
SHOWS_CUSTOM_ATTRS_IN_INNER_HTML:goog.userAgent.IE, COLLAPSES_EMPTY_NODES:goog.userAgent.GECKO || goog.userAgent.WEBKIT || goog.userAgent.OPERA, CONVERT_TO_B_AND_I_TAGS:goog.userAgent.GECKO || goog.userAgent.OPERA, TABS_THROUGH_IMAGES:goog.userAgent.IE, UNESCAPES_URLS_WITHOUT_ASKING:goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("7.0"), HAS_STYLE_WITH_CSS:goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("1.8") || goog.userAgent.WEBKIT || goog.userAgent.OPERA, FOLLOWS_EDITABLE_LINKS:goog.userAgent.WEBKIT || 
goog.userAgent.IE && goog.userAgent.isVersionOrHigher("9"), HAS_ACTIVE_ELEMENT:goog.userAgent.IE || goog.userAgent.EDGE || goog.userAgent.OPERA || goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("1.9"), HAS_SET_CAPTURE:goog.userAgent.IE, EATS_EMPTY_BACKGROUND_COLOR:goog.userAgent.GECKO || goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher("527"), SUPPORTS_FOCUSIN:goog.userAgent.IE || goog.userAgent.OPERA, SELECTS_IMAGES_ON_CLICK:goog.userAgent.IE || goog.userAgent.OPERA, MOVES_STYLE_TO_HEAD:goog.userAgent.WEBKIT, 
COLLAPSES_SELECTION_ONMOUSEDOWN:false, CARET_INSIDE_SELECTION:goog.userAgent.OPERA, FOCUSES_EDITABLE_BODY_ON_HTML_CLICK:true, USES_KEYDOWN:goog.userAgent.IE || goog.userAgent.EDGE || goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher("525"), ADDS_NBSPS_IN_REMOVE_FORMAT:goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher("531"), GETS_STUCK_IN_LINKS:goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher("528"), NORMALIZE_CORRUPTS_EMPTY_TEXT_NODES:goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("1.9") || 
goog.userAgent.IE || goog.userAgent.EDGE || goog.userAgent.OPERA || goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher("531"), NORMALIZE_CORRUPTS_ALL_TEXT_NODES:goog.userAgent.IE, NESTS_SUBSCRIPT_SUPERSCRIPT:goog.userAgent.IE || goog.userAgent.EDGE || goog.userAgent.GECKO || goog.userAgent.OPERA, CAN_SELECT_EMPTY_ELEMENT:!goog.userAgent.IE && !goog.userAgent.WEBKIT, FORGETS_FORMATTING_WHEN_LISTIFYING:goog.userAgent.GECKO || goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher("526"), 
LEAVES_P_WHEN_REMOVING_LISTS:goog.userAgent.IE || goog.userAgent.OPERA, CAN_LISTIFY_BR:!goog.userAgent.IE && !goog.userAgent.OPERA, DOESNT_OVERRIDE_FONT_SIZE_IN_STYLE_ATTR:!goog.userAgent.WEBKIT && !goog.userAgent.EDGE, SUPPORTS_HTML5_FILE_DRAGGING:goog.userAgent.product.CHROME && goog.userAgent.product.isVersion("4") || goog.userAgent.product.SAFARI && goog.userAgent.isVersionOrHigher("533") || goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher("2.0") || goog.userAgent.IE && goog.userAgent.isVersionOrHigher("10") || 
goog.userAgent.OPERA && goog.labs.userAgent.browser.isVersionOrHigher("15") || goog.userAgent.EDGE, SUPPORTS_OPERA_DEFAULTBLOCK_COMMAND:goog.userAgent.OPERA && goog.userAgent.isVersionOrHigher("11.10"), SUPPORTS_FILE_PASTING:goog.userAgent.product.CHROME && goog.userAgent.product.isVersion("12")};
goog.provide("goog.editor.Plugin");
goog.require("goog.events.EventTarget");
goog.require("goog.functions");
goog.require("goog.log");
goog.require("goog.object");
goog.require("goog.reflect");
goog.require("goog.userAgent");
goog.editor.Plugin = function() {
  goog.events.EventTarget.call(this);
  this.enabled_ = this.activeOnUneditableFields();
  this.fieldObject = null;
  this.autoDispose_ = true;
  this.logger = goog.log.getLogger("goog.editor.Plugin");
};
goog.inherits(goog.editor.Plugin, goog.events.EventTarget);
goog.editor.Plugin.prototype.getFieldDomHelper = function() {
  return this.getFieldObject() && this.getFieldObject().getEditableDomHelper();
};
goog.editor.Plugin.prototype.getFieldObject = function() {
  return this.fieldObject;
};
goog.editor.Plugin.prototype.setFieldObject = function(fieldObject) {
  this.fieldObject = fieldObject;
};
goog.editor.Plugin.prototype.registerFieldObject = function(fieldObject) {
  this.setFieldObject(fieldObject);
};
goog.editor.Plugin.prototype.unregisterFieldObject = function(fieldObj) {
  if (this.getFieldObject()) {
    this.disable(this.getFieldObject());
    this.setFieldObject(null);
  }
};
goog.editor.Plugin.prototype.enable = function(fieldObject) {
  if (this.getFieldObject() == fieldObject) {
    this.enabled_ = true;
  } else {
    goog.log.error(this.logger, "Trying to enable an unregistered field with " + "this plugin.");
  }
};
goog.editor.Plugin.prototype.disable = function(fieldObject) {
  if (this.getFieldObject() == fieldObject) {
    this.enabled_ = false;
  } else {
    goog.log.error(this.logger, "Trying to disable an unregistered field " + "with this plugin.");
  }
};
goog.editor.Plugin.prototype.isEnabled = function(fieldObject) {
  return this.getFieldObject() == fieldObject ? this.enabled_ : false;
};
goog.editor.Plugin.prototype.setAutoDispose = function(autoDispose) {
  this.autoDispose_ = autoDispose;
};
goog.editor.Plugin.prototype.isAutoDispose = function() {
  return this.autoDispose_;
};
goog.editor.Plugin.prototype.activeOnUneditableFields = goog.functions.FALSE;
goog.editor.Plugin.prototype.isSilentCommand = goog.functions.FALSE;
goog.editor.Plugin.prototype.disposeInternal = function() {
  if (this.getFieldObject()) {
    this.unregisterFieldObject(this.getFieldObject());
  }
  goog.editor.Plugin.superClass_.disposeInternal.call(this);
};
goog.editor.Plugin.prototype.getTrogClassId;
goog.editor.Plugin.Op = {KEYDOWN:1, KEYPRESS:2, KEYUP:3, SELECTION:4, SHORTCUT:5, EXEC_COMMAND:6, QUERY_COMMAND:7, PREPARE_CONTENTS_HTML:8, CLEAN_CONTENTS_HTML:10, CLEAN_CONTENTS_DOM:11};
goog.editor.Plugin.OPCODE = goog.object.transpose(goog.reflect.object(goog.editor.Plugin, {handleKeyDown:goog.editor.Plugin.Op.KEYDOWN, handleKeyPress:goog.editor.Plugin.Op.KEYPRESS, handleKeyUp:goog.editor.Plugin.Op.KEYUP, handleSelectionChange:goog.editor.Plugin.Op.SELECTION, handleKeyboardShortcut:goog.editor.Plugin.Op.SHORTCUT, execCommand:goog.editor.Plugin.Op.EXEC_COMMAND, queryCommandValue:goog.editor.Plugin.Op.QUERY_COMMAND, prepareContentsHtml:goog.editor.Plugin.Op.PREPARE_CONTENTS_HTML, 
cleanContentsHtml:goog.editor.Plugin.Op.CLEAN_CONTENTS_HTML, cleanContentsDom:goog.editor.Plugin.Op.CLEAN_CONTENTS_DOM}));
goog.editor.Plugin.IRREPRESSIBLE_OPS = goog.object.createSet(goog.editor.Plugin.Op.PREPARE_CONTENTS_HTML, goog.editor.Plugin.Op.CLEAN_CONTENTS_HTML, goog.editor.Plugin.Op.CLEAN_CONTENTS_DOM);
goog.editor.Plugin.prototype.handleKeyDown;
goog.editor.Plugin.prototype.handleKeyPress;
goog.editor.Plugin.prototype.handleKeyUp;
goog.editor.Plugin.prototype.handleSelectionChange;
goog.editor.Plugin.prototype.handleKeyboardShortcut;
goog.editor.Plugin.prototype.execCommand = function(command, var_args) {
  var silent = this.isSilentCommand(command);
  if (!silent) {
    if (goog.userAgent.GECKO) {
      this.getFieldObject().stopChangeEvents(true, true);
    }
    this.getFieldObject().dispatchBeforeChange();
  }
  try {
    var result = this.execCommandInternal.apply(this, arguments);
  } finally {
    if (!silent) {
      this.getFieldObject().dispatchChange();
      this.getFieldObject().dispatchSelectionChangeEvent();
    }
  }
  return result;
};
goog.editor.Plugin.prototype.execCommandInternal;
goog.editor.Plugin.prototype.queryCommandValue;
goog.editor.Plugin.prototype.prepareContentsHtml;
goog.editor.Plugin.prototype.cleanContentsDom;
goog.editor.Plugin.prototype.cleanContentsHtml;
goog.editor.Plugin.prototype.isSupportedCommand = function(command) {
  return false;
};
goog.editor.Plugin.prototype.saveScrollPosition = function() {
  if (this.getFieldObject() && goog.userAgent.EDGE) {
    var win = this.getFieldObject().getEditableDomHelper().getWindow();
    return win.scrollTo.bind(win, win.scrollX, win.scrollY);
  }
  return function() {
  };
};
goog.provide("goog.editor.icontent");
goog.provide("goog.editor.icontent.FieldFormatInfo");
goog.provide("goog.editor.icontent.FieldStyleInfo");
goog.require("goog.dom");
goog.require("goog.editor.BrowserFeature");
goog.require("goog.style");
goog.require("goog.userAgent");
goog.editor.icontent.FieldFormatInfo = function(fieldId, standards, blended, fixedHeight, opt_extraStyles) {
  this.fieldId_ = fieldId;
  this.standards_ = standards;
  this.blended_ = blended;
  this.fixedHeight_ = fixedHeight;
  this.extraStyles_ = opt_extraStyles || {};
};
goog.editor.icontent.FieldStyleInfo = function(wrapper, css) {
  this.wrapper_ = wrapper;
  this.css_ = css;
};
goog.editor.icontent.useStandardsModeIframes_ = false;
goog.editor.icontent.forceStandardsModeIframes = function() {
  goog.editor.icontent.useStandardsModeIframes_ = true;
};
goog.editor.icontent.getInitialIframeContent_ = function(info, bodyHtml, style) {
  var html = [];
  if (info.blended_ && info.standards_ || goog.editor.icontent.useStandardsModeIframes_) {
    html.push("<!DOCTYPE HTML>");
  }
  html.push('<html style="background:none transparent;min-width:0;');
  if (info.blended_) {
    html.push("height:", info.fixedHeight_ ? "100%" : "auto");
  }
  html.push('">');
  html.push("<head><style>");
  if (style && style.css_) {
    html.push(style.css_);
  }
  if (goog.userAgent.GECKO && info.standards_) {
    html.push(" img {-moz-force-broken-image-icon: 1;}");
  }
  html.push("</style></head>");
  html.push('<body g_editable="true" hidefocus="true" ');
  if (goog.editor.BrowserFeature.HAS_CONTENT_EDITABLE) {
    html.push("contentEditable ");
  }
  html.push('class="editable ');
  html.push('" id="', info.fieldId_, '" style="min-width:0;');
  if (goog.userAgent.GECKO && info.blended_) {
    html.push(";width:100%;border:0;margin:0;background:none transparent;", ";height:", info.standards_ ? "100%" : "auto");
    if (info.fixedHeight_) {
      html.push(";overflow:auto");
    } else {
      html.push(";overflow-y:hidden;overflow-x:auto");
    }
  }
  if (goog.userAgent.OPERA) {
    html.push(";outline:hidden");
  }
  for (var key in info.extraStyles_) {
    html.push(";" + key + ":" + info.extraStyles_[key]);
  }
  html.push('">', bodyHtml, "</body></html>");
  return html.join("");
};
goog.editor.icontent.writeNormalInitialBlendedIframe = function(info, bodyHtml, style, iframe) {
  if (info.blended_) {
    var field = style.wrapper_;
    var paddingBox = goog.style.getPaddingBox(field);
    if (paddingBox.top || paddingBox.left || paddingBox.right || paddingBox.bottom) {
      goog.style.setStyle(iframe, "margin", -paddingBox.top + "px " + -paddingBox.right + "px " + -paddingBox.bottom + "px " + -paddingBox.left + "px");
    }
  }
  goog.editor.icontent.writeNormalInitialIframe(info, bodyHtml, style, iframe);
};
goog.editor.icontent.writeNormalInitialIframe = function(info, bodyHtml, style, iframe) {
  var html = goog.editor.icontent.getInitialIframeContent_(info, bodyHtml, style);
  var doc = goog.dom.getFrameContentDocument(iframe);
  doc.open();
  doc.write(html);
  doc.close();
};
goog.editor.icontent.writeHttpsInitialIframe = function(info, doc, bodyHtml) {
  var body = doc.body;
  if (goog.editor.BrowserFeature.HAS_CONTENT_EDITABLE) {
    body.contentEditable = true;
  }
  body.className = "editable";
  body.setAttribute("g_editable", true);
  body.hideFocus = true;
  body.id = info.fieldId_;
  goog.style.setStyle(body, info.extraStyles_);
  body.innerHTML = bodyHtml;
};
goog.provide("goog.dom.iter.AncestorIterator");
goog.provide("goog.dom.iter.ChildIterator");
goog.provide("goog.dom.iter.SiblingIterator");
goog.require("goog.iter.Iterator");
goog.require("goog.iter.StopIteration");
goog.dom.iter.SiblingIterator = function(node, opt_includeNode, opt_reverse) {
  this.node_ = node;
  this.reverse_ = !!opt_reverse;
  if (node && !opt_includeNode) {
    this.next();
  }
};
goog.inherits(goog.dom.iter.SiblingIterator, goog.iter.Iterator);
goog.dom.iter.SiblingIterator.prototype.next = function() {
  var node = this.node_;
  if (!node) {
    throw goog.iter.StopIteration;
  }
  this.node_ = this.reverse_ ? node.previousSibling : node.nextSibling;
  return node;
};
goog.dom.iter.ChildIterator = function(element, opt_reverse, opt_startIndex) {
  if (!goog.isDef(opt_startIndex)) {
    opt_startIndex = opt_reverse && element.childNodes.length ? element.childNodes.length - 1 : 0;
  }
  goog.dom.iter.SiblingIterator.call(this, element.childNodes[opt_startIndex], true, opt_reverse);
};
goog.inherits(goog.dom.iter.ChildIterator, goog.dom.iter.SiblingIterator);
goog.dom.iter.AncestorIterator = function(node, opt_includeNode) {
  this.node_ = node;
  if (node && !opt_includeNode) {
    this.next();
  }
};
goog.inherits(goog.dom.iter.AncestorIterator, goog.iter.Iterator);
goog.dom.iter.AncestorIterator.prototype.next = function() {
  var node = this.node_;
  if (!node) {
    throw goog.iter.StopIteration;
  }
  this.node_ = node.parentNode;
  return node;
};
goog.provide("goog.editor.node");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.TagName");
goog.require("goog.dom.iter.ChildIterator");
goog.require("goog.dom.iter.SiblingIterator");
goog.require("goog.iter");
goog.require("goog.object");
goog.require("goog.string");
goog.require("goog.string.Unicode");
goog.require("goog.userAgent");
goog.editor.node.BLOCK_TAG_NAMES_ = goog.object.createSet(goog.dom.TagName.ADDRESS, goog.dom.TagName.ARTICLE, goog.dom.TagName.ASIDE, goog.dom.TagName.BLOCKQUOTE, goog.dom.TagName.BODY, goog.dom.TagName.CAPTION, goog.dom.TagName.CENTER, goog.dom.TagName.COL, goog.dom.TagName.COLGROUP, goog.dom.TagName.DETAILS, goog.dom.TagName.DIR, goog.dom.TagName.DIV, goog.dom.TagName.DL, goog.dom.TagName.DD, goog.dom.TagName.DT, goog.dom.TagName.FIELDSET, goog.dom.TagName.FIGCAPTION, goog.dom.TagName.FIGURE, goog.dom.TagName.FOOTER, 
goog.dom.TagName.FORM, goog.dom.TagName.H1, goog.dom.TagName.H2, goog.dom.TagName.H3, goog.dom.TagName.H4, goog.dom.TagName.H5, goog.dom.TagName.H6, goog.dom.TagName.HEADER, goog.dom.TagName.HGROUP, goog.dom.TagName.HR, goog.dom.TagName.ISINDEX, goog.dom.TagName.OL, goog.dom.TagName.LI, goog.dom.TagName.MAP, goog.dom.TagName.MENU, goog.dom.TagName.NAV, goog.dom.TagName.OPTGROUP, goog.dom.TagName.OPTION, goog.dom.TagName.P, goog.dom.TagName.PRE, goog.dom.TagName.SECTION, goog.dom.TagName.SUMMARY, 
goog.dom.TagName.TABLE, goog.dom.TagName.TBODY, goog.dom.TagName.TD, goog.dom.TagName.TFOOT, goog.dom.TagName.TH, goog.dom.TagName.THEAD, goog.dom.TagName.TR, goog.dom.TagName.UL);
goog.editor.node.NON_EMPTY_TAGS_ = goog.object.createSet(goog.dom.TagName.IMG, goog.dom.TagName.IFRAME, goog.dom.TagName.EMBED);
goog.editor.node.isStandardsMode = function(node) {
  return goog.dom.getDomHelper(node).isCss1CompatMode();
};
goog.editor.node.getRightMostLeaf = function(parent) {
  var temp;
  while (temp = goog.editor.node.getLastChild(parent)) {
    parent = temp;
  }
  return parent;
};
goog.editor.node.getLeftMostLeaf = function(parent) {
  var temp;
  while (temp = goog.editor.node.getFirstChild(parent)) {
    parent = temp;
  }
  return parent;
};
goog.editor.node.getFirstChild = function(parent) {
  return goog.editor.node.getChildHelper_(parent, false);
};
goog.editor.node.getLastChild = function(parent) {
  return goog.editor.node.getChildHelper_(parent, true);
};
goog.editor.node.getPreviousSibling = function(sibling) {
  return goog.editor.node.getFirstValue_(goog.iter.filter(new goog.dom.iter.SiblingIterator(sibling, false, true), goog.editor.node.isImportant));
};
goog.editor.node.getNextSibling = function(sibling) {
  return goog.editor.node.getFirstValue_(goog.iter.filter(new goog.dom.iter.SiblingIterator(sibling), goog.editor.node.isImportant));
};
goog.editor.node.getChildHelper_ = function(parent, isReversed) {
  return !parent || parent.nodeType != goog.dom.NodeType.ELEMENT ? null : goog.editor.node.getFirstValue_(goog.iter.filter(new goog.dom.iter.ChildIterator(parent, isReversed), goog.editor.node.isImportant));
};
goog.editor.node.getFirstValue_ = function(iterator) {
  try {
    return iterator.next();
  } catch (e) {
    return null;
  }
};
goog.editor.node.isImportant = function(node) {
  return node.nodeType == goog.dom.NodeType.ELEMENT || node.nodeType == goog.dom.NodeType.TEXT && !goog.editor.node.isAllNonNbspWhiteSpace(node);
};
goog.editor.node.isAllNonNbspWhiteSpace = function(textNode) {
  return goog.string.isBreakingWhitespace(textNode.nodeValue);
};
goog.editor.node.isEmpty = function(node, opt_prohibitSingleNbsp) {
  var nodeData = goog.dom.getRawTextContent(node);
  if (node.getElementsByTagName) {
    node = node;
    for (var tag in goog.editor.node.NON_EMPTY_TAGS_) {
      if (node.tagName == tag || node.getElementsByTagName(tag).length > 0) {
        return false;
      }
    }
  }
  return !opt_prohibitSingleNbsp && nodeData == goog.string.Unicode.NBSP || goog.string.isBreakingWhitespace(nodeData);
};
goog.editor.node.getLength = function(node) {
  return node.length || node.childNodes.length;
};
goog.editor.node.findInChildren = function(parent, hasProperty) {
  for (var i = 0, len = parent.childNodes.length; i < len; i++) {
    if (hasProperty(parent.childNodes[i])) {
      return i;
    }
  }
  return null;
};
goog.editor.node.findHighestMatchingAncestor = function(node, hasProperty) {
  var parent = node.parentNode;
  var ancestor = null;
  while (parent && hasProperty(parent)) {
    ancestor = parent;
    parent = parent.parentNode;
  }
  return ancestor;
};
goog.editor.node.isBlockTag = function(node) {
  return !!goog.editor.node.BLOCK_TAG_NAMES_[node.tagName];
};
goog.editor.node.skipEmptyTextNodes = function(node) {
  while (node && node.nodeType == goog.dom.NodeType.TEXT && !node.nodeValue) {
    node = node.nextSibling;
  }
  return node;
};
goog.editor.node.isEditableContainer = function(element) {
  return element.getAttribute && element.getAttribute("g_editable") == "true";
};
goog.editor.node.isEditable = function(node) {
  return !!goog.dom.getAncestor(node, goog.editor.node.isEditableContainer);
};
goog.editor.node.findTopMostEditableAncestor = function(node, criteria) {
  var targetNode = null;
  while (node && !goog.editor.node.isEditableContainer(node)) {
    if (criteria(node)) {
      targetNode = node;
    }
    node = node.parentNode;
  }
  return targetNode;
};
goog.editor.node.splitDomTreeAt = function(currentNode, opt_secondHalf, opt_root) {
  var parent;
  while (currentNode != opt_root && (parent = currentNode.parentNode)) {
    opt_secondHalf = goog.editor.node.getSecondHalfOfNode_(parent, currentNode, opt_secondHalf);
    currentNode = parent;
  }
  return opt_secondHalf;
};
goog.editor.node.getSecondHalfOfNode_ = function(node, startNode, firstChild) {
  var secondHalf = node.cloneNode(false);
  while (startNode.nextSibling) {
    goog.dom.appendChild(secondHalf, startNode.nextSibling);
  }
  if (firstChild) {
    secondHalf.insertBefore(firstChild, secondHalf.firstChild);
  }
  return secondHalf;
};
goog.editor.node.transferChildren = function(newNode, oldNode) {
  goog.dom.append(newNode, oldNode.childNodes);
};
goog.editor.node.replaceInnerHtml = function(node, html) {
  if (goog.userAgent.IE) {
    goog.dom.removeChildren(node);
  }
  node.innerHTML = html;
};
goog.provide("goog.events.EventHandler");
goog.require("goog.Disposable");
goog.require("goog.events");
goog.require("goog.object");
goog.forwardDeclare("goog.events.EventWrapper");
goog.events.EventHandler = function(opt_scope) {
  goog.Disposable.call(this);
  this.handler_ = opt_scope;
  this.keys_ = {};
};
goog.inherits(goog.events.EventHandler, goog.Disposable);
goog.events.EventHandler.typeArray_ = [];
goog.events.EventHandler.prototype.listen = function(src, type, opt_fn, opt_capture) {
  var self = this;
  return self.listen_(src, type, opt_fn, opt_capture);
};
goog.events.EventHandler.prototype.listenWithScope = function(src, type, fn, capture, scope) {
  var self = this;
  return self.listen_(src, type, fn, capture, scope);
};
goog.events.EventHandler.prototype.listen_ = function(src, type, opt_fn, opt_capture, opt_scope) {
  var self = this;
  if (!goog.isArray(type)) {
    if (type) {
      goog.events.EventHandler.typeArray_[0] = type.toString();
    }
    type = goog.events.EventHandler.typeArray_;
  }
  for (var i = 0; i < type.length; i++) {
    var listenerObj = goog.events.listen(src, type[i], opt_fn || self.handleEvent, opt_capture || false, opt_scope || self.handler_ || self);
    if (!listenerObj) {
      return self;
    }
    var key = listenerObj.key;
    self.keys_[key] = listenerObj;
  }
  return self;
};
goog.events.EventHandler.prototype.listenOnce = function(src, type, opt_fn, opt_capture) {
  var self = this;
  return self.listenOnce_(src, type, opt_fn, opt_capture);
};
goog.events.EventHandler.prototype.listenOnceWithScope = function(src, type, fn, capture, scope) {
  var self = this;
  return self.listenOnce_(src, type, fn, capture, scope);
};
goog.events.EventHandler.prototype.listenOnce_ = function(src, type, opt_fn, opt_capture, opt_scope) {
  var self = this;
  if (goog.isArray(type)) {
    for (var i = 0; i < type.length; i++) {
      self.listenOnce_(src, type[i], opt_fn, opt_capture, opt_scope);
    }
  } else {
    var listenerObj = goog.events.listenOnce(src, type, opt_fn || self.handleEvent, opt_capture, opt_scope || self.handler_ || self);
    if (!listenerObj) {
      return self;
    }
    var key = listenerObj.key;
    self.keys_[key] = listenerObj;
  }
  return self;
};
goog.events.EventHandler.prototype.listenWithWrapper = function(src, wrapper, listener, opt_capt) {
  var self = this;
  return self.listenWithWrapper_(src, wrapper, listener, opt_capt);
};
goog.events.EventHandler.prototype.listenWithWrapperAndScope = function(src, wrapper, listener, capture, scope) {
  var self = this;
  return self.listenWithWrapper_(src, wrapper, listener, capture, scope);
};
goog.events.EventHandler.prototype.listenWithWrapper_ = function(src, wrapper, listener, opt_capt, opt_scope) {
  var self = this;
  wrapper.listen(src, listener, opt_capt, opt_scope || self.handler_ || self, self);
  return self;
};
goog.events.EventHandler.prototype.getListenerCount = function() {
  var count = 0;
  for (var key in this.keys_) {
    if (Object.prototype.hasOwnProperty.call(this.keys_, key)) {
      count++;
    }
  }
  return count;
};
goog.events.EventHandler.prototype.unlisten = function(src, type, opt_fn, opt_capture, opt_scope) {
  var self = this;
  if (goog.isArray(type)) {
    for (var i = 0; i < type.length; i++) {
      self.unlisten(src, type[i], opt_fn, opt_capture, opt_scope);
    }
  } else {
    var listener = goog.events.getListener(src, type, opt_fn || self.handleEvent, opt_capture, opt_scope || self.handler_ || self);
    if (listener) {
      goog.events.unlistenByKey(listener);
      delete self.keys_[listener.key];
    }
  }
  return self;
};
goog.events.EventHandler.prototype.unlistenWithWrapper = function(src, wrapper, listener, opt_capt, opt_scope) {
  var self = this;
  wrapper.unlisten(src, listener, opt_capt, opt_scope || self.handler_ || self, self);
  return self;
};
goog.events.EventHandler.prototype.removeAll = function() {
  goog.object.forEach(this.keys_, function(listenerObj, key) {
    if (this.keys_.hasOwnProperty(key)) {
      goog.events.unlistenByKey(listenerObj);
    }
  }, this);
  this.keys_ = {};
};
goog.events.EventHandler.prototype.disposeInternal = function() {
  goog.events.EventHandler.superClass_.disposeInternal.call(this);
  this.removeAll();
};
goog.events.EventHandler.prototype.handleEvent = function(e) {
  throw Error("EventHandler.handleEvent not implemented");
};
goog.provide("goog.editor.style");
goog.require("goog.array");
goog.require("goog.asserts");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.TagName");
goog.require("goog.editor.BrowserFeature");
goog.require("goog.events.EventHandler");
goog.require("goog.events.EventType");
goog.require("goog.object");
goog.require("goog.style");
goog.require("goog.userAgent");
goog.editor.style.getComputedOrCascadedStyle_ = function(node, stylePropertyName) {
  if (node.nodeType != goog.dom.NodeType.ELEMENT) {
    return null;
  }
  return goog.userAgent.IE ? goog.style.getCascadedStyle(node, stylePropertyName) : goog.style.getComputedStyle(node, stylePropertyName);
};
goog.editor.style.isDisplayBlock = function(node) {
  return goog.editor.style.getComputedOrCascadedStyle_(node, "display") == "block";
};
goog.editor.style.isContainer = function(element) {
  var nodeName = element && element.nodeName;
  return !!(element && (goog.editor.style.isDisplayBlock(element) || nodeName == goog.dom.TagName.TD || nodeName == goog.dom.TagName.TABLE || nodeName == goog.dom.TagName.LI));
};
goog.editor.style.getContainer = function(node) {
  return goog.dom.getAncestor(node, goog.editor.style.isContainer, true);
};
goog.editor.style.SELECTABLE_INPUT_TYPES_ = goog.object.createSet("text", "file", "url");
goog.editor.style.cancelMouseDownHelper_ = function(e) {
  var targetTagName = e.target.tagName;
  if (targetTagName != goog.dom.TagName.TEXTAREA && targetTagName != goog.dom.TagName.INPUT) {
    e.preventDefault();
  }
};
goog.editor.style.makeUnselectable = function(element, eventHandler) {
  if (goog.editor.BrowserFeature.HAS_UNSELECTABLE_STYLE) {
    eventHandler.listen(element, goog.events.EventType.MOUSEDOWN, goog.editor.style.cancelMouseDownHelper_, true);
  }
  goog.style.setUnselectable(element, true);
  var inputs = goog.dom.getElementsByTagName(goog.dom.TagName.INPUT, goog.asserts.assert(element));
  for (var i = 0, len = inputs.length; i < len; i++) {
    var input = inputs[i];
    if (input.type in goog.editor.style.SELECTABLE_INPUT_TYPES_) {
      goog.editor.style.makeSelectable(input);
    }
  }
  goog.array.forEach(goog.dom.getElementsByTagName(goog.dom.TagName.TEXTAREA, goog.asserts.assert(element)), goog.editor.style.makeSelectable);
};
goog.editor.style.makeSelectable = function(element) {
  goog.style.setUnselectable(element, false);
  if (goog.editor.BrowserFeature.HAS_UNSELECTABLE_STYLE) {
    var child = element;
    var current = element.parentNode;
    while (current && current.tagName != goog.dom.TagName.HTML) {
      if (goog.style.isUnselectable(current)) {
        goog.style.setUnselectable(current, false, true);
        for (var i = 0, len = current.childNodes.length; i < len; i++) {
          var node = current.childNodes[i];
          if (node != child && node.nodeType == goog.dom.NodeType.ELEMENT) {
            goog.style.setUnselectable(current.childNodes[i], true);
          }
        }
      }
      child = current;
      current = current.parentNode;
    }
  }
};
goog.provide("goog.editor.range");
goog.provide("goog.editor.range.Point");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.Range");
goog.require("goog.dom.RangeEndpoint");
goog.require("goog.dom.SavedCaretRange");
goog.require("goog.editor.node");
goog.require("goog.editor.style");
goog.require("goog.iter");
goog.require("goog.userAgent");
goog.editor.range.narrow = function(range, el) {
  var startContainer = range.getStartNode();
  var endContainer = range.getEndNode();
  if (startContainer && endContainer) {
    var isElement = function(node) {
      return node == el;
    };
    var hasStart = goog.dom.getAncestor(startContainer, isElement, true);
    var hasEnd = goog.dom.getAncestor(endContainer, isElement, true);
    if (hasStart && hasEnd) {
      return range.clone();
    } else {
      if (hasStart) {
        var leaf = goog.editor.node.getRightMostLeaf(el);
        return goog.dom.Range.createFromNodes(range.getStartNode(), range.getStartOffset(), leaf, goog.editor.node.getLength(leaf));
      } else {
        if (hasEnd) {
          return goog.dom.Range.createFromNodes(goog.editor.node.getLeftMostLeaf(el), 0, range.getEndNode(), range.getEndOffset());
        }
      }
    }
  }
  return null;
};
goog.editor.range.expand = function(range, opt_stopNode) {
  var expandedRange = goog.editor.range.expandEndPointToContainer_(range, goog.dom.RangeEndpoint.START, opt_stopNode);
  expandedRange = goog.editor.range.expandEndPointToContainer_(expandedRange, goog.dom.RangeEndpoint.END, opt_stopNode);
  var startNode = expandedRange.getStartNode();
  var endNode = expandedRange.getEndNode();
  var startOffset = expandedRange.getStartOffset();
  var endOffset = expandedRange.getEndOffset();
  if (startNode == endNode) {
    while (endNode != opt_stopNode && startOffset == 0 && endOffset == goog.editor.node.getLength(endNode)) {
      var parentNode = endNode.parentNode;
      startOffset = goog.array.indexOf(parentNode.childNodes, endNode);
      endOffset = startOffset + 1;
      endNode = parentNode;
    }
    startNode = endNode;
  }
  return goog.dom.Range.createFromNodes(startNode, startOffset, endNode, endOffset);
};
goog.editor.range.expandEndPointToContainer_ = function(range, endpoint, opt_stopNode) {
  var expandStart = endpoint == goog.dom.RangeEndpoint.START;
  var node = expandStart ? range.getStartNode() : range.getEndNode();
  var offset = expandStart ? range.getStartOffset() : range.getEndOffset();
  var container = range.getContainerElement();
  while (node != container && node != opt_stopNode) {
    if (expandStart && offset != 0 || !expandStart && offset != goog.editor.node.getLength(node)) {
      break;
    }
    var parentNode = node.parentNode;
    var index = goog.array.indexOf(parentNode.childNodes, node);
    offset = expandStart ? index : index + 1;
    node = parentNode;
  }
  return goog.dom.Range.createFromNodes(expandStart ? node : range.getStartNode(), expandStart ? offset : range.getStartOffset(), expandStart ? range.getEndNode() : node, expandStart ? range.getEndOffset() : offset);
};
goog.editor.range.selectNodeStart = function(node) {
  goog.dom.Range.createCaret(goog.editor.node.getLeftMostLeaf(node), 0).select();
};
goog.editor.range.placeCursorNextTo = function(node, toLeft) {
  var parent = node.parentNode;
  var offset = goog.array.indexOf(parent.childNodes, node) + (toLeft ? 0 : 1);
  var point = goog.editor.range.Point.createDeepestPoint(parent, offset, toLeft, true);
  var range = goog.dom.Range.createCaret(point.node, point.offset);
  range.select();
  return range;
};
goog.editor.range.selectionPreservingNormalize = function(node) {
  var doc = goog.dom.getOwnerDocument(node);
  var selection = goog.dom.Range.createFromWindow(goog.dom.getWindow(doc));
  var normalizedRange = goog.editor.range.rangePreservingNormalize(node, selection);
  if (normalizedRange) {
    normalizedRange.select();
  }
};
goog.editor.range.normalizeNodeIe_ = function(node) {
  var lastText = null;
  var child = node.firstChild;
  while (child) {
    var next = child.nextSibling;
    if (child.nodeType == goog.dom.NodeType.TEXT) {
      if (child.nodeValue == "") {
        node.removeChild(child);
      } else {
        if (lastText) {
          lastText.nodeValue += child.nodeValue;
          node.removeChild(child);
        } else {
          lastText = child;
        }
      }
    } else {
      goog.editor.range.normalizeNodeIe_(child);
      lastText = null;
    }
    child = next;
  }
};
goog.editor.range.normalizeNode = function(node) {
  if (goog.userAgent.IE) {
    goog.editor.range.normalizeNodeIe_(node);
  } else {
    node.normalize();
  }
};
goog.editor.range.rangePreservingNormalize = function(node, range) {
  if (range) {
    var rangeFactory = goog.editor.range.normalize(range);
    var container = goog.editor.style.getContainer(range.getContainerElement());
  }
  if (container) {
    goog.editor.range.normalizeNode(goog.dom.findCommonAncestor(container, node));
  } else {
    if (node) {
      goog.editor.range.normalizeNode(node);
    }
  }
  if (rangeFactory) {
    return rangeFactory();
  } else {
    return null;
  }
};
goog.editor.range.getDeepEndPoint = function(range, atStart) {
  return atStart ? goog.editor.range.Point.createDeepestPoint(range.getStartNode(), range.getStartOffset()) : goog.editor.range.Point.createDeepestPoint(range.getEndNode(), range.getEndOffset());
};
goog.editor.range.normalize = function(range) {
  var isReversed = range.isReversed();
  var anchorPoint = goog.editor.range.normalizePoint_(goog.editor.range.getDeepEndPoint(range, !isReversed));
  var anchorParent = anchorPoint.getParentPoint();
  var anchorPreviousSibling = anchorPoint.node.previousSibling;
  if (anchorPoint.node.nodeType == goog.dom.NodeType.TEXT) {
    anchorPoint.node = null;
  }
  var focusPoint = goog.editor.range.normalizePoint_(goog.editor.range.getDeepEndPoint(range, isReversed));
  var focusParent = focusPoint.getParentPoint();
  var focusPreviousSibling = focusPoint.node.previousSibling;
  if (focusPoint.node.nodeType == goog.dom.NodeType.TEXT) {
    focusPoint.node = null;
  }
  return function() {
    if (!anchorPoint.node && anchorPreviousSibling) {
      anchorPoint.node = anchorPreviousSibling.nextSibling;
      if (!anchorPoint.node) {
        anchorPoint = goog.editor.range.Point.getPointAtEndOfNode(anchorPreviousSibling);
      }
    }
    if (!focusPoint.node && focusPreviousSibling) {
      focusPoint.node = focusPreviousSibling.nextSibling;
      if (!focusPoint.node) {
        focusPoint = goog.editor.range.Point.getPointAtEndOfNode(focusPreviousSibling);
      }
    }
    return goog.dom.Range.createFromNodes(anchorPoint.node || anchorParent.node.firstChild || anchorParent.node, anchorPoint.offset, focusPoint.node || focusParent.node.firstChild || focusParent.node, focusPoint.offset);
  };
};
goog.editor.range.normalizePoint_ = function(point) {
  var previous;
  if (point.node.nodeType == goog.dom.NodeType.TEXT) {
    for (var current = point.node.previousSibling; current && current.nodeType == goog.dom.NodeType.TEXT; current = current.previousSibling) {
      point.offset += goog.editor.node.getLength(current);
    }
    previous = current;
  } else {
    previous = point.node.previousSibling;
  }
  var parent = point.node.parentNode;
  point.node = previous ? previous.nextSibling : parent.firstChild;
  return point;
};
goog.editor.range.isEditable = function(range) {
  var rangeContainer = range.getContainerElement();
  var rangeContainerIsOutsideRange = range.getStartNode() != rangeContainer.parentElement;
  return rangeContainerIsOutsideRange && goog.editor.node.isEditableContainer(rangeContainer) || goog.editor.node.isEditable(rangeContainer);
};
goog.editor.range.intersectsTag = function(range, tagName) {
  if (goog.dom.getAncestorByTagNameAndClass(range.getContainerElement(), tagName)) {
    return true;
  }
  return goog.iter.some(range, function(node) {
    return node.tagName == tagName;
  });
};
goog.editor.range.Point = function(node, offset) {
  this.node = node;
  this.offset = offset;
};
goog.editor.range.Point.prototype.getParentPoint = function() {
  var parent = this.node.parentNode;
  return new goog.editor.range.Point(parent, goog.array.indexOf(parent.childNodes, this.node));
};
goog.editor.range.Point.createDeepestPoint = function(node, offset, opt_trendLeft, opt_stopOnChildlessElement) {
  while (node.nodeType == goog.dom.NodeType.ELEMENT) {
    var child = node.childNodes[offset];
    if (!child && !node.lastChild) {
      break;
    } else {
      if (child) {
        var prevSibling = child.previousSibling;
        if (opt_trendLeft && prevSibling) {
          if (opt_stopOnChildlessElement && goog.editor.range.Point.isTerminalElement_(prevSibling)) {
            break;
          }
          node = prevSibling;
          offset = goog.editor.node.getLength(node);
        } else {
          if (opt_stopOnChildlessElement && goog.editor.range.Point.isTerminalElement_(child)) {
            break;
          }
          node = child;
          offset = 0;
        }
      } else {
        if (opt_stopOnChildlessElement && goog.editor.range.Point.isTerminalElement_(node.lastChild)) {
          break;
        }
        node = node.lastChild;
        offset = goog.editor.node.getLength(node);
      }
    }
  }
  return new goog.editor.range.Point(node, offset);
};
goog.editor.range.Point.isTerminalElement_ = function(node) {
  return node.nodeType == goog.dom.NodeType.ELEMENT && !goog.dom.canHaveChildren(node);
};
goog.editor.range.Point.getPointAtEndOfNode = function(node) {
  return new goog.editor.range.Point(node, goog.editor.node.getLength(node));
};
goog.editor.range.saveUsingNormalizedCarets = function(range) {
  return new goog.editor.range.NormalizedCaretRange_(range);
};
goog.editor.range.NormalizedCaretRange_ = function(range) {
  goog.dom.SavedCaretRange.call(this, range);
};
goog.inherits(goog.editor.range.NormalizedCaretRange_, goog.dom.SavedCaretRange);
goog.editor.range.NormalizedCaretRange_.prototype.removeCarets = function(opt_range) {
  var startCaret = this.getCaret(true);
  var endCaret = this.getCaret(false);
  var node = startCaret && endCaret ? goog.dom.findCommonAncestor(startCaret, endCaret) : startCaret || endCaret;
  goog.editor.range.NormalizedCaretRange_.superClass_.removeCarets.call(this);
  if (opt_range) {
    return goog.editor.range.rangePreservingNormalize(node, opt_range);
  } else {
    if (node) {
      goog.editor.range.selectionPreservingNormalize(node);
    }
  }
};
goog.provide("goog.events.KeyCodes");
goog.require("goog.userAgent");
goog.forwardDeclare("goog.events.BrowserEvent");
goog.events.KeyCodes = {WIN_KEY_FF_LINUX:0, MAC_ENTER:3, BACKSPACE:8, TAB:9, NUM_CENTER:12, ENTER:13, SHIFT:16, CTRL:17, ALT:18, PAUSE:19, CAPS_LOCK:20, ESC:27, SPACE:32, PAGE_UP:33, PAGE_DOWN:34, END:35, HOME:36, LEFT:37, UP:38, RIGHT:39, DOWN:40, PLUS_SIGN:43, PRINT_SCREEN:44, INSERT:45, DELETE:46, ZERO:48, ONE:49, TWO:50, THREE:51, FOUR:52, FIVE:53, SIX:54, SEVEN:55, EIGHT:56, NINE:57, FF_SEMICOLON:59, FF_EQUALS:61, FF_DASH:173, QUESTION_MARK:63, AT_SIGN:64, A:65, B:66, C:67, D:68, E:69, F:70, 
G:71, H:72, I:73, J:74, K:75, L:76, M:77, N:78, O:79, P:80, Q:81, R:82, S:83, T:84, U:85, V:86, W:87, X:88, Y:89, Z:90, META:91, WIN_KEY_RIGHT:92, CONTEXT_MENU:93, NUM_ZERO:96, NUM_ONE:97, NUM_TWO:98, NUM_THREE:99, NUM_FOUR:100, NUM_FIVE:101, NUM_SIX:102, NUM_SEVEN:103, NUM_EIGHT:104, NUM_NINE:105, NUM_MULTIPLY:106, NUM_PLUS:107, NUM_MINUS:109, NUM_PERIOD:110, NUM_DIVISION:111, F1:112, F2:113, F3:114, F4:115, F5:116, F6:117, F7:118, F8:119, F9:120, F10:121, F11:122, F12:123, NUMLOCK:144, SCROLL_LOCK:145, 
FIRST_MEDIA_KEY:166, LAST_MEDIA_KEY:183, SEMICOLON:186, DASH:189, EQUALS:187, COMMA:188, PERIOD:190, SLASH:191, APOSTROPHE:192, TILDE:192, SINGLE_QUOTE:222, OPEN_SQUARE_BRACKET:219, BACKSLASH:220, CLOSE_SQUARE_BRACKET:221, WIN_KEY:224, MAC_FF_META:224, MAC_WK_CMD_LEFT:91, MAC_WK_CMD_RIGHT:93, WIN_IME:229, VK_NONAME:252, PHANTOM:255};
goog.events.KeyCodes.isTextModifyingKeyEvent = function(e) {
  if (e.altKey && !e.ctrlKey || e.metaKey || e.keyCode >= goog.events.KeyCodes.F1 && e.keyCode <= goog.events.KeyCodes.F12) {
    return false;
  }
  switch(e.keyCode) {
    case goog.events.KeyCodes.ALT:
    case goog.events.KeyCodes.CAPS_LOCK:
    case goog.events.KeyCodes.CONTEXT_MENU:
    case goog.events.KeyCodes.CTRL:
    case goog.events.KeyCodes.DOWN:
    case goog.events.KeyCodes.END:
    case goog.events.KeyCodes.ESC:
    case goog.events.KeyCodes.HOME:
    case goog.events.KeyCodes.INSERT:
    case goog.events.KeyCodes.LEFT:
    case goog.events.KeyCodes.MAC_FF_META:
    case goog.events.KeyCodes.META:
    case goog.events.KeyCodes.NUMLOCK:
    case goog.events.KeyCodes.NUM_CENTER:
    case goog.events.KeyCodes.PAGE_DOWN:
    case goog.events.KeyCodes.PAGE_UP:
    case goog.events.KeyCodes.PAUSE:
    case goog.events.KeyCodes.PHANTOM:
    case goog.events.KeyCodes.PRINT_SCREEN:
    case goog.events.KeyCodes.RIGHT:
    case goog.events.KeyCodes.SCROLL_LOCK:
    case goog.events.KeyCodes.SHIFT:
    case goog.events.KeyCodes.UP:
    case goog.events.KeyCodes.VK_NONAME:
    case goog.events.KeyCodes.WIN_KEY:
    case goog.events.KeyCodes.WIN_KEY_RIGHT:
      return false;
    case goog.events.KeyCodes.WIN_KEY_FF_LINUX:
      return !goog.userAgent.GECKO;
    default:
      return e.keyCode < goog.events.KeyCodes.FIRST_MEDIA_KEY || e.keyCode > goog.events.KeyCodes.LAST_MEDIA_KEY;
  }
};
goog.events.KeyCodes.firesKeyPressEvent = function(keyCode, opt_heldKeyCode, opt_shiftKey, opt_ctrlKey, opt_altKey, opt_metaKey) {
  if (!goog.userAgent.IE && !goog.userAgent.EDGE && !(goog.userAgent.WEBKIT && goog.userAgent.isVersionOrHigher("525"))) {
    return true;
  }
  if (goog.userAgent.MAC && opt_altKey) {
    return goog.events.KeyCodes.isCharacterKey(keyCode);
  }
  if (opt_altKey && !opt_ctrlKey) {
    return false;
  }
  if (goog.isNumber(opt_heldKeyCode)) {
    opt_heldKeyCode = goog.events.KeyCodes.normalizeKeyCode(opt_heldKeyCode);
  }
  var heldKeyIsModifier = opt_heldKeyCode == goog.events.KeyCodes.CTRL || opt_heldKeyCode == goog.events.KeyCodes.ALT || goog.userAgent.MAC && opt_heldKeyCode == goog.events.KeyCodes.META;
  var modifiedShiftKey = opt_heldKeyCode == goog.events.KeyCodes.SHIFT && (opt_ctrlKey || opt_metaKey);
  if ((!opt_shiftKey || goog.userAgent.MAC) && heldKeyIsModifier || goog.userAgent.MAC && modifiedShiftKey) {
    return false;
  }
  if ((goog.userAgent.WEBKIT || goog.userAgent.EDGE) && opt_ctrlKey && opt_shiftKey) {
    switch(keyCode) {
      case goog.events.KeyCodes.BACKSLASH:
      case goog.events.KeyCodes.OPEN_SQUARE_BRACKET:
      case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET:
      case goog.events.KeyCodes.TILDE:
      case goog.events.KeyCodes.SEMICOLON:
      case goog.events.KeyCodes.DASH:
      case goog.events.KeyCodes.EQUALS:
      case goog.events.KeyCodes.COMMA:
      case goog.events.KeyCodes.PERIOD:
      case goog.events.KeyCodes.SLASH:
      case goog.events.KeyCodes.APOSTROPHE:
      case goog.events.KeyCodes.SINGLE_QUOTE:
        return false;
    }
  }
  if (goog.userAgent.IE && opt_ctrlKey && opt_heldKeyCode == keyCode) {
    return false;
  }
  switch(keyCode) {
    case goog.events.KeyCodes.ENTER:
      return true;
    case goog.events.KeyCodes.ESC:
      return !(goog.userAgent.WEBKIT || goog.userAgent.EDGE);
  }
  return goog.events.KeyCodes.isCharacterKey(keyCode);
};
goog.events.KeyCodes.isCharacterKey = function(keyCode) {
  if (keyCode >= goog.events.KeyCodes.ZERO && keyCode <= goog.events.KeyCodes.NINE) {
    return true;
  }
  if (keyCode >= goog.events.KeyCodes.NUM_ZERO && keyCode <= goog.events.KeyCodes.NUM_MULTIPLY) {
    return true;
  }
  if (keyCode >= goog.events.KeyCodes.A && keyCode <= goog.events.KeyCodes.Z) {
    return true;
  }
  if ((goog.userAgent.WEBKIT || goog.userAgent.EDGE) && keyCode == 0) {
    return true;
  }
  switch(keyCode) {
    case goog.events.KeyCodes.SPACE:
    case goog.events.KeyCodes.PLUS_SIGN:
    case goog.events.KeyCodes.QUESTION_MARK:
    case goog.events.KeyCodes.AT_SIGN:
    case goog.events.KeyCodes.NUM_PLUS:
    case goog.events.KeyCodes.NUM_MINUS:
    case goog.events.KeyCodes.NUM_PERIOD:
    case goog.events.KeyCodes.NUM_DIVISION:
    case goog.events.KeyCodes.SEMICOLON:
    case goog.events.KeyCodes.FF_SEMICOLON:
    case goog.events.KeyCodes.DASH:
    case goog.events.KeyCodes.EQUALS:
    case goog.events.KeyCodes.FF_EQUALS:
    case goog.events.KeyCodes.COMMA:
    case goog.events.KeyCodes.PERIOD:
    case goog.events.KeyCodes.SLASH:
    case goog.events.KeyCodes.APOSTROPHE:
    case goog.events.KeyCodes.SINGLE_QUOTE:
    case goog.events.KeyCodes.OPEN_SQUARE_BRACKET:
    case goog.events.KeyCodes.BACKSLASH:
    case goog.events.KeyCodes.CLOSE_SQUARE_BRACKET:
      return true;
    default:
      return false;
  }
};
goog.events.KeyCodes.normalizeKeyCode = function(keyCode) {
  if (goog.userAgent.GECKO) {
    return goog.events.KeyCodes.normalizeGeckoKeyCode(keyCode);
  } else {
    if (goog.userAgent.MAC && goog.userAgent.WEBKIT) {
      return goog.events.KeyCodes.normalizeMacWebKitKeyCode(keyCode);
    } else {
      return keyCode;
    }
  }
};
goog.events.KeyCodes.normalizeGeckoKeyCode = function(keyCode) {
  switch(keyCode) {
    case goog.events.KeyCodes.FF_EQUALS:
      return goog.events.KeyCodes.EQUALS;
    case goog.events.KeyCodes.FF_SEMICOLON:
      return goog.events.KeyCodes.SEMICOLON;
    case goog.events.KeyCodes.FF_DASH:
      return goog.events.KeyCodes.DASH;
    case goog.events.KeyCodes.MAC_FF_META:
      return goog.events.KeyCodes.META;
    case goog.events.KeyCodes.WIN_KEY_FF_LINUX:
      return goog.events.KeyCodes.WIN_KEY;
    default:
      return keyCode;
  }
};
goog.events.KeyCodes.normalizeMacWebKitKeyCode = function(keyCode) {
  switch(keyCode) {
    case goog.events.KeyCodes.MAC_WK_CMD_RIGHT:
      return goog.events.KeyCodes.META;
    default:
      return keyCode;
  }
};
goog.provide("goog.editor.Field");
goog.provide("goog.editor.Field.EventType");
goog.require("goog.a11y.aria");
goog.require("goog.a11y.aria.Role");
goog.require("goog.array");
goog.require("goog.asserts");
goog.require("goog.async.Delay");
goog.require("goog.dom");
goog.require("goog.dom.Range");
goog.require("goog.dom.TagName");
goog.require("goog.dom.classlist");
goog.require("goog.editor.BrowserFeature");
goog.require("goog.editor.Command");
goog.require("goog.editor.Plugin");
goog.require("goog.editor.icontent");
goog.require("goog.editor.icontent.FieldFormatInfo");
goog.require("goog.editor.icontent.FieldStyleInfo");
goog.require("goog.editor.node");
goog.require("goog.editor.range");
goog.require("goog.events");
goog.require("goog.events.EventHandler");
goog.require("goog.events.EventTarget");
goog.require("goog.events.EventType");
goog.require("goog.events.KeyCodes");
goog.require("goog.functions");
goog.require("goog.html.SafeHtml");
goog.require("goog.html.legacyconversions");
goog.require("goog.log");
goog.require("goog.log.Level");
goog.require("goog.string");
goog.require("goog.string.Unicode");
goog.require("goog.style");
goog.require("goog.userAgent");
goog.require("goog.userAgent.product");
goog.editor.Field = function(id, opt_doc) {
  goog.events.EventTarget.call(this);
  this.id = id;
  this.hashCode_ = id;
  this.editableDomHelper = null;
  this.plugins_ = {};
  this.indexedPlugins_ = {};
  for (var op in goog.editor.Plugin.OPCODE) {
    this.indexedPlugins_[op] = [];
  }
  this.cssStyles = "";
  this.stoppedEvents_ = {};
  this.stopEvent(goog.editor.Field.EventType.CHANGE);
  this.stopEvent(goog.editor.Field.EventType.DELAYEDCHANGE);
  this.isModified_ = false;
  this.isEverModified_ = false;
  this.delayedChangeTimer_ = new goog.async.Delay(this.dispatchDelayedChange_, goog.editor.Field.DELAYED_CHANGE_FREQUENCY, this);
  this.debouncedEvents_ = {};
  for (var key in goog.editor.Field.EventType) {
    this.debouncedEvents_[goog.editor.Field.EventType[key]] = 0;
  }
  if (goog.editor.BrowserFeature.USE_MUTATION_EVENTS) {
    this.changeTimerGecko_ = new goog.async.Delay(this.handleChange, goog.editor.Field.CHANGE_FREQUENCY, this);
  }
  this.eventRegister = new goog.events.EventHandler(this);
  this.wrappers_ = [];
  this.loadState_ = goog.editor.Field.LoadState_.UNEDITABLE;
  var doc = opt_doc || document;
  this.originalDomHelper = goog.dom.getDomHelper(doc);
  this.originalElement = this.originalDomHelper.getElement(this.id);
  this.followLinkInNewWindow_ = goog.editor.BrowserFeature.FOLLOWS_EDITABLE_LINKS;
  this.appWindow_ = this.originalDomHelper.getWindow();
};
goog.inherits(goog.editor.Field, goog.events.EventTarget);
goog.editor.Field.prototype.field = null;
goog.editor.Field.prototype.logger = goog.log.getLogger("goog.editor.Field");
goog.editor.Field.EventType = {COMMAND_VALUE_CHANGE:"cvc", LOAD:"load", UNLOAD:"unload", BEFORECHANGE:"beforechange", CHANGE:"change", DELAYEDCHANGE:"delayedchange", BEFOREFOCUS:"beforefocus", FOCUS:"focus", BLUR:"blur", BEFORETAB:"beforetab", IFRAME_RESIZED:"ifrsz", BEFORESELECTIONCHANGE:"beforeselectionchange", SELECTIONCHANGE:"selectionchange"};
goog.editor.Field.LoadState_ = {UNEDITABLE:0, LOADING:1, EDITABLE:2};
goog.editor.Field.DEBOUNCE_TIME_MS_ = 500;
goog.editor.Field.activeFieldId_ = null;
goog.editor.Field.prototype.inModalMode_ = false;
goog.editor.Field.prototype.appWindow_;
goog.editor.Field.prototype.selectionChangeTarget_;
goog.editor.Field.prototype.useWindowMouseUp_ = false;
goog.editor.Field.prototype.waitingForMouseUp_ = false;
goog.editor.Field.setActiveFieldId = function(fieldId) {
  goog.editor.Field.activeFieldId_ = fieldId;
};
goog.editor.Field.getActiveFieldId = function() {
  return goog.editor.Field.activeFieldId_;
};
goog.editor.Field.prototype.setUseWindowMouseUp = function(flag) {
  goog.asserts.assert(!flag || !this.usesIframe(), "procssing window mouse up should only be enabled when not using iframe");
  this.useWindowMouseUp_ = flag;
};
goog.editor.Field.prototype.inModalMode = function() {
  return this.inModalMode_;
};
goog.editor.Field.prototype.setModalMode = function(inModalMode) {
  this.inModalMode_ = inModalMode;
};
goog.editor.Field.prototype.getHashCode = function() {
  return this.hashCode_;
};
goog.editor.Field.prototype.getElement = function() {
  return this.field;
};
goog.editor.Field.prototype.getOriginalElement = function() {
  return this.originalElement;
};
goog.editor.Field.prototype.addListener = function(type, listener, opt_capture, opt_handler) {
  var elem = this.getElement();
  if (goog.editor.BrowserFeature.USE_DOCUMENT_FOR_KEY_EVENTS && elem && this.usesIframe()) {
    elem = elem.ownerDocument;
  }
  if (opt_handler) {
    this.eventRegister.listenWithScope(elem, type, listener, opt_capture, opt_handler);
  } else {
    this.eventRegister.listen(elem, type, listener, opt_capture);
  }
};
goog.editor.Field.prototype.getPluginByClassId = function(classId) {
  return this.plugins_[classId];
};
goog.editor.Field.prototype.registerPlugin = function(plugin) {
  var classId = plugin.getTrogClassId();
  if (this.plugins_[classId]) {
    goog.log.error(this.logger, "Cannot register the same class of plugin twice.");
  }
  this.plugins_[classId] = plugin;
  for (var op in goog.editor.Plugin.OPCODE) {
    var opcode = goog.editor.Plugin.OPCODE[op];
    if (plugin[opcode]) {
      this.indexedPlugins_[op].push(plugin);
    }
  }
  plugin.registerFieldObject(this);
  if (this.isLoaded()) {
    plugin.enable(this);
  }
};
goog.editor.Field.prototype.unregisterPlugin = function(plugin) {
  var classId = plugin.getTrogClassId();
  if (!this.plugins_[classId]) {
    goog.log.error(this.logger, "Cannot unregister a plugin that isn't registered.");
  }
  delete this.plugins_[classId];
  for (var op in goog.editor.Plugin.OPCODE) {
    var opcode = goog.editor.Plugin.OPCODE[op];
    if (plugin[opcode]) {
      goog.array.remove(this.indexedPlugins_[op], plugin);
    }
  }
  plugin.unregisterFieldObject(this);
};
goog.editor.Field.prototype.setInitialStyle = function(cssText) {
  this.cssText = cssText;
};
goog.editor.Field.prototype.resetOriginalElemProperties = function() {
  var field = this.getOriginalElement();
  field.removeAttribute("contentEditable");
  field.removeAttribute("g_editable");
  field.removeAttribute("role");
  if (!this.id) {
    field.removeAttribute("id");
  } else {
    field.id = this.id;
  }
  field.className = this.savedClassName_ || "";
  var cssText = this.cssText;
  if (!cssText) {
    field.removeAttribute("style");
  } else {
    goog.dom.setProperties(field, {"style":cssText});
  }
  if (goog.isString(this.originalFieldLineHeight_)) {
    goog.style.setStyle(field, "lineHeight", this.originalFieldLineHeight_);
    this.originalFieldLineHeight_ = null;
  }
};
goog.editor.Field.prototype.isModified = function(opt_useIsEverModified) {
  return opt_useIsEverModified ? this.isEverModified_ : this.isModified_;
};
goog.editor.Field.CHANGE_FREQUENCY = 15;
goog.editor.Field.DELAYED_CHANGE_FREQUENCY = 250;
goog.editor.Field.prototype.usesIframe = goog.functions.TRUE;
goog.editor.Field.prototype.isFixedHeight = goog.functions.TRUE;
goog.editor.Field.prototype.shouldRefocusOnInputMobileSafari = goog.functions.FALSE;
goog.editor.Field.KEYS_CAUSING_CHANGES_ = {46:true, 8:true};
if (!goog.userAgent.IE) {
  goog.editor.Field.KEYS_CAUSING_CHANGES_[9] = true;
}
goog.editor.Field.CTRL_KEYS_CAUSING_CHANGES_ = {86:true, 88:true};
if (goog.userAgent.WINDOWS && !goog.userAgent.GECKO) {
  goog.editor.Field.KEYS_CAUSING_CHANGES_[229] = true;
}
goog.editor.Field.isGeneratingKey_ = function(e, testAllKeys) {
  if (goog.editor.Field.isSpecialGeneratingKey_(e)) {
    return true;
  }
  return !!(testAllKeys && !(e.ctrlKey || e.metaKey) && (!goog.userAgent.GECKO || e.charCode));
};
goog.editor.Field.isSpecialGeneratingKey_ = function(e) {
  var testCtrlKeys = (e.ctrlKey || e.metaKey) && e.keyCode in goog.editor.Field.CTRL_KEYS_CAUSING_CHANGES_;
  var testRegularKeys = !(e.ctrlKey || e.metaKey) && e.keyCode in goog.editor.Field.KEYS_CAUSING_CHANGES_;
  return testCtrlKeys || testRegularKeys;
};
goog.editor.Field.prototype.setAppWindow = function(appWindow) {
  this.appWindow_ = appWindow;
};
goog.editor.Field.prototype.getAppWindow = function() {
  return this.appWindow_;
};
goog.editor.Field.prototype.setBaseZindex = function(zindex) {
  this.baseZindex_ = zindex;
};
goog.editor.Field.prototype.getBaseZindex = function() {
  return this.baseZindex_ || 0;
};
goog.editor.Field.prototype.setupFieldObject = function(field) {
  this.loadState_ = goog.editor.Field.LoadState_.EDITABLE;
  this.field = field;
  this.editableDomHelper = goog.dom.getDomHelper(field);
  this.isModified_ = false;
  this.isEverModified_ = false;
  field.setAttribute("g_editable", "true");
  goog.a11y.aria.setRole(field, goog.a11y.aria.Role.TEXTBOX);
};
goog.editor.Field.prototype.tearDownFieldObject_ = function() {
  this.loadState_ = goog.editor.Field.LoadState_.UNEDITABLE;
  for (var classId in this.plugins_) {
    var plugin = this.plugins_[classId];
    if (!plugin.activeOnUneditableFields()) {
      plugin.disable(this);
    }
  }
  this.field = null;
  this.editableDomHelper = null;
};
goog.editor.Field.prototype.setupChangeListeners_ = function() {
  if ((goog.userAgent.product.IPHONE || goog.userAgent.product.IPAD) && this.usesIframe() && this.shouldRefocusOnInputMobileSafari()) {
    var editWindow = this.getEditableDomHelper().getWindow();
    this.boundRefocusListenerMobileSafari_ = goog.bind(editWindow.focus, editWindow);
    editWindow.addEventListener(goog.events.EventType.KEYDOWN, this.boundRefocusListenerMobileSafari_, false);
    editWindow.addEventListener(goog.events.EventType.TOUCHEND, this.boundRefocusListenerMobileSafari_, false);
  }
  if (goog.userAgent.OPERA && this.usesIframe()) {
    this.boundFocusListenerOpera_ = goog.bind(this.dispatchFocusAndBeforeFocus_, this);
    this.boundBlurListenerOpera_ = goog.bind(this.dispatchBlur, this);
    var editWindow = this.getEditableDomHelper().getWindow();
    editWindow.addEventListener(goog.events.EventType.FOCUS, this.boundFocusListenerOpera_, false);
    editWindow.addEventListener(goog.events.EventType.BLUR, this.boundBlurListenerOpera_, false);
  } else {
    if (goog.editor.BrowserFeature.SUPPORTS_FOCUSIN) {
      this.addListener(goog.events.EventType.FOCUS, this.dispatchFocus_);
      this.addListener(goog.events.EventType.FOCUSIN, this.dispatchBeforeFocus_);
    } else {
      this.addListener(goog.events.EventType.FOCUS, this.dispatchFocusAndBeforeFocus_);
    }
    this.addListener(goog.events.EventType.BLUR, this.dispatchBlur, goog.editor.BrowserFeature.USE_MUTATION_EVENTS);
  }
  if (goog.editor.BrowserFeature.USE_MUTATION_EVENTS) {
    this.setupMutationEventHandlersGecko();
  } else {
    this.addListener(["beforecut", "beforepaste", "drop", "dragend"], this.dispatchBeforeChange);
    this.addListener(["cut", "paste"], goog.functions.lock(this.dispatchChange));
    this.addListener("drop", this.handleDrop_);
  }
  var dropEventName = goog.userAgent.WEBKIT ? "dragend" : "dragdrop";
  this.addListener(dropEventName, this.handleDrop_);
  this.addListener(goog.events.EventType.KEYDOWN, this.handleKeyDown_);
  this.addListener(goog.events.EventType.KEYPRESS, this.handleKeyPress_);
  this.addListener(goog.events.EventType.KEYUP, this.handleKeyUp_);
  this.selectionChangeTimer_ = new goog.async.Delay(this.handleSelectionChangeTimer_, goog.editor.Field.SELECTION_CHANGE_FREQUENCY_, this);
  if (this.followLinkInNewWindow_) {
    this.addListener(goog.events.EventType.CLICK, goog.editor.Field.cancelLinkClick_);
  }
  this.addListener(goog.events.EventType.MOUSEDOWN, this.handleMouseDown_);
  if (this.useWindowMouseUp_) {
    this.eventRegister.listen(this.editableDomHelper.getDocument(), goog.events.EventType.MOUSEUP, this.handleMouseUp_);
    this.addListener(goog.events.EventType.DRAGSTART, this.handleDragStart_);
  } else {
    this.addListener(goog.events.EventType.MOUSEUP, this.handleMouseUp_);
  }
};
goog.editor.Field.SELECTION_CHANGE_FREQUENCY_ = 250;
goog.editor.Field.prototype.clearListeners = function() {
  if (this.eventRegister) {
    this.eventRegister.removeAll();
  }
  if ((goog.userAgent.product.IPHONE || goog.userAgent.product.IPAD) && this.usesIframe() && this.shouldRefocusOnInputMobileSafari()) {
    try {
      var editWindow = this.getEditableDomHelper().getWindow();
      editWindow.removeEventListener(goog.events.EventType.KEYDOWN, this.boundRefocusListenerMobileSafari_, false);
      editWindow.removeEventListener(goog.events.EventType.TOUCHEND, this.boundRefocusListenerMobileSafari_, false);
    } catch (e) {
    }
    delete this.boundRefocusListenerMobileSafari_;
  }
  if (goog.userAgent.OPERA && this.usesIframe()) {
    try {
      var editWindow = this.getEditableDomHelper().getWindow();
      editWindow.removeEventListener(goog.events.EventType.FOCUS, this.boundFocusListenerOpera_, false);
      editWindow.removeEventListener(goog.events.EventType.BLUR, this.boundBlurListenerOpera_, false);
    } catch (e$3) {
    }
    delete this.boundFocusListenerOpera_;
    delete this.boundBlurListenerOpera_;
  }
  if (this.changeTimerGecko_) {
    this.changeTimerGecko_.stop();
  }
  this.delayedChangeTimer_.stop();
};
goog.editor.Field.prototype.disposeInternal = function() {
  if (this.isLoading() || this.isLoaded()) {
    goog.log.warning(this.logger, "Disposing a field that is in use.");
  }
  if (this.getOriginalElement()) {
    this.execCommand(goog.editor.Command.CLEAR_LOREM);
  }
  this.tearDownFieldObject_();
  this.clearListeners();
  this.clearFieldLoadListener_();
  this.originalDomHelper = null;
  if (this.eventRegister) {
    this.eventRegister.dispose();
    this.eventRegister = null;
  }
  this.removeAllWrappers();
  if (goog.editor.Field.getActiveFieldId() == this.id) {
    goog.editor.Field.setActiveFieldId(null);
  }
  for (var classId in this.plugins_) {
    var plugin = this.plugins_[classId];
    if (plugin.isAutoDispose()) {
      plugin.dispose();
    }
  }
  delete this.plugins_;
  goog.editor.Field.superClass_.disposeInternal.call(this);
};
goog.editor.Field.prototype.attachWrapper = function(wrapper) {
  this.wrappers_.push(wrapper);
};
goog.editor.Field.prototype.removeAllWrappers = function() {
  var wrapper;
  while (wrapper = this.wrappers_.pop()) {
    wrapper.dispose();
  }
};
goog.editor.Field.prototype.setFollowLinkInNewWindow = function(followLinkInNewWindow) {
  this.followLinkInNewWindow_ = followLinkInNewWindow;
};
goog.editor.Field.MUTATION_EVENTS_GECKO = ["DOMNodeInserted", "DOMNodeRemoved", "DOMNodeRemovedFromDocument", "DOMNodeInsertedIntoDocument", "DOMCharacterDataModified"];
goog.editor.Field.prototype.setupMutationEventHandlersGecko = function() {
  if (goog.editor.BrowserFeature.HAS_DOM_SUBTREE_MODIFIED_EVENT || !this.usesIframe()) {
    this.eventRegister.listen(this.getElement(), "DOMSubtreeModified", this.handleMutationEventGecko_);
  } else {
    var doc = this.getEditableDomHelper().getDocument();
    this.eventRegister.listen(doc, goog.editor.Field.MUTATION_EVENTS_GECKO, this.handleMutationEventGecko_, true);
    this.eventRegister.listen(doc, "DOMAttrModified", goog.bind(this.handleDomAttrChange, this, this.handleMutationEventGecko_), true);
  }
};
goog.editor.Field.prototype.handleBeforeChangeKeyEvent_ = function(e) {
  var block = e.keyCode == goog.events.KeyCodes.TAB && !this.dispatchBeforeTab_(e) || goog.userAgent.GECKO && e.metaKey && !goog.userAgent.isVersionOrHigher(29) && (e.keyCode == goog.events.KeyCodes.LEFT || e.keyCode == goog.events.KeyCodes.RIGHT);
  if (block) {
    e.preventDefault();
    return false;
  } else {
    this.gotGeneratingKey_ = e.charCode || goog.editor.Field.isGeneratingKey_(e, goog.userAgent.GECKO);
    if (this.gotGeneratingKey_) {
      this.dispatchBeforeChange();
    }
  }
  return true;
};
goog.editor.Field.SELECTION_CHANGE_KEYCODES = {8:1, 9:1, 13:1, 33:1, 34:1, 35:1, 36:1, 37:1, 38:1, 39:1, 40:1, 46:1};
goog.editor.Field.CTRL_KEYS_CAUSING_SELECTION_CHANGES_ = {65:true, 86:true, 88:true};
goog.editor.Field.POTENTIAL_SHORTCUT_KEYCODES_ = {8:1, 9:1, 13:1, 27:1, 33:1, 34:1, 37:1, 38:1, 39:1, 40:1};
goog.editor.Field.prototype.invokeShortCircuitingOp_ = function(op, var_args) {
  var plugins = this.indexedPlugins_[op];
  var argList = goog.array.slice(arguments, 1);
  for (var i = 0; i < plugins.length; ++i) {
    var plugin = plugins[i];
    if ((plugin.isEnabled(this) || goog.editor.Plugin.IRREPRESSIBLE_OPS[op]) && plugin[goog.editor.Plugin.OPCODE[op]].apply(plugin, argList)) {
      return true;
    }
  }
  return false;
};
goog.editor.Field.prototype.invokeOp_ = function(op, var_args) {
  var plugins = this.indexedPlugins_[op];
  var argList = goog.array.slice(arguments, 1);
  for (var i = 0; i < plugins.length; ++i) {
    var plugin = plugins[i];
    if (plugin.isEnabled(this) || goog.editor.Plugin.IRREPRESSIBLE_OPS[op]) {
      plugin[goog.editor.Plugin.OPCODE[op]].apply(plugin, argList);
    }
  }
};
goog.editor.Field.prototype.reduceOp_ = function(op, arg, var_args) {
  var plugins = this.indexedPlugins_[op];
  var argList = goog.array.slice(arguments, 1);
  for (var i = 0; i < plugins.length; ++i) {
    var plugin = plugins[i];
    if (plugin.isEnabled(this) || goog.editor.Plugin.IRREPRESSIBLE_OPS[op]) {
      argList[0] = plugin[goog.editor.Plugin.OPCODE[op]].apply(plugin, argList);
    }
  }
  return argList[0];
};
goog.editor.Field.prototype.injectContents = function(contents, field) {
  var styles = {};
  var newHtml = this.getInjectableContents(contents, styles);
  goog.style.setStyle(field, styles);
  goog.editor.node.replaceInnerHtml(field, newHtml);
};
goog.editor.Field.prototype.getInjectableContents = function(contents, styles) {
  return this.reduceOp_(goog.editor.Plugin.Op.PREPARE_CONTENTS_HTML, contents || "", styles);
};
goog.editor.Field.prototype.handleKeyDown_ = function(e) {
  if (goog.userAgent.MAC && e.keyCode == goog.events.KeyCodes.A) {
    this.maybeStartSelectionChangeTimer_(e);
  }
  if (!goog.editor.BrowserFeature.USE_MUTATION_EVENTS) {
    if (!this.handleBeforeChangeKeyEvent_(e)) {
      return;
    }
  }
  if (!this.invokeShortCircuitingOp_(goog.editor.Plugin.Op.KEYDOWN, e) && goog.editor.BrowserFeature.USES_KEYDOWN) {
    this.handleKeyboardShortcut_(e);
  }
};
goog.editor.Field.prototype.handleKeyPress_ = function(e) {
  if (goog.editor.BrowserFeature.USE_MUTATION_EVENTS) {
    if (!this.handleBeforeChangeKeyEvent_(e)) {
      return;
    }
  } else {
    this.gotGeneratingKey_ = true;
    this.dispatchBeforeChange();
  }
  if (!this.invokeShortCircuitingOp_(goog.editor.Plugin.Op.KEYPRESS, e) && !goog.editor.BrowserFeature.USES_KEYDOWN) {
    this.handleKeyboardShortcut_(e);
  }
};
goog.editor.Field.prototype.handleKeyUp_ = function(e) {
  if (!goog.editor.BrowserFeature.USE_MUTATION_EVENTS && (this.gotGeneratingKey_ || goog.editor.Field.isSpecialGeneratingKey_(e))) {
    this.handleChange();
  }
  this.invokeShortCircuitingOp_(goog.editor.Plugin.Op.KEYUP, e);
  this.maybeStartSelectionChangeTimer_(e);
};
goog.editor.Field.prototype.maybeStartSelectionChangeTimer_ = function(e) {
  if (this.isEventStopped(goog.editor.Field.EventType.SELECTIONCHANGE)) {
    return;
  }
  if (goog.editor.Field.SELECTION_CHANGE_KEYCODES[e.keyCode] || (e.ctrlKey || e.metaKey) && goog.editor.Field.CTRL_KEYS_CAUSING_SELECTION_CHANGES_[e.keyCode]) {
    this.dispatchEvent(goog.editor.Field.EventType.BEFORESELECTIONCHANGE);
    this.selectionChangeTimer_.start();
  }
};
goog.editor.Field.prototype.handleKeyboardShortcut_ = function(e) {
  if (e.altKey) {
    return;
  }
  var isModifierPressed = goog.userAgent.MAC ? e.metaKey : e.ctrlKey;
  if (isModifierPressed || goog.editor.Field.POTENTIAL_SHORTCUT_KEYCODES_[e.keyCode]) {
    var key = e.charCode || e.keyCode;
    if (key == 17) {
      return;
    }
    var stringKey = String.fromCharCode(key).toLowerCase();
    if (goog.userAgent.MAC && goog.userAgent.GECKO && stringKey == "`" && e.getBrowserEvent().key == " ") {
      stringKey = " ";
    }
    if (e.keyCode == goog.events.KeyCodes.BACKSLASH) {
      stringKey = "\\";
    }
    if (this.invokeShortCircuitingOp_(goog.editor.Plugin.Op.SHORTCUT, e, stringKey, isModifierPressed)) {
      e.preventDefault();
    }
  }
};
goog.editor.Field.prototype.execCommand = function(command, var_args) {
  var args = arguments;
  var result;
  var plugins = this.indexedPlugins_[goog.editor.Plugin.Op.EXEC_COMMAND];
  for (var i = 0; i < plugins.length; ++i) {
    var plugin = plugins[i];
    if (plugin.isEnabled(this) && plugin.isSupportedCommand(command)) {
      result = plugin.execCommand.apply(plugin, args);
      break;
    }
  }
  return result;
};
goog.editor.Field.prototype.queryCommandValue = function(commands) {
  var isEditable = this.isLoaded() && this.isSelectionEditable();
  if (goog.isString(commands)) {
    return this.queryCommandValueInternal_(commands, isEditable);
  } else {
    var state = {};
    for (var i = 0; i < commands.length; i++) {
      state[commands[i]] = this.queryCommandValueInternal_(commands[i], isEditable);
    }
    return state;
  }
};
goog.editor.Field.prototype.queryCommandValueInternal_ = function(command, isEditable) {
  var plugins = this.indexedPlugins_[goog.editor.Plugin.Op.QUERY_COMMAND];
  for (var i = 0; i < plugins.length; ++i) {
    var plugin = plugins[i];
    if (plugin.isEnabled(this) && plugin.isSupportedCommand(command) && (isEditable || plugin.activeOnUneditableFields())) {
      return plugin.queryCommandValue(command);
    }
  }
  return isEditable ? null : false;
};
goog.editor.Field.prototype.handleDomAttrChange = function(handler, browserEvent) {
  if (this.isEventStopped(goog.editor.Field.EventType.CHANGE)) {
    return;
  }
  var e = browserEvent.getBrowserEvent();
  try {
    if (e.originalTarget.prefix || e.originalTarget.nodeName == "scrollbar") {
      return;
    }
  } catch (ex1) {
    return;
  }
  if (e.prevValue == e.newValue) {
    return;
  }
  handler.call(this, e);
};
goog.editor.Field.prototype.handleMutationEventGecko_ = function(e) {
  if (this.isEventStopped(goog.editor.Field.EventType.CHANGE)) {
    return;
  }
  e = e.getBrowserEvent ? e.getBrowserEvent() : e;
  if (e.target.firebugIgnore) {
    return;
  }
  this.isModified_ = true;
  this.isEverModified_ = true;
  this.changeTimerGecko_.start();
};
goog.editor.Field.prototype.handleDrop_ = function(e) {
  if (goog.userAgent.IE) {
    this.execCommand(goog.editor.Command.CLEAR_LOREM, true);
  }
  if (goog.editor.BrowserFeature.USE_MUTATION_EVENTS) {
    this.dispatchFocusAndBeforeFocus_();
  }
  this.dispatchChange();
};
goog.editor.Field.prototype.getEditableIframe = function() {
  var dh;
  if (this.usesIframe() && (dh = this.getEditableDomHelper())) {
    var win = dh.getWindow();
    return win && win.frameElement;
  }
  return null;
};
goog.editor.Field.prototype.getEditableDomHelper = function() {
  return this.editableDomHelper;
};
goog.editor.Field.prototype.getRange = function() {
  var win = this.editableDomHelper && this.editableDomHelper.getWindow();
  return win && goog.dom.Range.createFromWindow(win);
};
goog.editor.Field.prototype.dispatchSelectionChangeEvent = function(opt_e, opt_target) {
  if (this.isEventStopped(goog.editor.Field.EventType.SELECTIONCHANGE)) {
    return;
  }
  var range = this.getRange();
  var rangeContainer = range && range.getContainerElement();
  this.isSelectionEditable_ = !!rangeContainer && goog.dom.contains(this.getElement(), rangeContainer);
  this.dispatchCommandValueChange();
  this.dispatchEvent({type:goog.editor.Field.EventType.SELECTIONCHANGE, originalType:opt_e && opt_e.type});
  this.invokeShortCircuitingOp_(goog.editor.Plugin.Op.SELECTION, opt_e, opt_target);
};
goog.editor.Field.prototype.handleSelectionChangeTimer_ = function() {
  var t = this.selectionChangeTarget_;
  this.selectionChangeTarget_ = null;
  this.dispatchSelectionChangeEvent(undefined, t);
};
goog.editor.Field.prototype.dispatchBeforeChange = function() {
  if (this.isEventStopped(goog.editor.Field.EventType.BEFORECHANGE)) {
    return;
  }
  this.dispatchEvent(goog.editor.Field.EventType.BEFORECHANGE);
};
goog.editor.Field.prototype.dispatchBeforeTab_ = function(e) {
  return this.dispatchEvent({type:goog.editor.Field.EventType.BEFORETAB, shiftKey:e.shiftKey, altKey:e.altKey, ctrlKey:e.ctrlKey});
};
goog.editor.Field.prototype.stopChangeEvents = function(opt_stopChange, opt_stopDelayedChange) {
  if (opt_stopChange) {
    if (this.changeTimerGecko_) {
      this.changeTimerGecko_.fireIfActive();
    }
    this.stopEvent(goog.editor.Field.EventType.CHANGE);
  }
  if (opt_stopDelayedChange) {
    this.clearDelayedChange();
    this.stopEvent(goog.editor.Field.EventType.DELAYEDCHANGE);
  }
};
goog.editor.Field.prototype.startChangeEvents = function(opt_fireChange, opt_fireDelayedChange) {
  if (!opt_fireChange && this.changeTimerGecko_) {
    this.changeTimerGecko_.fireIfActive();
  }
  this.startEvent(goog.editor.Field.EventType.CHANGE);
  this.startEvent(goog.editor.Field.EventType.DELAYEDCHANGE);
  if (opt_fireChange) {
    this.handleChange();
  }
  if (opt_fireDelayedChange) {
    this.dispatchDelayedChange_();
  }
};
goog.editor.Field.prototype.stopEvent = function(eventType) {
  this.stoppedEvents_[eventType] = 1;
};
goog.editor.Field.prototype.startEvent = function(eventType) {
  this.stoppedEvents_[eventType] = 0;
};
goog.editor.Field.prototype.debounceEvent = function(eventType) {
  this.debouncedEvents_[eventType] = goog.now();
};
goog.editor.Field.prototype.isEventStopped = function(eventType) {
  return !!this.stoppedEvents_[eventType] || this.debouncedEvents_[eventType] && goog.now() - this.debouncedEvents_[eventType] <= goog.editor.Field.DEBOUNCE_TIME_MS_;
};
goog.editor.Field.prototype.manipulateDom = function(func, opt_preventDelayedChange, opt_handler) {
  this.stopChangeEvents(true, true);
  try {
    func.call(opt_handler);
  } finally {
    if (this.isLoaded()) {
      if (opt_preventDelayedChange) {
        this.startEvent(goog.editor.Field.EventType.CHANGE);
        this.handleChange();
        this.startEvent(goog.editor.Field.EventType.DELAYEDCHANGE);
      } else {
        this.dispatchChange();
      }
    }
  }
};
goog.editor.Field.prototype.dispatchCommandValueChange = function(opt_commands) {
  if (opt_commands) {
    this.dispatchEvent({type:goog.editor.Field.EventType.COMMAND_VALUE_CHANGE, commands:opt_commands});
  } else {
    this.dispatchEvent(goog.editor.Field.EventType.COMMAND_VALUE_CHANGE);
  }
};
goog.editor.Field.prototype.dispatchChange = function(opt_noDelay) {
  this.startChangeEvents(true, opt_noDelay);
};
goog.editor.Field.prototype.handleChange = function() {
  if (this.isEventStopped(goog.editor.Field.EventType.CHANGE)) {
    return;
  }
  if (this.changeTimerGecko_) {
    this.changeTimerGecko_.stop();
  }
  this.isModified_ = true;
  this.isEverModified_ = true;
  if (this.isEventStopped(goog.editor.Field.EventType.DELAYEDCHANGE)) {
    return;
  }
  this.delayedChangeTimer_.start();
};
goog.editor.Field.prototype.dispatchDelayedChange_ = function() {
  if (this.isEventStopped(goog.editor.Field.EventType.DELAYEDCHANGE)) {
    return;
  }
  this.delayedChangeTimer_.stop();
  this.isModified_ = false;
  this.dispatchEvent(goog.editor.Field.EventType.DELAYEDCHANGE);
};
goog.editor.Field.prototype.clearDelayedChange = function() {
  if (this.changeTimerGecko_) {
    this.changeTimerGecko_.fireIfActive();
  }
  this.delayedChangeTimer_.fireIfActive();
};
goog.editor.Field.prototype.dispatchFocusAndBeforeFocus_ = function() {
  this.dispatchBeforeFocus_();
  this.dispatchFocus_();
};
goog.editor.Field.prototype.dispatchBeforeFocus_ = function() {
  if (this.isEventStopped(goog.editor.Field.EventType.BEFOREFOCUS)) {
    return;
  }
  this.execCommand(goog.editor.Command.CLEAR_LOREM, true);
  this.dispatchEvent(goog.editor.Field.EventType.BEFOREFOCUS);
};
goog.editor.Field.prototype.dispatchFocus_ = function() {
  if (this.isEventStopped(goog.editor.Field.EventType.FOCUS)) {
    return;
  }
  goog.editor.Field.setActiveFieldId(this.id);
  this.isSelectionEditable_ = true;
  this.dispatchEvent(goog.editor.Field.EventType.FOCUS);
  if (goog.editor.BrowserFeature.PUTS_CURSOR_BEFORE_FIRST_BLOCK_ELEMENT_ON_FOCUS) {
    var field = this.getElement();
    var range = this.getRange();
    if (range) {
      var focusNode = range.getFocusNode();
      if (range.getFocusOffset() == 0 && (!focusNode || focusNode == field || focusNode.tagName == goog.dom.TagName.BODY)) {
        goog.editor.range.selectNodeStart(field);
      }
    }
  }
  if (!goog.editor.BrowserFeature.CLEARS_SELECTION_WHEN_FOCUS_LEAVES && this.usesIframe()) {
    var parent = this.getEditableDomHelper().getWindow().parent;
    parent.getSelection().removeAllRanges();
  }
};
goog.editor.Field.prototype.dispatchBlur = function() {
  if (this.isEventStopped(goog.editor.Field.EventType.BLUR)) {
    return;
  }
  if (goog.editor.Field.getActiveFieldId() == this.id) {
    goog.editor.Field.setActiveFieldId(null);
  }
  this.isSelectionEditable_ = false;
  this.dispatchEvent(goog.editor.Field.EventType.BLUR);
};
goog.editor.Field.prototype.isSelectionEditable = function() {
  return this.isSelectionEditable_;
};
goog.editor.Field.cancelLinkClick_ = function(e) {
  if (goog.dom.getAncestorByTagNameAndClass(e.target, goog.dom.TagName.A)) {
    e.preventDefault();
  }
};
goog.editor.Field.prototype.handleMouseDown_ = function(e) {
  goog.editor.Field.setActiveFieldId(this.id);
  if (goog.userAgent.IE) {
    var targetElement = e.target;
    if (targetElement && targetElement.tagName == goog.dom.TagName.A && e.ctrlKey) {
      this.originalDomHelper.getWindow().open(targetElement.href);
    }
  }
  this.waitingForMouseUp_ = true;
};
goog.editor.Field.prototype.handleDragStart_ = function(e) {
  this.waitingForMouseUp_ = false;
};
goog.editor.Field.prototype.handleMouseUp_ = function(e) {
  if (this.useWindowMouseUp_ && !this.waitingForMouseUp_) {
    return;
  }
  this.waitingForMouseUp_ = false;
  this.dispatchEvent(goog.editor.Field.EventType.BEFORESELECTIONCHANGE);
  this.dispatchSelectionChangeEvent(e);
  if (goog.userAgent.IE) {
    this.selectionChangeTarget_ = e.target;
    this.selectionChangeTimer_.start();
  }
};
goog.editor.Field.prototype.getCleanContents = function() {
  if (this.queryCommandValue(goog.editor.Command.USING_LOREM)) {
    return goog.string.Unicode.NBSP;
  }
  if (!this.isLoaded()) {
    var elem = this.getOriginalElement();
    if (!elem) {
      goog.log.log(this.logger, goog.log.Level.SHOUT, "Couldn't get the field element to read the contents");
    }
    return elem.innerHTML;
  }
  var fieldCopy = this.getFieldCopy();
  this.invokeOp_(goog.editor.Plugin.Op.CLEAN_CONTENTS_DOM, fieldCopy);
  return this.reduceOp_(goog.editor.Plugin.Op.CLEAN_CONTENTS_HTML, fieldCopy.innerHTML);
};
goog.editor.Field.prototype.getFieldCopy = function() {
  var field = this.getElement();
  var fieldCopy = field.cloneNode(false);
  var html = field.innerHTML;
  if (goog.userAgent.IE && html.match(/^\s*<script/i)) {
    html = goog.string.Unicode.NBSP + html;
  }
  fieldCopy.innerHTML = html;
  return fieldCopy;
};
goog.editor.Field.prototype.setHtml = function(addParas, html, opt_dontFireDelayedChange, opt_applyLorem) {
  var safeHtml = html ? goog.html.legacyconversions.safeHtmlFromString(html) : null;
  this.setSafeHtml(addParas, safeHtml, opt_dontFireDelayedChange, opt_applyLorem);
};
goog.editor.Field.prototype.setSafeHtml = function(addParas, html, opt_dontFireDelayedChange, opt_applyLorem) {
  if (this.isLoading()) {
    goog.log.error(this.logger, "Can't set html while loading Trogedit");
    return;
  }
  if (opt_applyLorem) {
    this.execCommand(goog.editor.Command.CLEAR_LOREM);
  }
  if (html && addParas) {
    html = goog.html.SafeHtml.create("p", {}, html);
  }
  if (opt_dontFireDelayedChange) {
    this.stopChangeEvents(false, true);
  }
  this.setInnerHtml_(html);
  if (opt_applyLorem) {
    this.execCommand(goog.editor.Command.UPDATE_LOREM);
  }
  if (this.isLoaded()) {
    if (opt_dontFireDelayedChange) {
      if (goog.editor.BrowserFeature.USE_MUTATION_EVENTS) {
        this.changeTimerGecko_.fireIfActive();
      }
      this.startChangeEvents();
    } else {
      this.dispatchChange();
    }
  }
};
goog.editor.Field.prototype.setInnerHtml_ = function(html) {
  var field = this.getElement();
  if (field) {
    if (this.usesIframe() && goog.editor.BrowserFeature.MOVES_STYLE_TO_HEAD) {
      var heads = goog.dom.getElementsByTagName(goog.dom.TagName.HEAD, goog.asserts.assert(field.ownerDocument));
      for (var i = heads.length - 1; i >= 1; --i) {
        heads[i].parentNode.removeChild(heads[i]);
      }
    }
  } else {
    field = this.getOriginalElement();
  }
  if (field) {
    this.injectContents(html && goog.html.SafeHtml.unwrap(html), field);
  }
};
goog.editor.Field.prototype.turnOnDesignModeGecko = function() {
  var doc = this.getEditableDomHelper().getDocument();
  doc.designMode = "on";
  if (goog.editor.BrowserFeature.HAS_STYLE_WITH_CSS) {
    doc.execCommand("styleWithCSS", false, false);
  }
};
goog.editor.Field.prototype.installStyles = function() {
  if (this.cssStyles && this.shouldLoadAsynchronously()) {
    goog.style.installSafeStyleSheet(goog.html.legacyconversions.safeStyleSheetFromString(this.cssStyles), this.getElement());
  }
};
goog.editor.Field.prototype.dispatchLoadEvent_ = function() {
  this.getElement();
  this.installStyles();
  this.startChangeEvents();
  goog.log.info(this.logger, "Dispatching load " + this.id);
  this.dispatchEvent(goog.editor.Field.EventType.LOAD);
};
goog.editor.Field.prototype.isUneditable = function() {
  return this.loadState_ == goog.editor.Field.LoadState_.UNEDITABLE;
};
goog.editor.Field.prototype.isLoaded = function() {
  return this.loadState_ == goog.editor.Field.LoadState_.EDITABLE;
};
goog.editor.Field.prototype.isLoading = function() {
  return this.loadState_ == goog.editor.Field.LoadState_.LOADING;
};
goog.editor.Field.prototype.focus = function() {
  if (!goog.editor.BrowserFeature.HAS_CONTENT_EDITABLE && this.usesIframe()) {
    this.getEditableDomHelper().getWindow().focus();
  } else {
    if (goog.userAgent.OPERA) {
      var scrollX = this.appWindow_.pageXOffset;
      var scrollY = this.appWindow_.pageYOffset;
    }
    this.getElement().focus();
    if (goog.userAgent.OPERA) {
      this.appWindow_.scrollTo(scrollX, scrollY);
    }
  }
};
goog.editor.Field.prototype.focusAndPlaceCursorAtStart = function() {
  if (goog.editor.BrowserFeature.HAS_IE_RANGES || !goog.userAgent.GECKO) {
    this.placeCursorAtStart();
  }
  this.focus();
};
goog.editor.Field.prototype.placeCursorAtStart = function() {
  this.placeCursorAtStartOrEnd_(true);
};
goog.editor.Field.prototype.placeCursorAtEnd = function() {
  this.placeCursorAtStartOrEnd_(false);
};
goog.editor.Field.prototype.placeCursorAtStartOrEnd_ = function(isStart) {
  var field = this.getElement();
  if (field) {
    var cursorPosition = isStart ? goog.editor.node.getLeftMostLeaf(field) : goog.editor.node.getRightMostLeaf(field);
    if (field == cursorPosition) {
      goog.dom.Range.createCaret(field, 0).select();
    } else {
      goog.editor.range.placeCursorNextTo(cursorPosition, isStart);
    }
    this.dispatchSelectionChangeEvent();
  }
};
goog.editor.Field.prototype.restoreSavedRange = function(opt_range) {
  if (opt_range) {
    opt_range.restore();
  }
  this.focus();
};
goog.editor.Field.prototype.makeEditable = function(opt_iframeSrc) {
  this.loadState_ = goog.editor.Field.LoadState_.LOADING;
  var field = this.getOriginalElement();
  this.nodeName = field.nodeName;
  this.savedClassName_ = field.className;
  this.setInitialStyle(field.style.cssText);
  goog.dom.classlist.add(field, "editable");
  this.makeEditableInternal(opt_iframeSrc);
};
goog.editor.Field.prototype.makeEditableInternal = function(opt_iframeSrc) {
  this.makeIframeField_(opt_iframeSrc);
};
goog.editor.Field.prototype.handleFieldLoad = function() {
  if (goog.userAgent.IE) {
    goog.dom.Range.clearSelection(this.editableDomHelper.getWindow());
  }
  if (goog.editor.Field.getActiveFieldId() != this.id) {
    this.execCommand(goog.editor.Command.UPDATE_LOREM);
  }
  this.setupChangeListeners_();
  this.dispatchLoadEvent_();
  for (var classId in this.plugins_) {
    this.plugins_[classId].enable(this);
  }
};
goog.editor.Field.prototype.makeUneditable = function(opt_skipRestore) {
  if (this.isUneditable()) {
    throw Error("makeUneditable: Field is already uneditable");
  }
  this.clearDelayedChange();
  this.selectionChangeTimer_.fireIfActive();
  this.execCommand(goog.editor.Command.CLEAR_LOREM);
  var html = null;
  if (!opt_skipRestore && this.getElement()) {
    html = this.getCleanContents();
  }
  this.clearFieldLoadListener_();
  var field = this.getOriginalElement();
  if (goog.editor.Field.getActiveFieldId() == field.id) {
    goog.editor.Field.setActiveFieldId(null);
  }
  this.clearListeners();
  if (goog.isString(html)) {
    goog.editor.node.replaceInnerHtml(field, html);
    this.resetOriginalElemProperties();
  }
  this.restoreDom();
  this.tearDownFieldObject_();
  if (goog.userAgent.WEBKIT) {
    field.blur();
  }
  this.execCommand(goog.editor.Command.UPDATE_LOREM);
  this.dispatchEvent(goog.editor.Field.EventType.UNLOAD);
};
goog.editor.Field.prototype.restoreDom = function() {
  var field = this.getOriginalElement();
  if (field) {
    var iframe = this.getEditableIframe();
    if (iframe) {
      goog.dom.replaceNode(field, iframe);
    }
  }
};
goog.editor.Field.prototype.shouldLoadAsynchronously = function() {
  if (!goog.isDef(this.isHttps_)) {
    this.isHttps_ = false;
    if (goog.userAgent.IE && this.usesIframe()) {
      var win = this.originalDomHelper.getWindow();
      while (win != win.parent) {
        try {
          win = win.parent;
        } catch (e) {
          break;
        }
      }
      var loc = win.location;
      this.isHttps_ = loc.protocol == "https:" && loc.search.indexOf("nocheckhttps") == -1;
    }
  }
  return this.isHttps_;
};
goog.editor.Field.prototype.makeIframeField_ = function(opt_iframeSrc) {
  var field = this.getOriginalElement();
  if (field) {
    var html = field.innerHTML;
    var styles = {};
    html = this.reduceOp_(goog.editor.Plugin.Op.PREPARE_CONTENTS_HTML, html, styles);
    var iframe = this.originalDomHelper.createDom(goog.dom.TagName.IFRAME, this.getIframeAttributes());
    if (this.shouldLoadAsynchronously()) {
      var onLoad = goog.bind(this.iframeFieldLoadHandler, this, iframe, html, styles);
      this.fieldLoadListenerKey_ = goog.events.listen(iframe, goog.events.EventType.LOAD, onLoad, true);
      if (opt_iframeSrc) {
        iframe.src = opt_iframeSrc;
      }
    }
    this.attachIframe(iframe);
    if (!this.shouldLoadAsynchronously()) {
      this.iframeFieldLoadHandler(iframe, html, styles);
    }
  }
};
goog.editor.Field.prototype.attachIframe = function(iframe) {
  var field = this.getOriginalElement();
  iframe.className = field.className;
  iframe.id = field.id;
  goog.dom.replaceNode(iframe, field);
};
goog.editor.Field.prototype.getFieldFormatInfo = function(extraStyles) {
  var originalElement = this.getOriginalElement();
  var isStandardsMode = goog.editor.node.isStandardsMode(originalElement);
  return new goog.editor.icontent.FieldFormatInfo(this.id, isStandardsMode, false, false, extraStyles);
};
goog.editor.Field.prototype.writeIframeContent = function(iframe, innerHtml, extraStyles) {
  var formatInfo = this.getFieldFormatInfo(extraStyles);
  if (this.shouldLoadAsynchronously()) {
    var doc = goog.dom.getFrameContentDocument(iframe);
    goog.editor.icontent.writeHttpsInitialIframe(formatInfo, doc, innerHtml);
  } else {
    var styleInfo = new goog.editor.icontent.FieldStyleInfo(this.getElement(), this.cssStyles);
    goog.editor.icontent.writeNormalInitialIframe(formatInfo, innerHtml, styleInfo, iframe);
  }
};
goog.editor.Field.prototype.iframeFieldLoadHandler = function(iframe, innerHtml, styles) {
  this.clearFieldLoadListener_();
  iframe.allowTransparency = "true";
  this.writeIframeContent(iframe, innerHtml, styles);
  var doc = goog.dom.getFrameContentDocument(iframe);
  var body = doc.body;
  this.setupFieldObject(body);
  if (!goog.editor.BrowserFeature.HAS_CONTENT_EDITABLE && this.usesIframe()) {
    this.turnOnDesignModeGecko();
  }
  this.handleFieldLoad();
};
goog.editor.Field.prototype.clearFieldLoadListener_ = function() {
  if (this.fieldLoadListenerKey_) {
    goog.events.unlistenByKey(this.fieldLoadListenerKey_);
    this.fieldLoadListenerKey_ = null;
  }
};
goog.editor.Field.prototype.getIframeAttributes = function() {
  var iframeStyle = "padding:0;" + this.getOriginalElement().style.cssText;
  if (!goog.string.endsWith(iframeStyle, ";")) {
    iframeStyle += ";";
  }
  iframeStyle += "background-color:white;";
  if (goog.userAgent.IE) {
    iframeStyle += "overflow:visible;";
  }
  return {"frameBorder":0, "style":iframeStyle};
};
goog.provide("goog.cssom");
goog.provide("goog.cssom.CssRuleType");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.dom.TagName");
goog.cssom.CssRuleType = {STYLE:1, IMPORT:3, MEDIA:4, FONT_FACE:5, PAGE:6, NAMESPACE:7};
goog.cssom.getAllCssText = function(opt_styleSheet) {
  var styleSheet = opt_styleSheet || document.styleSheets;
  return goog.cssom.getAllCss_(styleSheet, true);
};
goog.cssom.getAllCssStyleRules = function(opt_styleSheet) {
  var styleSheet = opt_styleSheet || document.styleSheets;
  return goog.cssom.getAllCss_(styleSheet, false);
};
goog.cssom.getCssRulesFromStyleSheet = function(styleSheet) {
  var cssRuleList = null;
  try {
    cssRuleList = styleSheet.cssRules || styleSheet.rules;
  } catch (e) {
    if (e.code == 15) {
      e.styleSheet = styleSheet;
      throw e;
    }
  }
  return cssRuleList;
};
goog.cssom.getAllCssStyleSheets = function(opt_styleSheet, opt_includeDisabled) {
  var styleSheetsOutput = [];
  var styleSheet = opt_styleSheet || document.styleSheets;
  var includeDisabled = goog.isDef(opt_includeDisabled) ? opt_includeDisabled : false;
  if (styleSheet.imports && styleSheet.imports.length) {
    for (var i = 0, n = styleSheet.imports.length; i < n; i++) {
      goog.array.extend(styleSheetsOutput, goog.cssom.getAllCssStyleSheets(styleSheet.imports[i]));
    }
  } else {
    if (styleSheet.length) {
      for (var i = 0, n = styleSheet.length; i < n; i++) {
        goog.array.extend(styleSheetsOutput, goog.cssom.getAllCssStyleSheets(styleSheet[i]));
      }
    } else {
      var cssRuleList = goog.cssom.getCssRulesFromStyleSheet(styleSheet);
      if (cssRuleList && cssRuleList.length) {
        for (var i = 0, n = cssRuleList.length, cssRule; i < n; i++) {
          cssRule = cssRuleList[i];
          if (cssRule.styleSheet) {
            goog.array.extend(styleSheetsOutput, goog.cssom.getAllCssStyleSheets(cssRule.styleSheet));
          }
        }
      }
    }
  }
  if ((styleSheet.type || styleSheet.rules || styleSheet.cssRules) && (!styleSheet.disabled || includeDisabled)) {
    styleSheetsOutput.push(styleSheet);
  }
  return styleSheetsOutput;
};
goog.cssom.getCssTextFromCssRule = function(cssRule) {
  var cssText = "";
  if (cssRule.cssText) {
    cssText = cssRule.cssText;
  } else {
    if (cssRule.style && cssRule.style.cssText && cssRule.selectorText) {
      var styleCssText = cssRule.style.cssText.replace(/\s*-closure-parent-stylesheet:\s*\[object\];?\s*/gi, "").replace(/\s*-closure-rule-index:\s*[\d]+;?\s*/gi, "");
      var thisCssText = cssRule.selectorText + " { " + styleCssText + " }";
      cssText = thisCssText;
    }
  }
  return cssText;
};
goog.cssom.getCssRuleIndexInParentStyleSheet = function(cssRule, opt_parentStyleSheet) {
  if (cssRule.style && cssRule.style["-closure-rule-index"]) {
    return cssRule.style["-closure-rule-index"];
  }
  var parentStyleSheet = opt_parentStyleSheet || goog.cssom.getParentStyleSheet(cssRule);
  if (!parentStyleSheet) {
    throw Error("Cannot find a parentStyleSheet.");
  }
  var cssRuleList = goog.cssom.getCssRulesFromStyleSheet(parentStyleSheet);
  if (cssRuleList && cssRuleList.length) {
    for (var i = 0, n = cssRuleList.length, thisCssRule; i < n; i++) {
      thisCssRule = cssRuleList[i];
      if (thisCssRule == cssRule) {
        return i;
      }
    }
  }
  return -1;
};
goog.cssom.getParentStyleSheet = function(cssRule) {
  return cssRule.parentStyleSheet || cssRule.style && cssRule.style["-closure-parent-stylesheet"];
};
goog.cssom.replaceCssRule = function(cssRule, cssText, opt_parentStyleSheet, opt_index) {
  var parentStyleSheet = opt_parentStyleSheet || goog.cssom.getParentStyleSheet(cssRule);
  if (parentStyleSheet) {
    var index = Number(opt_index) >= 0 ? Number(opt_index) : goog.cssom.getCssRuleIndexInParentStyleSheet(cssRule, parentStyleSheet);
    if (index >= 0) {
      goog.cssom.removeCssRule(parentStyleSheet, index);
      goog.cssom.addCssRule(parentStyleSheet, cssText, index);
    } else {
      throw Error("Cannot proceed without the index of the cssRule.");
    }
  } else {
    throw Error("Cannot proceed without the parentStyleSheet.");
  }
};
goog.cssom.addCssRule = function(cssStyleSheet, cssText, opt_index) {
  var index = opt_index;
  if (index == undefined || index < 0) {
    var rules = goog.cssom.getCssRulesFromStyleSheet(cssStyleSheet);
    index = rules.length;
  }
  if (cssStyleSheet.insertRule) {
    cssStyleSheet.insertRule(cssText, index);
  } else {
    var matches = /^([^\{]+)\{([^\{]+)\}/.exec(cssText);
    if (matches.length == 3) {
      var selector = matches[1];
      var style = matches[2];
      cssStyleSheet.addRule(selector, style, index);
    } else {
      throw Error("Your CSSRule appears to be ill-formatted.");
    }
  }
};
goog.cssom.removeCssRule = function(cssStyleSheet, index) {
  if (cssStyleSheet.deleteRule) {
    cssStyleSheet.deleteRule(index);
  } else {
    cssStyleSheet.removeRule(index);
  }
};
goog.cssom.addCssText = function(cssText, opt_domHelper) {
  var domHelper = opt_domHelper || goog.dom.getDomHelper();
  var document = domHelper.getDocument();
  var cssNode = domHelper.createElement(goog.dom.TagName.STYLE);
  cssNode.type = "text/css";
  var head = domHelper.getElementsByTagName(goog.dom.TagName.HEAD)[0];
  head.appendChild(cssNode);
  if (cssNode.styleSheet) {
    cssNode.styleSheet.cssText = cssText;
  } else {
    var cssTextNode = document.createTextNode(cssText);
    cssNode.appendChild(cssTextNode);
  }
  return cssNode;
};
goog.cssom.getFileNameFromStyleSheet = function(styleSheet) {
  var href = styleSheet.href;
  if (!href) {
    return null;
  }
  var matches = /([^\/\?]+)[^\/]*$/.exec(href);
  var filename = matches[1];
  return filename;
};
goog.cssom.getAllCss_ = function(styleSheet, isTextOutput) {
  var cssOut = [];
  var styleSheets = goog.cssom.getAllCssStyleSheets(styleSheet);
  for (var i = 0; styleSheet = styleSheets[i]; i++) {
    var cssRuleList = goog.cssom.getCssRulesFromStyleSheet(styleSheet);
    if (cssRuleList && cssRuleList.length) {
      var ruleIndex = 0;
      for (var j = 0, n = cssRuleList.length, cssRule; j < n; j++) {
        cssRule = cssRuleList[j];
        if (isTextOutput && !cssRule.href) {
          var res = goog.cssom.getCssTextFromCssRule(cssRule);
          cssOut.push(res);
        } else {
          if (!cssRule.href) {
            if (cssRule.style) {
              if (!cssRule.parentStyleSheet) {
                cssRule.style["-closure-parent-stylesheet"] = styleSheet;
              }
              cssRule.style["-closure-rule-index"] = isTextOutput ? undefined : ruleIndex;
            }
            cssOut.push(cssRule);
          }
        }
        if (!isTextOutput) {
          ruleIndex++;
        }
      }
    }
  }
  return isTextOutput ? cssOut.join(" ") : cssOut;
};
goog.provide("goog.cssom.iframe.style");
goog.require("goog.asserts");
goog.require("goog.cssom");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.TagName");
goog.require("goog.dom.classlist");
goog.require("goog.string");
goog.require("goog.style");
goog.require("goog.userAgent");
goog.cssom.iframe.style.selectorPartAnchorRegex_ = /a(:(link|visited|active|hover))?/;
goog.cssom.iframe.style.SELECTOR_DELIMITER_ = ",";
goog.cssom.iframe.style.SELECTOR_PART_DELIMITER_ = " ";
goog.cssom.iframe.style.DECLARATION_START_DELIMITER_ = "{";
goog.cssom.iframe.style.DECLARATION_END_DELIMITER_ = "}\n";
goog.cssom.iframe.style.CssRuleSet_ = function() {
  this.declarationText = "";
  this.selectors = [];
};
goog.cssom.iframe.style.CssRuleSet_.prototype.initializeFromCssRule = function(cssRule) {
  var ruleStyle = cssRule.style;
  if (!ruleStyle) {
    return false;
  }
  var selector;
  var declarations = "";
  if (ruleStyle && (selector = cssRule.selectorText) && (declarations = ruleStyle.cssText)) {
    if (goog.userAgent.IE) {
      declarations += "/* */";
    }
  } else {
    if (cssRule.cssText) {
      var cssSelectorMatch = /([^\{]+)\{/;
      var endTagMatch = /\}[^\}]*$/g;
      selector = cssSelectorMatch.exec(cssRule.cssText)[1];
      declarations = cssRule.cssText.replace(cssSelectorMatch, "").replace(endTagMatch, "");
    }
  }
  if (selector) {
    this.setSelectorsFromString(selector);
    this.declarationText = declarations;
    return true;
  }
  return false;
};
goog.cssom.iframe.style.CssRuleSet_.prototype.setSelectorsFromString = function(selectorsString) {
  this.selectors = [];
  var selectors = selectorsString.split(/,\s*/gm);
  for (var i = 0; i < selectors.length; i++) {
    var selector = selectors[i];
    if (selector.length > 0) {
      this.selectors.push(new goog.cssom.iframe.style.CssSelector_(selector));
    }
  }
};
goog.cssom.iframe.style.CssRuleSet_.prototype.clone = function() {
  var newRuleSet = new goog.cssom.iframe.style.CssRuleSet_;
  newRuleSet.selectors = this.selectors.concat();
  newRuleSet.declarationText = this.declarationText;
  return newRuleSet;
};
goog.cssom.iframe.style.CssRuleSet_.prototype.setDeclarationTextFromObject = function(sourceObject, opt_important) {
  var stringParts = [];
  for (var prop in sourceObject) {
    var value = sourceObject[prop];
    if (value) {
      stringParts.push(prop, ":", value, opt_important ? " !important" : "", ";");
    }
  }
  this.declarationText = stringParts.join("");
};
goog.cssom.iframe.style.CssRuleSet_.prototype.writeToArray = function(array) {
  var selectorCount = this.selectors.length;
  var matchesAnchorTag = false;
  for (var i = 0; i < selectorCount; i++) {
    var selectorParts = this.selectors[i].parts;
    var partCount = selectorParts.length;
    for (var j = 0; j < partCount; j++) {
      array.push(selectorParts[j].inputString_, goog.cssom.iframe.style.SELECTOR_PART_DELIMITER_);
    }
    if (i < selectorCount - 1) {
      array.push(goog.cssom.iframe.style.SELECTOR_DELIMITER_);
    }
    if (goog.userAgent.GECKO && !goog.userAgent.isVersionOrHigher("1.9a")) {
      matchesAnchorTag = matchesAnchorTag || goog.cssom.iframe.style.selectorPartAnchorRegex_.test(selectorParts[partCount - 1].inputString_);
    }
  }
  var declarationText = this.declarationText;
  if (matchesAnchorTag) {
    declarationText = goog.cssom.iframe.style.makeColorRuleImportant_(declarationText);
  }
  array.push(goog.cssom.iframe.style.DECLARATION_START_DELIMITER_, declarationText, goog.cssom.iframe.style.DECLARATION_END_DELIMITER_);
};
goog.cssom.iframe.style.colorImportantReplaceRegex_ = /(^|;|{)\s*color:([^;]+);/g;
goog.cssom.iframe.style.makeColorRuleImportant_ = function(cssText) {
  return cssText.replace(goog.cssom.iframe.style.colorImportantReplaceRegex_, "$1 color: $2 ! important; ");
};
goog.cssom.iframe.style.CssSelector_ = function(opt_selectorString) {
  this.ancestryMatchCache_ = {};
  if (opt_selectorString) {
    this.setPartsFromString_(opt_selectorString);
  }
};
goog.cssom.iframe.style.CssSelector_.prototype.setPartsFromString_ = function(selectorString) {
  var parts = [];
  var selectorPartStrings = selectorString.split(/\s+/gm);
  for (var i = 0; i < selectorPartStrings.length; i++) {
    if (!selectorPartStrings[i]) {
      continue;
    }
    var part = new goog.cssom.iframe.style.CssSelectorPart_(selectorPartStrings[i]);
    parts.push(part);
  }
  this.parts = parts;
};
goog.cssom.iframe.style.CssSelector_.prototype.matchElementAncestry = function(elementAncestry) {
  var ancestryUid = elementAncestry.uid;
  if (this.ancestryMatchCache_[ancestryUid]) {
    return this.ancestryMatchCache_[ancestryUid];
  }
  var elementIndex = 0;
  var match = null;
  var selectorPart = null;
  var lastSelectorPart = null;
  var ancestorNodes = elementAncestry.nodes;
  var ancestorNodeCount = ancestorNodes.length;
  for (var i = 0; i <= this.parts.length; i++) {
    selectorPart = this.parts[i];
    while (elementIndex < ancestorNodeCount) {
      var currentElementInfo = ancestorNodes[elementIndex];
      if (selectorPart && selectorPart.testElement(currentElementInfo)) {
        match = {elementIndex:elementIndex, selectorPartIndex:i};
        elementIndex++;
        break;
      } else {
        if (lastSelectorPart && lastSelectorPart.testElement(currentElementInfo)) {
          match = {elementIndex:elementIndex, selectorPartIndex:i - 1};
        }
      }
      elementIndex++;
    }
    lastSelectorPart = selectorPart;
  }
  this.ancestryMatchCache_[ancestryUid] = match;
  return match;
};
goog.cssom.iframe.style.CssSelectorPart_ = function(selectorPartString) {
  var cacheEntry = goog.cssom.iframe.style.CssSelectorPart_.instances_[selectorPartString];
  if (cacheEntry) {
    return cacheEntry;
  }
  var identifiers;
  if (selectorPartString.match(/[#\.]/)) {
    identifiers = selectorPartString.split(/(?=[#\.])/);
  } else {
    identifiers = [selectorPartString];
  }
  var properties = {};
  for (var i = 0; i < identifiers.length; i++) {
    var identifier = identifiers[i];
    if (identifier.charAt(0) == ".") {
      properties.className = identifier.substring(1, identifier.length);
    } else {
      if (identifier.charAt(0) == "#") {
        properties.id = identifier.substring(1, identifier.length);
      } else {
        properties.tagName = identifier.toUpperCase();
      }
    }
  }
  this.inputString_ = selectorPartString;
  this.matchProperties_ = properties;
  this.testedElements_ = {};
  goog.cssom.iframe.style.CssSelectorPart_.instances_[selectorPartString] = this;
};
goog.cssom.iframe.style.CssSelectorPart_.instances_ = {};
goog.cssom.iframe.style.CssSelectorPart_.prototype.testElement = function(elementInfo) {
  var elementUid = elementInfo.uid;
  var cachedMatch = this.testedElements_[elementUid];
  if (typeof cachedMatch != "undefined") {
    return cachedMatch;
  }
  var matchProperties = this.matchProperties_;
  var testTag = matchProperties.tagName;
  var testClass = matchProperties.className;
  var testId = matchProperties.id;
  var matched = true;
  if (testTag && testTag != "*" && testTag != elementInfo.nodeName) {
    matched = false;
  } else {
    if (testId && testId != elementInfo.id) {
      matched = false;
    } else {
      if (testClass && !elementInfo.classNames[testClass]) {
        matched = false;
      }
    }
  }
  this.testedElements_[elementUid] = matched;
  return matched;
};
goog.cssom.iframe.style.NodeAncestry_ = function(el) {
  var node = el;
  var nodeUid = goog.getUid(node);
  var ancestry = goog.cssom.iframe.style.NodeAncestry_.instances_[nodeUid];
  if (ancestry) {
    return ancestry;
  }
  var nodes = [];
  do {
    var nodeInfo = {id:node.id, nodeName:node.nodeName};
    nodeInfo.uid = goog.getUid(nodeInfo);
    var className = node.className;
    var classNamesLookup = {};
    if (className) {
      var classNames = goog.dom.classlist.get(goog.asserts.assertElement(node));
      for (var i = 0; i < classNames.length; i++) {
        classNamesLookup[classNames[i]] = 1;
      }
    }
    nodeInfo.classNames = classNamesLookup;
    nodes.unshift(nodeInfo);
  } while (node = node.parentNode);
  this.nodes = nodes;
  this.uid = goog.getUid(this);
  goog.cssom.iframe.style.NodeAncestry_.instances_[nodeUid] = this;
};
goog.cssom.iframe.style.NodeAncestry_.instances_ = {};
goog.cssom.iframe.style.resetDomCache = function() {
  goog.cssom.iframe.style.NodeAncestry_.instances_ = {};
};
goog.cssom.iframe.style.getRuleSetsFromDocument_ = function(doc) {
  var ruleSets = [];
  var styleSheets = goog.cssom.getAllCssStyleSheets(doc.styleSheets);
  for (var i = 0, styleSheet; styleSheet = styleSheets[i]; i++) {
    var domRuleSets = goog.cssom.getCssRulesFromStyleSheet(styleSheet);
    if (domRuleSets && domRuleSets.length) {
      for (var j = 0, n = domRuleSets.length; j < n; j++) {
        var ruleSet = new goog.cssom.iframe.style.CssRuleSet_;
        if (ruleSet.initializeFromCssRule(domRuleSets[j])) {
          ruleSets.push(ruleSet);
        }
      }
    }
  }
  return ruleSets;
};
goog.cssom.iframe.style.ruleSetCache_ = {};
goog.cssom.iframe.style.ruleSetCache_.ruleSetCache_ = {};
goog.cssom.iframe.style.ruleSetCache_.loadRuleSetsForDocument = function(doc) {
  var docUid = goog.getUid(doc);
  goog.cssom.iframe.style.ruleSetCache_.ruleSetCache_[docUid] = goog.cssom.iframe.style.getRuleSetsFromDocument_(doc);
};
goog.cssom.iframe.style.ruleSetCache_.getRuleSetsForDocument = function(doc) {
  var docUid = goog.getUid(doc);
  var cache = goog.cssom.iframe.style.ruleSetCache_.ruleSetCache_;
  if (!cache[docUid]) {
    goog.cssom.iframe.style.ruleSetCache_.loadRuleSetsForDocument(doc);
  }
  var ruleSets = cache[docUid];
  var ruleSetsCopy = [];
  for (var i = 0; i < ruleSets.length; i++) {
    ruleSetsCopy.push(ruleSets[i].clone());
  }
  return ruleSetsCopy;
};
goog.cssom.iframe.style.inheritedProperties_ = ["color", "visibility", "quotes", "list-style-type", "list-style-image", "list-style-position", "list-style", "page-break-inside", "orphans", "widows", "font-family", "font-style", "font-variant", "font-weight", "text-indent", "text-align", "text-transform", "white-space", "caption-side", "border-collapse", "border-spacing", "empty-cells", "cursor"];
goog.cssom.iframe.style.textProperties_ = ["font-family", "font-size", "font-weight", "font-variant", "font-style", "color", "text-align", "text-decoration", "text-indent", "text-transform", "letter-spacing", "white-space", "word-spacing"];
goog.cssom.iframe.style.getElementContext = function(element, opt_forceRuleSetCacheUpdate, opt_copyBackgroundContext) {
  var sourceDocument = element.ownerDocument;
  if (opt_forceRuleSetCacheUpdate) {
    goog.cssom.iframe.style.ruleSetCache_.loadRuleSetsForDocument(sourceDocument);
  }
  var ruleSets = goog.cssom.iframe.style.ruleSetCache_.getRuleSetsForDocument(sourceDocument);
  var elementAncestry = new goog.cssom.iframe.style.NodeAncestry_(element);
  var bodySelectorPart = new goog.cssom.iframe.style.CssSelectorPart_("body");
  for (var i = 0; i < ruleSets.length; i++) {
    var ruleSet = ruleSets[i];
    var selectors = ruleSet.selectors;
    var ruleCount = selectors.length;
    for (var j = 0; j < ruleCount; j++) {
      var selector = selectors[j];
      var match = selector.matchElementAncestry(elementAncestry);
      if (match) {
        var ruleIndex = match.selectorPartIndex;
        var selectorParts = selector.parts;
        var lastSelectorPartIndex = selectorParts.length - 1;
        var selectorCopy;
        if (match.elementIndex == elementAncestry.nodes.length - 1 || ruleIndex < lastSelectorPartIndex) {
          var selectorPartsCopy = selectorParts.concat();
          selectorPartsCopy.splice(0, ruleIndex + 1, bodySelectorPart);
          selectorCopy = new goog.cssom.iframe.style.CssSelector_;
          selectorCopy.parts = selectorPartsCopy;
          selectors.push(selectorCopy);
        } else {
          if (ruleIndex > 0 && ruleIndex == lastSelectorPartIndex) {
            selectorCopy = new goog.cssom.iframe.style.CssSelector_;
            selectorCopy.parts = [bodySelectorPart, selectorParts[lastSelectorPartIndex]];
            selectors.push(selectorCopy);
          }
        }
      }
    }
  }
  var defaultPropertiesRuleSet = new goog.cssom.iframe.style.CssRuleSet_;
  var computedStyle = goog.cssom.iframe.style.getComputedStyleObject_(element);
  var htmlSelector = new goog.cssom.iframe.style.CssSelector_;
  htmlSelector.parts = [new goog.cssom.iframe.style.CssSelectorPart_("html")];
  defaultPropertiesRuleSet.selectors = [htmlSelector];
  var defaultProperties = {};
  for (var i = 0, prop; prop = goog.cssom.iframe.style.inheritedProperties_[i]; i++) {
    defaultProperties[prop] = computedStyle[goog.string.toCamelCase(prop)];
  }
  defaultPropertiesRuleSet.setDeclarationTextFromObject(defaultProperties);
  ruleSets.push(defaultPropertiesRuleSet);
  var bodyRuleSet = new goog.cssom.iframe.style.CssRuleSet_;
  var bodySelector = new goog.cssom.iframe.style.CssSelector_;
  bodySelector.parts = [new goog.cssom.iframe.style.CssSelectorPart_("body")];
  var bodyProperties = {position:"relative", top:"0", left:"0", right:"auto", display:"block", visibility:"visible"};
  for (i = 0; prop = goog.cssom.iframe.style.textProperties_[i]; i++) {
    bodyProperties[prop] = computedStyle[goog.string.toCamelCase(prop)];
  }
  if (opt_copyBackgroundContext && goog.cssom.iframe.style.isTransparentValue_(computedStyle["backgroundColor"])) {
    var bgProperties = goog.cssom.iframe.style.getBackgroundContext(element);
    bodyProperties["background-color"] = bgProperties["backgroundColor"];
    var elementBgImage = computedStyle["backgroundImage"];
    if (!elementBgImage || elementBgImage == "none") {
      bodyProperties["background-image"] = bgProperties["backgroundImage"];
      bodyProperties["background-repeat"] = bgProperties["backgroundRepeat"];
      bodyProperties["background-position"] = bgProperties["backgroundPosition"];
    }
  }
  bodyRuleSet.setDeclarationTextFromObject(bodyProperties, true);
  bodyRuleSet.selectors = [bodySelector];
  ruleSets.push(bodyRuleSet);
  var ruleSetStrings = [];
  ruleCount = ruleSets.length;
  for (i = 0; i < ruleCount; i++) {
    ruleSets[i].writeToArray(ruleSetStrings);
  }
  return ruleSetStrings.join("");
};
goog.cssom.iframe.style.isTransparentValue_ = function(colorValue) {
  return colorValue == "transparent" || colorValue == "rgba(0, 0, 0, 0)";
};
goog.cssom.iframe.style.getComputedStyleObject_ = function(element) {
  return element.currentStyle || goog.dom.getOwnerDocument(element).defaultView.getComputedStyle(element, "") || {};
};
goog.cssom.iframe.style.valueWithUnitsRegEx_ = /^(-?)([0-9]+)([a-z]*|%)/;
goog.cssom.iframe.style.getBackgroundXYValues_ = function(styleObject) {
  if (styleObject["backgroundPositionY"]) {
    return [styleObject["backgroundPositionX"], styleObject["backgroundPositionY"]];
  } else {
    return (styleObject["backgroundPosition"] || "0 0").split(" ");
  }
};
goog.cssom.iframe.style.getBackgroundContext = function(element) {
  var propertyValues = {"backgroundImage":"none"};
  var ancestor = element;
  var currentIframeWindow;
  while ((ancestor = ancestor.parentNode) && ancestor.nodeType == goog.dom.NodeType.ELEMENT) {
    var computedStyle = goog.cssom.iframe.style.getComputedStyleObject_(ancestor);
    var backgroundColorValue = computedStyle["backgroundColor"];
    if (!goog.cssom.iframe.style.isTransparentValue_(backgroundColorValue)) {
      propertyValues["backgroundColor"] = backgroundColorValue;
    }
    if (computedStyle["backgroundImage"] && computedStyle["backgroundImage"] != "none") {
      propertyValues["backgroundImage"] = computedStyle["backgroundImage"];
      propertyValues["backgroundRepeat"] = computedStyle["backgroundRepeat"];
      var relativePosition;
      if (currentIframeWindow) {
        relativePosition = goog.style.getFramedPageOffset(element, currentIframeWindow);
        var frameElement = currentIframeWindow.frameElement;
        var iframeRelativePosition = goog.style.getRelativePosition(frameElement, ancestor);
        var iframeBorders = goog.style.getBorderBox(frameElement);
        relativePosition.x += iframeRelativePosition.x + iframeBorders.left;
        relativePosition.y += iframeRelativePosition.y + iframeBorders.top;
      } else {
        relativePosition = goog.style.getRelativePosition(element, ancestor);
      }
      var backgroundXYValues = goog.cssom.iframe.style.getBackgroundXYValues_(computedStyle);
      for (var i = 0; i < 2; i++) {
        var positionValue = backgroundXYValues[i];
        var coordinate = i == 0 ? "X" : "Y";
        var positionProperty = "backgroundPosition" + coordinate;
        var positionValueParts = goog.cssom.iframe.style.valueWithUnitsRegEx_.exec(positionValue);
        if (positionValueParts) {
          var value = parseInt(positionValueParts[1] + positionValueParts[2], 10);
          var units = positionValueParts[3];
          if (value == 0 || units == "px") {
            value -= coordinate == "X" ? relativePosition.x : relativePosition.y;
          }
          positionValue = value + units;
        }
        propertyValues[positionProperty] = positionValue;
      }
      propertyValues["backgroundPosition"] = propertyValues["backgroundPositionX"] + " " + propertyValues["backgroundPositionY"];
    }
    if (propertyValues["backgroundColor"]) {
      break;
    }
    if (ancestor.tagName == goog.dom.TagName.HTML) {
      try {
        currentIframeWindow = goog.dom.getWindow(ancestor.parentNode);
        ancestor = currentIframeWindow.frameElement;
        if (!ancestor) {
          break;
        }
      } catch (e) {
        break;
      }
    }
  }
  return propertyValues;
};
goog.provide("goog.editor.SeamlessField");
goog.require("goog.cssom.iframe.style");
goog.require("goog.dom");
goog.require("goog.dom.Range");
goog.require("goog.dom.TagName");
goog.require("goog.dom.safe");
goog.require("goog.editor.BrowserFeature");
goog.require("goog.editor.Field");
goog.require("goog.editor.icontent");
goog.require("goog.editor.icontent.FieldFormatInfo");
goog.require("goog.editor.icontent.FieldStyleInfo");
goog.require("goog.editor.node");
goog.require("goog.events");
goog.require("goog.events.EventType");
goog.require("goog.html.legacyconversions");
goog.require("goog.html.uncheckedconversions");
goog.require("goog.log");
goog.require("goog.string.Const");
goog.require("goog.style");
goog.editor.SeamlessField = function(id, opt_doc) {
  goog.editor.Field.call(this, id, opt_doc);
};
goog.inherits(goog.editor.SeamlessField, goog.editor.Field);
goog.editor.SeamlessField.prototype.logger = goog.log.getLogger("goog.editor.SeamlessField");
goog.editor.SeamlessField.prototype.listenForDragOverEventKey_;
goog.editor.SeamlessField.prototype.listenForIframeLoadEventKey_;
goog.editor.SeamlessField.prototype.setMinHeight = function(height) {
  if (height == this.minHeight_) {
    return;
  }
  this.minHeight_ = height;
  if (this.usesIframe()) {
    this.doFieldSizingGecko();
  }
};
goog.editor.SeamlessField.prototype.isFixedHeight_ = false;
goog.editor.SeamlessField.prototype.isFixedHeightOverridden_ = false;
goog.editor.SeamlessField.prototype.isFixedHeight = function() {
  return this.isFixedHeight_;
};
goog.editor.SeamlessField.prototype.overrideFixedHeight = function(newVal) {
  this.isFixedHeight_ = newVal;
  this.isFixedHeightOverridden_ = true;
};
goog.editor.SeamlessField.prototype.autoDetectFixedHeight_ = function() {
  if (!this.isFixedHeightOverridden_) {
    var originalElement = this.getOriginalElement();
    if (originalElement) {
      this.isFixedHeight_ = goog.style.getComputedOverflowY(originalElement) == "auto";
    }
  }
};
goog.editor.SeamlessField.prototype.handleOuterDocChange_ = function() {
  if (this.isEventStopped(goog.editor.Field.EventType.CHANGE)) {
    return;
  }
  this.sizeIframeToWrapperGecko_();
};
goog.editor.SeamlessField.prototype.sizeIframeToBodyHeightGecko_ = function() {
  if (this.acquireSizeIframeLockGecko_()) {
    var resized = false;
    var ifr = this.getEditableIframe();
    if (ifr) {
      var fieldHeight = this.getIframeBodyHeightGecko_();
      if (this.minHeight_) {
        fieldHeight = Math.max(fieldHeight, this.minHeight_);
      }
      if (parseInt(goog.style.getStyle(ifr, "height"), 10) != fieldHeight) {
        ifr.style.height = fieldHeight + "px";
        resized = true;
      }
    }
    this.releaseSizeIframeLockGecko_();
    if (resized) {
      this.dispatchEvent(goog.editor.Field.EventType.IFRAME_RESIZED);
    }
  }
};
goog.editor.SeamlessField.prototype.getIframeBodyHeightGecko_ = function() {
  var ifr = this.getEditableIframe();
  var body = ifr.contentDocument.body;
  var htmlElement = body.parentNode;
  if (parseInt(goog.style.getStyle(ifr, "height"), 10) === 0) {
    goog.style.setStyle(ifr, "height", 1 + "px");
  }
  var fieldHeight;
  if (goog.editor.node.isStandardsMode(body)) {
    fieldHeight = htmlElement.offsetHeight;
  } else {
    fieldHeight = htmlElement.scrollHeight;
    if (htmlElement.clientHeight != htmlElement.offsetHeight) {
      fieldHeight += goog.editor.SeamlessField.getScrollbarWidth_();
    }
  }
  return fieldHeight;
};
goog.editor.SeamlessField.getScrollbarWidth_ = function() {
  return goog.editor.SeamlessField.scrollbarWidth_ || (goog.editor.SeamlessField.scrollbarWidth_ = goog.style.getScrollbarWidth());
};
goog.editor.SeamlessField.prototype.sizeIframeToWrapperGecko_ = function() {
  if (this.acquireSizeIframeLockGecko_()) {
    var ifr = this.getEditableIframe();
    var field = this.getElement();
    var resized = false;
    if (ifr && field) {
      var fieldPaddingBox;
      var widthDiv = ifr.parentNode;
      var width = widthDiv.offsetWidth;
      if (parseInt(goog.style.getStyle(ifr, "width"), 10) != width) {
        fieldPaddingBox = goog.style.getPaddingBox(field);
        ifr.style.width = width + "px";
        field.style.width = width - fieldPaddingBox.left - fieldPaddingBox.right + "px";
        resized = true;
      }
      var height = widthDiv.offsetHeight;
      if (this.isFixedHeight() && parseInt(goog.style.getStyle(ifr, "height"), 10) != height) {
        if (!fieldPaddingBox) {
          fieldPaddingBox = goog.style.getPaddingBox(field);
        }
        ifr.style.height = height + "px";
        field.style.height = height - fieldPaddingBox.top - fieldPaddingBox.bottom + "px";
        resized = true;
      }
    }
    this.releaseSizeIframeLockGecko_();
    if (resized) {
      this.dispatchEvent(goog.editor.Field.EventType.IFRAME_RESIZED);
    }
  }
};
goog.editor.SeamlessField.prototype.doFieldSizingGecko = function() {
  if (this.getElement()) {
    this.sizeIframeToWrapperGecko_();
    if (!this.isFixedHeight()) {
      this.sizeIframeToBodyHeightGecko_();
    }
  }
};
goog.editor.SeamlessField.prototype.acquireSizeIframeLockGecko_ = function() {
  if (this.sizeIframeLock_) {
    return false;
  }
  return this.sizeIframeLock_ = true;
};
goog.editor.SeamlessField.prototype.releaseSizeIframeLockGecko_ = function() {
  this.sizeIframeLock_ = false;
};
goog.editor.SeamlessField.prototype.iframeableCss_ = "";
goog.editor.SeamlessField.prototype.getIframeableCss = function(opt_forceRegeneration) {
  if (!this.iframeableCss_ || opt_forceRegeneration) {
    var originalElement = this.getOriginalElement();
    if (originalElement) {
      this.iframeableCss_ = goog.cssom.iframe.style.getElementContext(originalElement, opt_forceRegeneration);
    }
  }
  return this.iframeableCss_;
};
goog.editor.SeamlessField.prototype.setIframeableCss = function(iframeableCss) {
  this.iframeableCss_ = iframeableCss;
};
goog.editor.SeamlessField.haveInstalledCss_ = false;
goog.editor.SeamlessField.prototype.inheritBlendedCSS = function() {
  if (!this.usesIframe()) {
    return;
  }
  var field = this.getElement();
  var head = goog.dom.getDomHelper(field).getElementsByTagNameAndClass(goog.dom.TagName.HEAD)[0];
  if (head) {
    goog.dom.removeChildren(head);
  }
  var newCSS = this.getIframeableCss(true);
  goog.style.installSafeStyleSheet(goog.html.legacyconversions.safeStyleSheetFromString(newCSS), field);
};
goog.editor.SeamlessField.prototype.usesIframe = function() {
  return !goog.editor.BrowserFeature.HAS_CONTENT_EDITABLE;
};
goog.editor.SeamlessField.prototype.setupMutationEventHandlersGecko = function() {
  goog.editor.SeamlessField.superClass_.setupMutationEventHandlersGecko.call(this);
  if (this.usesIframe()) {
    var iframe = this.getEditableIframe();
    var outerDoc = iframe.ownerDocument;
    this.eventRegister.listen(outerDoc, goog.editor.Field.MUTATION_EVENTS_GECKO, this.handleOuterDocChange_, true);
    this.listenForIframeLoadEventKey_ = goog.events.listenOnce(this.getEditableDomHelper().getWindow(), goog.events.EventType.LOAD, this.sizeIframeToBodyHeightGecko_, true, this);
    this.eventRegister.listen(outerDoc, "DOMAttrModified", goog.bind(this.handleDomAttrChange, this, this.handleOuterDocChange_), true);
  }
};
goog.editor.SeamlessField.prototype.handleChange = function() {
  if (this.isEventStopped(goog.editor.Field.EventType.CHANGE)) {
    return;
  }
  goog.editor.SeamlessField.superClass_.handleChange.call(this);
  if (this.usesIframe()) {
    this.sizeIframeToBodyHeightGecko_();
  }
};
goog.editor.SeamlessField.prototype.dispatchBlur = function() {
  if (this.isEventStopped(goog.editor.Field.EventType.BLUR)) {
    return;
  }
  goog.editor.SeamlessField.superClass_.dispatchBlur.call(this);
  if (!goog.editor.BrowserFeature.HAS_CONTENT_EDITABLE && !goog.editor.BrowserFeature.CLEARS_SELECTION_WHEN_FOCUS_LEAVES) {
    var win = this.getEditableDomHelper().getWindow();
    var dragging = false;
    goog.events.unlistenByKey(this.listenForDragOverEventKey_);
    this.listenForDragOverEventKey_ = goog.events.listenOnce(win.document.body, "dragover", function() {
      dragging = true;
    });
    goog.global.setTimeout(goog.bind(function() {
      if (!dragging) {
        if (this.editableDomHelper) {
          var rng = this.getRange();
          var iframeWindow = this.editableDomHelper.getWindow();
          goog.dom.Range.clearSelection(iframeWindow);
          if (rng) {
            rng.collapse(true);
            rng.select();
          }
        }
      }
    }, this), 0);
  }
};
goog.editor.SeamlessField.prototype.turnOnDesignModeGecko = function() {
  goog.editor.SeamlessField.superClass_.turnOnDesignModeGecko.call(this);
  var doc = this.getEditableDomHelper().getDocument();
  doc.execCommand("enableInlineTableEditing", false, "false");
  doc.execCommand("enableObjectResizing", false, "false");
};
goog.editor.SeamlessField.prototype.installStyles = function() {
  if (!this.usesIframe()) {
    if (!goog.editor.SeamlessField.haveInstalledCss_) {
      if (this.cssStyles) {
        goog.style.installSafeStyleSheet(goog.html.legacyconversions.safeStyleSheetFromString(this.cssStyles), this.getElement());
      }
      goog.editor.SeamlessField.haveInstalledCss_ = true;
    }
  }
};
goog.editor.SeamlessField.prototype.makeEditableInternal = function(opt_iframeSrc) {
  if (this.usesIframe()) {
    goog.editor.SeamlessField.superClass_.makeEditableInternal.call(this, opt_iframeSrc);
  } else {
    var field = this.getOriginalElement();
    if (field) {
      this.setupFieldObject(field);
      field.contentEditable = true;
      this.injectContents(field.innerHTML, field);
      this.handleFieldLoad();
    }
  }
};
goog.editor.SeamlessField.prototype.handleFieldLoad = function() {
  if (this.usesIframe()) {
    var self = this;
    goog.global.setTimeout(function() {
      self.doFieldSizingGecko();
    }, 0);
  }
  goog.editor.SeamlessField.superClass_.handleFieldLoad.call(this);
};
goog.editor.SeamlessField.prototype.getIframeAttributes = function() {
  return {"frameBorder":0, "style":"padding:0;"};
};
goog.editor.SeamlessField.prototype.attachIframe = function(iframe) {
  this.autoDetectFixedHeight_();
  var field = this.getOriginalElement();
  var dh = goog.dom.getDomHelper(field);
  var oldWidth = field.style.width;
  var oldHeight = field.style.height;
  goog.style.setStyle(field, "visibility", "hidden");
  var startDiv = dh.createDom(goog.dom.TagName.DIV, {"style":"height:0;clear:both", "innerHTML":"&nbsp;"});
  var endDiv = startDiv.cloneNode(true);
  field.insertBefore(startDiv, field.firstChild);
  goog.dom.appendChild(field, endDiv);
  var contentBox = goog.style.getContentBoxSize(field);
  var width = contentBox.width;
  var height = contentBox.height;
  var html = "";
  if (this.isFixedHeight()) {
    html = "&nbsp;";
    goog.style.setStyle(field, "position", "relative");
    goog.style.setStyle(field, "overflow", "visible");
    goog.style.setStyle(iframe, "position", "absolute");
    goog.style.setStyle(iframe, "top", "0");
    goog.style.setStyle(iframe, "left", "0");
  }
  goog.style.setSize(field, width, height);
  if (goog.editor.node.isStandardsMode(field)) {
    this.originalFieldLineHeight_ = field.style.lineHeight;
    goog.style.setStyle(field, "lineHeight", "0");
  }
  goog.editor.node.replaceInnerHtml(field, html);
  goog.style.setSize(iframe, width, height);
  goog.style.setSize(field, oldWidth, oldHeight);
  goog.style.setStyle(field, "visibility", "");
  goog.dom.appendChild(field, iframe);
  if (!this.shouldLoadAsynchronously()) {
    var doc = iframe.contentWindow.document;
    if (goog.editor.node.isStandardsMode(iframe.ownerDocument)) {
      doc.open();
      var emptyHtml = goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("HTML from constant string"), "<!DOCTYPE HTML><html></html>");
      goog.dom.safe.documentWrite(doc, emptyHtml);
      doc.close();
    }
  }
};
goog.editor.SeamlessField.prototype.getFieldFormatInfo = function(extraStyles) {
  var originalElement = this.getOriginalElement();
  if (originalElement) {
    return new goog.editor.icontent.FieldFormatInfo(this.id, goog.editor.node.isStandardsMode(originalElement), true, this.isFixedHeight(), extraStyles);
  }
  throw Error("no field");
};
goog.editor.SeamlessField.prototype.writeIframeContent = function(iframe, innerHtml, extraStyles) {
  goog.style.setStyle(iframe, "visibility", "hidden");
  var formatInfo = this.getFieldFormatInfo(extraStyles);
  var styleInfo = new goog.editor.icontent.FieldStyleInfo(this.getOriginalElement(), this.cssStyles + this.getIframeableCss());
  goog.editor.icontent.writeNormalInitialBlendedIframe(formatInfo, innerHtml, styleInfo, iframe);
  this.doFieldSizingGecko();
  goog.style.setStyle(iframe, "visibility", "visible");
};
goog.editor.SeamlessField.prototype.restoreDom = function() {
  if (this.usesIframe()) {
    goog.dom.removeNode(this.getEditableIframe());
  }
};
goog.editor.SeamlessField.prototype.clearListeners = function() {
  goog.events.unlistenByKey(this.listenForDragOverEventKey_);
  goog.events.unlistenByKey(this.listenForIframeLoadEventKey_);
  goog.editor.SeamlessField.base(this, "clearListeners");
};
goog.provide("goog.uri.utils");
goog.provide("goog.uri.utils.ComponentIndex");
goog.provide("goog.uri.utils.QueryArray");
goog.provide("goog.uri.utils.QueryValue");
goog.provide("goog.uri.utils.StandardQueryParam");
goog.require("goog.array");
goog.require("goog.asserts");
goog.require("goog.string");
goog.uri.utils.CharCode_ = {AMPERSAND:38, EQUAL:61, HASH:35, QUESTION:63};
goog.uri.utils.buildFromEncodedParts = function(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {
  var out = "";
  if (opt_scheme) {
    out += opt_scheme + ":";
  }
  if (opt_domain) {
    out += "//";
    if (opt_userInfo) {
      out += opt_userInfo + "@";
    }
    out += opt_domain;
    if (opt_port) {
      out += ":" + opt_port;
    }
  }
  if (opt_path) {
    out += opt_path;
  }
  if (opt_queryData) {
    out += "?" + opt_queryData;
  }
  if (opt_fragment) {
    out += "#" + opt_fragment;
  }
  return out;
};
goog.uri.utils.splitRe_ = new RegExp("^" + "(?:" + "([^:/?#.]+)" + ":)?" + "(?://" + "(?:([^/?#]*)@)?" + "([^/#?]*?)" + "(?::([0-9]+))?" + "(?=[/#?]|$)" + ")?" + "([^?#]+)?" + "(?:\\?([^#]*))?" + "(?:#([\\s\\S]*))?" + "$");
goog.uri.utils.ComponentIndex = {SCHEME:1, USER_INFO:2, DOMAIN:3, PORT:4, PATH:5, QUERY_DATA:6, FRAGMENT:7};
goog.uri.utils.split = function(uri) {
  return uri.match(goog.uri.utils.splitRe_);
};
goog.uri.utils.decodeIfPossible_ = function(uri, opt_preserveReserved) {
  if (!uri) {
    return uri;
  }
  return opt_preserveReserved ? decodeURI(uri) : decodeURIComponent(uri);
};
goog.uri.utils.getComponentByIndex_ = function(componentIndex, uri) {
  return goog.uri.utils.split(uri)[componentIndex] || null;
};
goog.uri.utils.getScheme = function(uri) {
  return goog.uri.utils.getComponentByIndex_(goog.uri.utils.ComponentIndex.SCHEME, uri);
};
goog.uri.utils.getEffectiveScheme = function(uri) {
  var scheme = goog.uri.utils.getScheme(uri);
  if (!scheme && goog.global.self && goog.global.self.location) {
    var protocol = goog.global.self.location.protocol;
    scheme = protocol.substr(0, protocol.length - 1);
  }
  return scheme ? scheme.toLowerCase() : "";
};
goog.uri.utils.getUserInfoEncoded = function(uri) {
  return goog.uri.utils.getComponentByIndex_(goog.uri.utils.ComponentIndex.USER_INFO, uri);
};
goog.uri.utils.getUserInfo = function(uri) {
  return goog.uri.utils.decodeIfPossible_(goog.uri.utils.getUserInfoEncoded(uri));
};
goog.uri.utils.getDomainEncoded = function(uri) {
  return goog.uri.utils.getComponentByIndex_(goog.uri.utils.ComponentIndex.DOMAIN, uri);
};
goog.uri.utils.getDomain = function(uri) {
  return goog.uri.utils.decodeIfPossible_(goog.uri.utils.getDomainEncoded(uri), true);
};
goog.uri.utils.getPort = function(uri) {
  return Number(goog.uri.utils.getComponentByIndex_(goog.uri.utils.ComponentIndex.PORT, uri)) || null;
};
goog.uri.utils.getPathEncoded = function(uri) {
  return goog.uri.utils.getComponentByIndex_(goog.uri.utils.ComponentIndex.PATH, uri);
};
goog.uri.utils.getPath = function(uri) {
  return goog.uri.utils.decodeIfPossible_(goog.uri.utils.getPathEncoded(uri), true);
};
goog.uri.utils.getQueryData = function(uri) {
  return goog.uri.utils.getComponentByIndex_(goog.uri.utils.ComponentIndex.QUERY_DATA, uri);
};
goog.uri.utils.getFragmentEncoded = function(uri) {
  var hashIndex = uri.indexOf("#");
  return hashIndex < 0 ? null : uri.substr(hashIndex + 1);
};
goog.uri.utils.setFragmentEncoded = function(uri, fragment) {
  return goog.uri.utils.removeFragment(uri) + (fragment ? "#" + fragment : "");
};
goog.uri.utils.getFragment = function(uri) {
  return goog.uri.utils.decodeIfPossible_(goog.uri.utils.getFragmentEncoded(uri));
};
goog.uri.utils.getHost = function(uri) {
  var pieces = goog.uri.utils.split(uri);
  return goog.uri.utils.buildFromEncodedParts(pieces[goog.uri.utils.ComponentIndex.SCHEME], pieces[goog.uri.utils.ComponentIndex.USER_INFO], pieces[goog.uri.utils.ComponentIndex.DOMAIN], pieces[goog.uri.utils.ComponentIndex.PORT]);
};
goog.uri.utils.getOrigin = function(uri) {
  var pieces = goog.uri.utils.split(uri);
  return goog.uri.utils.buildFromEncodedParts(pieces[goog.uri.utils.ComponentIndex.SCHEME], null, pieces[goog.uri.utils.ComponentIndex.DOMAIN], pieces[goog.uri.utils.ComponentIndex.PORT]);
};
goog.uri.utils.getPathAndAfter = function(uri) {
  var pieces = goog.uri.utils.split(uri);
  return goog.uri.utils.buildFromEncodedParts(null, null, null, null, pieces[goog.uri.utils.ComponentIndex.PATH], pieces[goog.uri.utils.ComponentIndex.QUERY_DATA], pieces[goog.uri.utils.ComponentIndex.FRAGMENT]);
};
goog.uri.utils.removeFragment = function(uri) {
  var hashIndex = uri.indexOf("#");
  return hashIndex < 0 ? uri : uri.substr(0, hashIndex);
};
goog.uri.utils.haveSameDomain = function(uri1, uri2) {
  var pieces1 = goog.uri.utils.split(uri1);
  var pieces2 = goog.uri.utils.split(uri2);
  return pieces1[goog.uri.utils.ComponentIndex.DOMAIN] == pieces2[goog.uri.utils.ComponentIndex.DOMAIN] && pieces1[goog.uri.utils.ComponentIndex.SCHEME] == pieces2[goog.uri.utils.ComponentIndex.SCHEME] && pieces1[goog.uri.utils.ComponentIndex.PORT] == pieces2[goog.uri.utils.ComponentIndex.PORT];
};
goog.uri.utils.assertNoFragmentsOrQueries_ = function(uri) {
  goog.asserts.assert(uri.indexOf("#") < 0 && uri.indexOf("?") < 0, "goog.uri.utils: Fragment or query identifiers are not supported: [%s]", uri);
};
goog.uri.utils.QueryValue;
goog.uri.utils.QueryArray;
goog.uri.utils.parseQueryData = function(encodedQuery, callback) {
  if (!encodedQuery) {
    return;
  }
  var pairs = encodedQuery.split("&");
  for (var i = 0; i < pairs.length; i++) {
    var indexOfEquals = pairs[i].indexOf("=");
    var name = null;
    var value = null;
    if (indexOfEquals >= 0) {
      name = pairs[i].substring(0, indexOfEquals);
      value = pairs[i].substring(indexOfEquals + 1);
    } else {
      name = pairs[i];
    }
    callback(name, value ? goog.string.urlDecode(value) : "");
  }
};
goog.uri.utils.splitQueryData_ = function(uri) {
  var hashIndex = uri.indexOf("#");
  if (hashIndex < 0) {
    hashIndex = uri.length;
  }
  var questionIndex = uri.indexOf("?");
  var queryData;
  if (questionIndex < 0 || questionIndex > hashIndex) {
    questionIndex = hashIndex;
    queryData = "";
  } else {
    queryData = uri.substring(questionIndex + 1, hashIndex);
  }
  return [uri.substr(0, questionIndex), queryData, uri.substr(hashIndex)];
};
goog.uri.utils.joinQueryData_ = function(parts) {
  return parts[0] + (parts[1] ? "?" + parts[1] : "") + parts[2];
};
goog.uri.utils.appendQueryData_ = function(queryData, newData) {
  if (!newData) {
    return queryData;
  }
  return queryData ? queryData + "&" + newData : newData;
};
goog.uri.utils.appendQueryDataToUri_ = function(uri, queryData) {
  if (!queryData) {
    return uri;
  }
  var parts = goog.uri.utils.splitQueryData_(uri);
  parts[1] = goog.uri.utils.appendQueryData_(parts[1], queryData);
  return goog.uri.utils.joinQueryData_(parts);
};
goog.uri.utils.appendKeyValuePairs_ = function(key, value, pairs) {
  goog.asserts.assertString(key);
  if (goog.isArray(value)) {
    goog.asserts.assertArray(value);
    for (var j = 0; j < value.length; j++) {
      goog.uri.utils.appendKeyValuePairs_(key, String(value[j]), pairs);
    }
  } else {
    if (value != null) {
      pairs.push(key + (value === "" ? "" : "=" + goog.string.urlEncode(value)));
    }
  }
};
goog.uri.utils.buildQueryData = function(keysAndValues, opt_startIndex) {
  goog.asserts.assert(Math.max(keysAndValues.length - (opt_startIndex || 0), 0) % 2 == 0, "goog.uri.utils: Key/value lists must be even in length.");
  var params = [];
  for (var i = opt_startIndex || 0; i < keysAndValues.length; i += 2) {
    var key = keysAndValues[i];
    goog.uri.utils.appendKeyValuePairs_(key, keysAndValues[i + 1], params);
  }
  return params.join("&");
};
goog.uri.utils.buildQueryDataFromMap = function(map) {
  var params = [];
  for (var key in map) {
    goog.uri.utils.appendKeyValuePairs_(key, map[key], params);
  }
  return params.join("&");
};
goog.uri.utils.appendParams = function(uri, var_args) {
  var queryData = arguments.length == 2 ? goog.uri.utils.buildQueryData(arguments[1], 0) : goog.uri.utils.buildQueryData(arguments, 1);
  return goog.uri.utils.appendQueryDataToUri_(uri, queryData);
};
goog.uri.utils.appendParamsFromMap = function(uri, map) {
  var queryData = goog.uri.utils.buildQueryDataFromMap(map);
  return goog.uri.utils.appendQueryDataToUri_(uri, queryData);
};
goog.uri.utils.appendParam = function(uri, key, opt_value) {
  var value = goog.isDefAndNotNull(opt_value) ? "=" + goog.string.urlEncode(opt_value) : "";
  return goog.uri.utils.appendQueryDataToUri_(uri, key + value);
};
goog.uri.utils.findParam_ = function(uri, startIndex, keyEncoded, hashOrEndIndex) {
  var index = startIndex;
  var keyLength = keyEncoded.length;
  while ((index = uri.indexOf(keyEncoded, index)) >= 0 && index < hashOrEndIndex) {
    var precedingChar = uri.charCodeAt(index - 1);
    if (precedingChar == goog.uri.utils.CharCode_.AMPERSAND || precedingChar == goog.uri.utils.CharCode_.QUESTION) {
      var followingChar = uri.charCodeAt(index + keyLength);
      if (!followingChar || followingChar == goog.uri.utils.CharCode_.EQUAL || followingChar == goog.uri.utils.CharCode_.AMPERSAND || followingChar == goog.uri.utils.CharCode_.HASH) {
        return index;
      }
    }
    index += keyLength + 1;
  }
  return -1;
};
goog.uri.utils.hashOrEndRe_ = /#|$/;
goog.uri.utils.hasParam = function(uri, keyEncoded) {
  return goog.uri.utils.findParam_(uri, 0, keyEncoded, uri.search(goog.uri.utils.hashOrEndRe_)) >= 0;
};
goog.uri.utils.getParamValue = function(uri, keyEncoded) {
  var hashOrEndIndex = uri.search(goog.uri.utils.hashOrEndRe_);
  var foundIndex = goog.uri.utils.findParam_(uri, 0, keyEncoded, hashOrEndIndex);
  if (foundIndex < 0) {
    return null;
  } else {
    var endPosition = uri.indexOf("&", foundIndex);
    if (endPosition < 0 || endPosition > hashOrEndIndex) {
      endPosition = hashOrEndIndex;
    }
    foundIndex += keyEncoded.length + 1;
    return goog.string.urlDecode(uri.substr(foundIndex, endPosition - foundIndex));
  }
};
goog.uri.utils.getParamValues = function(uri, keyEncoded) {
  var hashOrEndIndex = uri.search(goog.uri.utils.hashOrEndRe_);
  var position = 0;
  var foundIndex;
  var result = [];
  while ((foundIndex = goog.uri.utils.findParam_(uri, position, keyEncoded, hashOrEndIndex)) >= 0) {
    position = uri.indexOf("&", foundIndex);
    if (position < 0 || position > hashOrEndIndex) {
      position = hashOrEndIndex;
    }
    foundIndex += keyEncoded.length + 1;
    result.push(goog.string.urlDecode(uri.substr(foundIndex, position - foundIndex)));
  }
  return result;
};
goog.uri.utils.trailingQueryPunctuationRe_ = /[?&]($|#)/;
goog.uri.utils.removeParam = function(uri, keyEncoded) {
  var hashOrEndIndex = uri.search(goog.uri.utils.hashOrEndRe_);
  var position = 0;
  var foundIndex;
  var buffer = [];
  while ((foundIndex = goog.uri.utils.findParam_(uri, position, keyEncoded, hashOrEndIndex)) >= 0) {
    buffer.push(uri.substring(position, foundIndex));
    position = Math.min(uri.indexOf("&", foundIndex) + 1 || hashOrEndIndex, hashOrEndIndex);
  }
  buffer.push(uri.substr(position));
  return buffer.join("").replace(goog.uri.utils.trailingQueryPunctuationRe_, "$1");
};
goog.uri.utils.setParam = function(uri, keyEncoded, value) {
  return goog.uri.utils.appendParam(goog.uri.utils.removeParam(uri, keyEncoded), keyEncoded, value);
};
goog.uri.utils.setParamsFromMap = function(uri, params) {
  var parts = goog.uri.utils.splitQueryData_(uri);
  var queryData = parts[1];
  var buffer = [];
  if (queryData) {
    goog.array.forEach(queryData.split("&"), function(pair) {
      var indexOfEquals = pair.indexOf("=");
      var name = indexOfEquals >= 0 ? pair.substr(0, indexOfEquals) : pair;
      if (!params.hasOwnProperty(name)) {
        buffer.push(pair);
      }
    });
  }
  parts[1] = goog.uri.utils.appendQueryData_(buffer.join("&"), goog.uri.utils.buildQueryDataFromMap(params));
  return goog.uri.utils.joinQueryData_(parts);
};
goog.uri.utils.appendPath = function(baseUri, path) {
  goog.uri.utils.assertNoFragmentsOrQueries_(baseUri);
  if (goog.string.endsWith(baseUri, "/")) {
    baseUri = baseUri.substr(0, baseUri.length - 1);
  }
  if (goog.string.startsWith(path, "/")) {
    path = path.substr(1);
  }
  return goog.string.buildString(baseUri, "/", path);
};
goog.uri.utils.setPath = function(uri, path) {
  if (!goog.string.startsWith(path, "/")) {
    path = "/" + path;
  }
  var parts = goog.uri.utils.split(uri);
  return goog.uri.utils.buildFromEncodedParts(parts[goog.uri.utils.ComponentIndex.SCHEME], parts[goog.uri.utils.ComponentIndex.USER_INFO], parts[goog.uri.utils.ComponentIndex.DOMAIN], parts[goog.uri.utils.ComponentIndex.PORT], path, parts[goog.uri.utils.ComponentIndex.QUERY_DATA], parts[goog.uri.utils.ComponentIndex.FRAGMENT]);
};
goog.uri.utils.StandardQueryParam = {RANDOM:"zx"};
goog.uri.utils.makeUnique = function(uri) {
  return goog.uri.utils.setParam(uri, goog.uri.utils.StandardQueryParam.RANDOM, goog.string.getRandomString());
};
goog.provide("goog.editor.Link");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.Range");
goog.require("goog.dom.TagName");
goog.require("goog.editor.BrowserFeature");
goog.require("goog.editor.Command");
goog.require("goog.editor.Field");
goog.require("goog.editor.node");
goog.require("goog.editor.range");
goog.require("goog.string");
goog.require("goog.string.Unicode");
goog.require("goog.uri.utils");
goog.require("goog.uri.utils.ComponentIndex");
goog.editor.Link = function(anchor, isNew) {
  this.anchor_ = anchor;
  this.isNew_ = isNew;
  this.extraAnchors_ = [];
};
goog.editor.Link.prototype.getAnchor = function() {
  return this.anchor_;
};
goog.editor.Link.prototype.getExtraAnchors = function() {
  return this.extraAnchors_;
};
goog.editor.Link.prototype.getCurrentText = function() {
  if (!this.currentText_) {
    var anchor = this.getAnchor();
    var leaf = goog.editor.node.getLeftMostLeaf(anchor);
    if (leaf.tagName && leaf.tagName == goog.dom.TagName.IMG) {
      this.currentText_ = leaf.getAttribute("alt");
    } else {
      this.currentText_ = goog.dom.getRawTextContent(this.getAnchor());
    }
  }
  return this.currentText_;
};
goog.editor.Link.prototype.isNew = function() {
  return this.isNew_;
};
goog.editor.Link.prototype.initializeUrl = function(url) {
  this.getAnchor().href = url;
};
goog.editor.Link.prototype.removeLink = function() {
  goog.dom.flattenElement(this.anchor_);
  this.anchor_ = null;
  while (this.extraAnchors_.length) {
    goog.dom.flattenElement(this.extraAnchors_.pop());
  }
};
goog.editor.Link.prototype.setTextAndUrl = function(newText, newUrl) {
  var anchor = this.getAnchor();
  anchor.href = newUrl;
  var currentText = this.getCurrentText();
  if (newText != currentText) {
    var leaf = goog.editor.node.getLeftMostLeaf(anchor);
    if (leaf.tagName && leaf.tagName == goog.dom.TagName.IMG) {
      leaf.setAttribute("alt", newText ? newText : "");
    } else {
      if (leaf.nodeType == goog.dom.NodeType.TEXT) {
        leaf = leaf.parentNode;
      }
      if (goog.dom.getRawTextContent(leaf) != currentText) {
        leaf = anchor;
      }
      goog.dom.removeChildren(leaf);
      var domHelper = goog.dom.getDomHelper(leaf);
      goog.dom.appendChild(leaf, domHelper.createTextNode(newText));
    }
    this.currentText_ = null;
  }
  this.isNew_ = false;
};
goog.editor.Link.prototype.placeCursorRightOf = function() {
  var anchor = this.getAnchor();
  if (goog.editor.BrowserFeature.GETS_STUCK_IN_LINKS) {
    var spaceNode;
    var nextSibling = anchor.nextSibling;
    if (nextSibling && nextSibling.nodeType == goog.dom.NodeType.TEXT && (goog.string.startsWith(nextSibling.data, goog.string.Unicode.NBSP) || goog.string.startsWith(nextSibling.data, " "))) {
      spaceNode = nextSibling;
    } else {
      var dh = goog.dom.getDomHelper(anchor);
      spaceNode = dh.createTextNode(goog.string.Unicode.NBSP);
      goog.dom.insertSiblingAfter(spaceNode, anchor);
    }
    var range = goog.dom.Range.createCaret(spaceNode, 1);
    range.select();
  } else {
    goog.editor.range.placeCursorNextTo(anchor, false);
  }
};
goog.editor.Link.prototype.updateLinkDisplay_ = function(field, url) {
  this.initializeUrl(url);
  this.placeCursorRightOf();
  field.execCommand(goog.editor.Command.UPDATE_LINK_BUBBLE);
};
goog.editor.Link.prototype.getValidLinkFromText = function() {
  var text = goog.string.trim(this.getCurrentText());
  if (goog.editor.Link.isLikelyUrl(text)) {
    if (text.search(/:/) < 0) {
      return "http://" + goog.string.trimLeft(text);
    }
    return text;
  } else {
    if (goog.editor.Link.isLikelyEmailAddress(text)) {
      return "mailto:" + text;
    }
  }
  return null;
};
goog.editor.Link.prototype.finishLinkCreation = function(field) {
  var linkFromText = this.getValidLinkFromText();
  if (linkFromText) {
    this.updateLinkDisplay_(field, linkFromText);
  } else {
    field.execCommand(goog.editor.Command.MODAL_LINK_EDITOR, this);
  }
};
goog.editor.Link.createNewLink = function(anchor, url, opt_target, opt_extraAnchors) {
  var link = new goog.editor.Link(anchor, true);
  link.initializeUrl(url);
  if (opt_target) {
    anchor.target = opt_target;
  }
  if (opt_extraAnchors) {
    link.extraAnchors_ = opt_extraAnchors;
  }
  return link;
};
goog.editor.Link.createNewLinkFromText = function(anchor, opt_target) {
  var link = new goog.editor.Link(anchor, true);
  var text = link.getValidLinkFromText();
  link.initializeUrl(text ? text : "");
  if (opt_target) {
    anchor.target = opt_target;
  }
  return link;
};
goog.editor.Link.isLikelyUrl = function(str) {
  if (/\s/.test(str)) {
    return false;
  }
  if (goog.editor.Link.isLikelyEmailAddress(str)) {
    return false;
  }
  var addedScheme = false;
  if (!/^[^:\/?#.]+:/.test(str)) {
    str = "http://" + str;
    addedScheme = true;
  }
  var parts = goog.uri.utils.split(str);
  var scheme = parts[goog.uri.utils.ComponentIndex.SCHEME];
  if (goog.array.indexOf(["mailto", "aim"], scheme) != -1) {
    return true;
  }
  var domain = parts[goog.uri.utils.ComponentIndex.DOMAIN];
  if (!domain || addedScheme && domain.indexOf(".") == -1 || /[^\w\d\-\u0100-\uffff.%]/.test(domain)) {
    return false;
  }
  var path = parts[goog.uri.utils.ComponentIndex.PATH];
  return !path || path.indexOf("/") == 0;
};
goog.editor.Link.LIKELY_EMAIL_ADDRESS_ = new RegExp("^" + "[\\w-]+(\\.[\\w-]+)*" + "\\@" + "([\\w-]+\\.)+" + "(\\d+|\\w\\w+)$", "i");
goog.editor.Link.isLikelyEmailAddress = function(str) {
  return goog.editor.Link.LIKELY_EMAIL_ADDRESS_.test(str);
};
goog.editor.Link.isMailto = function(url) {
  return !!url && goog.string.startsWith(url, "mailto:");
};
goog.provide("goog.ui.editor.messages");
goog.require("goog.html.uncheckedconversions");
goog.require("goog.string.Const");
goog.ui.editor.messages.MSG_LINK_CAPTION = goog.getMsg("Link");
goog.ui.editor.messages.MSG_EDIT_LINK = goog.getMsg("Edit Link");
goog.ui.editor.messages.MSG_TEXT_TO_DISPLAY = goog.getMsg("Text to display:");
goog.ui.editor.messages.MSG_LINK_TO = goog.getMsg("Link to:");
goog.ui.editor.messages.MSG_ON_THE_WEB = goog.getMsg("Web address");
goog.ui.editor.messages.MSG_ON_THE_WEB_TIP = goog.getMsg("Link to a page or file somewhere else on the web");
goog.ui.editor.messages.MSG_TEST_THIS_LINK = goog.getMsg("Test this link");
goog.ui.editor.messages.MSG_TR_LINK_EXPLANATION = goog.getMsg("{$startBold}Not sure what to put in the box?{$endBold} " + "First, find the page on the web that you want to " + "link to. (A {$searchEngineLink}search engine{$endLink} " + "might be useful.) Then, copy the web address from " + "the box in your browser's address bar, and paste it into " + "the box above.", {"startBold":"<b>", "endBold":"</b>", "searchEngineLink":"<a href='http://www.google.com/' target='_new'>", "endLink":"</a>"});
goog.ui.editor.messages.getTrLinkExplanationSafeHtml = function() {
  return goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Parameterless translation"), goog.ui.editor.messages.MSG_TR_LINK_EXPLANATION);
};
goog.ui.editor.messages.MSG_WHAT_URL = goog.getMsg("To what URL should this link go?");
goog.ui.editor.messages.MSG_EMAIL_ADDRESS = goog.getMsg("Email address");
goog.ui.editor.messages.MSG_EMAIL_ADDRESS_TIP = goog.getMsg("Link to an email address");
goog.ui.editor.messages.MSG_INVALID_EMAIL = goog.getMsg("Invalid email address");
goog.ui.editor.messages.MSG_WHAT_EMAIL = goog.getMsg("To what email address should this link?");
goog.ui.editor.messages.MSG_EMAIL_EXPLANATION = goog.getMsg("{$preb}Be careful.{$postb} " + "Remember that any time you include an email address on a web page, " + "nasty spammers can find it too.", {"preb":"<b>", "postb":"</b>"});
goog.ui.editor.messages.getEmailExplanationSafeHtml = function() {
  return goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Parameterless translation"), goog.ui.editor.messages.MSG_EMAIL_EXPLANATION);
};
goog.ui.editor.messages.MSG_OPEN_IN_NEW_WINDOW = goog.getMsg("Open this link in a new window");
goog.ui.editor.messages.MSG_IMAGE_CAPTION = goog.getMsg("Image");
goog.provide("goog.editor.plugins.BasicTextFormatter");
goog.provide("goog.editor.plugins.BasicTextFormatter.COMMAND");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.Range");
goog.require("goog.dom.TagName");
goog.require("goog.editor.BrowserFeature");
goog.require("goog.editor.Command");
goog.require("goog.editor.Link");
goog.require("goog.editor.Plugin");
goog.require("goog.editor.node");
goog.require("goog.editor.range");
goog.require("goog.editor.style");
goog.require("goog.iter");
goog.require("goog.iter.StopIteration");
goog.require("goog.log");
goog.require("goog.object");
goog.require("goog.string");
goog.require("goog.string.Unicode");
goog.require("goog.style");
goog.require("goog.ui.editor.messages");
goog.require("goog.userAgent");
goog.editor.plugins.BasicTextFormatter = function() {
  goog.editor.Plugin.call(this);
};
goog.inherits(goog.editor.plugins.BasicTextFormatter, goog.editor.Plugin);
goog.editor.plugins.BasicTextFormatter.prototype.getTrogClassId = function() {
  return "BTF";
};
goog.editor.plugins.BasicTextFormatter.prototype.logger = goog.log.getLogger("goog.editor.plugins.BasicTextFormatter");
goog.editor.plugins.BasicTextFormatter.COMMAND = {LINK:"+link", CREATE_LINK:"+createLink", FORMAT_BLOCK:"+formatBlock", INDENT:"+indent", OUTDENT:"+outdent", STRIKE_THROUGH:"+strikeThrough", HORIZONTAL_RULE:"+insertHorizontalRule", SUBSCRIPT:"+subscript", SUPERSCRIPT:"+superscript", UNDERLINE:"+underline", BOLD:"+bold", ITALIC:"+italic", FONT_SIZE:"+fontSize", FONT_FACE:"+fontName", FONT_COLOR:"+foreColor", BACKGROUND_COLOR:"+backColor", ORDERED_LIST:"+insertOrderedList", UNORDERED_LIST:"+insertUnorderedList", 
JUSTIFY_CENTER:"+justifyCenter", JUSTIFY_FULL:"+justifyFull", JUSTIFY_RIGHT:"+justifyRight", JUSTIFY_LEFT:"+justifyLeft"};
goog.editor.plugins.BasicTextFormatter.SUPPORTED_COMMANDS_ = goog.object.transpose(goog.editor.plugins.BasicTextFormatter.COMMAND);
goog.editor.plugins.BasicTextFormatter.prototype.isSupportedCommand = function(command) {
  return command in goog.editor.plugins.BasicTextFormatter.SUPPORTED_COMMANDS_;
};
goog.editor.plugins.BasicTextFormatter.SILENT_COMMANDS_ = [goog.editor.plugins.BasicTextFormatter.COMMAND.CREATE_LINK];
goog.editor.plugins.BasicTextFormatter.prototype.isSilentCommand = function(command) {
  return goog.array.contains(goog.editor.plugins.BasicTextFormatter.SILENT_COMMANDS_, command);
};
goog.editor.plugins.BasicTextFormatter.prototype.getRange_ = function() {
  return this.getFieldObject().getRange();
};
goog.editor.plugins.BasicTextFormatter.prototype.getDocument_ = function() {
  return this.getFieldDomHelper().getDocument();
};
goog.editor.plugins.BasicTextFormatter.prototype.execCommandInternal = function(command, var_args) {
  var preserveDir, styleWithCss, needsFormatBlockDiv, hasDummySelection;
  var result;
  var opt_arg = arguments[1];
  switch(command) {
    case goog.editor.plugins.BasicTextFormatter.COMMAND.BACKGROUND_COLOR:
      if (!goog.isNull(opt_arg)) {
        if (goog.editor.BrowserFeature.EATS_EMPTY_BACKGROUND_COLOR) {
          this.applyBgColorManually_(opt_arg);
        } else {
          if (goog.userAgent.OPERA) {
            this.execCommandHelper_("hiliteColor", opt_arg);
          } else {
            this.execCommandHelper_(command, opt_arg);
          }
        }
      }
      break;
    case goog.editor.plugins.BasicTextFormatter.COMMAND.CREATE_LINK:
      result = this.createLink_(arguments[1], arguments[2], arguments[3]);
      break;
    case goog.editor.plugins.BasicTextFormatter.COMMAND.LINK:
      result = this.toggleLink_(opt_arg);
      break;
    case goog.editor.plugins.BasicTextFormatter.COMMAND.JUSTIFY_CENTER:
    case goog.editor.plugins.BasicTextFormatter.COMMAND.JUSTIFY_FULL:
    case goog.editor.plugins.BasicTextFormatter.COMMAND.JUSTIFY_RIGHT:
    case goog.editor.plugins.BasicTextFormatter.COMMAND.JUSTIFY_LEFT:
      this.justify_(command);
      break;
    default:
      if (goog.userAgent.IE && command == goog.editor.plugins.BasicTextFormatter.COMMAND.FORMAT_BLOCK && opt_arg) {
        opt_arg = "<" + opt_arg + ">";
      }
      if (command == goog.editor.plugins.BasicTextFormatter.COMMAND.FONT_COLOR && goog.isNull(opt_arg)) {
        break;
      }
      switch(command) {
        case goog.editor.plugins.BasicTextFormatter.COMMAND.INDENT:
        case goog.editor.plugins.BasicTextFormatter.COMMAND.OUTDENT:
          if (goog.editor.BrowserFeature.HAS_STYLE_WITH_CSS) {
            if (goog.userAgent.GECKO) {
              styleWithCss = true;
            }
            if (goog.userAgent.OPERA) {
              if (command == goog.editor.plugins.BasicTextFormatter.COMMAND.OUTDENT) {
                styleWithCss = !this.getDocument_().queryCommandEnabled("outdent");
              } else {
                styleWithCss = true;
              }
            }
          }
        case goog.editor.plugins.BasicTextFormatter.COMMAND.ORDERED_LIST:
        case goog.editor.plugins.BasicTextFormatter.COMMAND.UNORDERED_LIST:
          if (goog.editor.BrowserFeature.LEAVES_P_WHEN_REMOVING_LISTS && this.queryCommandStateInternal_(this.getDocument_(), command)) {
            needsFormatBlockDiv = this.getFieldObject().queryCommandValue(goog.editor.Command.DEFAULT_TAG) != goog.dom.TagName.P;
          } else {
            if (!goog.editor.BrowserFeature.CAN_LISTIFY_BR) {
              this.convertBreaksToDivs_();
            }
          }
          if (goog.userAgent.GECKO && goog.editor.BrowserFeature.FORGETS_FORMATTING_WHEN_LISTIFYING && !this.queryCommandValue(command)) {
            hasDummySelection |= this.beforeInsertListGecko_();
          }
        case goog.editor.plugins.BasicTextFormatter.COMMAND.FORMAT_BLOCK:
          preserveDir = !!this.getFieldObject().getPluginByClassId("Bidi");
          break;
        case goog.editor.plugins.BasicTextFormatter.COMMAND.SUBSCRIPT:
        case goog.editor.plugins.BasicTextFormatter.COMMAND.SUPERSCRIPT:
          if (goog.editor.BrowserFeature.NESTS_SUBSCRIPT_SUPERSCRIPT) {
            this.applySubscriptSuperscriptWorkarounds_(command);
          }
          break;
        case goog.editor.plugins.BasicTextFormatter.COMMAND.UNDERLINE:
        case goog.editor.plugins.BasicTextFormatter.COMMAND.BOLD:
        case goog.editor.plugins.BasicTextFormatter.COMMAND.ITALIC:
          styleWithCss = goog.userAgent.GECKO && goog.editor.BrowserFeature.HAS_STYLE_WITH_CSS && this.queryCommandValue(command);
          break;
        case goog.editor.plugins.BasicTextFormatter.COMMAND.FONT_COLOR:
        case goog.editor.plugins.BasicTextFormatter.COMMAND.FONT_FACE:
          styleWithCss = goog.editor.BrowserFeature.HAS_STYLE_WITH_CSS && goog.userAgent.GECKO;
      }this.execCommandHelper_(command, opt_arg, preserveDir, !!styleWithCss);
      if (hasDummySelection) {
        this.getDocument_().execCommand("Delete", false, true);
      }
      if (needsFormatBlockDiv) {
        this.getDocument_().execCommand("FormatBlock", false, "<div>");
      }
  }
  if (goog.userAgent.GECKO && !this.getFieldObject().inModalMode()) {
    this.focusField_();
  }
  return result;
};
goog.editor.plugins.BasicTextFormatter.prototype.focusField_ = function() {
  this.getFieldDomHelper().getWindow().focus();
};
goog.editor.plugins.BasicTextFormatter.prototype.queryCommandValue = function(command) {
  var styleWithCss;
  switch(command) {
    case goog.editor.plugins.BasicTextFormatter.COMMAND.LINK:
      return this.isNodeInState_(goog.dom.TagName.A);
    case goog.editor.plugins.BasicTextFormatter.COMMAND.JUSTIFY_CENTER:
    case goog.editor.plugins.BasicTextFormatter.COMMAND.JUSTIFY_FULL:
    case goog.editor.plugins.BasicTextFormatter.COMMAND.JUSTIFY_RIGHT:
    case goog.editor.plugins.BasicTextFormatter.COMMAND.JUSTIFY_LEFT:
      return this.isJustification_(command);
    case goog.editor.plugins.BasicTextFormatter.COMMAND.FORMAT_BLOCK:
      return goog.editor.plugins.BasicTextFormatter.getSelectionBlockState_(this.getFieldObject().getRange());
    case goog.editor.plugins.BasicTextFormatter.COMMAND.INDENT:
    case goog.editor.plugins.BasicTextFormatter.COMMAND.OUTDENT:
    case goog.editor.plugins.BasicTextFormatter.COMMAND.HORIZONTAL_RULE:
      return false;
    case goog.editor.plugins.BasicTextFormatter.COMMAND.FONT_SIZE:
    case goog.editor.plugins.BasicTextFormatter.COMMAND.FONT_FACE:
    case goog.editor.plugins.BasicTextFormatter.COMMAND.FONT_COLOR:
    case goog.editor.plugins.BasicTextFormatter.COMMAND.BACKGROUND_COLOR:
      return this.queryCommandValueInternal_(this.getDocument_(), command, goog.editor.BrowserFeature.HAS_STYLE_WITH_CSS && goog.userAgent.GECKO);
    case goog.editor.plugins.BasicTextFormatter.COMMAND.UNDERLINE:
    case goog.editor.plugins.BasicTextFormatter.COMMAND.BOLD:
    case goog.editor.plugins.BasicTextFormatter.COMMAND.ITALIC:
      styleWithCss = goog.editor.BrowserFeature.HAS_STYLE_WITH_CSS && goog.userAgent.GECKO;
    default:
      return this.queryCommandStateInternal_(this.getDocument_(), command, styleWithCss);
  }
};
goog.editor.plugins.BasicTextFormatter.prototype.prepareContentsHtml = function(html) {
  if (goog.editor.BrowserFeature.COLLAPSES_EMPTY_NODES && html.match(/^\s*<script/i)) {
    html = "&nbsp;" + html;
  }
  if (goog.editor.BrowserFeature.CONVERT_TO_B_AND_I_TAGS) {
    html = html.replace(/<(\/?)strong([^\w])/gi, "<$1b$2");
    html = html.replace(/<(\/?)em([^\w])/gi, "<$1i$2");
  }
  return html;
};
goog.editor.plugins.BasicTextFormatter.prototype.cleanContentsDom = function(fieldCopy) {
  var images = goog.dom.getElementsByTagName(goog.dom.TagName.IMG, fieldCopy);
  for (var i = 0, image; image = images[i]; i++) {
    if (goog.editor.BrowserFeature.SHOWS_CUSTOM_ATTRS_IN_INNER_HTML) {
      image.removeAttribute("tabIndex");
      image.removeAttribute("tabIndexSet");
      goog.removeUid(image);
      image.oldTabIndex;
      if (image.oldTabIndex) {
        image.tabIndex = image.oldTabIndex;
      }
    }
  }
};
goog.editor.plugins.BasicTextFormatter.prototype.cleanContentsHtml = function(html) {
  if (goog.editor.BrowserFeature.MOVES_STYLE_TO_HEAD) {
    var heads = this.getFieldObject().getEditableDomHelper().getElementsByTagNameAndClass(goog.dom.TagName.HEAD);
    var stylesHtmlArr = [];
    var numHeads = heads.length;
    for (var i = 1; i < numHeads; ++i) {
      var styles = goog.dom.getElementsByTagName(goog.dom.TagName.STYLE, heads[i]);
      var numStyles = styles.length;
      for (var j = 0; j < numStyles; ++j) {
        stylesHtmlArr.push(styles[j].outerHTML);
      }
    }
    return stylesHtmlArr.join("") + html;
  }
  return html;
};
goog.editor.plugins.BasicTextFormatter.prototype.handleKeyboardShortcut = function(e, key, isModifierPressed) {
  if (!isModifierPressed) {
    return false;
  }
  var command;
  switch(key) {
    case "b":
      command = goog.editor.plugins.BasicTextFormatter.COMMAND.BOLD;
      break;
    case "i":
      command = goog.editor.plugins.BasicTextFormatter.COMMAND.ITALIC;
      break;
    case "u":
      command = goog.editor.plugins.BasicTextFormatter.COMMAND.UNDERLINE;
      break;
    case "s":
      return true;
  }
  if (command) {
    this.getFieldObject().execCommand(command);
    return true;
  }
  return false;
};
goog.editor.plugins.BasicTextFormatter.BR_REGEXP_ = goog.userAgent.IE ? /<br([^\/>]*)\/?>/gi : /<br([^\/>]*)\/?>(?!<\/(div|p)>)/gi;
goog.editor.plugins.BasicTextFormatter.prototype.convertBreaksToDivs_ = function() {
  if (!goog.userAgent.IE && !goog.userAgent.OPERA) {
    return false;
  }
  var range = this.getRange_();
  var parent = range.getContainerElement();
  var doc = this.getDocument_();
  var dom = this.getFieldDomHelper();
  goog.editor.plugins.BasicTextFormatter.BR_REGEXP_.lastIndex = 0;
  if (goog.editor.plugins.BasicTextFormatter.BR_REGEXP_.test(parent.innerHTML)) {
    var savedRange = range.saveUsingCarets();
    if (parent.tagName == goog.dom.TagName.P) {
      goog.editor.plugins.BasicTextFormatter.convertParagraphToDiv_(parent, true);
    } else {
      var attribute = "trtempbr";
      var value = "temp_br";
      var newHtml = parent.innerHTML.replace(goog.editor.plugins.BasicTextFormatter.BR_REGEXP_, "<p$1 " + attribute + '="' + value + '">');
      goog.editor.node.replaceInnerHtml(parent, newHtml);
      var paragraphs = goog.array.toArray(goog.dom.getElementsByTagName(goog.dom.TagName.P, parent));
      goog.iter.forEach(paragraphs, function(paragraph) {
        if (paragraph.getAttribute(attribute) == value) {
          paragraph.removeAttribute(attribute);
          if (goog.string.isBreakingWhitespace(goog.dom.getTextContent(paragraph))) {
            var child = goog.userAgent.IE ? doc.createTextNode(goog.string.Unicode.NBSP) : dom.createElement(goog.dom.TagName.BR);
            paragraph.appendChild(child);
          }
          goog.editor.plugins.BasicTextFormatter.convertParagraphToDiv_(paragraph);
        }
      });
    }
    savedRange.restore();
    return true;
  }
  return false;
};
goog.editor.plugins.BasicTextFormatter.convertParagraphToDiv_ = function(paragraph, opt_convertBrs) {
  if (!goog.userAgent.IE && !goog.userAgent.OPERA) {
    return;
  }
  var outerHTML = paragraph.outerHTML.replace(/<(\/?)p/gi, "<$1div");
  if (opt_convertBrs) {
    outerHTML = outerHTML.replace(goog.editor.plugins.BasicTextFormatter.BR_REGEXP_, "</div><div$1>");
  }
  if (goog.userAgent.OPERA && !/<\/div>$/i.test(outerHTML)) {
    outerHTML += "</div>";
  }
  paragraph.outerHTML = outerHTML;
};
goog.editor.plugins.BasicTextFormatter.convertToRealExecCommand_ = function(command) {
  return command.indexOf("+") == 0 ? command.substring(1) : command;
};
goog.editor.plugins.BasicTextFormatter.prototype.justify_ = function(command) {
  this.execCommandHelper_(command, null, false, true);
  if (goog.userAgent.GECKO) {
    this.execCommandHelper_(command, null, false, true);
  }
  if (!(goog.editor.BrowserFeature.HAS_STYLE_WITH_CSS && goog.userAgent.GECKO)) {
    goog.iter.forEach(this.getFieldObject().getRange(), goog.editor.plugins.BasicTextFormatter.convertContainerToTextAlign_);
  }
};
goog.editor.plugins.BasicTextFormatter.convertContainerToTextAlign_ = function(node) {
  var container = goog.editor.style.getContainer(node);
  if (container.align) {
    container.style.textAlign = container.align;
    container.removeAttribute("align");
  }
};
goog.editor.plugins.BasicTextFormatter.prototype.execCommandHelper_ = function(command, opt_value, opt_preserveDir, opt_styleWithCss) {
  var dir = null;
  if (opt_preserveDir) {
    dir = this.getFieldObject().queryCommandValue(goog.editor.Command.DIR_RTL) ? "rtl" : this.getFieldObject().queryCommandValue(goog.editor.Command.DIR_LTR) ? "ltr" : null;
  }
  command = goog.editor.plugins.BasicTextFormatter.convertToRealExecCommand_(command);
  var endDiv, nbsp;
  if (goog.userAgent.IE) {
    var ret = this.applyExecCommandIEFixes_(command);
    endDiv = ret[0];
    nbsp = ret[1];
  }
  if (goog.userAgent.WEBKIT) {
    endDiv = this.applyExecCommandSafariFixes_(command);
  }
  if (goog.userAgent.GECKO) {
    this.applyExecCommandGeckoFixes_(command);
  }
  if (goog.editor.BrowserFeature.DOESNT_OVERRIDE_FONT_SIZE_IN_STYLE_ATTR && command.toLowerCase() == "fontsize") {
    this.removeFontSizeFromStyleAttrs_();
  }
  var doc = this.getDocument_();
  if (opt_styleWithCss && goog.editor.BrowserFeature.HAS_STYLE_WITH_CSS) {
    doc.execCommand("styleWithCSS", false, true);
    if (goog.userAgent.OPERA) {
      this.invalidateInlineCss_();
    }
  }
  doc.execCommand(command, false, opt_value);
  if (opt_styleWithCss && goog.editor.BrowserFeature.HAS_STYLE_WITH_CSS) {
    doc.execCommand("styleWithCSS", false, false);
  }
  if (goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher("526") && command.toLowerCase() == "formatblock" && opt_value && /^[<]?h\d[>]?$/i.test(opt_value)) {
    this.cleanUpSafariHeadings_();
  }
  if (/insert(un)?orderedlist/i.test(command)) {
    if (goog.userAgent.WEBKIT && !goog.userAgent.isVersionOrHigher(534)) {
      this.fixSafariLists_();
    }
    if (goog.userAgent.IE) {
      this.fixIELists_();
      if (nbsp) {
        goog.dom.removeNode(nbsp);
      }
    }
  }
  if (endDiv) {
    goog.dom.removeNode(endDiv);
  }
  if (dir) {
    this.getFieldObject().execCommand(dir);
  }
};
goog.editor.plugins.BasicTextFormatter.prototype.applyBgColorManually_ = function(bgColor) {
  var needsSpaceInTextNode = goog.userAgent.GECKO;
  var range = this.getFieldObject().getRange();
  var textNode;
  var parentTag;
  if (range && range.isCollapsed()) {
    textNode = this.getFieldDomHelper().createTextNode(needsSpaceInTextNode ? " " : "");
    var containerNode = range.getStartNode();
    parentTag = containerNode.nodeType == goog.dom.NodeType.ELEMENT ? containerNode : containerNode.parentNode;
    if (parentTag.innerHTML == "") {
      parentTag.style.textIndent = "-10000px";
      parentTag.appendChild(textNode);
    } else {
      parentTag = this.getFieldDomHelper().createDom(goog.dom.TagName.SPAN, {"style":"text-indent:-10000px"}, textNode);
      range.replaceContentsWithNode(parentTag);
    }
    goog.dom.Range.createFromNodeContents(textNode).select();
  }
  this.execCommandHelper_("hiliteColor", bgColor, false, true);
  if (textNode) {
    if (needsSpaceInTextNode) {
      textNode.data = "";
    }
    parentTag.style.textIndent = "";
  }
};
goog.editor.plugins.BasicTextFormatter.prototype.toggleLink_ = function(opt_target) {
  if (!this.getFieldObject().isSelectionEditable()) {
    this.focusField_();
  }
  var range = this.getRange_();
  var parent = range && range.getContainerElement();
  var link = goog.dom.getAncestorByTagNameAndClass(parent, goog.dom.TagName.A);
  if (link && goog.editor.node.isEditable(link)) {
    goog.dom.flattenElement(link);
  } else {
    var editableLink = this.createLink_(range, "/", opt_target);
    if (editableLink) {
      if (!this.getFieldObject().execCommand(goog.editor.Command.MODAL_LINK_EDITOR, editableLink)) {
        var url = this.getFieldObject().getAppWindow().prompt(goog.ui.editor.messages.MSG_LINK_TO, "http://");
        if (url) {
          editableLink.setTextAndUrl(editableLink.getCurrentText() || url, url);
          editableLink.placeCursorRightOf();
        } else {
          var savedRange = goog.editor.range.saveUsingNormalizedCarets(goog.dom.Range.createFromNodeContents(editableLink.getAnchor()));
          editableLink.removeLink();
          savedRange.restore().select();
          return null;
        }
      }
      return editableLink;
    }
  }
  return null;
};
goog.editor.plugins.BasicTextFormatter.prototype.createLink_ = function(range, url, opt_target) {
  var anchor = null;
  var anchors = [];
  var parent = range && range.getContainerElement();
  if (parent && parent.tagName == goog.dom.TagName.IMG) {
    return null;
  }
  if (!range) {
    return null;
  }
  if (range.isCollapsed()) {
    var textRange = range.getTextRange(0).getBrowserRangeObject();
    if (goog.editor.BrowserFeature.HAS_W3C_RANGES) {
      anchor = this.getFieldDomHelper().createElement(goog.dom.TagName.A);
      textRange.insertNode(anchor);
    } else {
      if (goog.editor.BrowserFeature.HAS_IE_RANGES) {
        textRange.pasteHTML("<a id='newLink'></a>");
        anchor = this.getFieldDomHelper().getElement("newLink");
        anchor.removeAttribute("id");
      }
    }
  } else {
    var uniqueId = goog.string.createUniqueString();
    this.execCommandHelper_("CreateLink", uniqueId);
    var setHrefAndLink = function(element, index, arr) {
      if (goog.string.endsWith(element.href, uniqueId)) {
        anchors.push(element);
      }
    };
    goog.array.forEach(goog.dom.getElementsByTagName(goog.dom.TagName.A, this.getFieldObject().getElement()), setHrefAndLink);
    if (anchors.length) {
      anchor = anchors.pop();
    }
    var isLikelyUrl = function(a, i, anchors) {
      return goog.editor.Link.isLikelyUrl(goog.dom.getRawTextContent(a));
    };
    if (anchors.length && goog.array.every(anchors, isLikelyUrl)) {
      for (var i = 0, a; a = anchors[i]; i++) {
        goog.editor.Link.createNewLinkFromText(a, opt_target);
      }
      anchors = null;
    }
  }
  return goog.editor.Link.createNewLink(anchor, url, opt_target, anchors);
};
goog.editor.plugins.BasicTextFormatter.brokenExecCommandsIE_ = {"indent":1, "outdent":1, "insertOrderedList":1, "insertUnorderedList":1, "justifyCenter":1, "justifyFull":1, "justifyRight":1, "justifyLeft":1, "ltr":1, "rtl":1};
goog.editor.plugins.BasicTextFormatter.blockquoteHatingCommandsIE_ = {"insertOrderedList":1, "insertUnorderedList":1};
goog.editor.plugins.BasicTextFormatter.prototype.applySubscriptSuperscriptWorkarounds_ = function(command) {
  if (!this.queryCommandValue(command)) {
    var oppositeCommand = command == goog.editor.plugins.BasicTextFormatter.COMMAND.SUBSCRIPT ? goog.editor.plugins.BasicTextFormatter.COMMAND.SUPERSCRIPT : goog.editor.plugins.BasicTextFormatter.COMMAND.SUBSCRIPT;
    var oppositeExecCommand = goog.editor.plugins.BasicTextFormatter.convertToRealExecCommand_(oppositeCommand);
    if (!this.queryCommandValue(oppositeCommand)) {
      this.getDocument_().execCommand(oppositeExecCommand, false, null);
    }
    this.getDocument_().execCommand(oppositeExecCommand, false, null);
  }
};
goog.editor.plugins.BasicTextFormatter.prototype.removeFontSizeFromStyleAttrs_ = function() {
  var range = goog.editor.range.expand(this.getFieldObject().getRange(), this.getFieldObject().getElement());
  goog.iter.forEach(goog.iter.filter(range, function(tag, dummy, iter) {
    return iter.isStartTag() && range.containsNode(tag);
  }), function(node) {
    goog.style.setStyle(node, "font-size", "");
    if (goog.userAgent.GECKO && node.style.length == 0 && node.getAttribute("style") != null) {
      node.removeAttribute("style");
    }
  });
};
goog.editor.plugins.BasicTextFormatter.prototype.applyExecCommandIEFixes_ = function(command) {
  var toRemove = [];
  var endDiv = null;
  var range = this.getRange_();
  var dh = this.getFieldDomHelper();
  if (command in goog.editor.plugins.BasicTextFormatter.blockquoteHatingCommandsIE_) {
    var parent = range && range.getContainerElement();
    if (parent) {
      var blockquotes = goog.dom.getElementsByTagNameAndClass(goog.dom.TagName.BLOCKQUOTE, null, parent);
      var bq;
      for (var i = 0; i < blockquotes.length; i++) {
        if (range.containsNode(blockquotes[i])) {
          bq = blockquotes[i];
          break;
        }
      }
      var bqThatNeedsDummyDiv = bq || goog.dom.getAncestorByTagNameAndClass(parent, goog.dom.TagName.BLOCKQUOTE);
      if (bqThatNeedsDummyDiv) {
        endDiv = dh.createDom(goog.dom.TagName.DIV, {style:"height:0"});
        goog.dom.appendChild(bqThatNeedsDummyDiv, endDiv);
        toRemove.push(endDiv);
        if (bq) {
          range = goog.dom.Range.createFromNodes(bq, 0, endDiv, 0);
        } else {
          if (range.containsNode(endDiv)) {
            range = goog.dom.Range.createFromNodes(range.getStartNode(), range.getStartOffset(), endDiv, 0);
          }
        }
        range.select();
      }
    }
  }
  var fieldObject = this.getFieldObject();
  if (!fieldObject.usesIframe() && !endDiv) {
    if (command in goog.editor.plugins.BasicTextFormatter.brokenExecCommandsIE_) {
      var field = fieldObject.getElement();
      if (range && range.isCollapsed() && !goog.dom.getFirstElementChild(field)) {
        var selection = range.getTextRange(0).getBrowserRangeObject();
        var testRange = selection.duplicate();
        testRange.moveToElementText(field);
        testRange.collapse(false);
        if (testRange.isEqual(selection)) {
          var nbsp = dh.createTextNode(goog.string.Unicode.NBSP);
          field.appendChild(nbsp);
          selection.move("character", 1);
          selection.move("character", -1);
          selection.select();
          toRemove.push(nbsp);
        }
      }
      endDiv = dh.createDom(goog.dom.TagName.DIV, {style:"height:0"});
      goog.dom.appendChild(field, endDiv);
      toRemove.push(endDiv);
    }
  }
  return toRemove;
};
goog.editor.plugins.BasicTextFormatter.prototype.cleanUpSafariHeadings_ = function() {
  goog.iter.forEach(this.getRange_(), function(node) {
    if (node.className == "Apple-style-span") {
      node.style.fontSize = "";
      node.style.fontWeight = "";
    }
  });
};
goog.editor.plugins.BasicTextFormatter.prototype.fixSafariLists_ = function() {
  var previousList = false;
  goog.iter.forEach(this.getRange_(), function(node) {
    var tagName = node.tagName;
    if (tagName == goog.dom.TagName.UL || tagName == goog.dom.TagName.OL) {
      if (!previousList) {
        previousList = true;
        return;
      }
      var previousElementSibling = goog.dom.getPreviousElementSibling(node);
      if (!previousElementSibling) {
        return;
      }
      var range = node.ownerDocument.createRange();
      range.setStartAfter(previousElementSibling);
      range.setEndBefore(node);
      if (!goog.string.isEmptyOrWhitespace(range.toString())) {
        return;
      }
      if (previousElementSibling.nodeName == node.nodeName) {
        while (previousElementSibling.lastChild) {
          node.insertBefore(previousElementSibling.lastChild, node.firstChild);
        }
        previousElementSibling.parentNode.removeChild(previousElementSibling);
      }
    }
  });
};
goog.editor.plugins.BasicTextFormatter.orderedListTypes_ = {1:1, "a":1, "A":1, "i":1, "I":1};
goog.editor.plugins.BasicTextFormatter.unorderedListTypes_ = {"disc":1, "circle":1, "square":1};
goog.editor.plugins.BasicTextFormatter.prototype.fixIELists_ = function() {
  var range = this.getRange_();
  var container = range && range.getContainer();
  while (container && container.tagName != goog.dom.TagName.UL && container.tagName != goog.dom.TagName.OL) {
    container = container.parentNode;
  }
  if (container) {
    container = container.parentNode;
  }
  if (!container) {
    return;
  }
  var lists = goog.array.toArray(goog.dom.getElementsByTagName(goog.dom.TagName.UL, container));
  goog.array.extend(lists, goog.array.toArray(goog.dom.getElementsByTagName(goog.dom.TagName.OL, container)));
  goog.array.forEach(lists, function(node) {
    var type = node.type;
    if (type) {
      var saneTypes = node.tagName == goog.dom.TagName.UL ? goog.editor.plugins.BasicTextFormatter.unorderedListTypes_ : goog.editor.plugins.BasicTextFormatter.orderedListTypes_;
      if (!saneTypes[type]) {
        node.type = "";
      }
    }
  });
};
goog.editor.plugins.BasicTextFormatter.brokenExecCommandsSafari_ = {"justifyCenter":1, "justifyFull":1, "justifyRight":1, "justifyLeft":1, "formatBlock":1};
goog.editor.plugins.BasicTextFormatter.hangingExecCommandWebkit_ = {"insertOrderedList":1, "insertUnorderedList":1};
goog.editor.plugins.BasicTextFormatter.prototype.applyExecCommandSafariFixes_ = function(command) {
  var div;
  if (goog.editor.plugins.BasicTextFormatter.brokenExecCommandsSafari_[command]) {
    div = this.getFieldDomHelper().createDom(goog.dom.TagName.DIV, {"style":"height: 0"}, "x");
    goog.dom.appendChild(this.getFieldObject().getElement(), div);
  }
  if (!goog.userAgent.isVersionOrHigher(534) && goog.editor.plugins.BasicTextFormatter.hangingExecCommandWebkit_[command]) {
    var field = this.getFieldObject().getElement();
    div = this.getFieldDomHelper().createDom(goog.dom.TagName.DIV, {"style":"height: 0"}, "x");
    field.insertBefore(div, field.firstChild);
  }
  return div;
};
goog.editor.plugins.BasicTextFormatter.prototype.applyExecCommandGeckoFixes_ = function(command) {
  if (goog.userAgent.isVersionOrHigher("1.9") && command.toLowerCase() == "formatblock") {
    var range = this.getRange_();
    var startNode = range.getStartNode();
    if (range.isCollapsed() && startNode && startNode.tagName == goog.dom.TagName.BODY) {
      var startOffset = range.getStartOffset();
      var childNode = startNode.childNodes[startOffset];
      if (childNode && childNode.tagName == goog.dom.TagName.BR) {
        var browserRange = range.getBrowserRangeObject();
        browserRange.setStart(childNode, 0);
        browserRange.setEnd(childNode, 0);
      }
    }
  }
};
goog.editor.plugins.BasicTextFormatter.prototype.invalidateInlineCss_ = function() {
  var ancestors = [];
  var ancestor = this.getFieldObject().getRange().getContainerElement();
  do {
    ancestors.push(ancestor);
  } while (ancestor = ancestor.parentNode);
  var nodesInSelection = goog.iter.chain(goog.iter.toIterator(this.getFieldObject().getRange()), goog.iter.toIterator(ancestors));
  var containersInSelection = goog.iter.filter(nodesInSelection, goog.editor.style.isContainer);
  goog.iter.forEach(containersInSelection, function(element) {
    var oldOutline = element.style.outline;
    element.style.outline = "0px solid red";
    element.style.outline = oldOutline;
  });
};
goog.editor.plugins.BasicTextFormatter.prototype.beforeInsertListGecko_ = function() {
  var tag = this.getFieldObject().queryCommandValue(goog.editor.Command.DEFAULT_TAG);
  if (tag == goog.dom.TagName.P || tag == goog.dom.TagName.DIV) {
    return false;
  }
  var range = this.getRange_();
  if (range.isCollapsed() && range.getContainer().nodeType != goog.dom.NodeType.TEXT) {
    var tempTextNode = this.getFieldDomHelper().createTextNode(goog.string.Unicode.NBSP);
    range.insertNode(tempTextNode, false);
    goog.dom.Range.createFromNodeContents(tempTextNode).select();
    return true;
  }
  return false;
};
goog.editor.plugins.BasicTextFormatter.getSelectionBlockState_ = function(range) {
  var tagName = null;
  goog.iter.forEach(range, function(node, ignore, it) {
    if (!it.isEndTag()) {
      var container = goog.editor.style.getContainer(node);
      var thisTagName = container.tagName;
      tagName = tagName || thisTagName;
      if (tagName != thisTagName) {
        tagName = null;
        throw goog.iter.StopIteration;
      }
      it.skipTag();
    }
  });
  return tagName;
};
goog.editor.plugins.BasicTextFormatter.SUPPORTED_JUSTIFICATIONS_ = {"center":1, "justify":1, "right":1, "left":1};
goog.editor.plugins.BasicTextFormatter.prototype.isJustification_ = function(command) {
  var alignment = command.replace("+justify", "").toLowerCase();
  if (alignment == "full") {
    alignment = "justify";
  }
  var bidiPlugin = this.getFieldObject().getPluginByClassId("Bidi");
  if (bidiPlugin) {
    bidiPlugin.getSelectionAlignment;
    return alignment == bidiPlugin.getSelectionAlignment();
  } else {
    var range = this.getRange_();
    if (!range) {
      return false;
    }
    var parent = range.getContainerElement();
    var nodes = goog.array.filter(parent.childNodes, function(node) {
      return goog.editor.node.isImportant(node) && range.containsNode(node, true);
    });
    nodes = nodes.length ? nodes : [parent];
    for (var i = 0; i < nodes.length; i++) {
      var current = nodes[i];
      var container = goog.editor.style.getContainer(current);
      if (alignment != goog.editor.plugins.BasicTextFormatter.getNodeJustification_(container)) {
        return false;
      }
    }
    return true;
  }
};
goog.editor.plugins.BasicTextFormatter.getNodeJustification_ = function(element) {
  var value = goog.style.getComputedTextAlign(element);
  value = value.replace(/^-(moz|webkit)-/, "");
  if (!goog.editor.plugins.BasicTextFormatter.SUPPORTED_JUSTIFICATIONS_[value]) {
    value = element.align || "left";
  }
  return value;
};
goog.editor.plugins.BasicTextFormatter.prototype.isNodeInState_ = function(nodeName) {
  var range = this.getRange_();
  var node = range && range.getContainerElement();
  var ancestor = goog.dom.getAncestorByTagNameAndClass(node, nodeName);
  return !!ancestor && goog.editor.node.isEditable(ancestor);
};
goog.editor.plugins.BasicTextFormatter.prototype.queryCommandStateInternal_ = function(queryObject, command, opt_styleWithCss) {
  return this.queryCommandHelper_(true, queryObject, command, opt_styleWithCss);
};
goog.editor.plugins.BasicTextFormatter.prototype.queryCommandValueInternal_ = function(queryObject, command, opt_styleWithCss) {
  return this.queryCommandHelper_(false, queryObject, command, opt_styleWithCss);
};
goog.editor.plugins.BasicTextFormatter.prototype.queryCommandHelper_ = function(isGetQueryCommandState, queryObject, command, opt_styleWithCss) {
  command = goog.editor.plugins.BasicTextFormatter.convertToRealExecCommand_(command);
  if (opt_styleWithCss) {
    var doc = this.getDocument_();
    doc.execCommand("styleWithCSS", false, true);
  }
  var ret = isGetQueryCommandState ? queryObject.queryCommandState(command) : queryObject.queryCommandValue(command);
  if (opt_styleWithCss) {
    doc.execCommand("styleWithCSS", false, false);
  }
  return ret;
};
goog.provide("goog.dom.NodeOffset");
goog.require("goog.Disposable");
goog.require("goog.dom.TagName");
goog.dom.NodeOffset = function(node, baseNode) {
  goog.Disposable.call(this);
  this.offsetStack_ = [];
  this.nameStack_ = [];
  while (node && node.nodeName != goog.dom.TagName.BODY && node != baseNode) {
    var siblingOffset = 0;
    var sib = node.previousSibling;
    while (sib) {
      sib = sib.previousSibling;
      ++siblingOffset;
    }
    this.offsetStack_.unshift(siblingOffset);
    this.nameStack_.unshift(node.nodeName);
    node = node.parentNode;
  }
};
goog.inherits(goog.dom.NodeOffset, goog.Disposable);
goog.dom.NodeOffset.prototype.toString = function() {
  var strs = [];
  var name;
  for (var i = 0; name = this.nameStack_[i]; i++) {
    strs.push(this.offsetStack_[i] + "," + name);
  }
  return strs.join("\n");
};
goog.dom.NodeOffset.prototype.findTargetNode = function(baseNode) {
  var name;
  var curNode = baseNode;
  for (var i = 0; name = this.nameStack_[i]; ++i) {
    curNode = curNode.childNodes[this.offsetStack_[i]];
    if (!curNode || curNode.nodeName != name) {
      return null;
    }
  }
  return curNode;
};
goog.dom.NodeOffset.prototype.disposeInternal = function() {
  delete this.offsetStack_;
  delete this.nameStack_;
};
goog.provide("goog.editor.plugins.Blockquote");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.TagName");
goog.require("goog.dom.classlist");
goog.require("goog.editor.BrowserFeature");
goog.require("goog.editor.Command");
goog.require("goog.editor.Plugin");
goog.require("goog.editor.node");
goog.require("goog.functions");
goog.require("goog.log");
goog.editor.plugins.Blockquote = function(requiresClassNameToSplit, opt_className) {
  goog.editor.Plugin.call(this);
  this.requiresClassNameToSplit_ = requiresClassNameToSplit;
  this.className_ = opt_className || goog.getCssName("tr_bq");
};
goog.inherits(goog.editor.plugins.Blockquote, goog.editor.Plugin);
goog.editor.plugins.Blockquote.SPLIT_COMMAND = "+splitBlockquote";
goog.editor.plugins.Blockquote.CLASS_ID = "Blockquote";
goog.editor.plugins.Blockquote.prototype.logger = goog.log.getLogger("goog.editor.plugins.Blockquote");
goog.editor.plugins.Blockquote.prototype.getTrogClassId = function() {
  return goog.editor.plugins.Blockquote.CLASS_ID;
};
goog.editor.plugins.Blockquote.prototype.isSilentCommand = goog.functions.TRUE;
goog.editor.plugins.Blockquote.prototype.isSplittableBlockquote = function(node) {
  if (node.tagName != goog.dom.TagName.BLOCKQUOTE) {
    return false;
  }
  if (!this.requiresClassNameToSplit_) {
    return true;
  }
  return goog.dom.classlist.contains(node, this.className_);
};
goog.editor.plugins.Blockquote.prototype.isSetupBlockquote = function(node) {
  return node.tagName == goog.dom.TagName.BLOCKQUOTE && goog.dom.classlist.contains(node, this.className_);
};
goog.editor.plugins.Blockquote.prototype.isUnsetupBlockquote = function(node) {
  return node.tagName == goog.dom.TagName.BLOCKQUOTE && !this.isSetupBlockquote(node);
};
goog.editor.plugins.Blockquote.prototype.getBlockquoteClassName = function() {
  return this.className_;
};
goog.editor.plugins.Blockquote.findAndRemoveSingleChildAncestor_ = function(node, root) {
  var predicateFunc = function(parentNode) {
    return parentNode != root && parentNode.childNodes.length == 1;
  };
  var ancestor = goog.editor.node.findHighestMatchingAncestor(node, predicateFunc);
  if (!ancestor) {
    ancestor = node;
  }
  goog.dom.removeNode(ancestor);
};
goog.editor.plugins.Blockquote.removeAllWhiteSpaceNodes_ = function(nodes) {
  for (var i = 0; i < nodes.length; ++i) {
    if (goog.editor.node.isEmpty(nodes[i], true)) {
      goog.dom.removeNode(nodes[i]);
    }
  }
};
goog.editor.plugins.Blockquote.prototype.isSupportedCommand = function(command) {
  return command == goog.editor.plugins.Blockquote.SPLIT_COMMAND;
};
goog.editor.plugins.Blockquote.prototype.execCommandInternal = function(command, var_args) {
  var pos = arguments[1];
  if (command == goog.editor.plugins.Blockquote.SPLIT_COMMAND && pos && (this.className_ || !this.requiresClassNameToSplit_)) {
    return goog.editor.BrowserFeature.HAS_W3C_RANGES ? this.splitQuotedBlockW3C_(pos) : this.splitQuotedBlockIE_(pos);
  }
};
goog.editor.plugins.Blockquote.prototype.splitQuotedBlockW3C_ = function(anchorPos) {
  var cursorNode = anchorPos.node;
  var quoteNode = goog.editor.node.findTopMostEditableAncestor(cursorNode.parentNode, goog.bind(this.isSplittableBlockquote, this));
  var secondHalf, textNodeToRemove;
  var insertTextNode = false;
  if (quoteNode) {
    if (cursorNode.nodeType == goog.dom.NodeType.TEXT) {
      if (anchorPos.offset == cursorNode.length) {
        var siblingNode = cursorNode.nextSibling;
        if (siblingNode && siblingNode.tagName == goog.dom.TagName.BR) {
          cursorNode = siblingNode;
          secondHalf = siblingNode.nextSibling;
        } else {
          textNodeToRemove = cursorNode.splitText(anchorPos.offset);
          secondHalf = textNodeToRemove;
        }
      } else {
        secondHalf = cursorNode.splitText(anchorPos.offset);
      }
    } else {
      if (cursorNode.tagName == goog.dom.TagName.BR) {
        secondHalf = cursorNode.nextSibling;
      } else {
        insertTextNode = true;
      }
    }
  } else {
    if (this.isSetupBlockquote(cursorNode)) {
      quoteNode = cursorNode;
      insertTextNode = true;
    }
  }
  if (insertTextNode) {
    cursorNode = this.insertEmptyTextNodeBeforeRange_();
    secondHalf = this.insertEmptyTextNodeBeforeRange_();
  }
  if (!quoteNode) {
    return false;
  }
  secondHalf = goog.editor.node.splitDomTreeAt(cursorNode, secondHalf, quoteNode);
  goog.dom.insertSiblingAfter(secondHalf, quoteNode);
  var dh = this.getFieldDomHelper();
  var tagToInsert = this.getFieldObject().queryCommandValue(goog.editor.Command.DEFAULT_TAG) || goog.dom.TagName.DIV;
  var container = dh.createElement(tagToInsert);
  container.innerHTML = "&nbsp;";
  quoteNode.parentNode.insertBefore(container, secondHalf);
  dh.getWindow().getSelection().collapse(container, 0);
  if (textNodeToRemove) {
    goog.editor.plugins.Blockquote.findAndRemoveSingleChildAncestor_(textNodeToRemove, secondHalf);
  }
  goog.editor.plugins.Blockquote.removeAllWhiteSpaceNodes_([quoteNode, secondHalf]);
  return true;
};
goog.editor.plugins.Blockquote.prototype.insertEmptyTextNodeBeforeRange_ = function() {
  var range = this.getFieldObject().getRange();
  var node = this.getFieldDomHelper().createTextNode("");
  range.insertNode(node, true);
  return node;
};
goog.editor.plugins.Blockquote.prototype.splitQuotedBlockIE_ = function(splitNode) {
  var dh = this.getFieldDomHelper();
  var quoteNode = goog.editor.node.findTopMostEditableAncestor(splitNode.parentNode, goog.bind(this.isSplittableBlockquote, this));
  if (!quoteNode) {
    return false;
  }
  var clone = splitNode.cloneNode(false);
  if (splitNode.nextSibling && splitNode.nextSibling.tagName == goog.dom.TagName.BR) {
    splitNode = splitNode.nextSibling;
  }
  var secondHalf = goog.editor.node.splitDomTreeAt(splitNode, clone, quoteNode);
  goog.dom.insertSiblingAfter(secondHalf, quoteNode);
  var tagToInsert = this.getFieldObject().queryCommandValue(goog.editor.Command.DEFAULT_TAG) || goog.dom.TagName.DIV;
  var div = dh.createElement(tagToInsert);
  quoteNode.parentNode.insertBefore(div, secondHalf);
  div.innerHTML = "&nbsp;";
  var range = dh.getDocument().selection.createRange();
  range.moveToElementText(splitNode);
  range.move("character", 2);
  range.select();
  goog.dom.removeChildren(div);
  range.pasteHTML("");
  goog.editor.plugins.Blockquote.findAndRemoveSingleChildAncestor_(clone, secondHalf);
  goog.editor.plugins.Blockquote.removeAllWhiteSpaceNodes_([quoteNode, secondHalf]);
  return true;
};
goog.provide("goog.editor.plugins.EnterHandler");
goog.require("goog.dom");
goog.require("goog.dom.NodeOffset");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.Range");
goog.require("goog.dom.TagName");
goog.require("goog.editor.BrowserFeature");
goog.require("goog.editor.Plugin");
goog.require("goog.editor.node");
goog.require("goog.editor.plugins.Blockquote");
goog.require("goog.editor.range");
goog.require("goog.editor.style");
goog.require("goog.events.KeyCodes");
goog.require("goog.functions");
goog.require("goog.object");
goog.require("goog.string");
goog.require("goog.userAgent");
goog.editor.plugins.EnterHandler = function() {
  goog.editor.Plugin.call(this);
};
goog.inherits(goog.editor.plugins.EnterHandler, goog.editor.Plugin);
goog.editor.plugins.EnterHandler.prototype.tag = goog.dom.TagName.DIV;
goog.editor.plugins.EnterHandler.prototype.getTrogClassId = function() {
  return "EnterHandler";
};
goog.editor.plugins.EnterHandler.prototype.enable = function(fieldObject) {
  goog.editor.plugins.EnterHandler.base(this, "enable", fieldObject);
  if (goog.editor.BrowserFeature.SUPPORTS_OPERA_DEFAULTBLOCK_COMMAND && (this.tag == goog.dom.TagName.P || this.tag == goog.dom.TagName.DIV)) {
    var doc = this.getFieldDomHelper().getDocument();
    doc.execCommand("opera-defaultBlock", false, this.tag);
  }
};
goog.editor.plugins.EnterHandler.prototype.prepareContentsHtml = function(html) {
  if (!html || goog.string.isBreakingWhitespace(html)) {
    return goog.editor.BrowserFeature.COLLAPSES_EMPTY_NODES ? this.getNonCollapsingBlankHtml() : "";
  }
  return html;
};
goog.editor.plugins.EnterHandler.prototype.getNonCollapsingBlankHtml = goog.functions.constant("<br>");
goog.editor.plugins.EnterHandler.prototype.handleBackspaceInternal = function(e, range) {
  var field = this.getFieldObject().getElement();
  var container = range && range.getStartNode();
  if (field.firstChild == container && goog.editor.node.isEmpty(container)) {
    e.preventDefault();
    e.stopPropagation();
  }
};
goog.editor.plugins.EnterHandler.prototype.processParagraphTagsInternal = function(e, split) {
  if (goog.userAgent.IE || goog.userAgent.OPERA) {
    this.ensureBlockIeOpera(goog.dom.TagName.DIV);
  } else {
    if (!split && goog.userAgent.WEBKIT) {
      var range = this.getFieldObject().getRange();
      if (!range || !goog.editor.plugins.EnterHandler.isDirectlyInBlockquote(range.getContainerElement())) {
        return;
      }
      var dh = this.getFieldDomHelper();
      var br = dh.createElement(goog.dom.TagName.BR);
      range.insertNode(br, true);
      if (goog.editor.node.isBlockTag(br.parentNode) && !goog.editor.node.skipEmptyTextNodes(br.nextSibling)) {
        goog.dom.insertSiblingBefore(dh.createElement(goog.dom.TagName.BR), br);
      }
      goog.editor.range.placeCursorNextTo(br, false);
      e.preventDefault();
    }
  }
};
goog.editor.plugins.EnterHandler.isDirectlyInBlockquote = function(n) {
  for (var current = n; current; current = current.parentNode) {
    if (goog.editor.node.isBlockTag(current)) {
      return current.tagName == goog.dom.TagName.BLOCKQUOTE;
    }
  }
  return false;
};
goog.editor.plugins.EnterHandler.prototype.handleDeleteGecko = function(e) {
  this.deleteBrGecko(e);
};
goog.editor.plugins.EnterHandler.prototype.deleteBrGecko = function(e) {
  var range = this.getFieldObject().getRange();
  if (range.isCollapsed()) {
    var container = range.getEndNode();
    if (container.nodeType == goog.dom.NodeType.ELEMENT) {
      var nextNode = container.childNodes[range.getEndOffset()];
      if (nextNode && nextNode.tagName == goog.dom.TagName.BR) {
        var previousSibling = goog.editor.node.getPreviousSibling(nextNode);
        var nextSibling = nextNode.nextSibling;
        container.removeChild(nextNode);
        e.preventDefault();
        if (nextSibling && goog.editor.node.isBlockTag(nextSibling)) {
          if (previousSibling && !(previousSibling.tagName == goog.dom.TagName.BR || goog.editor.node.isBlockTag(previousSibling))) {
            goog.dom.Range.createCaret(previousSibling, goog.editor.node.getLength(previousSibling)).select();
          } else {
            var leftMostLeaf = goog.editor.node.getLeftMostLeaf(nextSibling);
            goog.dom.Range.createCaret(leftMostLeaf, 0).select();
          }
        }
      }
    }
  }
};
goog.editor.plugins.EnterHandler.prototype.handleKeyPress = function(e) {
  if (goog.userAgent.GECKO && this.getFieldObject().inModalMode()) {
    return false;
  }
  if (e.keyCode == goog.events.KeyCodes.BACKSPACE) {
    this.handleBackspaceInternal(e, this.getFieldObject().getRange());
  } else {
    if (e.keyCode == goog.events.KeyCodes.ENTER) {
      if (goog.userAgent.GECKO) {
        if (!e.shiftKey) {
          this.handleEnterGecko_(e);
        }
      } else {
        this.getFieldObject().dispatchBeforeChange();
        var cursorPosition = this.deleteCursorSelection_();
        var split = !!this.getFieldObject().execCommand(goog.editor.plugins.Blockquote.SPLIT_COMMAND, cursorPosition);
        if (split) {
          e.preventDefault();
          e.stopPropagation();
        }
        this.releasePositionObject_(cursorPosition);
        if (goog.userAgent.WEBKIT) {
          this.handleEnterWebkitInternal(e);
        }
        this.processParagraphTagsInternal(e, split);
        this.getFieldObject().dispatchChange();
      }
    } else {
      if (goog.userAgent.GECKO && e.keyCode == goog.events.KeyCodes.DELETE) {
        this.handleDeleteGecko(e);
      }
    }
  }
  return false;
};
goog.editor.plugins.EnterHandler.prototype.handleKeyUp = function(e) {
  if (goog.userAgent.GECKO && this.getFieldObject().inModalMode()) {
    return false;
  }
  this.handleKeyUpInternal(e);
  return false;
};
goog.editor.plugins.EnterHandler.prototype.handleKeyUpInternal = function(e) {
  if ((goog.userAgent.IE || goog.userAgent.OPERA) && e.keyCode == goog.events.KeyCodes.ENTER) {
    this.ensureBlockIeOpera(goog.dom.TagName.DIV, true);
  }
};
goog.editor.plugins.EnterHandler.prototype.handleEnterGecko_ = function(e) {
  var range = this.getFieldObject().getRange();
  var wasCollapsed = !range || range.isCollapsed();
  var cursorPosition = this.deleteCursorSelection_();
  var handled = this.getFieldObject().execCommand(goog.editor.plugins.Blockquote.SPLIT_COMMAND, cursorPosition);
  if (handled) {
    e.preventDefault();
    e.stopPropagation();
  }
  this.releasePositionObject_(cursorPosition);
  if (!handled) {
    this.handleEnterAtCursorGeckoInternal(e, wasCollapsed, range);
  }
};
goog.editor.plugins.EnterHandler.prototype.handleEnterWebkitInternal = goog.nullFunction;
goog.editor.plugins.EnterHandler.prototype.handleEnterAtCursorGeckoInternal = goog.nullFunction;
goog.editor.plugins.EnterHandler.DO_NOT_ENSURE_BLOCK_NODES_ = goog.object.createSet(goog.dom.TagName.LI, goog.dom.TagName.DIV, goog.dom.TagName.H1, goog.dom.TagName.H2, goog.dom.TagName.H3, goog.dom.TagName.H4, goog.dom.TagName.H5, goog.dom.TagName.H6);
goog.editor.plugins.EnterHandler.isBrElem = function(node) {
  return goog.editor.node.isEmpty(node) && goog.dom.getElementsByTagName(goog.dom.TagName.BR, node).length == 1;
};
goog.editor.plugins.EnterHandler.prototype.ensureBlockIeOpera = function(tag, opt_keyUp) {
  var range = this.getFieldObject().getRange();
  var container = range.getContainer();
  var field = this.getFieldObject().getElement();
  var paragraph;
  while (container && container != field) {
    var nodeName = container.nodeName;
    if (nodeName == tag || goog.editor.plugins.EnterHandler.DO_NOT_ENSURE_BLOCK_NODES_[nodeName] && !(opt_keyUp && goog.editor.plugins.EnterHandler.isBrElem(container))) {
      if (goog.userAgent.OPERA && paragraph) {
        if (nodeName == tag && paragraph == container.lastChild && goog.editor.node.isEmpty(paragraph)) {
          goog.dom.insertSiblingAfter(paragraph, container);
          goog.dom.Range.createFromNodeContents(paragraph).select();
        }
        break;
      }
      return;
    }
    if (goog.userAgent.OPERA && opt_keyUp && nodeName == goog.dom.TagName.P && nodeName != tag) {
      paragraph = container;
    }
    container = container.parentNode;
  }
  if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher(9)) {
    var needsHelp = false;
    range = range.getBrowserRangeObject();
    var range2 = range.duplicate();
    range2.moveEnd("character", 1);
    if (range2.text.length) {
      var parent2 = range2.parentElement();
      var range3 = range2.duplicate();
      range3.collapse(false);
      var parent3 = range3.parentElement();
      if (needsHelp = parent2 != parent3 && parent3 != range.parentElement()) {
        range.move("character", -1);
        range.select();
      }
    }
  }
  this.getFieldObject().getEditableDomHelper().getDocument().execCommand("FormatBlock", false, "<" + tag + ">");
  if (needsHelp) {
    range.move("character", 1);
    range.select();
  }
};
goog.editor.plugins.EnterHandler.prototype.deleteCursorSelection_ = function() {
  return goog.editor.BrowserFeature.HAS_W3C_RANGES ? this.deleteCursorSelectionW3C_() : this.deleteCursorSelectionIE_();
};
goog.editor.plugins.EnterHandler.prototype.releasePositionObject_ = function(position) {
  if (!goog.editor.BrowserFeature.HAS_W3C_RANGES) {
    position.removeNode(true);
  }
};
goog.editor.plugins.EnterHandler.prototype.deleteCursorSelectionIE_ = function() {
  var doc = this.getFieldDomHelper().getDocument();
  var range = doc.selection.createRange();
  var id = goog.string.createUniqueString();
  range.pasteHTML('<span id="' + id + '"></span>');
  var splitNode = doc.getElementById(id);
  splitNode.id = "";
  return splitNode;
};
goog.editor.plugins.EnterHandler.prototype.deleteCursorSelectionW3C_ = function() {
  var range = this.getFieldObject().getRange();
  if (range && !range.isCollapsed()) {
    var shouldDelete = true;
    if (goog.userAgent.OPERA) {
      var startNode = range.getStartNode();
      var startOffset = range.getStartOffset();
      if (startNode == range.getEndNode() && startNode.lastChild && startNode.lastChild.tagName == goog.dom.TagName.BR && startOffset == startNode.childNodes.length - 1) {
        shouldDelete = false;
      }
    }
    if (shouldDelete) {
      goog.editor.plugins.EnterHandler.deleteW3cRange_(range);
    }
  }
  return goog.editor.range.getDeepEndPoint(range, true);
};
goog.editor.plugins.EnterHandler.deleteW3cRange_ = function(range) {
  if (range && !range.isCollapsed()) {
    var reselect = true;
    var baseNode = range.getContainerElement();
    var nodeOffset = new goog.dom.NodeOffset(range.getStartNode(), baseNode);
    var rangeOffset = range.getStartOffset();
    var isInOneContainer = goog.editor.plugins.EnterHandler.isInOneContainerW3c_(range);
    var isPartialEnd = !isInOneContainer && goog.editor.plugins.EnterHandler.isPartialEndW3c_(range);
    range.removeContents();
    var node = nodeOffset.findTargetNode(baseNode);
    if (node) {
      range = goog.dom.Range.createCaret(node, rangeOffset);
    } else {
      range = goog.dom.Range.createCaret(baseNode, baseNode.childNodes.length);
      reselect = false;
    }
    range.select();
    if (isInOneContainer) {
      var container = goog.editor.style.getContainer(range.getStartNode());
      if (goog.editor.node.isEmpty(container, true)) {
        var html = "&nbsp;";
        if (goog.userAgent.OPERA && container.tagName == goog.dom.TagName.LI) {
          html = "<br>";
        }
        goog.editor.node.replaceInnerHtml(container, html);
        goog.editor.range.selectNodeStart(container.firstChild);
        reselect = false;
      }
    }
    if (isPartialEnd) {
      var rangeStart = goog.editor.style.getContainer(range.getStartNode());
      var redundantContainer = goog.editor.node.getNextSibling(rangeStart);
      if (rangeStart && redundantContainer) {
        goog.dom.append(rangeStart, redundantContainer.childNodes);
        goog.dom.removeNode(redundantContainer);
      }
    }
    if (reselect) {
      range = goog.dom.Range.createCaret(nodeOffset.findTargetNode(baseNode), rangeOffset);
      range.select();
    }
  }
  return range;
};
goog.editor.plugins.EnterHandler.isInOneContainerW3c_ = function(range) {
  var startContainer = range.getStartNode();
  if (goog.editor.style.isContainer(startContainer)) {
    startContainer = startContainer.childNodes[range.getStartOffset()] || startContainer;
  }
  startContainer = goog.editor.style.getContainer(startContainer);
  var endContainer = range.getEndNode();
  if (goog.editor.style.isContainer(endContainer)) {
    endContainer = endContainer.childNodes[range.getEndOffset()] || endContainer;
  }
  endContainer = goog.editor.style.getContainer(endContainer);
  return startContainer == endContainer;
};
goog.editor.plugins.EnterHandler.isPartialEndW3c_ = function(range) {
  var endContainer = range.getEndNode();
  var endOffset = range.getEndOffset();
  var node = endContainer;
  if (goog.editor.style.isContainer(node)) {
    var child = node.childNodes[endOffset];
    if (!child || child.nodeType == goog.dom.NodeType.ELEMENT && goog.editor.style.isContainer(child)) {
      return false;
    }
  }
  var container = goog.editor.style.getContainer(node);
  while (container != node) {
    if (goog.editor.node.getNextSibling(node)) {
      return true;
    }
    node = node.parentNode;
  }
  return endOffset != goog.editor.node.getLength(endContainer);
};
goog.provide("goog.editor.plugins.RemoveFormatting");
goog.require("goog.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.Range");
goog.require("goog.dom.TagName");
goog.require("goog.editor.BrowserFeature");
goog.require("goog.editor.Plugin");
goog.require("goog.editor.node");
goog.require("goog.editor.range");
goog.require("goog.string");
goog.require("goog.userAgent");
goog.editor.plugins.RemoveFormatting = function() {
  goog.editor.Plugin.call(this);
  this.optRemoveFormattingFunc_ = null;
  this.keyboardShortcutKey_ = " ";
};
goog.inherits(goog.editor.plugins.RemoveFormatting, goog.editor.Plugin);
goog.editor.plugins.RemoveFormatting.REMOVE_FORMATTING_COMMAND = "+removeFormat";
goog.editor.plugins.RemoveFormatting.BLOCK_RE_ = /^(DIV|TR|LI|BLOCKQUOTE|H\d|PRE|XMP)/;
goog.editor.plugins.RemoveFormatting.appendNewline_ = function(sb) {
  sb.push("<br>");
};
goog.editor.plugins.RemoveFormatting.createRangeDelimitedByRanges_ = function(startRange, endRange) {
  return goog.dom.Range.createFromNodes(startRange.getStartNode(), startRange.getStartOffset(), endRange.getEndNode(), endRange.getEndOffset());
};
goog.editor.plugins.RemoveFormatting.prototype.getTrogClassId = function() {
  return "RemoveFormatting";
};
goog.editor.plugins.RemoveFormatting.prototype.isSupportedCommand = function(command) {
  return command == goog.editor.plugins.RemoveFormatting.REMOVE_FORMATTING_COMMAND;
};
goog.editor.plugins.RemoveFormatting.prototype.execCommandInternal = function(command, var_args) {
  if (command == goog.editor.plugins.RemoveFormatting.REMOVE_FORMATTING_COMMAND) {
    this.removeFormatting_();
  }
};
goog.editor.plugins.RemoveFormatting.prototype.handleKeyboardShortcut = function(e, key, isModifierPressed) {
  if (!isModifierPressed) {
    return false;
  }
  if (e.metaKey && e.ctrlKey) {
    return false;
  }
  if (e.shiftKey) {
    return false;
  }
  if (key == this.keyboardShortcutKey_) {
    this.getFieldObject().execCommand(goog.editor.plugins.RemoveFormatting.REMOVE_FORMATTING_COMMAND);
    return true;
  }
  return false;
};
goog.editor.plugins.RemoveFormatting.prototype.setKeyboardShortcutKey = function(key) {
  this.keyboardShortcutKey_ = key;
};
goog.editor.plugins.RemoveFormatting.prototype.removeFormatting_ = function() {
  var range = this.getFieldObject().getRange();
  if (range.isCollapsed()) {
    return;
  }
  var convFunc = this.optRemoveFormattingFunc_ || goog.bind(this.removeFormattingWorker_, this);
  this.convertSelectedHtmlText_(convFunc);
  var doc = this.getFieldDomHelper().getDocument();
  doc.execCommand("RemoveFormat", false, undefined);
  if (goog.editor.BrowserFeature.ADDS_NBSPS_IN_REMOVE_FORMAT) {
    this.convertSelectedHtmlText_(function(text) {
      var nbspRegExp = goog.userAgent.isVersionOrHigher("528") ? /&nbsp;/g : /\u00A0/g;
      return text.replace(nbspRegExp, " ");
    });
  }
};
goog.editor.plugins.RemoveFormatting.prototype.getTableAncestor_ = function(nodeToCheck) {
  var fieldElement = this.getFieldObject().getElement();
  while (nodeToCheck && nodeToCheck != fieldElement) {
    if (nodeToCheck.tagName == goog.dom.TagName.TABLE) {
      return nodeToCheck;
    }
    nodeToCheck = nodeToCheck.parentNode;
  }
  return null;
};
goog.editor.plugins.RemoveFormatting.prototype.pasteHtml_ = function(html) {
  var range = this.getFieldObject().getRange();
  var dh = this.getFieldDomHelper();
  var startSpanId = goog.string.createUniqueString();
  var endSpanId = goog.string.createUniqueString();
  html = '<span id="' + startSpanId + '"></span>' + html + '<span id="' + endSpanId + '"></span>';
  var dummyNodeId = goog.string.createUniqueString();
  var dummySpanText = '<span id="' + dummyNodeId + '"></span>';
  if (goog.editor.BrowserFeature.HAS_IE_RANGES) {
    var textRange = range.getTextRange(0).getBrowserRangeObject();
    textRange.pasteHTML(dummySpanText);
    var parent;
    while ((parent = textRange.parentElement()) && goog.editor.node.isEmpty(parent) && !goog.editor.node.isEditableContainer(parent)) {
      var tag = parent.nodeName;
      if (tag == goog.dom.TagName.TD || tag == goog.dom.TagName.TR || tag == goog.dom.TagName.TH) {
        break;
      }
      goog.dom.removeNode(parent);
    }
    textRange.pasteHTML(html);
    var dummySpan = dh.getElement(dummyNodeId);
    if (dummySpan) {
      goog.dom.removeNode(dummySpan);
    }
  } else {
    if (goog.editor.BrowserFeature.HAS_W3C_RANGES) {
      dh.getDocument().execCommand("insertImage", false, dummyNodeId);
      var dummyImageNodePattern = new RegExp("<[^<]*" + dummyNodeId + "[^>]*>");
      var parent = this.getFieldObject().getRange().getContainerElement();
      if (parent.nodeType == goog.dom.NodeType.TEXT) {
        parent = parent.parentNode;
      }
      while (!dummyImageNodePattern.test(parent.innerHTML)) {
        parent = parent.parentNode;
      }
      if (goog.userAgent.GECKO) {
        goog.editor.node.replaceInnerHtml(parent, parent.innerHTML.replace(dummyImageNodePattern, html.replace(/\$/g, "$$$$")));
      } else {
        goog.editor.node.replaceInnerHtml(parent, parent.innerHTML.replace(dummyImageNodePattern, dummySpanText));
        var dummySpan = dh.getElement(dummyNodeId);
        parent = dummySpan;
        while ((parent = dummySpan.parentNode) && goog.editor.node.isEmpty(parent) && !goog.editor.node.isEditableContainer(parent)) {
          var tag = parent.nodeName;
          if (tag == goog.dom.TagName.TD || tag == goog.dom.TagName.TR || tag == goog.dom.TagName.TH) {
            break;
          }
          goog.dom.insertSiblingAfter(dummySpan, parent);
          goog.dom.removeNode(parent);
        }
        goog.editor.node.replaceInnerHtml(parent, parent.innerHTML.replace(new RegExp(dummySpanText, "i"), html.replace(/\$/g, "$$$$")));
      }
    }
  }
  var startSpan = dh.getElement(startSpanId);
  var endSpan = dh.getElement(endSpanId);
  goog.dom.Range.createFromNodes(startSpan, 0, endSpan, endSpan.childNodes.length).select();
  goog.dom.removeNode(startSpan);
  goog.dom.removeNode(endSpan);
};
goog.editor.plugins.RemoveFormatting.prototype.getHtmlText_ = function(range) {
  var div = this.getFieldDomHelper().createDom(goog.dom.TagName.DIV);
  var textRange = range.getBrowserRangeObject();
  if (goog.editor.BrowserFeature.HAS_W3C_RANGES) {
    div.appendChild(textRange.cloneContents());
  } else {
    if (goog.editor.BrowserFeature.HAS_IE_RANGES) {
      var rngText = range.getText();
      rngText = rngText.replace(/\r\n/g, "\r");
      var rngTextLength = rngText.length;
      var left = rngTextLength - goog.string.trimLeft(rngText).length;
      var right = rngTextLength - goog.string.trimRight(rngText).length;
      textRange.moveStart("character", left);
      textRange.moveEnd("character", -right);
      var htmlText = textRange.htmlText;
      if (textRange.queryCommandValue("formatBlock") == "Formatted") {
        htmlText = goog.string.newLineToBr(textRange.htmlText);
      }
      div.innerHTML = htmlText;
    }
  }
  return div.innerHTML;
};
goog.editor.plugins.RemoveFormatting.prototype.adjustRangeForTables_ = function(range, startInTable, endInTable) {
  var savedCaretRange = goog.editor.range.saveUsingNormalizedCarets(range);
  var startNode = range.getStartNode();
  var startOffset = range.getStartOffset();
  var endNode = range.getEndNode();
  var endOffset = range.getEndOffset();
  var dh = this.getFieldDomHelper();
  if (startInTable) {
    var textNode = dh.createTextNode("");
    goog.dom.insertSiblingAfter(textNode, startInTable);
    startNode = textNode;
    startOffset = 0;
  }
  if (endInTable) {
    var textNode = dh.createTextNode("");
    goog.dom.insertSiblingBefore(textNode, endInTable);
    endNode = textNode;
    endOffset = 0;
  }
  goog.dom.Range.createFromNodes(startNode, startOffset, endNode, endOffset).select();
  return savedCaretRange;
};
goog.editor.plugins.RemoveFormatting.prototype.putCaretInCave_ = function(caretRange, isStart) {
  var cavedCaret = goog.dom.removeNode(caretRange.getCaret(isStart));
  if (isStart) {
    this.startCaretInCave_ = cavedCaret;
  } else {
    this.endCaretInCave_ = cavedCaret;
  }
};
goog.editor.plugins.RemoveFormatting.prototype.restoreCaretsFromCave_ = function() {
  var field = this.getFieldObject().getElement();
  if (this.startCaretInCave_) {
    field.insertBefore(this.startCaretInCave_, field.firstChild);
    this.startCaretInCave_ = null;
  }
  if (this.endCaretInCave_) {
    field.appendChild(this.endCaretInCave_);
    this.endCaretInCave_ = null;
  }
};
goog.editor.plugins.RemoveFormatting.prototype.convertSelectedHtmlText_ = function(convertFunc) {
  var range = this.getFieldObject().getRange();
  if (range.getTextRangeCount() > 1) {
    return;
  }
  if (goog.userAgent.GECKO || goog.userAgent.EDGE) {
    var expandedRange = goog.editor.range.expand(range, this.getFieldObject().getElement());
    var startInTable = this.getTableAncestor_(expandedRange.getStartNode());
    var endInTable = this.getTableAncestor_(expandedRange.getEndNode());
    if (startInTable || endInTable) {
      if (startInTable == endInTable) {
        return;
      }
      var savedCaretRange = this.adjustRangeForTables_(range, startInTable, endInTable);
      if (!startInTable) {
        this.putCaretInCave_(savedCaretRange, true);
      }
      if (!endInTable) {
        this.putCaretInCave_(savedCaretRange, false);
      }
      range = this.getFieldObject().getRange();
      expandedRange = goog.editor.range.expand(range, this.getFieldObject().getElement());
    }
    expandedRange.select();
    range = expandedRange;
  }
  var text = this.getHtmlText_(range);
  this.pasteHtml_(convertFunc(text));
  if ((goog.userAgent.GECKO || goog.userAgent.EDGE) && savedCaretRange) {
    range = this.getFieldObject().getRange();
    this.restoreCaretsFromCave_();
    var realSavedCaretRange = savedCaretRange.toAbstractRange();
    var startRange = startInTable ? realSavedCaretRange : range;
    var endRange = endInTable ? realSavedCaretRange : range;
    var restoredRange = goog.editor.plugins.RemoveFormatting.createRangeDelimitedByRanges_(startRange, endRange);
    restoredRange.select();
    savedCaretRange.dispose();
  }
};
goog.editor.plugins.RemoveFormatting.prototype.removeFormattingWorker_ = function(html) {
  var el = goog.dom.createElement(goog.dom.TagName.DIV);
  el.innerHTML = html;
  var sb = [];
  var stack = [el.childNodes, 0];
  var preTagStack = [];
  var preTagLevel = 0;
  var tableStack = [];
  var tableLevel = 0;
  for (var sp = 0; sp >= 0; sp -= 2) {
    var changedLevel = false;
    while (tableLevel > 0 && sp <= tableStack[tableLevel - 1]) {
      tableLevel--;
      changedLevel = true;
    }
    if (changedLevel) {
      goog.editor.plugins.RemoveFormatting.appendNewline_(sb);
    }
    changedLevel = false;
    while (preTagLevel > 0 && sp <= preTagStack[preTagLevel - 1]) {
      preTagLevel--;
      changedLevel = true;
    }
    if (changedLevel) {
      goog.editor.plugins.RemoveFormatting.appendNewline_(sb);
    }
    var nodeList = stack[sp];
    var numNodesProcessed = stack[sp + 1];
    while (numNodesProcessed < nodeList.length) {
      var node = nodeList[numNodesProcessed++];
      var nodeName = node.nodeName;
      var formatted = this.getValueForNode(node);
      if (goog.isDefAndNotNull(formatted)) {
        sb.push(formatted);
        continue;
      }
      switch(nodeName) {
        case "#text":
          var nodeValue = preTagLevel > 0 ? node.nodeValue : goog.string.stripNewlines(node.nodeValue);
          nodeValue = goog.string.htmlEscape(nodeValue);
          sb.push(nodeValue);
          continue;
        case String(goog.dom.TagName.P):
          goog.editor.plugins.RemoveFormatting.appendNewline_(sb);
          goog.editor.plugins.RemoveFormatting.appendNewline_(sb);
          break;
        case String(goog.dom.TagName.BR):
          goog.editor.plugins.RemoveFormatting.appendNewline_(sb);
          continue;
        case String(goog.dom.TagName.TABLE):
          goog.editor.plugins.RemoveFormatting.appendNewline_(sb);
          tableStack[tableLevel++] = sp;
          break;
        case String(goog.dom.TagName.PRE):
        case "XMP":
          preTagStack[preTagLevel++] = sp;
          break;
        case String(goog.dom.TagName.STYLE):
        case String(goog.dom.TagName.SCRIPT):
        case String(goog.dom.TagName.SELECT):
          continue;
        case String(goog.dom.TagName.A):
          if (node.href && node.href != "") {
            sb.push("<a href='");
            sb.push(node.href);
            sb.push("'>");
            sb.push(this.removeFormattingWorker_(node.innerHTML));
            sb.push("</a>");
            continue;
          } else {
            break;
          }
        case String(goog.dom.TagName.IMG):
          sb.push("<img src='");
          sb.push(node.src);
          sb.push("'");
          if (node.border == "0") {
            sb.push(" border='0'");
          }
          sb.push(">");
          continue;
        case String(goog.dom.TagName.TD):
          if (node.previousSibling) {
            sb.push(" ");
          }
          break;
        case String(goog.dom.TagName.TR):
          if (node.previousSibling) {
            goog.editor.plugins.RemoveFormatting.appendNewline_(sb);
          }
          break;
        case String(goog.dom.TagName.DIV):
          var parent = node.parentNode;
          if (parent.firstChild == node && goog.editor.plugins.RemoveFormatting.BLOCK_RE_.test(parent.tagName)) {
            break;
          }
        default:
          if (goog.editor.plugins.RemoveFormatting.BLOCK_RE_.test(nodeName)) {
            goog.editor.plugins.RemoveFormatting.appendNewline_(sb);
          }
      }
      var children = node.childNodes;
      if (children.length > 0) {
        stack[sp++] = nodeList;
        stack[sp++] = numNodesProcessed;
        nodeList = children;
        numNodesProcessed = 0;
      }
    }
  }
  return goog.string.normalizeSpaces(sb.join(""));
};
goog.editor.plugins.RemoveFormatting.prototype.getValueForNode = function(node) {
  return null;
};
goog.editor.plugins.RemoveFormatting.prototype.setRemoveFormattingFunc = function(removeFormattingFunc) {
  this.optRemoveFormattingFunc_ = removeFormattingFunc;
};
goog.provide("goog.editor.plugins.AbstractTabHandler");
goog.require("goog.editor.Plugin");
goog.require("goog.events.KeyCodes");
goog.require("goog.userAgent");
goog.editor.plugins.AbstractTabHandler = function() {
  goog.editor.Plugin.call(this);
};
goog.inherits(goog.editor.plugins.AbstractTabHandler, goog.editor.Plugin);
goog.editor.plugins.AbstractTabHandler.prototype.getTrogClassId = goog.abstractMethod;
goog.editor.plugins.AbstractTabHandler.prototype.handleKeyboardShortcut = function(e, key, isModifierPressed) {
  if (goog.userAgent.GECKO && this.getFieldObject().inModalMode()) {
    return false;
  }
  if (e.keyCode == goog.events.KeyCodes.TAB && !e.metaKey && !e.ctrlKey) {
    return this.handleTabKey(e);
  }
  return false;
};
goog.editor.plugins.AbstractTabHandler.prototype.handleTabKey = goog.abstractMethod;
goog.provide("goog.editor.plugins.SpacesTabHandler");
goog.require("goog.dom.TagName");
goog.require("goog.editor.plugins.AbstractTabHandler");
goog.require("goog.editor.range");
goog.editor.plugins.SpacesTabHandler = function() {
  goog.editor.plugins.AbstractTabHandler.call(this);
};
goog.inherits(goog.editor.plugins.SpacesTabHandler, goog.editor.plugins.AbstractTabHandler);
goog.editor.plugins.SpacesTabHandler.prototype.getTrogClassId = function() {
  return "SpacesTabHandler";
};
goog.editor.plugins.SpacesTabHandler.prototype.handleTabKey = function(e) {
  var dh = this.getFieldDomHelper();
  var range = this.getFieldObject().getRange();
  if (!goog.editor.range.intersectsTag(range, goog.dom.TagName.LI)) {
    if (!e.shiftKey) {
      this.getFieldObject().stopChangeEvents(true, true);
      if (!range.isCollapsed()) {
        dh.getDocument().execCommand("delete", false, null);
        range = this.getFieldObject().getRange();
      }
      var elem = dh.createDom(goog.dom.TagName.SPAN, null, "\u00a0\u00a0 \u00a0");
      elem = range.insertNode(elem, false);
      this.getFieldObject().dispatchChange();
      goog.editor.range.placeCursorNextTo(elem, false);
      this.getFieldObject().dispatchSelectionChangeEvent();
    }
    e.preventDefault();
    return true;
  }
  return false;
};
goog.provide("goog.editor.Table");
goog.provide("goog.editor.TableCell");
goog.provide("goog.editor.TableRow");
goog.require("goog.asserts");
goog.require("goog.dom");
goog.require("goog.dom.DomHelper");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.TagName");
goog.require("goog.log");
goog.require("goog.string.Unicode");
goog.require("goog.style");
goog.editor.Table = function(node) {
  this.element = goog.dom.getAncestorByTagNameAndClass(node, goog.dom.TagName.TABLE);
  if (!this.element) {
    goog.log.error(this.logger_, "Can't create Table based on a node " + "that isn't a table, or descended from a table.");
  }
  this.dom_ = goog.dom.getDomHelper(this.element);
  this.refresh();
};
goog.editor.Table.prototype.logger_ = goog.log.getLogger("goog.editor.Table");
goog.editor.Table.prototype.refresh = function() {
  var rows = this.rows = [];
  var tbody = goog.dom.getElementsByTagName(goog.dom.TagName.TBODY, goog.asserts.assert(this.element))[0];
  if (!tbody) {
    return;
  }
  var trs = [];
  for (var child = tbody.firstChild; child; child = child.nextSibling) {
    if (child.nodeName == goog.dom.TagName.TR) {
      trs.push(child);
    }
  }
  for (var rowNum = 0, tr; tr = trs[rowNum]; rowNum++) {
    var existingRow = rows[rowNum];
    var tds = goog.editor.Table.getChildCellElements(tr);
    var columnNum = 0;
    for (var cellNum = 0, td; td = tds[cellNum]; cellNum++) {
      while (existingRow && existingRow.columns[columnNum]) {
        columnNum++;
      }
      var cell = new goog.editor.TableCell(td, rowNum, columnNum);
      for (var i = 0; i < cell.rowSpan; i++) {
        var cellRowNum = rowNum + i;
        var cellRow = rows[cellRowNum];
        if (!cellRow) {
          rows.push(cellRow = new goog.editor.TableRow(trs[cellRowNum], cellRowNum));
        }
        var minimumColumnLength = columnNum + cell.colSpan;
        if (cellRow.columns.length < minimumColumnLength) {
          cellRow.columns.length = minimumColumnLength;
        }
        for (var j = 0; j < cell.colSpan; j++) {
          var cellColumnNum = columnNum + j;
          cellRow.columns[cellColumnNum] = cell;
        }
      }
      columnNum += cell.colSpan;
    }
  }
};
goog.editor.Table.getChildCellElements = function(tr) {
  var cells = [];
  for (var i = 0, cell; cell = tr.childNodes[i]; i++) {
    if (cell.nodeName == goog.dom.TagName.TD || cell.nodeName == goog.dom.TagName.TH) {
      cells.push(cell);
    }
  }
  return cells;
};
goog.editor.Table.prototype.insertRow = function(opt_rowIndex) {
  var rowIndex = goog.isDefAndNotNull(opt_rowIndex) ? opt_rowIndex : this.rows.length;
  var refRow;
  var insertAfter;
  if (rowIndex == 0) {
    refRow = this.rows[0];
    insertAfter = false;
  } else {
    refRow = this.rows[rowIndex - 1];
    insertAfter = true;
  }
  var newTr = this.dom_.createElement(goog.dom.TagName.TR);
  for (var i = 0, cell; cell = refRow.columns[i]; i += 1) {
    if (insertAfter && cell.endRow > rowIndex || !insertAfter && cell.startRow < rowIndex) {
      cell.setRowSpan(cell.rowSpan + 1);
      if (cell.colSpan > 1) {
        i += cell.colSpan - 1;
      }
    } else {
      newTr.appendChild(this.createEmptyTd());
    }
    if (insertAfter) {
      goog.dom.insertSiblingAfter(newTr, refRow.element);
    } else {
      goog.dom.insertSiblingBefore(newTr, refRow.element);
    }
  }
  this.refresh();
  return newTr;
};
goog.editor.Table.prototype.insertColumn = function(opt_colIndex) {
  var colIndex = goog.isDefAndNotNull(opt_colIndex) ? opt_colIndex : this.rows[0] && this.rows[0].columns.length || 0;
  var newTds = [];
  for (var rowNum = 0, row; row = this.rows[rowNum]; rowNum++) {
    var existingCell = row.columns[colIndex];
    if (existingCell && existingCell.endCol >= colIndex && existingCell.startCol < colIndex) {
      existingCell.setColSpan(existingCell.colSpan + 1);
      rowNum += existingCell.rowSpan - 1;
    } else {
      var newTd = this.createEmptyTd();
      newTd.style.width = goog.editor.Table.OPTIMUM_EMPTY_CELL_WIDTH + "px";
      this.insertCellElement(newTd, rowNum, colIndex);
      newTds.push(newTd);
    }
  }
  this.refresh();
  return newTds;
};
goog.editor.Table.prototype.removeRow = function(rowIndex) {
  var row = this.rows[rowIndex];
  if (!row) {
    goog.log.warning(this.logger_, "Can't remove row at position " + rowIndex + ": no such row.");
  }
  for (var i = 0, cell; cell = row.columns[i]; i += cell.colSpan) {
    if (cell.rowSpan > 1) {
      cell.setRowSpan(cell.rowSpan - 1);
      if (cell.startRow == rowIndex) {
        this.insertCellElement(cell.element, rowIndex + 1, cell.startCol);
      }
    }
  }
  row.element.parentNode.removeChild(row.element);
  this.refresh();
};
goog.editor.Table.prototype.removeColumn = function(colIndex) {
  for (var i = 0, row; row = this.rows[i]; i++) {
    var cell = row.columns[colIndex];
    if (!cell) {
      goog.log.error(this.logger_, "Can't remove cell at position " + i + ", " + colIndex + ": no such cell.");
    }
    if (cell.colSpan > 1) {
      cell.setColSpan(cell.colSpan - 1);
    } else {
      cell.element.parentNode.removeChild(cell.element);
    }
    i += cell.rowSpan - 1;
  }
  this.refresh();
};
goog.editor.Table.prototype.mergeCells = function(startRowIndex, startColIndex, endRowIndex, endColIndex) {
  var cells = [];
  var cell;
  if (startRowIndex == endRowIndex && startColIndex == endColIndex) {
    goog.log.warning(this.logger_, "Can't merge single cell");
    return false;
  }
  for (var i = startRowIndex; i <= endRowIndex; i++) {
    for (var j = startColIndex; j <= endColIndex; j++) {
      cell = this.rows[i].columns[j];
      if (cell.startRow < startRowIndex || cell.endRow > endRowIndex || cell.startCol < startColIndex || cell.endCol > endColIndex) {
        goog.log.warning(this.logger_, "Can't merge cells: the cell in row " + i + ", column " + j + "extends outside the supplied rectangle.");
        return false;
      }
      cells.push(cell);
    }
  }
  var targetCell = cells[0];
  var targetTd = targetCell.element;
  var doc = this.dom_.getDocument();
  for (var i = 1; cell = cells[i]; i++) {
    var td = cell.element;
    if (!td.parentNode || td == targetTd) {
      continue;
    }
    if (targetTd.lastChild && targetTd.lastChild.nodeType == goog.dom.NodeType.TEXT) {
      targetTd.appendChild(doc.createTextNode(" "));
    }
    var childNode;
    while (childNode = td.firstChild) {
      targetTd.appendChild(childNode);
    }
    td.parentNode.removeChild(td);
  }
  targetCell.setColSpan(endColIndex - startColIndex + 1);
  targetCell.setRowSpan(endRowIndex - startRowIndex + 1);
  if (endColIndex > startColIndex) {
    targetTd.removeAttribute("width");
    targetTd.style.width = null;
  }
  this.refresh();
  return true;
};
goog.editor.Table.prototype.splitCell = function(rowIndex, colIndex) {
  var row = this.rows[rowIndex];
  var cell = row.columns[colIndex];
  var newTds = [];
  for (var i = 0; i < cell.rowSpan; i++) {
    for (var j = 0; j < cell.colSpan; j++) {
      if (i > 0 || j > 0) {
        var newTd = this.createEmptyTd();
        this.insertCellElement(newTd, rowIndex + i, colIndex + j);
        newTds.push(newTd);
      }
    }
  }
  cell.setColSpan(1);
  cell.setRowSpan(1);
  this.refresh();
  return newTds;
};
goog.editor.Table.prototype.insertCellElement = function(td, rowIndex, colIndex) {
  var row = this.rows[rowIndex];
  var nextSiblingElement = null;
  for (var i = colIndex, cell; cell = row.columns[i]; i += cell.colSpan) {
    if (cell.startRow == rowIndex) {
      nextSiblingElement = cell.element;
      break;
    }
  }
  row.element.insertBefore(td, nextSiblingElement);
};
goog.editor.Table.prototype.createEmptyTd = function() {
  return this.dom_.createDom(goog.dom.TagName.TD, {}, goog.string.Unicode.NBSP);
};
goog.editor.TableRow = function(trElement, rowIndex) {
  this.index = rowIndex;
  this.element = trElement;
  this.columns = [];
};
goog.editor.TableCell = function(td, startRow, startCol) {
  this.element = td;
  this.colSpan = parseInt(td.colSpan, 10) || 1;
  this.rowSpan = parseInt(td.rowSpan, 10) || 1;
  this.startRow = startRow;
  this.startCol = startCol;
  this.updateCoordinates_();
};
goog.editor.TableCell.prototype.updateCoordinates_ = function() {
  this.endCol = this.startCol + this.colSpan - 1;
  this.endRow = this.startRow + this.rowSpan - 1;
};
goog.editor.TableCell.prototype.setColSpan = function(colSpan) {
  if (colSpan != this.colSpan) {
    if (colSpan > 1) {
      this.element.colSpan = colSpan;
    } else {
      this.element.colSpan = 1, this.element.removeAttribute("colSpan");
    }
    this.colSpan = colSpan;
    this.updateCoordinates_();
  }
};
goog.editor.TableCell.prototype.setRowSpan = function(rowSpan) {
  if (rowSpan != this.rowSpan) {
    if (rowSpan > 1) {
      this.element.rowSpan = rowSpan.toString();
    } else {
      this.element.rowSpan = "1";
      this.element.removeAttribute("rowSpan");
    }
    this.rowSpan = rowSpan;
    this.updateCoordinates_();
  }
};
goog.editor.Table.OPTIMUM_EMPTY_CELL_WIDTH = 60;
goog.editor.Table.OPTIMUM_MAX_NEW_TABLE_WIDTH = 600;
goog.editor.Table.DEFAULT_BORDER_COLOR = "#888";
goog.editor.Table.createDomTable = function(doc, columns, rows, opt_tableStyle) {
  var style = {borderWidth:"1", borderColor:goog.editor.Table.DEFAULT_BORDER_COLOR};
  for (var prop in opt_tableStyle) {
    style[prop] = opt_tableStyle[prop];
  }
  var dom = new goog.dom.DomHelper(doc);
  var tableElement = dom.createTable(rows, columns, true);
  var minimumCellWidth = 10;
  var cellWidth = Math.max(minimumCellWidth, Math.min(goog.editor.Table.OPTIMUM_EMPTY_CELL_WIDTH, goog.editor.Table.OPTIMUM_MAX_NEW_TABLE_WIDTH / columns));
  var tds = goog.dom.getElementsByTagName(goog.dom.TagName.TD, tableElement);
  for (var i = 0, td; td = tds[i]; i++) {
    td.style.width = cellWidth + "px";
  }
  goog.style.setStyle(tableElement, {"borderCollapse":"collapse", "borderColor":style.borderColor, "borderWidth":style.borderWidth + "px"});
  tableElement.border = style.borderWidth;
  tableElement.setAttribute("bordercolor", style.borderColor);
  tableElement.setAttribute("cellspacing", "0");
  return tableElement;
};
goog.provide("goog.editor.plugins.TableEditor");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.dom.Range");
goog.require("goog.dom.TagName");
goog.require("goog.editor.Plugin");
goog.require("goog.editor.Table");
goog.require("goog.editor.node");
goog.require("goog.editor.range");
goog.require("goog.object");
goog.require("goog.userAgent");
goog.editor.plugins.TableEditor = function() {
  goog.editor.plugins.TableEditor.base(this, "constructor");
  this.isTableEditableFunctions_ = [];
  this.isUserEditableTableBound_ = goog.bind(this.isUserEditableTable_, this);
};
goog.inherits(goog.editor.plugins.TableEditor, goog.editor.Plugin);
goog.editor.plugins.TableEditor.prototype.getTrogClassId = function() {
  return String(goog.getUid(this.constructor));
};
goog.editor.plugins.TableEditor.COMMAND = {TABLE:"+table", INSERT_ROW_AFTER:"+insertRowAfter", INSERT_ROW_BEFORE:"+insertRowBefore", INSERT_COLUMN_AFTER:"+insertColumnAfter", INSERT_COLUMN_BEFORE:"+insertColumnBefore", REMOVE_ROWS:"+removeRows", REMOVE_COLUMNS:"+removeColumns", SPLIT_CELL:"+splitCell", MERGE_CELLS:"+mergeCells", REMOVE_TABLE:"+removeTable"};
goog.editor.plugins.TableEditor.SUPPORTED_COMMANDS_ = goog.object.transpose(goog.editor.plugins.TableEditor.COMMAND);
goog.editor.plugins.TableEditor.prototype.isSupportedCommand = function(command) {
  return command in goog.editor.plugins.TableEditor.SUPPORTED_COMMANDS_;
};
goog.editor.plugins.TableEditor.prototype.enable = function(fieldObject) {
  goog.editor.plugins.TableEditor.base(this, "enable", fieldObject);
  if (goog.userAgent.GECKO) {
    var doc = this.getFieldDomHelper().getDocument();
    doc.execCommand("enableObjectResizing", false, "true");
  }
};
goog.editor.plugins.TableEditor.prototype.getCurrentTable_ = function() {
  var selectedElement = this.getFieldObject().getRange().getContainer();
  return this.getAncestorTable_(selectedElement);
};
goog.editor.plugins.TableEditor.prototype.getAncestorTable_ = function(node) {
  var ancestor = goog.dom.getAncestor(node, this.isUserEditableTableBound_, true);
  if (goog.editor.node.isEditable(ancestor)) {
    return ancestor;
  } else {
    return null;
  }
};
goog.editor.plugins.TableEditor.prototype.queryCommandValue = function(command) {
  if (command == goog.editor.plugins.TableEditor.COMMAND.TABLE) {
    return !!this.getCurrentTable_();
  }
};
goog.editor.plugins.TableEditor.prototype.execCommandInternal = function(command, opt_arg) {
  var result = null;
  var cursorCell = null;
  var range = this.getFieldObject().getRange();
  if (command == goog.editor.plugins.TableEditor.COMMAND.TABLE) {
    if (!goog.editor.range.isEditable(range)) {
      return null;
    }
    var tableProps = opt_arg || {width:4, height:2};
    var doc = this.getFieldDomHelper().getDocument();
    var table = goog.editor.Table.createDomTable(doc, tableProps.width, tableProps.height);
    range.replaceContentsWithNode(table);
    if (!goog.userAgent.IE) {
      cursorCell = goog.dom.getElementsByTagName(goog.dom.TagName.TD, table)[0];
    }
  } else {
    var cellSelection = new goog.editor.plugins.TableEditor.CellSelection_(range, goog.bind(this.getAncestorTable_, this));
    var table = cellSelection.getTable();
    if (!table) {
      return null;
    }
    switch(command) {
      case goog.editor.plugins.TableEditor.COMMAND.INSERT_ROW_BEFORE:
        table.insertRow(cellSelection.getFirstRowIndex());
        break;
      case goog.editor.plugins.TableEditor.COMMAND.INSERT_ROW_AFTER:
        table.insertRow(cellSelection.getLastRowIndex() + 1);
        break;
      case goog.editor.plugins.TableEditor.COMMAND.INSERT_COLUMN_BEFORE:
        table.insertColumn(cellSelection.getFirstColumnIndex());
        break;
      case goog.editor.plugins.TableEditor.COMMAND.INSERT_COLUMN_AFTER:
        table.insertColumn(cellSelection.getLastColumnIndex() + 1);
        break;
      case goog.editor.plugins.TableEditor.COMMAND.REMOVE_ROWS:
        var startRow = cellSelection.getFirstRowIndex();
        var endRow = cellSelection.getLastRowIndex();
        if (startRow == 0 && endRow == table.rows.length - 1) {
          return this.execCommandInternal(goog.editor.plugins.TableEditor.COMMAND.REMOVE_TABLE);
        }
        var startColumn = cellSelection.getFirstColumnIndex();
        var rowCount = endRow - startRow + 1;
        for (var i = 0; i < rowCount; i++) {
          table.removeRow(startRow);
        }
        if (table.rows.length > 0) {
          var closestRow = Math.min(startRow, table.rows.length - 1);
          cursorCell = table.rows[closestRow].columns[startColumn].element;
        }
        break;
      case goog.editor.plugins.TableEditor.COMMAND.REMOVE_COLUMNS:
        var startCol = cellSelection.getFirstColumnIndex();
        var endCol = cellSelection.getLastColumnIndex();
        if (startCol == 0 && endCol == table.rows[0].columns.length - 1) {
          return this.execCommandInternal(goog.editor.plugins.TableEditor.COMMAND.REMOVE_TABLE);
        }
        var startRow = cellSelection.getFirstRowIndex();
        var removeCount = endCol - startCol + 1;
        for (var i = 0; i < removeCount; i++) {
          table.removeColumn(startCol);
        }
        var currentRow = table.rows[startRow];
        if (currentRow) {
          var closestCol = Math.min(startCol, currentRow.columns.length - 1);
          cursorCell = currentRow.columns[closestCol].element;
        }
        break;
      case goog.editor.plugins.TableEditor.COMMAND.MERGE_CELLS:
        if (cellSelection.isRectangle()) {
          table.mergeCells(cellSelection.getFirstRowIndex(), cellSelection.getFirstColumnIndex(), cellSelection.getLastRowIndex(), cellSelection.getLastColumnIndex());
        }
        break;
      case goog.editor.plugins.TableEditor.COMMAND.SPLIT_CELL:
        if (cellSelection.containsSingleCell()) {
          table.splitCell(cellSelection.getFirstRowIndex(), cellSelection.getFirstColumnIndex());
        }
        break;
      case goog.editor.plugins.TableEditor.COMMAND.REMOVE_TABLE:
        table.element.parentNode.removeChild(table.element);
        break;
      default:
    }
  }
  if (cursorCell) {
    range = goog.dom.Range.createFromNodeContents(cursorCell);
    range.collapse(false);
    range.select();
  }
  return result;
};
goog.editor.plugins.TableEditor.prototype.isUserEditableTable_ = function(element) {
  if (element.tagName != goog.dom.TagName.TABLE) {
    return false;
  }
  return goog.array.every(this.isTableEditableFunctions_, function(func) {
    return func(element);
  });
};
goog.editor.plugins.TableEditor.prototype.addIsTableEditableFunction = function(func) {
  goog.array.insert(this.isTableEditableFunctions_, func);
};
goog.editor.plugins.TableEditor.CellSelection_ = function(range, getParentTableFunction) {
  this.cells_ = [];
  var selectionContainer = range.getContainerElement();
  var elementInSelection = function(node) {
    return selectionContainer == node || selectionContainer.parentNode == node || range.containsNode(node, false);
  };
  var parentTableElement = selectionContainer && getParentTableFunction(selectionContainer);
  if (!parentTableElement) {
    return;
  }
  var parentTable = new goog.editor.Table(parentTableElement);
  if (!parentTable.rows.length || !parentTable.rows[0].columns.length) {
    return;
  }
  for (var i = 0, row; row = parentTable.rows[i]; i++) {
    for (var j = 0, cell; cell = row.columns[j]; j++) {
      if (elementInSelection(cell.element)) {
        if (!this.cells_.length) {
          this.firstRowIndex_ = cell.startRow;
          this.lastRowIndex_ = cell.endRow;
          this.firstColIndex_ = cell.startCol;
          this.lastColIndex_ = cell.endCol;
        } else {
          this.firstRowIndex_ = Math.min(this.firstRowIndex_, cell.startRow);
          this.lastRowIndex_ = Math.max(this.lastRowIndex_, cell.endRow);
          this.firstColIndex_ = Math.min(this.firstColIndex_, cell.startCol);
          this.lastColIndex_ = Math.max(this.lastColIndex_, cell.endCol);
        }
        this.cells_.push(cell);
      }
    }
  }
  this.parentTable_ = parentTable;
};
goog.editor.plugins.TableEditor.CellSelection_.prototype.getTable = function() {
  return this.parentTable_;
};
goog.editor.plugins.TableEditor.CellSelection_.prototype.getFirstRowIndex = function() {
  return this.firstRowIndex_;
};
goog.editor.plugins.TableEditor.CellSelection_.prototype.getLastRowIndex = function() {
  return this.lastRowIndex_;
};
goog.editor.plugins.TableEditor.CellSelection_.prototype.getFirstColumnIndex = function() {
  return this.firstColIndex_;
};
goog.editor.plugins.TableEditor.CellSelection_.prototype.getLastColumnIndex = function() {
  return this.lastColIndex_;
};
goog.editor.plugins.TableEditor.CellSelection_.prototype.getCells = function() {
  return this.cells_;
};
goog.editor.plugins.TableEditor.CellSelection_.prototype.isRectangle = function() {
  if (!this.cells_.length) {
    return false;
  }
  var firstCell = this.cells_[0];
  var lastCell = this.cells_[this.cells_.length - 1];
  return !(this.firstRowIndex_ < firstCell.startRow || this.lastRowIndex_ > lastCell.endRow || this.firstColIndex_ < firstCell.startCol || this.lastColIndex_ > lastCell.endCol);
};
goog.editor.plugins.TableEditor.CellSelection_.prototype.containsSingleCell = function() {
  var cellCount = this.cells_.length;
  return cellCount > 0 && this.cells_[0] == this.cells_[cellCount - 1];
};
goog.provide("uno.defs");
(function() {
  var TRIPLE_SLASH_PROTOCOLS = "evernote|file";
  uno.defs = {unicode:{ZERO_WIDTH_SPACE:"\u200b", NBSP:"\u00a0"}, dragtypes:{NATIVE:"native", IMAGE:"image", ATTACHMENT:"attachment", TABLE:"table", LIST:"list", TODO:"todo"}, droparea:{LEFT:"left", RIGHT:"right"}, containers:{EDITOR_BODY_SELECTOR:"en-note"}, structuretypes:{NOTE:"NOTE", CODE:"CODE", CRYPTO:"CRYPTO", EMOTICON:"EMOTICON", HR:"HR", LIST:"LIST", RESOURCE:"RESOURCE", TABLE:"TABLE", TEXT:"TEXT", TODO:"TODO", CMD_CRYPTO:"CMD_CRYPTO", CMD_INDENT:"CMD_INDENT", CMD_HR:"CMD_HR", CMD_LIST:"CMD_LIST", 
  CMD_TODO:"CMD_TODO", CMD_CODE:"CMD_CODE", TYPE_LIST:"TYPE_LIST"}, classes:{RESOURCE_CLASS:"en-media", MODULE_CLASS:"en-module"}, tags:{BLOCK:"div", BOLD:"b", ITALIC:"i", STRIKETHROUGH:"s", UNDERLINE:"u", TT:"tt"}, objects:{OBJECT_PLACEHOLDER_CLASS:"en-object-placeholder"}, crypto:{CRYPT_CLASS:"en-crypt", CRYPT_HIDDEN_CLASS:"en-crypt-placeholder", CRYPT_VISIBLE_CLASS:"en-crypt-revealed"}, resources:{STATES:{LOADED:"loaded", LOADING:"loading", UNLOADED:"unloaded", MOCK:"mock", ERROR:"error"}}, format:{CLIPBOARD:"clipboard", 
  ENML:"enml", CLIENT_HTML:"client_html"}, image:{TRANSPARENT_IMAGE_DATA_URL:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"}, regex:{INVALID_HTML_CHARS:"[\x00\u0001-\b\u000e-\u001f\u007f-\u009f\ufdd0-\ufdef\x0B\ufffe\uffff]|[\u0001-\u0010][\ufffe-\uffff]", SIMPLE_EMAIL:"[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,24}", WORD_CHARACTERS:"A-Za-z\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2183\u2184\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005\u3006\u3031-\u3035\u303b\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6e5\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc", 
  SIMPLE_URL:"(" + "(?:" + "(?:[a-z]+://|www\\.)[a-z0-9][a-z0-9\\-\\.]*[a-z0-9]" + "|" + "[a-z0-9][a-z0-9\\-\\.]*[a-z0-9]\\.(?:com|net|edu|org)" + ")" + "(?:\\:\\d+)?" + "|(?:" + TRIPLE_SLASH_PROTOCOLS + "):///)" + "(" + "[\\/\\?#a-z0-9&=;:@_~!%,\"'\\(\\)\\.\\$\\*\\+\\|-]*" + "[\\/\\?#a-z0-9&=;-]+" + ")?"}, nbsp:{CHARACTER_SEQUENCE:"\u00a0"}, highlight:{COLOR:"rgb(255, 250, 165)", LEGACY_IOS:"rgb(255, 204, 102)", LEGACY_CLEARLY:"rgb(246, 238, 150)", regex:/rgb\(255, 204, 102\)|rgb\(255, 250, 165\)|rgb\(246, 238, 150\)/, 
  LEGACY_STYLE:"-evernote-highlighted", STYLE:"-evernote-highlight"}, table:{FIXED_WIDTH:792, CELL_LINE_HEIGHT:20, CELL_MIN_WIDTH:48, CELL_WIDTH:130, CELL_PADDING:8, CELL_HTML:"<div><br></div>", BORDER_COLOR:"rgb(204, 204, 204)"}, codeblock:{style:'box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, "Courier New", monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial;'}, 
  bitfields:{NODE_SHOW_ALL:-1, NODE_SHOW_TEXT:4, NODE_FILTER_ACCEPT:1, NODE_FILTER_REJECT:2, NODE_ATTRIBUTE_NODE:2, NODE_TEXT_NODE:3, NODE_CDATA_SECTION_NODE:4, NODE_ENTITY_REFERENCE_NODE:5, NODE_ENTITY_NODE:6, NODE_PROCESSING_INSTRUCTION_NODE:7, NODE_COMMENT_NODE:8, NODE_DOCUMENT_NODE:9, NODE_DOCUMENT_TYPE_NODE:10, NODE_DOCUMENT_FRAGMENT_NODE:11, NODE_NOTATION_NODE:12, NODE_DOCUMENT_POSITION_PRECEDING:2, NODE_DOCUMENT_POSITION_FOLLOWING:4, NODE_DOCUMENT_POSITION_CONTAINS:8, NODE_DOCUMENT_POSITION_CONTAINED_BY:16}, 
  tab:{CHARACTER_SEQUENCE:"\u00a0\u00a0\u00a0\u00a0"}, blockElements:{p:true, h1:true, h2:true, h3:true, h4:true, h5:true, h6:true, pre:true, hr:true, br:true, li:true, div:true, table:true, tr:true, head:true, body:true}, edam:{TITLE_LEN_MAX:255}, paragraph:{indent:40}};
})();
goog.provide("uno.env");
goog.require("goog.userAgent");
(function() {
  var ua = goog.userAgent;
  var env = uno.env;
  env.getClient = function() {
    if (ua.MAC) {
      return "mac";
    } else {
      if (ua.WINDOWS) {
        return "win";
      } else {
        if (ua.ANDROID) {
          return "android";
        } else {
          if (ua.IOS) {
            return "ios";
          } else {
            return "web";
          }
        }
      }
    }
  };
})();
goog.provide("uno.featureflags");
goog.require("goog.debug.Logger");
(function() {
  var log = goog.debug.Logger.getLogger("uno.featureflags");
  var StorageKey = "featureflagsv2";
  var FeatureFlags = ["realtimedelay", "realtimeundo", "imagepopovermenu", "undotypebehind", "templates"];
  uno.featureflags.read = function(id) {
    if (FeatureFlags.indexOf(id) === -1) {
      return false;
    }
    try {
      var features = JSON.parse(localStorage.getItem(StorageKey)) || {};
      return !!features[id];
    } catch (e) {
      log.error(e);
    }
    return false;
  };
  uno.featureflags.save = function(id, enabled) {
    if (FeatureFlags.indexOf(id) === -1) {
      return;
    }
    try {
      var features = JSON.parse(localStorage.getItem(StorageKey)) || {};
      features[id] = enabled;
      localStorage.setItem(StorageKey, JSON.stringify(features));
    } catch (e) {
      log.error(e);
    }
  };
})();
goog.provide("uno.EditorMultiRange");
goog.require("goog.debug.Logger");
goog.require("goog.dom.MultiRange");
(function() {
  var log = goog.debug.Logger.getLogger("uno.EditorMultiRange");
  var EditorMultiRange = uno.EditorMultiRange = function(editor) {
    this.invoking_ = false;
    this.invokedRangeIndex_ = -1;
    this.editor_ = editor;
  };
  goog.inherits(uno.EditorMultiRange, goog.dom.MultiRange);
  EditorMultiRange.Mode = {NONE:0, FIRST:1, ALL:2};
  EditorMultiRange.prototype.addTextRange = function(textRange) {
    if (this.findTextRangeIndex_(textRange) === -1) {
      this.browserRanges_.push(textRange.getBrowserRangeObject());
      this.clearCachedValues_();
    }
  };
  EditorMultiRange.prototype.removeTextRange = function(textRange) {
    var index = this.findTextRangeIndex_(textRange);
    if (index > -1) {
      this.browserRanges_.splice(index, 1);
      this.clearCachedValues_();
    }
  };
  EditorMultiRange.prototype.toggleTextRange = function(textRange, flag) {
    var index = this.findTextRangeIndex_(textRange);
    if (index === -1 && (flag || flag === undefined)) {
      this.browserRanges_.push(textRange.getBrowserRangeObject());
      this.clearCachedValues_();
    } else {
      if (index > -1 && !flag) {
        this.browserRanges_.splice(index, 1);
        this.clearCachedValues_();
      }
    }
  };
  EditorMultiRange.prototype.containsTextRange = function(textRange) {
    return this.findTextRangeIndex_(textRange) > -1;
  };
  EditorMultiRange.prototype.findTextRangeIndex_ = function(textRange) {
    if (!textRange) {
      return -1;
    }
    var wrapper = textRange.getBrowserRangeWrapper_();
    var start = goog.dom.RangeEndpoint.START;
    var end = goog.dom.RangeEndpoint.END;
    try {
      for (var i = 0, l = this.browserRanges_.length; i < l; i++) {
        var range = this.browserRanges_[i];
        if (wrapper.compareBrowserRangeEndpoints(range, end, end) >= 0 && wrapper.compareBrowserRangeEndpoints(range, start, start) <= 0) {
          return i;
        }
      }
    } catch (err) {
      this.clear();
      log.warning(err.stack || err);
    }
    return -1;
  };
  EditorMultiRange.prototype.isEmpty = function() {
    return !this.getTextRangeCount();
  };
  EditorMultiRange.prototype.isInvoking = function() {
    return this.invoking_;
  };
  EditorMultiRange.prototype.isLastInvokedRange = function() {
    return this.invokedRangeIndex_ >= this.browserRanges_.length - 1;
  };
  EditorMultiRange.prototype.isFirstInvokedRange = function() {
    return this.invokedRangeIndex_ === 0;
  };
  EditorMultiRange.prototype.clear = function() {
    this.browserRanges_ = [];
    this.clearCachedValues_();
  };
  EditorMultiRange.prototype.invoke = function(mode, fn, context) {
    var retVal = null;
    try {
      if (mode !== EditorMultiRange.Mode.NONE && !this.isEmpty()) {
        var originalRange = this.editor_.getRange();
        var iterFn = mode === EditorMultiRange.Mode.ALL ? goog.array.forEach : goog.array.some;
        this.invoking_ = true;
        iterFn(this.getTextRanges(), function(range, index) {
          this.currentInvokeRangeIndex_ = index;
          uno.util.range.fillContainer(range).select();
          var result = fn.call(context || this.editor_);
          if (!retVal && result) {
            retVal = result;
          }
          return result;
        }, this);
        if (originalRange) {
          originalRange.select();
        }
        this.currentInvokeRangeIndex_ = -1;
        setTimeout(function() {
          this.invoking_ = false;
        }.bind(this));
        return !!retVal;
      }
      return !!fn.call(context || this.editor_);
    } catch (err) {
      log.severe(err.stack || err);
      return false;
    }
  };
})();
goog.provide("uno.util.zoomscale");
goog.require("uno.defs");
(function() {
  var util = uno.util;
  var note = null;
  util.zoomscale.getZoom = function() {
    if (!note) {
      note = document.querySelector(uno.defs.containers.EDITOR_BODY_SELECTOR);
    }
    var zoom = parseFloat(note.style.zoom);
    return isNaN(zoom) ? 1.0 : zoom;
  };
  util.zoomscale.normalizeRect = function(rect) {
    var zoom = uno.util.zoomscale.getZoom();
    if (rect && zoom && zoom !== 1.0) {
      var b = {};
      if (rect.left) {
        b.left = rect.left * zoom;
      }
      if (rect.right) {
        b.right = rect.right * zoom;
      }
      if (rect.top) {
        b.top = rect.top * zoom;
      }
      if (rect.bottom) {
        b.bottom = rect.bottom * zoom;
      }
      if (rect.width) {
        b.width = rect.width * zoom;
      }
      if (rect.height) {
        b.height = rect.height * zoom;
      }
      return b;
    }
    return rect;
  };
})();
goog.provide("uno.util.string");
goog.require("goog.string");
(function() {
  var util = uno.util;
  util.string.removeInvalidHtmlCharacters = function(line) {
    var invalidCharacters = /[\u0000\u0001-\u0008\u000E-\u001F\u007F-\u009F\uFDD0-\uFDEF\u000B\uFFFE\uFFFF]|[\x01-\x10][\uFFFE-\uFFFF]/g;
    return line.replace(invalidCharacters, "");
  };
  util.string.trimZWS = function(str) {
    return str.replace(/(^[\s\u200b]*|[\s\u200b]*$)/g, "");
  };
  util.string.isEmpty = function(s) {
    var rxEmptyString = /^[\x00-\x20\s]*$/g;
    if (goog.string.isEmptySafe(s)) {
      rxEmptyString.lastIndex = 0;
      return s.length === 0 || rxEmptyString.test(s);
    }
    return false;
  };
  util.string.escapeRegexChars = function(str) {
    return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
  };
  var diacriticsMap = {"\u00e0":"a", "\u00e1":"a", "\u00e2":"a", "\u00e3":"a", "\u00e4":"a", "\u00e5":"a", "\u1ea5":"a", "\u1eaf":"a", "\u1eb3":"a", "\u1eb5":"a", "\u1eb7":"a", "\u00e6":"ae", "\u1ea7":"a", "\u1eb1":"a", "\u0203":"a", "\u00e7":"c", "\u1e09":"c", "\u00e8":"e", "\u00e9":"e", "\u00ea":"e", "\u00eb":"e", "\u1ebf":"e", "\u1e17":"e", "\u1ec1":"e", "\u1e15":"e", "\u1e1d":"e", "\u0207":"e", "\u00ec":"i", "\u00ed":"i", "\u00ee":"i", "\u00ef":"i", "\u1e2f":"i", "\u020b":"i", "\u00f0":"d", "\u00f1":"n", 
  "\u00f2":"o", "\u00f3":"o", "\u00f4":"o", "\u00f5":"o", "\u00f6":"o", "\u00f8":"o", "\u1ed1":"o", "\u1e4d":"o", "\u1e53":"o", "\u020f":"o", "\u00f9":"u", "\u00fa":"u", "\u00fb":"u", "\u00fc":"u", "\u00fd":"y", "\u00df":"s", "\u00ff":"y", "\u0101":"a", "\u0103":"a", "\u0105":"a", "\u0107":"c", "\u0109":"c", "\u010b":"c", "\u010d":"c", "c\u0306":"c", "\u010f":"d", "\u0111":"d", "\u0113":"e", "\u0115":"e", "\u0117":"e", "\u0119":"e", "\u011b":"e", "\u011d":"g", "\u01f5":"g", "\u011f":"g", "\u0121":"g", 
  "\u0123":"g", "\u0125":"h", "\u0127":"h", "\u1e2b":"h", "\u0129":"i", "\u012b":"i", "\u012d":"i", "\u012f":"i", "i\u0307":"i", "\u0131":"i", "\u0133":"ij", "\u0135":"j", "\u0137":"k", "\u1e31":"k", "k\u0306":"k", "\u013a":"l", "\u013c":"l", "\u013e":"l", "\u0140":"l", "\u0142":"l", "\u1e3f":"m", "m\u0306":"m", "\u0144":"n", "\u0146":"n", "\u0148":"n", "\u0149":"n", "n\u0306":"n", "\u014d":"o", "\u014f":"o", "\u0151":"o", "\u0153":"oe", "p\u0306":"p", "\u0155":"r", "\u0157":"r", "\u0159":"r", "r\u0306":"r", 
  "\u0213":"r", "\u015b":"s", "\u015d":"s", "\u015f":"s", "\u0219":"s", "\u0161":"s", "\u0163":"t", "\u021b":"t", "\u0165":"t", "\u0167":"t", "t\u0306":"t", "\u0169":"u", "\u016b":"u", "\u016d":"u", "\u016f":"u", "\u0171":"u", "\u0173":"u", "\u0217":"u", "v\u0306":"v", "\u0175":"w", "\u1e83":"w", "x\u0306":"x", "\u0177":"y", "y\u0306":"y", "\u017a":"z", "\u017c":"z", "\u017e":"z", "\u017f":"s", "\u0192":"f", "\u01a1":"o", "\u01b0":"u", "\u01ce":"a", "\u01d0":"i", "\u01d2":"o", "\u01d4":"u", "\u01d6":"u", 
  "\u01d8":"u", "\u01da":"u", "\u01dc":"u", "\u1ee9":"u", "\u1e79":"u", "\u01fb":"a", "\u01fd":"ae", "\u01ff":"o", "\u00fe":"th", "\u1e55":"p", "\u1e65":"s", "x\u0301":"x", "\u0453":"\u0433", "\u045c":"\u043a", "a\u030b":"a", "e\u030b":"e", "i\u030b":"i", "\u01f9":"n", "\u1ed3":"o", "\u1e51":"o", "\u1eeb":"u", "\u1e81":"w", "\u1ef3":"y", "\u0201":"a", "\u0205":"e", "\u0209":"i", "\u020d":"o", "\u0211":"r", "\u0215":"u", "b\u030c":"b", "\u010d\u0323":"c", "\u00ea\u030c":"e", "f\u030c":"f", "\u01e7":"g", 
  "\u021f":"h", "j\u030c":"j", "\u01f0":"j", "\u01e9":"k", "m\u030c":"m", "p\u030c":"p", "q\u030c":"q", "\u0159\u0329":"r", "\u1e67":"s", "v\u030c":"v", "w\u030c":"w", "x\u030c":"x", "y\u030c":"y", "a\u0327":"a", "b\u0327":"b", "\u1e11":"d", "\u0229":"e", "\u025b\u0327":"e", "\u1e29":"h", "i\u0327":"i", "\u0268\u0327":"i", "m\u0327":"m", "o\u0327":"o", "q\u0327":"q", "u\u0327":"u", "x\u0327":"x", "z\u0327":"z"};
  var diacriticsPolyfillPattern = new RegExp(Object.keys(diacriticsMap).join("|"), "g");
  var diacriticsPattern = /[\u0300-\u036f]/g;
  util.string.removeDiacritics = "".normalize === undefined ? function(value) {
    return value.replace(diacriticsPolyfillPattern, function(char) {
      return diacriticsMap[char];
    });
  } : function(value) {
    return value.normalize("NFD").replace(diacriticsPattern, "");
  };
  var validDataUrlRegex = /^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*?)$/i;
  util.string.isValidDataUrl = function(s) {
    return validDataUrlRegex.test((s || "").trim());
  };
})();
goog.provide("uno.util.dom");
goog.require("uno.defs");
goog.require("uno.util.zoomscale");
goog.require("goog.array");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.string");
goog.require("goog.editor.node");
goog.require("goog.html.SafeHtml");
goog.require("uno.util.string");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.dom");
  var dom = uno.util.dom;
  var util = uno.util;
  dom.inlineObjects = ["en-media", "en-todo", "en-crypt", "en-cursor", "img", "embed", "object", "input", "param", "hr", "br", "en-adornments", "en-comment"];
  dom.blockObjects = ["object", "hr", "en-table", "en-codeblock", "en-imagelayout"];
  dom.uiObjects = ["en-adornments", "ui-list"];
  dom.tableObjects = ["colgroup", "col", "tr", "td"];
  dom.inlineTagNames = ["en-media", "en-cursor", "span", "font", "a", "br", "img", "object", "embed"];
  dom.inlineWrapperTagNames = ["a", "abbr", "acronym", "b", "bdo", "big", "cite", "code", "dfn", "em", "font", "i", "kbd", "label", "q", "samp", "small", "span", "strike", "strong", "sub", "sup", "time", "tt", "u", "var"];
  dom.inlineStyleTagNames = ["b", "del", "em", "font", "i", "ins", "s", "strike", "strong", "sub", "sup", "u"];
  dom.blockTagNames = ["en-note", "address", "article", "aside", "body", "blockquote", "caption", "center", "col", "colgroup", "dd", "details", "dir", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "mobile-cursor-parking", "li", "listing", "menu", "nav", "ol", "p", "plaintext", "pre", "section", "summary", "table", "en-table", "tbody", "td", "tfoot", "th", "thead", "tr", "ul", "xmp"];
  dom.headers = ["h1", "h2", "h3", "h4", "h5", "h6"];
  dom.isInlineObject = function(node) {
    if (!node || !dom.isElementNode(node)) {
      return false;
    }
    return dom.inlineObjects.indexOf(node.tagName.toLowerCase()) > -1;
  };
  dom.isBlockObject = function(node) {
    if (!node || !dom.isElementNode(node)) {
      return false;
    }
    return dom.blockObjects.indexOf(node.tagName.toLowerCase()) > -1 || dom.isRevealedCrypt(node) || dom.isCodeBlock(node);
  };
  dom.isTextNode = function(node) {
    return !!(node && node.nodeType === Node.TEXT_NODE);
  };
  dom.isElementNode = function(node) {
    return !!(node && node.nodeType === Node.ELEMENT_NODE);
  };
  dom.isBlockNode = function(node) {
    if (!node) {
      return false;
    }
    return !!(dom.blockTagNames.indexOf(dom.getTagName(node)) > -1 || node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE);
  };
  dom.isInlineNode = function(node) {
    return !!(node && !dom.isBlockNode(node));
  };
  dom.isInlineWrapper = function(node) {
    return dom.inlineWrapperTagNames.indexOf(dom.getTagName(node)) > -1;
  };
  dom.isInlineStyleNode = function(node) {
    return dom.inlineStyleTagNames.indexOf(dom.getTagName(node)) > -1 || dom.isSpan(node) && (node.style.fontWeight || node.style.fontStyle || node.style.textDecoration || node.style.verticalAlign || node.style.backgroundColor);
  };
  dom.isUneditable = function(node) {
    return dom.isElementNode(node) && node.getAttribute("contenteditable") === "false";
  };
  dom.isUIObject = function(node) {
    if (!node || dom.isTextNode(node)) {
      return false;
    }
    return dom.uiObjects.indexOf(node.tagName && node.tagName.toLowerCase()) > -1;
  };
  dom.uiFor = function(node) {
    if (!node || dom.isTextNode(node)) {
      return false;
    }
    return dom.getAncestor(node, dom.isUIObject);
  };
  dom.isHeader = function(node) {
    return dom.headers.indexOf(name.tagName.toLowerCase()) > -1 ? node : null;
  };
  dom.getLastParagraphItem = function(node) {
    if (!node) {
      return null;
    }
    if (!node.childNodes || !node.childNodes.length) {
      return node;
    }
    var leafNode = null;
    goog.array.forEachRight(node.childNodes, function(element) {
      if (leafNode || dom.isEmpty(element)) {
        return;
      }
      if (!element.childNodes || !element.childNodes.length || dom.isInlineObject(element)) {
        leafNode = element;
      } else {
        leafNode = dom.getLastParagraphItem(element);
      }
    });
    return leafNode;
  };
  dom.getFirstParagraphItem = function(node) {
    if (!node) {
      return null;
    }
    if (!node.childNodes || !node.childNodes.length) {
      return node;
    }
    var leafNode = null;
    goog.array.forEach(node.childNodes, function(element) {
      if (leafNode || dom.isEmpty(element)) {
        return;
      }
      if (!element.childNodes || !element.childNodes.length || dom.isInlineObject(element)) {
        leafNode = element;
      } else {
        leafNode = dom.getFirstParagraphItem(element);
      }
    });
    return leafNode;
  };
  dom.isFragment = function(node) {
    return !!(node.nodeType === Node.DOCUMENT_FRAGMENT_NODE);
  };
  dom.isNoteSection = function(node) {
    if (!node) {
      return false;
    }
    return !!(dom.isEnnote(node) || dom.isTd(node) || dom.isCodeBlock(node) || dom.isLi(node) || dom.isRevealedCrypt(node) || dom.isBlockquote(node) || dom.isFragment(node));
  };
  dom.isUneditable = function(node) {
    return dom.isElementNode(node) && node.getAttribute("contenteditable") === "false";
  };
  dom.getNodeLeaves = function(root, forcedLeaves, skipTextNodes) {
    var deepestNodes = [];
    if (!root || !forcedLeaves && skipTextNodes) {
      return deepestNodes;
    }
    var set = Object.create(null);
    if (forcedLeaves) {
      forcedLeaves.forEach(function(name) {
        set[name.toUpperCase()] = true;
      });
    }
    var walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT | (skipTextNodes ? 0 : NodeFilter.SHOW_TEXT), {acceptNode:function(node) {
      if (set[node.tagName] || !node.firstChild) {
        deepestNodes.push(node);
        return NodeFilter.FILTER_REJECT;
      } else {
        return NodeFilter.FILTER_SKIP;
      }
    }}, false);
    while (walker.nextNode()) {
    }
    return deepestNodes;
  };
  dom.getTagName = function(node) {
    return node && node.tagName && node.tagName.toLowerCase() || "";
  };
  dom.endContent = function(node) {
    if (!node) {
      return null;
    }
    if (dom.isTextNode(node) || dom.isInlineObject(node)) {
      return node;
    }
    var leafNode = null;
    goog.array.forEachRight(node.childNodes || [], function(element) {
      if (leafNode || dom.isUIObject(element)) {
        return;
      }
      if (dom.isTextNode(element) || dom.isInlineObject(element)) {
        leafNode = element;
      } else {
        leafNode = dom.endContent(element);
      }
    });
    return leafNode;
  };
  dom.startContent = function(node) {
    if (!node) {
      return null;
    }
    if (dom.isTextNode(node) || dom.isInlineObject(node)) {
      return node;
    }
    var leafNode = null;
    goog.array.forEach(node.childNodes || [], function(element) {
      if (leafNode || dom.isUIObject(element)) {
        return;
      }
      if (dom.isTextNode(element) || dom.isInlineObject(element)) {
        leafNode = element;
      } else {
        leafNode = dom.startContent(element);
      }
    });
    return leafNode;
  };
  dom.getAncestor = function(element, matcher, optIncludeNode, optMaxSearchSteps) {
    if (element && !optIncludeNode) {
      element = element.parentNode;
    }
    var steps = 0;
    while (element && !dom.isEnnote(element) && (optMaxSearchSteps == null || steps <= optMaxSearchSteps)) {
      if (matcher(element)) {
        return element;
      }
      element = element.parentNode;
      steps++;
    }
    return null;
  };
  dom.isBlockOrInlineBlockNode = function(node) {
    if (!node || !node.style) {
      return false;
    }
    if (node.style.display === "block" || node.style.display === "inline-block") {
      return true;
    }
    if (node.style.display === "" || node.style.display === "inherit" || node.style.display === "default") {
      return dom.isBlockNode(node);
    }
    return false;
  };
  dom.changeTagName = function(node, newTagName) {
    if (!node || !newTagName) {
      return false;
    }
    var attributes = {};
    goog.array.forEach(node.attributes, function(item) {
      attributes[item.name] = item.value;
    });
    var newNode = goog.dom.createDom(newTagName, attributes, node.childNodes);
    goog.dom.replaceNode(newNode, node);
    return newNode;
  };
  dom.clone = function(node) {
    var clone = goog.dom.createDom("div", null);
    if (dom.isTextNode(node)) {
      clone.innerText = node.textContent;
    } else {
      clone.innerHTML = node.outerHTML;
    }
    return clone.firstChild;
  };
  dom.nodeFromHtml = function(html, tagName, attributes, childNodes) {
    var node = goog.dom.createDom(tagName || "div", attributes, childNodes);
    node.innerHTML = html;
    return node;
  };
  dom.isEmpty = function(node, options) {
    if (!node) {
      return true;
    }
    if (node.nodeType === Node.TEXT_NODE) {
      return !node.data.length;
    }
    if (node.firstChild) {
      if (node.querySelectorAll("br").length > 1) {
        return false;
      }
      if (node.querySelectorAll("li, blockquote, table").length > 0) {
        return false;
      }
      if (!dom.isEnnote(node) && dom.isBlockNode(node) && node.getAttribute && node.getAttribute("style")) {
        return false;
      }
      return Array.prototype.every.call(node.childNodes, function(childNode) {
        return dom.isEmpty(childNode, options);
      });
    }
    if (options && options.root === node) {
      return true;
    }
    if (dom.isBlockOrInlineBlockNode(node) && util.partialnormalize.hasLayoutStyle(node)) {
      return false;
    }
    if (node.style.clear) {
      return false;
    }
    var tagName = dom.getTagName(node);
    var components = ["img", "embed", "object", "input", "param", "hr", "en-media", "en-table", "en-todo", "en-crypt"];
    var isObject = components.indexOf(tagName) > -1;
    return !isObject || options && options.ignoreAttachments && util.attachment.isAttachment(node);
  };
  dom.isEmptyContent = function(node) {
    if (!node) {
      return true;
    }
    if (node.nodeType === Node.TEXT_NODE) {
      return !node.data.length;
    }
    if (node.firstChild) {
      if (node.querySelectorAll("br, li").length > 1) {
        return false;
      }
      return Array.prototype.every.call(node.childNodes, function(childNode) {
        return dom.isEmptyContent(childNode);
      });
    }
    var tagName = node.tagName && node.tagName.toLowerCase();
    var components = ["img", "embed", "object", "input", "param", "hr", "en-media", "en-table", "en-todo", "en-crypt"];
    var isObject = components.indexOf(tagName) > -1;
    return !isObject;
  };
  dom.isSeeminglyEmpty = function(node) {
    var range = document.createRange();
    range.selectNodeContents(node);
    return range.getBoundingClientRect().width === 0;
  };
  dom.parent = function(node, selector, rootNode) {
    if (!rootNode) {
      rootNode = document.body;
    }
    if (node === rootNode) {
      return null;
    }
    if (dom.matches(node, selector)) {
      return node;
    }
    var parentNode = node && node.parentNode;
    if (parentNode) {
      return dom.parent(parentNode, selector, rootNode);
    }
    return null;
  };
  var createIsTagNames = function() {
    dom.blockTagNames.concat(dom.inlineTagNames, dom.inlineObjects, dom.inlineWrapperTagNames).forEach(function(tagName) {
      var fnName = "is" + goog.string.capitalize(tagName.replace("-", ""));
      dom[fnName] = function(node) {
        return node && node.tagName && node.tagName.toLowerCase() === tagName ? node : null;
      };
    });
  };
  createIsTagNames();
  dom.isHeader = function(node) {
    return node && node.tagName && ["h1", "h2", "h3", "h4", "h5", "h6"].indexOf(node.tagName.toLowerCase()) > -1 ? node : null;
  };
  dom.isCodeBlock = function(node) {
    if (!node || !dom.isElementNode(node)) {
      return false;
    }
    return node.classList.contains("en-code") || node.getAttribute("data-en-codeblock") !== null || (node.getAttribute("style") || "").indexOf("-en-codeblock:") > -1;
  };
  dom.isRevealedCrypt = function(node) {
    if (!node) {
      return false;
    }
    return !!goog.dom.classlist.contains(node, "en-crypt-revealed");
  };
  dom.getFirstAncestor = function(node, tagNames, includeNode) {
    return dom.getAncestor(node, function(ancestor) {
      return ancestor && ancestor.tagName && tagNames.indexOf(ancestor.tagName.toLowerCase()) > -1;
    }, includeNode);
  };
  dom.getOrigin = function(child) {
    var origin = dom.getAncestor(child, function(node) {
      return dom.isTd(node) || dom.isCodeBlock(node) || dom.isRevealedCrypt(node) || dom.isEnnote(node);
    }, true);
    return origin;
  };
  dom.ancestors = function(node) {
    var ancestors = [];
    while (node && node.parentNode) {
      ancestors.unshift(node.parentNode);
      node = node.parentNode;
    }
    return ancestors;
  };
  dom.getNextSiblings = function(node) {
    if (!node) {
      return [];
    }
    var nodes = [];
    var sib = node;
    while (sib.nextSibling) {
      nodes.push(sib.nextSibling);
      sib = sib.nextSibling;
    }
    return nodes;
  };
  dom.getPreviousSiblings = function(node) {
    if (!node) {
      return [];
    }
    var nodes = [];
    var sib = node;
    while (sib.previousSibling) {
      nodes.unshift(sib.previousSibling);
      sib = sib.previousSibling;
    }
    return nodes;
  };
  dom.contiguousInlineSiblings = function(node) {
    var nodes = [node];
    var sib = node.previousSibling;
    while (sib && !dom.isBlockNode(sib)) {
      nodes.unshift(sib);
      sib = sib.previousSibling;
    }
    sib = node.nextSibling;
    while (sib && !dom.isBlockNode(sib)) {
      nodes.push(sib);
      sib = sib.nextSibling;
    }
    return nodes;
  };
  var rxEscapeObj = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;
  var rxEscape = function(value) {
    if (value instanceof RegExp) {
      return value.source;
    }
    return value.replace(rxEscapeObj, "\\$&");
  };
  var regexForAppDataNameCache = {};
  var regexForAppDataName = function(name) {
    var rx = regexForAppDataNameCache[name];
    if (!rx) {
      rx = new RegExp("(^|;)\\s*(" + rxEscape(name) + ")\\s*\\:\\s*(.*?)($|;)+", "gi");
      regexForAppDataName[name] = rx;
    } else {
      rx.lastIndex = 0;
    }
    return rx;
  };
  dom.fragFromString = function(html) {
    var frag = document.createDocumentFragment();
    var temp = document.createElement("div");
    temp.innerHTML = html;
    while (temp.firstChild) {
      if (temp.firstChild.nodeType === Node.TEXT_NODE && temp.firstChild.textContent.trim().length === 0) {
        temp.firstChild.remove();
      } else {
        frag.appendChild(temp.firstChild);
      }
    }
    return frag;
  };
  dom.stringFromFrag = function(frag) {
    return Array.prototype.reduce.call(frag.childNodes, function(html, node) {
      return html + (node.outerHTML || goog.string.htmlEscape(node.textContent));
    }, "");
  };
  dom.compareTagName = function(el, names, caseSensitive) {
    if (typeof names === "string") {
      names = [names];
    }
    if (el && el.tagName) {
      var tagName = caseSensitive ? el.tagName : el.tagName.toLowerCase();
      return names.some(function(name) {
        return caseSensitive ? tagName === name : tagName === name.toLowerCase();
      });
    }
    return false;
  };
  dom.getNodeLength = function(node) {
    if (!node) {
      return 0;
    }
    switch(node.nodeType) {
      case Node.PROCESSING_INSTRUCTION_NODE:
      case Node.DOCUMENT_TYPE_NODE:
        return 0;
      case Node.TEXT_NODE:
      case Node.COMMENT_NODE:
        return node.length;
      default:
        return node.childNodes.length;
    }
  };
  dom.nextNode = function(node) {
    if (node.hasChildNodes()) {
      return node.firstChild;
    }
    return dom.nextNodeDescendants(node);
  };
  dom.previousNode = function(node) {
    if (node.previousSibling) {
      node = node.previousSibling;
      while (node.hasChildNodes()) {
        node = node.lastChild;
      }
      return node;
    }
    if (dom.isElementNode(node.parentNode)) {
      return node.parentNode;
    }
    return null;
  };
  dom.nextNodeDescendants = function(node, root) {
    while (node && !node.nextSibling) {
      if (root === node) {
        break;
      }
      node = node.parentNode;
    }
    if (!node || root && root === node) {
      return null;
    }
    return node.nextSibling;
  };
  dom.isEditable = function(node) {
    return !!(node && dom.isInsideEditableContainer(node) && (dom.isElementNode(node) || dom.isElementNode(node.parentNode)));
  };
  dom.isComputedBlock = function(node) {
    var display = goog.style.getComputedStyle(node, "display");
    return !!(display === "block");
  };
  dom.hasEditableDescendants = function(node) {
    for (var i = 0; i < node.childNodes.length; i++) {
      if (dom.isEditable(node.childNodes[i]) || dom.hasEditableDescendants(node.childNodes[i])) {
        return true;
      }
    }
    return false;
  };
  dom.moveChildren = function(srcNode, destNode) {
    while (srcNode.firstChild) {
      destNode.appendChild(srcNode.firstChild);
    }
    return destNode;
  };
  dom.replaceContainer = function(node, replacementElement) {
    node.parentNode.insertBefore(replacementElement, node);
    dom.moveChildren(node, replacementElement);
    goog.dom.removeNode(node);
    return replacementElement;
  };
  dom.isVisible = function(node) {
    if (!node) {
      return false;
    }
    if (dom.isBlockNode(node) || dom.isImageLikeElement(node) || node.nodeType === Node.TEXT_NODE && !dom.isCollapsedWhitespaceNode(node) || node.tagName.toUpperCase() === "BR" && !dom.isExtraneousLineBreak(node)) {
      return true;
    }
    for (var i = 0; i < node.childNodes.length; i++) {
      if (dom.isVisible(node.childNodes[i])) {
        return true;
      }
    }
    return false;
  };
  dom.isImageLikeElement = function(node) {
    return !!(dom.compareTagName(node, ["img", "embed", "object", "input", "param", "hr"]) || goog.dom.classes.has(node, "en-media") || goog.dom.classes.has(node, "en-module") || goog.dom.classes.has(node, "en-richlink"));
  };
  dom.isInlinedImage = function(node) {
    return dom.isImg(node) && util.string.isValidDataUrl(node.getAttribute("src"));
  };
  dom.isCollapsedWhitespaceNode = function(node) {
    if (!dom.isWhitespaceNode(node)) {
      return false;
    }
    if (node.data === "") {
      return true;
    }
    var ancestor = node.parentNode;
    if (!ancestor) {
      return true;
    }
    while (!dom.isBlockNode(ancestor) && ancestor.parentNode) {
      ancestor = ancestor.parentNode;
    }
    var reference = node;
    while (reference !== ancestor) {
      reference = dom.previousNode(reference);
      if (dom.isBlockNode(reference) || dom.isBr(reference)) {
        return true;
      }
      if (reference.nodeType === Node.TEXT_NODE && !dom.isWhitespaceNode(reference) || dom.isImageLikeElement(reference)) {
        break;
      }
    }
    reference = node;
    var stop = dom.nextNodeDescendants(ancestor);
    while (reference !== stop) {
      reference = dom.nextNode(reference);
      if (dom.isBlockNode(reference) || dom.isBr(reference)) {
        return true;
      }
      if (reference && reference.nodeType === Node.TEXT_NODE && !dom.isWhitespaceNode(reference) || dom.isImageLikeElement(reference)) {
        break;
      }
    }
    return false;
  };
  dom.isWhitespaceNode = function(node) {
    dom.rxWhitespace.lastIndex = 0;
    return !!(node && node.nodeType === Node.TEXT_NODE && (node.data === "" || dom.rxWhitespace.test(node.data)));
  };
  dom.rxWhitespace = /^[\t\n\r ]+$/;
  dom.getEffectiveCssValue = function(node, propName) {
    if (!dom.isElementNode(node) && (!node.parentNode || !dom.isElementNode(node.parentNode))) {
      return null;
    }
    if (!dom.isElementNode(node)) {
      return dom.getEffectiveCssValue(node.parentNode, propName);
    }
    if (!dom.isRenderedDOMNode(node)) {
      log.warn("We are not on rendered DOM for fontSize retieval", node);
      return dom.styleInheritedForNode(node, propName, "");
    }
    if (node.style && node.style[propName] !== null && node.style[propName] !== "") {
      return node.style[propName];
    }
    var ret = goog.style.getComputedStyle(node, propName);
    return ret;
  };
  dom.styleInheritedForNode = function(node, styleName, defaultValue, root) {
    root = root || document.body;
    defaultValue = defaultValue || "";
    var styleValue;
    if (node == null) {
      return defaultValue;
    }
    if (!dom.isChild(node, root)) {
      do {
        if (dom.isElementNode(node) && node.hasAttribute("style")) {
          styleValue = node.style[styleName];
          if (styleValue != null) {
            break;
          }
        }
      } while ((node = node.parentNode) && root === node);
    }
    return styleValue || defaultValue;
  };
  dom.isUnwrappedTextMarkup = function(html) {
    var tags = (html.match(/<[a-z-]+/gi) || []).map(function(tag) {
      return tag.slice(1).toLowerCase();
    });
    return tags.every(function(tag) {
      return dom.inlineObjects.indexOf(tag) > -1 || dom.inlineWrapperTagNames.indexOf(tag) > -1;
    });
  };
  dom.isRenderedDOMNode = function(node) {
    return !!(node && (node.isEqualNode(document.documentElement) || document.documentElement.contains(node)));
  };
  dom.isBefore = function(node1, node2) {
    return node1 != null && node2 != null && !!(node1.compareDocumentPosition(node2) & Node.DOCUMENT_POSITION_FOLLOWING);
  };
  dom.isInsideEditableContainer = function(node) {
    return true;
  };
  dom.isExtraneousLineBreak = function(br) {
    return false;
  };
  dom.firstChild = function(node) {
    if (goog.dom.isElement(node) && node.firstChild) {
      return dom.firstChild(node.firstChild);
    }
    return node;
  };
  dom.isBeginningOfLineChild = function(node, root) {
    var beginNode = dom.firstChild(node);
    if (beginNode.parentNode !== root) {
      while (beginNode.parentNode !== root) {
        beginNode = beginNode.parentNode;
      }
      return dom.firstChild(beginNode) === dom.firstChild(node);
    }
    return dom.index(beginNode) === 0;
  };
  dom.isPrecededByInlineContent = function(node) {
    var block = dom.getAncestor(node, dom.isBlockNode, false);
    if (!block || !block.childNodes) {
      return false;
    }
    function hasInlineContentBeforeNode(elt) {
      var result = false;
      goog.array.some(elt.childNodes, function(child) {
        if (child === node) {
          return true;
        }
        if (child.contains(node) && !hasInlineContentBeforeNode(child)) {
          return true;
        }
        if (!dom.isBlockNode(child)) {
          if (child.nodeType === Node.TEXT_NODE && (child.textContent.length === 0 || child.textContent === uno.defs.unicode.ZERO_WIDTH_SPACE)) {
            return false;
          }
          result = true;
        } else {
          result = hasInlineContentBeforeNode(child);
        }
        return false;
      });
      return result;
    }
    return hasInlineContentBeforeNode(block);
  };
  dom.index = function(node) {
    var ret = 0;
    while (node = node.previousSibling) {
      ret++;
    }
    return ret;
  };
  dom.matches = function(node, selector) {
    if (!node || !dom.isElementNode(node)) {
      return false;
    }
    if (goog.isString(selector)) {
      if (node.matches != null) {
        return node.matches(selector);
      } else {
        var matches = document.querySelectorAll(selector);
        var i;
        for (i = 0; i < matches.length; i += 1) {
          if (matches.item(i) === node) {
            return true;
          }
        }
      }
    } else {
      if (goog.isFunction(selector)) {
        return selector(node);
      }
    }
    return false;
  };
  dom.attributes = function(node) {
    var attrs = {};
    if (node) {
      var nodeAttrs = node.attributes;
      if (nodeAttrs) {
        for (var i = nodeAttrs.length; i--;) {
          attrs[nodeAttrs[i].name.toLowerCase()] = nodeAttrs[i].value;
        }
      }
    }
    return attrs;
  };
  dom.moveNode = function(node, newParent, newIndex, activeRange) {
    if (newParent && newIndex === -1) {
      newIndex = newParent.childNodes.length;
    }
    var oldParent = node.parentNode;
    var oldIndex = dom.index(node);
    var preserve = activeRange != null;
    var boundaryPoints;
    if (preserve) {
      boundaryPoints = [[activeRange.getStartNode(), activeRange.getStartOffset()], [activeRange.getEndNode(), activeRange.getEndOffset()]];
      boundaryPoints.forEach(function(boundaryPoint) {
        if (boundaryPoint[0] === newParent && boundaryPoint[1] > newIndex) {
          boundaryPoint[1]++;
        }
        if (boundaryPoint[0] === oldParent && (boundaryPoint[1] === oldIndex || boundaryPoint[1] === oldIndex + 1)) {
          if (newParent) {
            boundaryPoint[0] = newParent;
            boundaryPoint[1] += newIndex - oldIndex;
          } else {
            if (boundaryPoint[1] > oldIndex && boundaryPoint[1] > 0) {
              boundaryPoint[1] -= 1;
            }
          }
        }
        if (boundaryPoint[0] === oldParent && boundaryPoint[1] > oldIndex + 1) {
          boundaryPoint[1]--;
        }
        if (!newParent && dom.isChild(boundaryPoint[0], node)) {
          boundaryPoint[0] = node.parentNode;
          boundaryPoint[1] = dom.index(node);
        }
      });
    }
    if (!newParent) {
      goog.dom.removeNode(node);
      return;
    }
    if (newParent.childNodes.length === newIndex || newIndex === -1) {
      newParent.appendChild(node);
    } else {
      newParent.insertBefore(node, newParent.childNodes[+newIndex]);
    }
    goog.dom.Range.clearSelection();
    if (preserve) {
      goog.dom.browserrange.createRangeFromNodes(boundaryPoints[0][0], boundaryPoints[0][1], boundaryPoints[1][0], boundaryPoints[1][1]).select();
    }
  };
  dom.detachNode = function(node) {
    if (node) {
      node = goog.isArray(node) ? node : [node];
      node.forEach(function(el) {
        el.parentNode.removeChild(el);
      });
    }
    return node;
  };
  dom.wrap = function(node, wrapper) {
    node.parentNode.insertBefore(wrapper, node);
    wrapper.appendChild(node);
    return wrapper;
  };
  dom.getNextEquivalentPoint = function(node, offset) {
    if (dom.getNodeLength(node) === 0) {
      return null;
    }
    if (offset === dom.getNodeLength(node) && node.parentNode && dom.isInlineNode(node)) {
      return [node.parentNode, 1 + dom.index(node)];
    }
    if (offset >= 0 && offset < node.childNodes.length && dom.getNodeLength(node.childNodes[offset]) !== 0 && dom.isInlineNode(node.childNodes[offset])) {
      return [node.childNodes[offset], 0];
    }
    return null;
  };
  dom.getLastEquivalentPoint = function(node, offset) {
    var next = dom.getNextEquivalentPoint(node, offset);
    while (next) {
      node = next[0];
      offset = next[1];
      next = dom.getNextEquivalentPoint(node, offset);
    }
    return [node, offset];
  };
  dom.isChild = function(node, other) {
    if (!other || !node) {
      return false;
    }
    return !!(node.compareDocumentPosition(other) & Node.DOCUMENT_POSITION_CONTAINS);
  };
  dom.isParent = function(node, other) {
    if (!other || !node) {
      return false;
    }
    return !!(node.compareDocumentPosition(other) & 16);
  };
  dom.getStyleString = function(node) {
    if (!node || !node.getAttribute) {
      return "";
    }
    return node.getAttribute("style");
  };
  var TreeWalker = dom.TreeWalker = function(startNode, rootNode) {
    var node = startNode;
    function findSibling(node, startName, siblingName, shallow) {
      var sibling, parent;
      if (node) {
        if (!shallow && node[startName]) {
          return node[startName];
        }
        if (node !== rootNode) {
          sibling = node[siblingName];
          if (sibling) {
            return sibling;
          }
          for (parent = node.parentNode; parent && parent !== rootNode; parent = parent.parentNode) {
            sibling = parent[siblingName];
            if (sibling) {
              return sibling;
            }
          }
        }
      }
      return null;
    }
    this.current = function() {
      return node;
    };
    this.next = function(shallow) {
      node = findSibling(node, "firstChild", "nextSibling", shallow);
      return node;
    };
    this.prev = function(shallow) {
      node = findSibling(node, "lastChild", "previousSibling", shallow);
      return node;
    };
  };
  dom.isBlockFormattingContext = function(node) {
    if (dom.isElementNode(node)) {
      var style = window.getComputedStyle(node);
      if (style.float !== "none") {
        return true;
      }
      if (style.position !== "static" && style.position !== "relative") {
        return true;
      }
      if (["flex", "inline-block", "inline-flex", "table-caption", "table-cell"].indexOf(style.display) > -1) {
        return true;
      }
      if (style.overlfow !== "visible") {
        return true;
      }
    }
    return false;
  };
  var voidElementNames = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
  dom.allowsChildren = function(node) {
    if (dom.isElementNode(node)) {
      if (voidElementNames.indexOf(node.tagName.toLowerCase()) > -1) {
        return true;
      }
    }
    return false;
  };
  dom.hasTextNextToIt = function(node) {
    var neighboringTextRegex = /[^\s]+/i;
    var leftNode = node.previousSibling;
    while (leftNode) {
      if (leftNode.nodeName && uno.defs.blockElements[leftNode.nodeName.toLowerCase()]) {
        break;
      }
      if (neighboringTextRegex.test(leftNode.textContent)) {
        return true;
      }
      leftNode = leftNode.previousSibling;
    }
    var rightNode = node.nextSibling;
    while (rightNode) {
      if (rightNode.nodeName && uno.defs.blockElements[rightNode.nodeName.toLowerCase()]) {
        break;
      }
      if (neighboringTextRegex.test(rightNode.textContent)) {
        return true;
      }
      rightNode = rightNode.nextSibling;
    }
    var parent = node.parentNode;
    if (parent && (!parent.nodeName || !uno.defs.blockElements[parent.nodeName.toLowerCase()])) {
      return dom.hasTextNextToIt(parent);
    }
    return false;
  };
  dom.hasTodoNextToIt = function(node) {
    var leftNode = node.previousSibling;
    while (leftNode) {
      if (goog.dom.classes.has(leftNode, "en-todo")) {
        return true;
      }
      leftNode = leftNode.previousSibling;
    }
    var rightNode = node.nextSibling;
    while (rightNode) {
      if (goog.dom.classes.has(rightNode, "en-todo")) {
        return true;
      }
      rightNode = rightNode.nextSibling;
    }
    return false;
  };
  dom.getViewportRect = function() {
    var rect = {top:util.dom.scrollTop(document.body), left:util.dom.scrollLeft(document.body), width:window.innerWidth, height:window.innerHeight, bottom:0, right:0};
    rect.bottom = rect.top + rect.height;
    rect.right = rect.left + rect.width;
    return rect;
  };
  dom.makeClientRect = function(rect, opt, client) {
    var offsetLeft;
    var offsetTop;
    if (rect == null) {
      return null;
    }
    goog.object.extend(opt, {absolute:false, zoomScale:1.0, ignoreOffset:false}, opt);
    if (client === "ios") {
      if (document.body.getClientRects()[0].top < 0 === false) {
        offsetLeft = 0;
        offsetTop = 0;
      }
    }
    if (!opt.absolute && offsetLeft == null) {
      offsetLeft = util.dom.scrollLeft(document.body);
      offsetTop = util.dom.scrollTop(document.body);
    } else {
      offsetLeft = 0;
      offsetTop = 0;
    }
    if (client === "android" && opt.ignoreOffset !== true) {
      var offsetElement = document.getElementById("offset");
      if (offsetElement != null) {
        offsetTop -= parseInt(offsetElement.style.height, 10);
      }
    }
    var clientRect;
    if (client === "web") {
      clientRect = {left:Math.round(rect.left * opt.zoomScale) + offsetLeft, right:Math.round(rect.right * opt.zoomScale) + offsetLeft, top:Math.round(rect.top * opt.zoomScale) + offsetTop, bottom:Math.round(rect.bottom * opt.zoomScale) + offsetTop, width:Math.round(rect.width * opt.zoomScale), height:Math.round(rect.height * opt.zoomScale)};
    } else {
      clientRect = {left:rect.left * opt.zoomScale + offsetLeft, right:rect.right * opt.zoomScale + offsetLeft, top:rect.top * opt.zoomScale + offsetTop, bottom:rect.bottom * opt.zoomScale + offsetTop, width:rect.width * opt.zoomScale, height:rect.height * opt.zoomScale};
    }
    return clientRect;
  };
  dom.getDataAttribute = function(node, key) {
    return node && node.getAttribute ? node.getAttribute(["data", goog.string.toSelectorCase(key)].join("-")) : null;
  };
  dom.setDataAttribute = function(node, key, value) {
    if (node) {
      node.setAttribute(["data", goog.string.toSelectorCase(key)].join("-"), value);
      return value;
    }
    return null;
  };
  dom.removeDataAttribute = function(node, key) {
    if (node && node.dataset) {
      key = ["data", goog.string.toSelectorCase(key)].join("-");
      var value = node.getAttribute(key);
      node.removeAttribute(key);
      return value;
    }
    return null;
  };
  dom.removeDataAttributes = function(node) {
    Object.keys(node.dataset).forEach(function(key) {
      node.removeAttribute(["data", goog.string.toSelectorCase(key)].join("-"));
    });
  };
  dom.copyAttributes = function(srcNode, targetNode, regexAttrName) {
    goog.array.forEachRight(srcNode.attributes, function(attr) {
      if (!regexAttrName || regexAttrName.test(attr.name)) {
        targetNode.setAttribute(attr.name, attr.value);
      }
    });
  };
  dom.stripContainerElementFromMarkup = function(markup) {
    var start = markup.indexOf(">");
    var end = markup.lastIndexOf("<");
    if (start < 0 || end < 0) {
      return markup;
    }
    return markup.substring(start + 1, end);
  };
  dom.toHTML = function(obj) {
    var node;
    if (goog.isString(obj)) {
      node = document.createElement("div");
      node.textContent = obj;
    } else {
      if (obj instanceof Node) {
        node = obj.ownerDocument.createElement("div");
        node.appendChild(obj.cloneNode(true));
      } else {
        log.severe("Illegal argument type for en.toHTML");
      }
    }
    return dom.stripContainerElementFromMarkup(node.outerHTML);
  };
  dom.workOnTemporaryDOMNode = function(node, fn) {
    var domNode = goog.dom.createDom("div", {style:"position: absolute; width: 1px; height: 1px; " + "top: -9999px; left: -9999px;"});
    domNode.appendChild(node);
    document.body.appendChild(domNode);
    fn(node);
    var n = goog.dom.removeNode(node);
    goog.dom.removeNode(domNode);
    return n;
  };
  dom.isOnScreen = function(node, onScreenAmount) {
    if (!goog.dom.isElement(node)) {
      return false;
    }
    start("node.getBoundingClientRect");
    var box = node.getBoundingClientRect();
    stop("node.getBoundingClientRect");
    start("dom.isBoundingBoxOnScreen");
    var isBoundingBoxOnScreen = dom.isBoundingBoxOnScreen(box.top, box.bottom, onScreenAmount);
    stop("dom.isBoundingBoxOnScreen");
    return isBoundingBoxOnScreen;
  };
  dom.getBoundingBox = function(node, optAbsolute) {
    if (node == null) {
      return null;
    }
    if (optAbsolute == null) {
      optAbsolute = false;
    }
    if (node.nodeType == null) {
      return null;
    }
    if (!dom.isRenderedDOMNode(node)) {
      return null;
    }
    if (!goog.isFunction(node.getClientRects)) {
      return null;
    }
    var boxes = node.getClientRects();
    if (boxes.length === 0) {
      var range = node.ownerDocument.createRange();
      range.selectNode(node);
      boxes = range.getClientRects();
    }
    if (boxes.length >= 1) {
      return dom.makeClientRect(boxes[0], {absolute:optAbsolute, zoomScale:uno.util.zoomscale.getZoom()});
    }
    return null;
  };
  dom.isBoundingBoxOnScreen = function(boxTop, boxBottom, onScreenAmount) {
    var scrollTop = window.scrollY;
    var scrollBottom = scrollTop + window.innerHeight;
    onScreenAmount = onScreenAmount || 55;
    var elementTop = boxTop + scrollTop;
    var elementBottom = boxBottom + scrollTop;
    var commonTop = Math.max(scrollTop, elementTop);
    var commonBottom = Math.min(scrollBottom, elementBottom);
    var overlapPercent = Math.max(0, Math.round((commonBottom - commonTop) / (elementBottom - elementTop) * 100));
    return overlapPercent >= onScreenAmount;
  };
  dom.isVisibleInView = function(node, partial) {
    if (!dom.isElementNode(node) || !node.parentNode) {
      return false;
    }
    if (partial !== false) {
      partial = true;
    }
    var bounds = node.getBoundingClientRect();
    var parent = node.parentNode;
    var viewRect = {top:0, left:0, bottom:window.innerHeight, right:window.innerWidth, height:window.innerHeight, width:window.innerWidth};
    var isIntersect = function(rect) {
      return partial ? !(bounds.bottom <= rect.top || bounds.top >= rect.bottom || bounds.left >= rect.right || bounds.right <= rect.left) : !(rect.height === 0 || rect.width === 0 || bounds.bottom > rect.bottom && bounds.top > rect.top || bounds.top < rect.top && bounds.bottom < rect.bottom || bounds.left > rect.left && bounds.right > rect.right || bounds.left < rect.left && bounds.right < rect.right);
    };
    if (!isIntersect(viewRect)) {
      return false;
    }
    while (parent && parent !== document.documentElement) {
      var style = window.getComputedStyle(parent);
      if (style.display === "none" || style.visibility === "hidden") {
        return false;
      }
      if (style.position !== "static" && [style.overflow, style.overflowY, style.overflowX].indexOf("hidden") > -1) {
        var pbounds = parent.getBoundingClientRect();
        var rect = {top:Math.max(viewRect.top, pbounds.top), left:Math.max(viewRect.left, pbounds.left), bottom:Math.min(viewRect.bottom, pbounds.bottom), right:Math.min(viewRect.right, pbounds.right), width:pbounds.width, height:pbounds.height};
        if (!isIntersect(rect)) {
          return false;
        }
      }
      parent = parent.parentNode;
    }
    return !!parent;
  };
  dom.scrollTo = function(pixelsFromTop, animationDuration, relativeToElement) {
    relativeToElement = relativeToElement || document.body;
    animationDuration = animationDuration || 0;
    pixelsFromTop = pixelsFromTop || 0;
    if (animationDuration === 0) {
      relativeToElement.scrollTop = pixelsFromTop;
      return;
    }
    var start = relativeToElement.scrollTop;
    var change = pixelsFromTop - start;
    var currentTime = 0;
    var increment = 20;
    var easeInOutQuad = function(curTime, startValue, changeInValue, duration) {
      curTime /= duration / 2;
      if (curTime < 1) {
        return changeInValue / 2 * curTime * curTime + startValue;
      }
      curTime--;
      return -changeInValue / 2 * (curTime * (curTime - 2) - 1) + startValue;
    };
    var animateScroll = function() {
      currentTime += increment;
      relativeToElement.scrollTop = easeInOutQuad(currentTime, start, change, animationDuration);
      if (currentTime < animationDuration) {
        window.setTimeout(animateScroll, increment);
      }
    };
    animateScroll();
  };
  dom.scrollTop = function(node, value) {
    if (node === document.body) {
      node = document.scrollingElement || document.body;
    }
    if (goog.isNumber(value)) {
      node.scrollTop = value;
    }
    return node.scrollTop;
  };
  dom.scrollLeft = function(node, value) {
    if (node === document.body) {
      node = document.scrollingElement || document.body;
    }
    if (goog.isNumber(value)) {
      node.scrollLeft = value;
    }
    return node.scrollLeft;
  };
  var voidRx = /^(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/i;
  dom.isVoid = function(el) {
    return voidRx.test(el.tagName);
  };
  dom.isFollowedByContent = function(node) {
    while (node != null) {
      if (node.nextSibling) {
        return true;
      }
      node = node.parentElement;
      if (dom.isBlockNode(node)) {
        return false;
      }
    }
    return false;
  };
  dom.isPendingStyleNode = function(node) {
    return dom.isTextNode(node) && node.data === uno.defs.unicode.ZERO_WIDTH_SPACE;
  };
  dom.flattenElement = function(element) {
    var child, parent = element.parentNode;
    if (parent) {
      if (element.removeNode) {
        return element.removeNode(false);
      } else {
        while (child = element.firstChild) {
          parent.insertBefore(child, element);
        }
        return goog.dom.removeNode(element);
      }
    }
    return null;
  };
  dom.unflattenElement = function(el, newChild) {
    newChild = newChild || document.createElement("div");
    while (el.childNodes.length) {
      newChild.appendChild(el.firstChild);
    }
    el.appendChild(newChild);
    return newChild;
  };
  dom.textFromHtml = function(html) {
    var el = document.createElement("span");
    el.innerHTML = html;
    return el.textContent;
  };
  dom.wrap = function(node, wrapper) {
    node.parentNode.insertBefore(wrapper, node);
    wrapper.appendChild(node);
    return wrapper;
  };
})();
goog.provide("uno.util.range");
goog.require("goog.debug.Logger");
goog.require("goog.editor.range");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.zoomscale");
(function() {
  var util = uno.util;
  var dom = util.dom;
  var log = goog.debug.Logger.getLogger("uno.util.range");
  util.range.isInNote = function(editor, range) {
    return range && editor.field.contains(range.getContainer());
  };
  function getViewPortRect(margin) {
    var rect = {left:0, top:0, width:window.innerWidth, height:window.innerHeight - margin.offset.height};
    if (margin.scroll.top > 0) {
      rect.top -= margin.scroll.top;
      rect.height += margin.scroll.top;
    }
    rect.bottom = rect.top + rect.height;
    rect.right = rect.left + rect.width;
    return rect;
  }
  function scrollRectIntoView(rect, placeOnTop, margin) {
    var transY = 0;
    var viewport = getViewPortRect(margin);
    var top = util.dom.scrollTop(document.body);
    if (placeOnTop === true) {
      transY = viewport.top - rect.top;
    } else {
      transY = viewport.bottom - rect.bottom;
    }
    top = Math.max(0, top - transY);
    util.dom.scrollTop(document.body, top);
  }
  util.range.atBeginningOfParagraph = function(range) {
    if (!range) {
      return null;
    }
    var startNode = range.getStartNode();
    var paragraph = util.paragraph.for(startNode);
    if (range.getStartOffset() > 0) {
      return false;
    }
    var node = startNode;
    while (node && node !== paragraph) {
      if (!node.parentNode || node.parentNode.firstChild !== node) {
        return false;
      }
      node = node.parentNode;
    }
    return !!node;
  };
  util.range.getBoundingBoxesFromRange = function(rangeObject, optAbsolute, optKeepInvisible) {
    if (optAbsolute == null) {
      optAbsolute = false;
    }
    if (optKeepInvisible == null) {
      optKeepInvisible = false;
    }
    if (!rangeObject) {
      return null;
    }
    var boxes = rangeObject.getClientRects();
    if (!boxes || !boxes.length) {
      return null;
    }
    var lastBox = null;
    var matches = [];
    for (var i = 0; i < boxes.length; i++) {
      var match = {};
      var box = boxes[i];
      if (!optKeepInvisible && (box.width <= 1 || box.height <= 1)) {
        continue;
      }
      if (lastBox && box.left >= lastBox.left && box.top >= lastBox.top && box.right <= lastBox.right && box.bottom <= lastBox.bottom) {
        continue;
      }
      lastBox = box;
      match.top = lastBox.top;
      match.bottom = lastBox.bottom;
      match.left = lastBox.left;
      match.right = lastBox.right;
      match.width = lastBox.right - lastBox.left;
      match.height = lastBox.bottom - lastBox.top;
      var prev = matches.length - 1;
      if (prev > -1 && matches[prev].left <= match.right && match.left <= matches[prev].right && matches[prev].top <= match.bottom && match.top <= matches[prev].bottom) {
        var newMatch = {};
        newMatch.top = Math.max(matches[prev].top, match.top);
        newMatch.bottom = Math.min(matches[prev].bottom, match.bottom);
        newMatch.left = matches[prev].left;
        newMatch.right = match.right;
        newMatch.width = newMatch.right - newMatch.left;
        newMatch.height = newMatch.bottom - newMatch.top;
        matches[prev] = newMatch;
      } else {
        matches.push(match);
      }
    }
    if (optAbsolute) {
      matches = goog.array.map(matches, function(matchbox) {
        return util.dom.makeClientRect(matchbox, {absolute:true, zoomScale:uno.util.zoomscale.getZoom()});
      });
    }
    return matches;
  };
  function _addRangeRectsToBoxes(boxes, range) {
    var rects = range.getClientRects();
    for (var i = 0; i < rects.length; i++) {
      boxes.push(rects[i]);
    }
    if (rects.length === 0 && range.collapsed && range.startContainer.nodeType !== document.TEXT_NODE) {
      var rect, container;
      if (range.startContainer.childNodes.length === 0) {
        rect = container.getBoundingClientRect();
        rect.width = 0;
      } else {
        if (range.startOffset < range.startContainer.childNodes.length) {
          container = range.startContainer.childNodes[range.startOffset];
          if (container.nodeType === document.TEXT_NODE) {
            var startRange = new Range;
            startRange.setStart(container, 0);
            startRange.setEnd(container, 0);
            _addRangeRectsToBoxes(boxes, startRange);
            return;
          } else {
            rect = container.getBoundingClientRect();
            rect.width = 0;
          }
        } else {
          container = range.startContainer.childNodes[range.startContainer.childNodes.length - 1];
          if (container.nodeType === document.TEXT_NODE) {
            var endRange = new Range;
            endRange.setStart(container, container.length);
            endRange.setEnd(container, container.length);
            _addRangeRectsToBoxes(boxes, endRange);
            return;
          } else {
            rect = container.getBoundingClientRect();
            rect.right += rect.width;
            rect.width = 0;
          }
        }
      }
      boxes.push(rect);
    }
  }
  util.range.getBoundingBoxesFromTextSelection = function(rangeObject, optAbsolute, optKeepInvisible) {
    if (optAbsolute == null) {
      optAbsolute = false;
    }
    if (optKeepInvisible == null) {
      optKeepInvisible = false;
    }
    if (!rangeObject) {
      return null;
    }
    var boxes = [];
    if (rangeObject.startContainer === rangeObject.endContainer) {
      _addRangeRectsToBoxes(boxes, rangeObject);
    } else {
      var startRange = document.createRange();
      startRange.setStart(rangeObject.startContainer, rangeObject.startOffset);
      startRange.setEndAfter(rangeObject.startContainer);
      _addRangeRectsToBoxes(boxes, startRange);
      var endRange = document.createRange();
      endRange.setStart(rangeObject.endContainer, 0);
      endRange.setEnd(rangeObject.endContainer, rangeObject.endOffset);
      _addRangeRectsToBoxes(boxes, endRange);
      var walker = document.createTreeWalker(rangeObject.commonAncestorContainer, NodeFilter.SHOW_TEXT, {acceptNode:function nodeFilter(node) {
        return rangeObject.intersectsNode(node) && rangeObject.startContainer !== node && rangeObject.endContainer !== node;
      }}, false);
      var textNode;
      while ((textNode = walker.nextNode()) != null) {
        var range = document.createRange();
        range.selectNode(textNode);
        _addRangeRectsToBoxes(boxes, range);
      }
    }
    if (!boxes || !boxes.length) {
      return null;
    }
    if (optAbsolute) {
      boxes = goog.array.map(boxes, function(matchbox) {
        return util.dom.makeClientRect(matchbox, {absolute:true, zoomScale:uno.util.zoomscale.getZoom()});
      });
    }
    return boxes;
  };
  function unionOfClientRects(rects) {
    if (rects == null || rects.length < 1) {
      return null;
    }
    var firstRect = rects[0];
    var rect = {top:firstRect.top, left:firstRect.left, right:firstRect.right, bottom:firstRect.bottom};
    for (var i = 1; i < rects.length; i++) {
      var currentRect = rects[i];
      if (currentRect.width > 0 && currentRect.height > 0) {
        rect = {top:Math.min(rect.top, currentRect.top), left:Math.min(rect.left, currentRect.left), right:Math.max(rect.right, currentRect.right), bottom:Math.max(rect.bottom, currentRect.bottom)};
      }
    }
    rect.width = rect.right - rect.left;
    rect.height = rect.bottom - rect.top;
    return rect;
  }
  util.range.scrollSelectionIntoView = function(editor) {
    if (!editor.inEditMode()) {
      return;
    }
    log.fine("Requesting to scroll selection into view");
    var range = editor.getRange();
    if (range) {
      var rect = unionOfClientRects(range.getBrowserRangeObject().getClientRects());
      if (!rect) {
        var node = range.getFocusNode();
        if (node && node.getClientRects) {
          rect = unionOfClientRects(node.getClientRects());
        }
      }
      if (rect) {
        var viewport = getViewPortRect(editor.config.margin);
        if (viewport.top >= rect.top && viewport.bottom <= rect.bottom) {
        } else {
          if (viewport.top > rect.top) {
            log.fine("  ... performing scrolling to TOP");
            scrollRectIntoView(rect, true, editor.config.margin);
          } else {
            if (viewport.bottom < rect.bottom) {
              log.fine("  ... performing scrolling to BOTTOM");
              scrollRectIntoView(rect, false, editor.config.margin);
            }
          }
        }
      } else {
        if (util.dom.isEmpty(editor.field)) {
          log.fine("  ... performing scrolling the editor field into view");
          editor.field.scrollIntoView();
        }
      }
    }
  };
  util.range.commonAncestors = function(range, opt_selector, opt_root) {
    var startNode = range.getStartNode();
    var endNode = range.getEndNode();
    var getNonTextOrSelectorParent = function(node) {
      if (opt_selector) {
        var selectorNode = util.dom.parent(node, opt_selector, opt_root);
        if (selectorNode !== null) {
          return selectorNode;
        }
      }
      while (util.dom.isTextNode(node)) {
        node = node.parentNode;
      }
      return node;
    };
    startNode = getNonTextOrSelectorParent(startNode);
    endNode = getNonTextOrSelectorParent(endNode);
    if (startNode === endNode) {
      return [startNode, endNode];
    }
    var startParents = util.dom.ancestors(startNode);
    var endParents = util.dom.ancestors(endNode);
    if (startParents[0] !== endParents[0]) {
      return [startNode, endNode];
    }
    var i = 0;
    for (; i < startParents.length && i < endParents.length; i++) {
      if (startParents[i] !== endParents[i]) {
        break;
      }
    }
    var result = [startNode, endNode];
    if (i < startParents.length) {
      result[0] = startParents[i];
    }
    if (i < endParents.length) {
      result[1] = endParents[i];
    }
    return result;
  };
  util.range.forEachWord = function(range, transformFunc) {
    goog.iter.forEach(range, function(element) {
      if (element.nodeType !== Node.TEXT_NODE) {
        return;
      }
      var nodeText = element.nodeValue;
      if (nodeText == null || goog.string.isEmpty(nodeText)) {
        return;
      }
      var re = new RegExp("[" + uno.defs.regex.WORD_CHARACTERS + "]+", "g");
      var match = null, matchRange = null;
      while ((match = re.exec(nodeText)) != null) {
        var matchStart = match.index;
        var matchEnd = match.index + match[0].length;
        if (element === range.getStartNode() && matchEnd <= range.getStartOffset() || element === range.getEndNode() && matchStart >= range.getEndOffset()) {
          continue;
        }
        matchRange = document.createRange();
        matchRange.setStart(element, matchStart);
        matchRange.setEnd(element, matchEnd);
        transformFunc(match[0], matchRange);
      }
    });
  };
  util.range.selectNode = function(node) {
    var range = goog.dom.Range.createFromNodes(node.parentElement, util.dom.index(node), node.parentElement, util.dom.index(node) + 1);
    range.select();
    return range;
  };
  util.range.selectNodeContents = function(node) {
    var range = goog.dom.Range.createFromNodeContents(node);
    range.select();
    return range;
  };
  util.range.fromInfo = function(start, end) {
    var range = document.createRange();
    range.setStart(start.container, start.offset);
    if (end != null) {
      range.setEnd(end.container, end.offset);
    }
    return goog.dom.Range.createFromBrowserRange(range);
  };
  util.range.selectFromInfo = function(start, end) {
    var range = util.range.fromInfo(start, end);
    range.select();
    return range;
  };
  util.range.boundary = function(node, offset) {
    return util.dom.isElementNode(node) ? node.childNodes[offset] : node;
  };
  util.range.contains = function(range, node, allowPartial) {
    if (!range || !node) {
      return false;
    }
    var container = range.getContainer();
    if (!container || !container.contains(node)) {
      return false;
    }
    var start = util.range.boundary(range.getStartNode(), range.getStartOffset());
    var end = util.range.boundary(range.getEndNode(), range.getEndOffset());
    if (util.dom.isBefore(start, node) && util.dom.isBefore(node, end)) {
      return true;
    }
    if (allowPartial) {
      while (start.parentNode && container.contains(start)) {
        if (start === node) {
          return true;
        }
        start = start.parentNode;
      }
      while (end.parentNode && container.contains(end)) {
        if (end === node) {
          return true;
        }
        end = end.parentNode;
      }
    }
    return false;
  };
  util.range.saveCursor = function(range) {
    if (!range) {
      return null;
    }
    var oldCursors = document.querySelectorAll('[id^="goog"]');
    goog.array.forEach(oldCursors, goog.dom.removeNode);
    var savedRange = range.saveUsingCarets();
    var start = document.querySelector("#" + savedRange.startCaretId_);
    var end = document.querySelector("#" + savedRange.endCaretId_);
    if (start && end) {
      util.dom.changeTagName(start, "en-cursor");
      util.dom.changeTagName(end, "en-cursor");
    }
    return savedRange;
  };
  util.range.clientRectsRanges = function(textNode) {
    if (!textNode || !util.dom.isTextNode(textNode) || !textNode.textContent) {
      return [];
    }
    var parentNode = textNode.parentNode;
    var offsets = [];
    var offset = 0;
    var top = null;
    var rects = null;
    var node = textNode;
    var measureRange = document.createRange();
    parentNode.normalize();
    measureRange.selectNodeContents(node);
    rects = measureRange.getClientRects();
    if (rects.length === 0) {
      return [];
    } else {
      if (rects.length === 1) {
        return [goog.dom.Range.createFromNodes(node, 0, node, node.length)];
      }
    }
    var oldWidth = parentNode.style.width;
    parentNode.style.width = parentNode.getBoundingClientRect().width + "px";
    for (var i = node.textContent.length - 1; i >= 0; i--) {
      var sibling = node.splitText(i + 1);
      if (sibling.textContent) {
        measureRange.selectNodeContents(sibling);
        rects = measureRange.getClientRects();
        if (top !== rects[0].top) {
          top = rects[0].top;
          offsets.push(i + 2);
        }
      }
    }
    parentNode.normalize();
    parentNode.style.width = oldWidth;
    offsets.push(0);
    var ranges = [];
    for (var j = offsets.length - 1; j > 0; j--) {
      ranges.push(goog.dom.Range.createFromNodes(textNode, offsets[j], textNode, offsets[j - 1]));
    }
    return ranges;
  };
  util.range.createFromPoints = function(x, y) {
    var range;
    var node;
    var offset;
    if (document.caretPositionFromPoint) {
      range = document.caretPositionFromPoint(x, y);
      node = range.offsetNode;
      offset = range.offset;
    } else {
      if (document.caretRangeFromPoint) {
        range = document.caretRangeFromPoint(x, y);
        node = range.startContainer;
        offset = range.startOffset;
      }
    }
    return goog.dom.Range.createFromNodes(node, offset, node, offset);
  };
  util.range.splitInlineNode = function(textNode, offset) {
    var inlineNode = dom.isInlineNode(textNode.parentNode) ? textNode.parentNode : textNode;
    var parent = inlineNode.parentNode;
    var left, right;
    if (offset === 0) {
      parent = textNode.parentNode;
      left = inlineNode.previousSibling;
      right = textNode;
    } else {
      left = inlineNode;
      if (offset === textNode.length) {
        right = inlineNode.nextSibling;
      } else {
        var rightTextNode = textNode.splitText(offset);
        if (dom.isElementNode(inlineNode)) {
          right = inlineNode.cloneNode(false);
          right.appendChild(rightTextNode);
        } else {
          right = rightTextNode;
        }
        parent.insertBefore(right, inlineNode.nextSibling);
      }
    }
    return {parent:parent, left:left, right:right};
  };
  function normalizeInternal(direction, rangeNode, rangeOffset, collapsed, debug) {
    var node = rangeNode;
    var offset = rangeOffset;
    while (dom.isUneditable(node)) {
      var parent = node.parentNode;
      var startOffset = dom.index(node);
      node = node.parentNode;
    }
    digging: while (!(dom.isTextNode(node) || dom.isInlineObject(node))) {
      var childNodes = node.childNodes;
      var currentOffset = Math.min(childNodes.length, offset);
      var check = direction === 0 ? function() {
        return currentOffset < childNodes.length;
      } : function() {
        return currentOffset > 0;
      };
      while (check()) {
        var candidate = childNodes[currentOffset + direction];
        if (dom.isInlineObject(candidate) || (dom.isBlockObject(candidate) || dom.isA(candidate)) && !collapsed) {
          offset = currentOffset;
          break digging;
        }
        if (!dom.isUneditable(candidate) && candidate.tagName !== "COLGROUP") {
          offset = direction === 0 ? 0 : dom.isTextNode(candidate) ? candidate.textContent.length : candidate.childNodes.length;
          node = candidate;
          continue digging;
        }
        currentOffset += direction === 0 ? 1 : -1;
      }
      break;
    }
    if (debug && (rangeNode !== node || rangeOffset !== offset)) {
      var message = "normalize" + (direction === 0 ? "Forward" : "Backward") + " changed a range boundary from " + toDebugString(rangeNode, rangeOffset) + " to " + toDebugString(node, offset);
      log.info(message, (new Error).stack);
    }
    return {node:node, offset:offset};
  }
  util.range.normalize = function(range, debug) {
    if (!range) {
      return range;
    }
    if (debug === undefined) {
      debug = DEBUG;
    }
    var collapsed = range.isCollapsed();
    var startNode = range.getStartNode();
    var endNode = range.getEndNode();
    var startOffset = range.getStartOffset();
    var endOffset = range.getEndOffset();
    if (!collapsed && dom.isBlockObject(startNode) && startNode === endNode && startOffset === 0 && endOffset === startNode.childNodes.length) {
      return range;
    }
    var start = normalizeInternal(0, startNode, startOffset, collapsed, debug);
    if (collapsed) {
      var start2 = normalizeInternal(-1, startNode, startOffset, collapsed, debug);
      if (start.node.contains(start2.node)) {
        start = start2;
      }
      return goog.dom.Range.createCaret(start.node, start.offset);
    }
    var end = normalizeInternal(-1, endNode, endOffset, collapsed, debug);
    return goog.dom.Range.createFromNodes(start.node, start.offset, end.node, end.offset);
  };
  util.range.truncateTrailingOpenTag = function(range) {
    if (range.isCollapsed()) {
      return util.range.normalize(range);
    }
    var endNode = range.getEndNode();
    var endOffset = range.getEndOffset();
    if (endOffset !== 0) {
      if (endNode.childNodes && dom.isBr(endNode.childNodes[endOffset - 1])) {
        endOffset -= 1;
      }
    }
    if (endOffset !== 0) {
      return util.range.normalize(range);
    }
    var current = endNode;
    var previousNode = current.previousSibling;
    while (util.dom.isUneditable(previousNode)) {
      previousNode = previousNode.previousSibling;
    }
    while (current && !previousNode) {
      current = current.parentNode;
      previousNode = current.previousSibling;
    }
    if (!previousNode) {
      return range;
    }
    range = goog.dom.Range.createFromNodes(range.getStartNode(), range.getStartOffset(), previousNode, previousNode.childNodes.length);
    return util.range.normalize(range);
  };
  function toDebugString(node, offset) {
    var n = node, a = [];
    while (n && n.parentNode && !dom.isEnnote(n)) {
      a.push(dom.getTagName(n.parentNode) + "(" + dom.index(n) + ")");
      n = n.parentNode;
    }
    var path = "/" + a.reverse().join("/") + "/";
    return "{ " + path + (node.tagName || "#" + node.textContent) + "::" + offset + " }";
  }
  util.range.print_ = function(startNode, startOffset, endNode, endOffset) {
    if (startNode === endNode && startOffset === endOffset) {
      return toDebugString(startNode, startOffset);
    } else {
      return "[" + toDebugString(startNode, startOffset) + " -- " + toDebugString(endNode, endOffset) + "]";
    }
  };
  util.range.print = function(range) {
    return util.range.print_(range.getStartNode(), range.getStartOffset(), range.getEndNode(), range.getEndOffset());
  };
  util.range.fillContainer = function(range) {
    if (range.getBrowserRangeObject().fillContainer) {
      return goog.dom.Range.createFromNodeContents(range.getContainer());
    } else {
      return range;
    }
  };
})();
goog.provide("uno.EditorSelection");
goog.require("goog.dom");
goog.require("goog.debug.Logger");
goog.require("uno.util.dom");
goog.require("uno.util.range");
uno.EditorSelection = function(Editor) {
  var util = uno.util;
  var dom = util.dom;
  var ZWS = "\u200b";
  Editor.prototype.select = function(startNode, startOffset, endNode, endOffset) {
    if (!startNode) {
      return false;
    }
    var newRange;
    if (endNode) {
      newRange = goog.dom.Range.createFromNodes(startNode, startOffset, endNode, endOffset);
    } else {
      newRange = util.range.normalize(goog.dom.Range.createCaret(startNode, startOffset || 0));
    }
    newRange.select();
    return true;
  };
  Editor.prototype.selectContent = function(node, atStart) {
    if (!node) {
      return;
    }
    var content = atStart ? dom.startContent(node) : dom.endContent(node);
    if (util.dom.isTextNode(content)) {
      this.select(content, atStart ? 0 : content.length);
    } else {
      if (dom.isInlineObject(content)) {
        if (dom.isBr(content)) {
          this.select(content.parentNode, dom.index(content));
        } else {
          this.select(content.parentNode, dom.index(content) + (atStart ? 0 : 1));
        }
      }
    }
  };
  Editor.prototype.selectStart = function(node) {
    return this.selectContent(node, true);
  };
  Editor.prototype.selectEnd = function(node) {
    return this.selectContent(node);
  };
  Editor.prototype.getSelectionContext = function(node, offset, useEndOffset) {
    if (node == null || offset == null) {
      return null;
    }
    var target = util.dom.isTextNode(node) ? node : node.childNodes[useEndOffset ? offset > 0 ? offset - 1 : 0 : offset] || null;
    var isText = util.dom.isTextNode(target);
    if (isText && !util.dom.isTextNode(node)) {
      offset = 0;
    }
    var text = isText ? target.data : null;
    var length = isText ? text.length : node.childNodes.length;
    var el = isText ? target.parentNode : target || node;
    var prev;
    if (target || isText) {
      prev = dom.isInlineWrapper(target.parentNode) ? target.parentNode.previousSibling : target.previousSibling;
    } else {
      prev = offset > 0 ? node.childNodes[offset - 1] : null;
    }
    var next;
    if (target || isText) {
      next = dom.isInlineWrapper(target.parentNode) ? target.parentNode.nextSibling : target.nextSibling;
    } else {
      next = node.childNodes[offset + 1] || null;
    }
    var left = isText ? offset > 0 ? text.substr(0, offset) : "" : prev;
    var right = isText ? offset < length ? text.substr(offset) : "" : next;
    var paragraph = util.paragraph.for(target || el);
    var prevParagraph = util.paragraph.prevParagraph(paragraph);
    var nextParagraph = util.paragraph.nextParagraph(paragraph);
    var segment = util.paragraph.segment(target || el);
    var prevSegment = prev && prev.parentNode === paragraph ? prev : null;
    var nextSegment = next && next.parentNode === paragraph ? next : null;
    return {node:node, offset:offset, isText:isText, target:target, text:text, length:length, el:el, prev:prev, next:next, left:left, right:right, paragraph:paragraph, prevParagraph:prevParagraph, nextParagraph:nextParagraph, segment:segment, prevSegment:prevSegment, nextSegment:nextSegment};
  };
  Editor.prototype.getSelection = function() {
    var range = util.range.normalize(this.getRange());
    if (!range) {
      return null;
    }
    var collapsed = range.isCollapsed();
    var context = this.getSelectionContext(range.getStartNode(), range.getStartOffset());
    var endContext = collapsed ? context : this.getSelectionContext(range.getEndNode(), range.getEndOffset(), true);
    return {start:context, end:endContext, collapsed:collapsed, range:range};
  };
  Editor.prototype.insertNodeAtCursor = function(node, options) {
    options = options || {};
    if (!node) {
      return;
    }
    var selection = this.getSelection().start;
    var pendingSpan = dom.isPendingStyleNode(selection.el) ? selection.el : null;
    if (options.selectNode && !pendingSpan && !selection.right) {
      util.styles.createPendingStyles(this);
      var text = document.createTextNode(ZWS);
      var pendingStyle = util.styles.applyPendingStyles(text, this);
      if (text !== pendingStyle) {
        pendingSpan = pendingStyle;
      }
    }
    if (selection.isText) {
      var neighbors = util.range.splitInlineNode(selection.target, selection.offset);
      neighbors.parent.insertBefore(node, neighbors.right);
    } else {
      if (dom.isEmpty(selection.paragraph)) {
        goog.dom.removeChildren(selection.paragraph);
        selection.segment = null;
      }
      selection.paragraph.insertBefore(node, selection.segment);
    }
    if (options.selectNode) {
      this.selectEnd(node);
    }
    if (pendingSpan) {
      if (options.removePendingStyle) {
        goog.dom.removeNode(pendingSpan);
      } else {
        goog.dom.insertSiblingAfter(pendingSpan, node);
        this.selectEnd(pendingSpan);
      }
    }
    if (util.paragraph.isParagraph(node)) {
      goog.dom.flattenElement(node);
    }
  };
  Editor.prototype.saveSelection = function(useCaret, range) {
    range = goog.isObject(range) ? range : this.getRange();
    if (range) {
      this.savedRange = useCaret ? range.saveUsingCarets() : range.saveUsingDom();
      this.currentRange = range;
    }
    return range;
  };
  Editor.prototype.restoreSelection = function(range) {
    if (goog.isObject(range)) {
      range.select();
    } else {
      if (this.savedRange && this.savedRange.isDisposed && !this.savedRange.isDisposed()) {
        try {
          this.savedRange.restore().select();
          var newRange = this.getRange();
          newRange.select();
          var startNode = newRange.getStartNode();
          var endNode = newRange.getStartNode();
          if (startNode) {
            if (dom.isElementNode(startNode)) {
              startNode.normalize();
            } else {
              if (dom.isElementNode(startNode.parentNode)) {
                startNode.parentNode.normalize();
              }
            }
          }
          if (endNode) {
            if (dom.isElementNode(endNode)) {
              endNode.normalize();
            } else {
              if (dom.isElementNode(endNode.parentNode)) {
                endNode.parentNode.normalize();
              }
            }
          }
          newRange.getEndNode().normalize();
        } catch (err) {
        }
      }
      this.savedRange = null;
    }
  };
};
goog.provide("uno.BasePlugin");
goog.require("goog.debug.Logger");
goog.require("goog.editor.Plugin");
goog.require("uno.EditorMultiRange");
(function() {
  var Plugin = goog.editor.Plugin;
  var BasePlugin = uno.BasePlugin = function(trogClassId) {
    Plugin.call(this);
    this.trogClassId = trogClassId;
    this.client = null;
    this.multiRangeMode = uno.EditorMultiRange.Mode.FIRST;
  };
  goog.inherits(BasePlugin, Plugin);
  BasePlugin.prototype.getTrogClassId = function() {
    return this.trogClassId;
  };
  BasePlugin.prototype.registerFieldObject = function(fieldObject) {
    Plugin.prototype.registerFieldObject.call(this, fieldObject);
    var me = this;
    var id = this.getTrogClassId();
    var namespace = goog.getObjectByName(id.toLowerCase());
    if (namespace) {
      this.client = namespace[fieldObject.config.client] || namespace.generic || {};
      Object.keys(this.client).forEach(function(key) {
        if (typeof me.client[key] === "function") {
          me.client[key] = me.client[key].bind(me);
        }
      });
    }
    this.editor = this.getFieldObject();
    this.setParentEventTarget(this.editor);
  };
  BasePlugin.prototype.unregisterFieldObject = function(fieldObject) {
    Plugin.prototype.unregisterFieldObject.call(this, fieldObject);
    this.editor = null;
  };
})();
goog.provide("uno.util.objects");
goog.require("goog.object");
(function() {
  var objects = uno.util.objects;
  objects.mergeOptions = function(options, defaultOptions) {
    var parsedOptions = goog.object.clone(options || {});
    goog.object.extend(defaultOptions, parsedOptions);
    return defaultOptions;
  };
  objects.valueOrDefault = function(val, defaultVal) {
    if (typeof val === "undefined") {
      return defaultVal;
    }
    return val;
  };
  objects.setValueByPath = function(obj, path, val) {
    var parts = path.split(".");
    var cur = obj;
    for (var part; part = parts.shift();) {
      if (parts.length === 0) {
        cur[part] = val;
      } else {
        cur[part] = cur[part] || {};
        cur = cur[part];
      }
    }
  };
  objects.merge = function(obj1, obj2, objN) {
    var result = {};
    var args = Array.prototype.slice.call(arguments);
    args.unshift(result);
    goog.object.extend.apply(null, args);
    return result;
  };
})();
goog.provide("uno.util.tools");
goog.require("goog.dom");
(function() {
  var util = uno.util;
  util.tools.getContainer = function() {
    var container = document.querySelector("en-tools");
    if (!container) {
      container = document.createElement("en-tools");
      document.body.appendChild(container);
    }
    return container;
  };
  util.tools.query = function(selector) {
    var container = util.tools.getContainer();
    return container.querySelector(selector);
  };
  util.tools.append = function(node) {
    var container = util.tools.getContainer();
    container.appendChild(node);
    return node;
  };
  util.tools.remove = function(selector) {
    var node = util.tools.query(selector);
    goog.dom.removeNode(node);
  };
  util.tools.preloadImages = function() {
    if (!util.tools.query("en-preload")) {
      util.tools.append(goog.dom.createDom("en-preload", {class:"en-preload"}));
    }
  };
})();
goog.provide("uno.commands.Accentuate");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.objects");
goog.require("uno.util.tools");
(function() {
  var util = uno.util;
  var log = goog.debug.Logger.getLogger("uno.commands.Accentuate");
  var Accentuate = uno.commands.Accentuate = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Accentuate, uno.BasePlugin);
  Accentuate.CONTAINER_CLASSNAME = "accentuate-container";
  Accentuate.BOX_CLASSNAME = "en-find-result";
  Accentuate.BOX_ACTIVE_CLASSNAME = "en-find-result-active";
  Accentuate.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Accentuate.prototype.isSupportedCommand = function(command) {
    return command === "accentuate";
  };
  Accentuate.prototype.execCommand = function(command, rawOptions) {
    var options = util.objects.mergeOptions(rawOptions, {boxes:[], selectedBoxIndex:-1, scrollToSelectedBox:true, clearFirst:false, clearOnClickSelector:"en-note"});
    var accentuateContainer = document.querySelector("." + Accentuate.CONTAINER_CLASSNAME);
    if (options.clearFirst && accentuateContainer) {
      accentuateContainer.innerHTML = "";
    }
    if (!accentuateContainer) {
      var toolsContainer = util.tools.getContainer();
      accentuateContainer = goog.dom.createDom("div", {class:Accentuate.CONTAINER_CLASSNAME});
      toolsContainer.appendChild(accentuateContainer);
    }
    var boxes = options.boxes;
    var currentIndex = accentuateContainer.querySelectorAll("." + Accentuate.BOX_CLASSNAME).length;
    for (var i = 0; i < boxes.length; i++) {
      var match = boxes[i];
      for (var j = 0; j < match.length; j++) {
        var item = match[j];
        var box = goog.dom.createDom("div", {id:Accentuate.BOX_CLASSNAME + currentIndex, class:Accentuate.BOX_CLASSNAME, style:createStyle({position:"absolute", top:item.top + "px", left:item.left + "px", width:item.width + "px", height:item.height + "px"})});
        currentIndex++;
        accentuateContainer.appendChild(box);
      }
    }
    var newActiveBox = accentuateContainer.querySelector("#" + Accentuate.BOX_CLASSNAME + options.selectedBoxIndex);
    if (newActiveBox) {
      var oldActiveBox = accentuateContainer.querySelector("." + Accentuate.BOX_ACTIVE_CLASSNAME);
      if (oldActiveBox) {
        goog.dom.classlist.remove(oldActiveBox, Accentuate.BOX_ACTIVE_CLASSNAME);
      }
      goog.dom.classlist.add(newActiveBox, Accentuate.BOX_ACTIVE_CLASSNAME);
      if (options.scrollToSelectedBox) {
        newActiveBox.scrollIntoView();
      }
    }
    return true;
  };
  function createStyle(style) {
    var finalStyle = "";
    for (var key in style) {
      if (style.hasOwnProperty(key)) {
        finalStyle += key + ":" + style[key] + ";";
      }
    }
    return finalStyle;
  }
})();
goog.provide("uno.util.id");
(function() {
  var util = uno.util;
  util.id.guid = function() {
    return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
      var rnd = Math.random() * 16 | 0;
      var val = c === "x" ? rnd : rnd & 3 | 8;
      return val.toString(16);
    });
  };
})();
goog.provide("uno.util.react");
(function() {
  var util = uno.util;
  var rootState = {};
  util.react.renderComments = function(state) {
    render(Object.assign(rootState, {comments:state}));
  };
  util.react.renderStatusBar = function(state) {
    render(Object.assign(rootState, {statusbar:state}));
  };
  util.react.renderPreview = function(state) {
    render(Object.assign(rootState, {preview:state}));
  };
  util.react.renderAISuggest = function(state) {
    render(Object.assign(rootState, {aisuggest:state}));
  };
  util.react.renderPlaceholder = function(state) {
    render(Object.assign(rootState, {placeholder:state}));
  };
  util.react.renderPopoverMenu = function(options) {
    if (!rootState.popoverMenu) {
      rootState.popoverMenu = {};
    }
    Object.assign(rootState.popoverMenu, {popoverOpenTime:Date.now()}, options);
    render(rootState);
  };
  util.react.renderTemplateDialog = function(state) {
    render(Object.assign(rootState, {templateDialog:state}));
  };
  util.react.showMenu = function() {
    invoke("menu", arguments);
  };
  util.react.toastNotification = function() {
    invoke("toast", arguments);
  };
  function render(state) {
    if (typeof window === "undefined" || window.reactRender === undefined) {
      return;
    }
    window.reactRender(state);
  }
  function invoke(type, args) {
    window.reactInvoke.apply(null, [type].concat(Array.prototype.slice.apply(args)));
  }
})();
goog.provide("uno.util.font.generic");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.style");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.font.generic");
  var util = uno.util;
  var generic = util.font.generic;
  generic.getSize = function(node) {
    var pxs = goog.style.getFontSize(node);
    return pxs;
  };
  generic.prepareSize = function(size) {
    if (goog.isString(size) && !isNaN(size) && !/[a-z]$/.test(size)) {
      size += "px";
    } else {
      if (typeof size === "number") {
        size += "px";
      }
    }
    return size;
  };
})();
goog.provide("uno.util.font.win");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.style");
goog.require("uno.util.font.generic");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.font.win");
  var util = uno.util;
  var generic = util.font.generic;
  var win = util.font.win;
  win.getSize = function(node) {
    var pxs = generic.getSize(node);
    var pts = util.font.pxsToPts(pxs);
    return pts;
  };
  win.prepareSize = function(size) {
    if (goog.isString(size) && !isNaN(size) && !/[a-z]$/i.test(size)) {
      size += "pt";
    } else {
      if (typeof size === "number") {
        size += "pt";
      }
    }
    return size;
  };
})();
goog.provide("uno.util.font");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.style");
goog.require("uno.util.font.generic");
goog.require("uno.util.font.win");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.font");
  var client = uno.util.font.generic;
  var util = uno.util;
  util.font.setClient = function(clientName) {
    client = uno.util.font[clientName] || uno.util.font.generic;
  };
  util.font.getSize = function(node) {
    return client.getSize(node);
  };
  util.font.getColor = function(node) {
    return goog.style.getComputedStyle(node, "color");
  };
  util.font.prepareSize = function(size) {
    if (size == null) {
      return "";
    }
    return client.prepareSize(size);
  };
  util.font.sizeEquals = function(size1, size2) {
    size1 = util.font.prepareSize(size1);
    size2 = util.font.prepareSize(size2);
    if (size1 === size2) {
      return true;
    }
    if (size1.indexOf("px") > 0) {
      size1 = util.font.pxsToPts(size1) + "pt";
    }
    if (size2.indexOf("px") > 0) {
      size2 = util.font.pxsToPts(size2) + "pt";
    }
    return size1 === size2;
  };
  util.font.pxsToPts = function(pxs) {
    var div = goog.dom.createDom("div", {style:"position:absolute; top:-1000pt; height:100pt;"});
    goog.dom.append(document.body, div);
    var ratio = parseFloat(goog.style.getComputedStyle(div, "height"));
    goog.dom.removeNode(div);
    var pts = Math.round(parseFloat(pxs) * 100 / ratio);
    return pts;
  };
  util.font.normalizeFontSize = function(elem, size) {
    size = size || window.getComputedStyle(elem, null).getPropertyValue("font-size");
    elem.removeAttribute("size");
    elem.style.fontSize = size;
  };
  util.font.normalize = function(fontContainer, size) {
    util.font.normalizeFontSize(fontContainer, size);
    var ancestor = fontContainer;
    var outerFontContainer;
    while (!util.dom.isEnnote(ancestor) && ancestor.parentNode) {
      if (ancestor.tagName === "FONT") {
        outerFontContainer = ancestor;
      }
      ancestor = ancestor.parentNode;
    }
    var fontNodeList = outerFontContainer.querySelectorAll("font[size]");
    var fontContainers = Array.prototype.slice.call(fontNodeList);
    Array.prototype.forEach.call(fontContainers, function(elem) {
      util.font.normalizeFontSize(elem);
    });
  };
})();
goog.provide("uno.util.styles");
goog.require("goog.dom");
goog.require("goog.style");
goog.require("goog.array");
goog.require("goog.object");
goog.require("goog.string");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.font");
(function() {
  var util = uno.util;
  var dom = uno.util.dom;
  var styles = util.styles;
  var ZWS = uno.defs.unicode.ZERO_WIDTH_SPACE;
  var highlightBackgroundColor = uno.defs.highlight.COLOR;
  var knownAttributes = /data-.*|face|border|name|href|rev|start|title|color|class/;
  var fontSizeMap = {1:"11px", 2:"12px", 3:"14px", 4:"18px", 5:"24px", 6:"36px", 7:"48px"};
  var rxEscapeObj = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;
  function rxEscape(value) {
    if (value instanceof RegExp) {
      return value.source;
    }
    return value.replace(rxEscapeObj, "\\$&");
  }
  var regexForAppDataNameCache = {};
  function regexForAppDataName(name) {
    var rx = regexForAppDataNameCache[name];
    if (!rx) {
      rx = new RegExp("(^|;)\\s*(" + rxEscape(name) + ")\\s*\\:\\s*(.*?)($|;)+", "gi");
      regexForAppDataName[name] = rx;
    } else {
      rx.lastIndex = 0;
    }
    return rx;
  }
  styles.rxEvernoteCustomStyleAttr = /^-(en|evernote)-/i;
  styles.rxEvernoteCustomDataAttr = /^data-(en|evernote)-/i;
  var metadataMarker = "data-en-has-metadata";
  styles.metadataImportSelectors = ['*[style*="-en-"]', '*[style*="-evernote-"]'];
  styles.metadataExportSelectors = ["*[" + metadataMarker + "]"];
  styles.stylesToIgnore = ["-evernote-editable"];
  styles.convertStylesToDataAttributes = function(el) {
    var styleString = goog.string.unescapeEntities(el.getAttribute("style"));
    var filteredStyle = "";
    var foundMetadata = false;
    goog.array.forEach(styleString.split(/\s*;\s*/), function(pair) {
      if (pair.length === 0) {
        return;
      }
      var keyValue = pair.match(/\s*([\w-]+)\s*\:(.*)/);
      if (!keyValue || !keyValue.length) {
        return;
      }
      var styleName = keyValue[1];
      var styleValue = goog.string.trim(keyValue[2]);
      if (styles.rxEvernoteCustomStyleAttr.test(styleName) && styles.stylesToIgnore.indexOf(styleName) === -1) {
        el.setAttribute("data" + styleName, styleValue);
        foundMetadata = true;
      } else {
        filteredStyle += pair + ";";
      }
    });
    if (foundMetadata) {
      el.setAttribute(metadataMarker, true);
      el.setAttribute("style", filteredStyle);
      if (goog.string.isEmpty(filteredStyle)) {
        el.removeAttribute("style");
      }
    }
  };
  styles.convertDataAttributesToStyles = function(el) {
    el.removeAttribute(metadataMarker);
    goog.array.forEachRight(el.attributes, function(attr) {
      if (styles.rxEvernoteCustomDataAttr.test(attr.name)) {
        styles.setStyle(el, attr.name.substr(4), attr.value);
        el.removeAttribute(attr.name);
      }
    });
  };
  styles.setMetadata = function(el, name, value) {
    if (name.indexOf("data") !== 0) {
      if (name.indexOf("-") !== 0) {
        name = "-" + name;
      }
      name = "data" + name;
    }
    if (value != null && value !== "") {
      el.setAttribute(name, value);
      el.setAttribute(metadataMarker, true);
    } else {
      el.removeAttribute(name);
      if (Object.keys(styles.getMetadata(el)).length === 0) {
        el.removeAttribute(metadataMarker);
      }
    }
  };
  styles.hasMetadata = function(el) {
    return !!(el && el.getAttribute && el.getAttribute(metadataMarker));
  };
  styles.getCascadedMetadata = function(node) {
    var current = node;
    var nodes = [];
    var metadata = {};
    while (current && current.tagName !== "EN-NOTE" && current.nodeType !== Node.DOCUMEN_NODE) {
      nodes.push(current);
      current = current.parentNode;
    }
    goog.array.forEachRight(nodes, function(n) {
      goog.object.extend(metadata, styles.getMetadata(n));
    });
    return metadata;
  };
  styles.getMetadata = function(el) {
    var metadata = {};
    if (styles.hasMetadata(el)) {
      goog.array.forEachRight(el.attributes, function(attr) {
        if (styles.rxEvernoteCustomDataAttr.test(attr.name) && attr.name !== metadataMarker) {
          metadata[attr.name.substr(4)] = attr.value;
        }
      });
    }
    return metadata;
  };
  styles.getStyle = function(node, name) {
    var styleString = node.getAttribute("style");
    if (styleString == null) {
      return null;
    }
    name = goog.string.toSelectorCase(name);
    var match = regexForAppDataName(name).exec(styleString);
    return match === null ? null : match[3].trim();
  };
  styles.setStyle = function(node, name, value) {
    name = goog.string.toSelectorCase(name);
    var styleString = styles.removeStyle(node, name);
    if (value == null || typeof value === "string" && !value.trim().length) {
      return null;
    }
    styleString = styleString.trim();
    if (styleString.length && styleString[styleString.length - 1] !== ";") {
      styleString += ";";
    }
    styleString = styleString + name + ":" + value + ";";
    node.setAttribute("style", styleString);
    return styleString;
  };
  styles.removeStyle = function(node, name) {
    name = goog.string.toSelectorCase(name);
    var styleString = node.getAttribute("style");
    if (styleString == null) {
      return "";
    }
    styleString = styleString.replace(regexForAppDataName(name), "$1").trim();
    if (styleString.length > 0) {
      node.setAttribute("style", styleString);
    } else {
      node.removeAttribute("style");
    }
    return styleString || "";
  };
  styles.transferStyles = function(stylesList, fromNode, toNode, options) {
    options = options || {};
    if (!goog.isArray(stylesList) || !goog.dom.isElement(fromNode) || !goog.dom.isElement(toNode)) {
      return;
    }
    goog.array.forEach(stylesList, function(styleName) {
      if (options.overwrite || !styles.getStyle(toNode, styleName)) {
        styles.setStyle(toNode, styleName, fromNode.style[styleName]);
      }
      if (options.removeOld) {
        styles.removeStyle(fromNode, styleName);
      }
    });
  };
  styles.createPendingStyles = function(editor) {
    editor.context.style.hasPendingStyles = true;
    editor.context.style.pendingStyles = {};
    editor.context.style.pendingStyles.state = goog.object.clone(editor.context.style.state);
    editor.context.style.pendingStyles.value = goog.object.clone(editor.context.style.value);
  };
  styles.savePendingStyles = function(editor) {
    styles.createPendingStyles(editor);
    return goog.object.clone(editor.context.style.pendingStyles);
  };
  styles.restorePendingStyles = function(editor, style) {
    var trackchanges = editor.config.trackchanges;
    trackchanges.state.forEach(function(command) {
      if (editor.queryCommandState(command) !== style.state[command]) {
        EN.execCommand(command);
      }
    });
    trackchanges.value.forEach(function(command) {
      if (editor.queryCommandValue(command) !== style.value[command]) {
        EN.execCommand(command, style.value[command]);
      }
    });
  };
  styles.clearPendingStyles = function(editor) {
    editor.context.style.hasPendingStyles = false;
    editor.context.style.pendingStyles = {state:{}, value:{}};
  };
  styles.clearInlineStylesAtRange = function(range) {
    var savedRange;
    var node = range.getStartNode();
    var removedMarkup = false;
    if (node.nodeType === Node.TEXT_NODE) {
      node = node.parentNode;
    }
    while (util.dom.isSeeminglyEmpty(node) && util.dom.isInlineStyleNode(node)) {
      if (!savedRange) {
        savedRange = goog.editor.range.saveUsingNormalizedCarets(range);
      }
      var parent = node.parentNode;
      util.dom.flattenElement(node);
      node = parent;
      removedMarkup = true;
    }
    if (removedMarkup) {
      if (node.childNodes && node.childNodes.length === 0) {
        node.appendChild(goog.dom.createDom("br"));
      }
      range = savedRange.restore();
    }
    return range;
  };
  styles.parseStyleAttribute = function(style) {
    var result = {};
    goog.array.forEach((style || "").split(/\s*;\s*/), function(pair) {
      var keyValue = pair.match(/\s*([\w-]+)\s*:(.+)/);
      if (keyValue) {
        var styleName = keyValue[1];
        var styleValue = goog.string.trim(keyValue[2]);
        result[styleName] = styleValue;
      }
    });
    return result;
  };
  styles.toStyleObject = function(currentStyles, defaults) {
    var results = {};
    Object.keys(currentStyles || {}).forEach(function(key) {
      var value = currentStyles[key];
      if (value) {
        switch(key) {
          case "bold":
            results.bold = true;
            break;
          case "italic":
            results.italic = true;
            break;
          case "strikethrough":
            results.strikethrough = true;
            break;
          case "underline":
            results.underline = true;
            break;
          case "forecolor":
            results.color = defaults.fontColor === value ? "" : value;
            break;
          case "fontname":
            results["font-family"] = isDefaultFont(value, defaults) ? "" : value;
            break;
          case "fontsize":
            var fontSize = util.font.prepareSize(value);
            results["font-size"] = util.font.sizeEquals(defaults.fontSize, fontSize) ? "" : fontSize;
            break;
          case "highlight":
            results["background-color"] = uno.defs.highlight.COLOR;
            break;
          default:
        }
      }
    });
    return results;
  };
  styles.withPendingStyles = function(editor, fn, opts) {
    var delayClearStyles = opts && opts.delayClearStyles;
    styles.createPendingStyles(editor);
    var range = editor.getRange();
    if (!delayClearStyles) {
      range = styles.clearInlineStylesAtRange(util.range.normalize(range));
    }
    var obj = fn(range) || {};
    var result = obj.result || false;
    var node = obj.node || editor.getRange().getStartNode();
    var styleOverride = obj.styleOverride;
    if (delayClearStyles) {
      range = styles.clearInlineStylesAtRange(goog.dom.Range.createCaret(node, 0));
      node = range.getStartNode();
    }
    editor.getRange().select();
    editor.dispatchStyleChange(styleOverride);
    if (!obj.dontApplyStyles) {
      if (!obj.node && util.dom.isTextNode(node) && node.data !== ZWS && range.isCollapsed()) {
        node = node.splitText(editor.getRange().getStartOffset());
        goog.dom.Range.createCaret(node, 0).select();
      }
      var savedRange = editor.getRange().saveUsingDom();
      styles.applyPendingStyles(node, editor, true);
      styles.clearPendingStyles(editor);
      util.range.normalize(savedRange.restore()).select();
    }
    return result;
  };
  styles.applyPendingStyles = function(node, editor, fromCurrent) {
    if (editor.context.style.hasPendingStyles) {
      return util.styles.setInlineStyles(node, editor.context.style.pendingStyles, editor.config.defaults, fromCurrent ? editor.context.style : undefined);
    }
    return node;
  };
  function isDefaultFont(fontName, defaults) {
    var defaultFonts = (defaults.fontFamily || defaults.fontName).split(/,\s*/g).join("|");
    var regex = "^(normal|-webkit-standard|-apple-system|" + defaultFonts + "|" + defaults.richTextFont + ")$";
    var fontFamilyRegex = new RegExp(regex, "i");
    return fontFamilyRegex.test(fontName);
  }
  styles.setInlineStyles = function(line, style, defaults, current) {
    var hadParent = true, node = line;
    if (dom.isTextNode(line) || dom.isImg(line) || dom.isBr(line)) {
      hadParent = false;
      if (!line.parentNode) {
        line = goog.dom.createDom("span", null, line);
      } else {
        line = line.parentNode;
      }
    } else {
      node = goog.dom.findNode(line, function(n) {
        return dom.isTextNode(n) || dom.isImg(n) || dom.isBr(n);
      });
      if (!node) {
        node = line;
      }
    }
    var fontNode = document.createElement("span");
    var nodeWrapper = node.parentNode;
    var index = util.dom.index(node);
    if (style.state.bold && (!current || !current.state.bold)) {
      node = goog.dom.createDom("b", null, node);
    }
    if (style.state.italic && (!current || !current.state.italic)) {
      node = goog.dom.createDom("i", null, node);
    }
    if (style.state.underline && (!current || !current.state.underline)) {
      node = goog.dom.createDom("u", null, node);
    }
    if (style.state.strikethrough && (!current || !current.state.strikethrough)) {
      node = goog.dom.createDom("strike", null, node);
    }
    if (style.state.subscript && (!current || !current.state.subscript)) {
      node = goog.dom.createDom("sub", null, node);
    }
    if (style.state.superscript && (!current || !current.state.superscript)) {
      node = goog.dom.createDom("sup", null, node);
    }
    if (style.state.highlight && (!current || !current.state.highlight)) {
      goog.style.setStyle(fontNode, "backgroundColor", highlightBackgroundColor);
    }
    if (!util.font.sizeEquals(style.value.fontsize, defaults.fontSize) && (!current || !util.font.sizeEquals(style.value.fontsize, current.value.fontsize))) {
      goog.style.setStyle(fontNode, "fontSize", util.font.prepareSize(style.value.fontsize));
    }
    if (style.value.forecolor !== defaults.foreColor && (!current || style.value.forecolor !== current.value.forecolor)) {
      goog.style.setStyle(fontNode, "color", style.value.forecolor);
    }
    if (!isDefaultFont(style.value.fontname, defaults) && (!current || style.value.fontname !== current.value.fontname)) {
      goog.style.setStyle(fontNode, "fontFamily", style.value.fontname);
    }
    if (fontNode.getAttribute("style")) {
      goog.dom.replaceNode(fontNode, node);
      fontNode.appendChild(node);
      node = fontNode;
    }
    if (node.parentNode !== nodeWrapper) {
      goog.dom.insertChildAt(nodeWrapper, node, index);
    }
    return hadParent ? line : line.firstChild;
  };
  styles.mergeAttributes = function(fromNode, toNode, skipTagName, options) {
    options = options || {};
    if (options.allowedStyles) {
      options.allowedStyles = new RegExp("^(" + options.allowedStyles + ")$");
    }
    if (options.disallowedStyles) {
      options.disallowedStyles = new RegExp("^(" + options.disallowedStyles + ")$");
    }
    if (options.allowedAttrs) {
      options.allowedAttrs = new RegExp("^(" + options.allowedAttrs + ")$");
    }
    if (options.disallowedAttrs) {
      options.disallowedAttrs = new RegExp("^(" + options.disallowedAttrs + ")$");
    }
    var fromAttributes = fromNode.attributes || [];
    var toAttributes = toNode.attributes || [];
    var finalAttributes = {};
    if (dom.isTextNode(toNode)) {
      return;
    }
    styles.convertAttributesToStyle(fromNode);
    styles.convertAttributesToStyle(toNode);
    goog.array.forEach(goog.array.toArray(fromAttributes), function(attr) {
      if (attr.name !== "style" && knownAttributes.test(attr.name)) {
        finalAttributes[attr.name] = attr.value;
      }
    });
    goog.array.forEach(goog.array.toArray(toAttributes), function(attr) {
      if (attr.name !== "style") {
        if (knownAttributes.test(attr.name)) {
          finalAttributes[attr.name] = attr.value;
        }
        toNode.removeAttribute(attr.name);
      }
    });
    var fromStyle = styles.getNodeStyle(fromNode, skipTagName);
    var toStyle = styles.getNodeStyle(toNode, skipTagName);
    var finalStyle = {};
    Object.keys(fromStyle).forEach(function(key) {
      if (options.disallowedStyles && options.disallowedStyles.test(key)) {
        return;
      }
      if (options.allowedStyles && !options.allowedStyles.test(key)) {
        return;
      }
      finalStyle[key] = fromStyle[key];
    });
    Object.keys(toStyle).forEach(function(key) {
      if (options.disallowedStyles && options.disallowedStyles.test(key)) {
        return;
      }
      if (options.allowedStyles && !options.allowedStyles.test(key)) {
        return;
      }
      finalStyle[key] = toStyle[key];
    });
    var styleString = styles.getStyleString(finalStyle);
    if (styleString) {
      toNode.setAttribute("style", styleString);
    } else {
      if (dom.isElementNode(toNode)) {
        toNode.removeAttribute("style");
      }
    }
    Object.keys(finalAttributes).forEach(function(key) {
      if (options.disallowedAttrs && options.disallowedAttrs.test(key)) {
        return;
      }
      if (options.allowedAttrs && !options.allowedAttrs.test(key)) {
        return;
      }
      toNode.setAttribute(key, finalAttributes[key]);
    });
  };
  styles.getNodeStyle = function(node, skipTagName) {
    if (!node || dom.isTextNode(node)) {
      return {};
    }
    var styleAttribute = node.getAttribute("style");
    styleAttribute = styleAttribute ? styleAttribute.split(";") : [];
    styleAttribute = styleAttribute.filter(function(style) {
      return style.trim() || false;
    }).map(function(style) {
      var styleObject = style.split(":");
      var name = styleObject[0] ? styleObject[0].trim() : "";
      var value = styleObject[1] ? styleObject[1].trim() : "";
      return {name:name, value:value};
    });
    var style = {};
    if (!skipTagName) {
      var tagName = node.tagName.toLowerCase();
      if (tagName === "b" || tagName === "strong") {
        style.bold = true;
      } else {
        if (tagName === "i" || tagName === "em") {
          style.italic = true;
        } else {
          if (tagName === "u" || tagName === "ins") {
            style.underline = true;
          } else {
            if (tagName === "strike" || tagName === "s" || tagName === "del") {
              style.strikethrough = true;
            } else {
              if (tagName === "sub") {
                style.subscript = true;
              } else {
                if (tagName === "sup") {
                  style.superscript = true;
                } else {
                  if (tagName === "font" && node.getAttribute("color")) {
                    style.color = node.getAttribute("color");
                  } else {
                    if (tagName === "font" && node.getAttribute("face")) {
                      style["font-family"] = node.getAttribute("face");
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    styleAttribute.forEach(function(attr) {
      if (attr.name === "font-weight") {
        var value = parseInt(attr.value, 10);
        if (attr.value === "bold") {
          style.bold = true;
        } else {
          if (attr.value === "normal") {
            style.bold = false;
          } else {
            if (!isNaN(value)) {
              style.bold = value >= 500;
            }
          }
        }
      } else {
        if (attr.name === "font-style") {
          if (["italic", "oblique"].indexOf(attr.value) > -1) {
            style.italic = true;
          }
        } else {
          if (attr.name === "text-decoration") {
            if (attr.value.indexOf("line-through") > -1) {
              style.strikethrough = true;
            }
            if (attr.value.indexOf("underline") > -1) {
              style.underline = true;
            }
          } else {
            if (attr.name === "vertical-align" && ["top", "bottom", "middle"].indexOf(attr.value) === -1) {
              if (["sub"].indexOf(attr.value) > -1) {
                style.subscript = true;
              }
              if (["super"].indexOf(attr.value) > -1) {
                style.superscript = true;
              }
            } else {
              var supportedStyle = ".*";
              var regex = new RegExp("^(" + supportedStyle + ")$");
              if (regex.test(attr.name)) {
                style[attr.name] = attr.value;
              }
            }
          }
        }
      }
    });
    return style;
  };
  styles.getCascadedStyle = function(node) {
    var current = node;
    var nodes = [];
    var style = {};
    while (!dom.isBlockNode(current)) {
      nodes.push(current);
      current = current.parentNode;
    }
    goog.array.forEachRight(nodes, function(n) {
      goog.object.extend(style, styles.getNodeStyle(n));
    });
    return style;
  };
  styles.convertAttributesToStyle = function(node) {
    if (dom.isTextNode(node)) {
      return;
    }
    if (node.attributes.face) {
      var face = node.attributes.face.value;
      var fontFamily = goog.style.getStyle(node, "font-family");
      node.removeAttribute("face");
      if (!fontFamily) {
        goog.style.setStyle(node, "font-family", face);
      }
    }
    if (node.attributes.color) {
      var color = node.attributes.color.value;
      var fontColor = goog.style.getStyle(node, "color");
      node.removeAttribute("color");
      if (!fontColor) {
        goog.style.setStyle(node, "color", color);
      }
    }
    if (node.attributes.size) {
      var size = node.attributes.size.value;
      var fontSize = goog.style.getStyle(node, "font-size");
      node.removeAttribute("size");
      if (!fontSize) {
        goog.style.setStyle(node, "font-size", fontSizeMap[size]);
      }
    }
  };
  styles.getStyleString = function(nodeStyles) {
    var finalStyle = "";
    var textDecoration = "";
    Object.keys(nodeStyles).forEach(function(key) {
      var style = nodeStyles[key];
      if (style === "inherit" || style === "initial") {
        return;
      }
      if (key === "bold") {
        if (style) {
          finalStyle += "font-weight: bold; ";
        }
      } else {
        if (key === "background-color") {
          if (style !== "transparent") {
            finalStyle += "background-color: " + style + "; ";
          }
        } else {
          if (key === "italic") {
            finalStyle += "font-style: italic; ";
          } else {
            if (key === "underline") {
              textDecoration += "underline ";
            } else {
              if (key === "strikethrough") {
                textDecoration += "line-through ";
              } else {
                if (key === "superscript") {
                  finalStyle += "vertical-align: super; font-size: smaller; ";
                } else {
                  if (key === "subscript") {
                    finalStyle += "vertical-align: sub; font-size: smaller; ";
                  } else {
                    if (style) {
                      finalStyle += key + ": " + style + "; ";
                    }
                  }
                }
              }
            }
          }
        }
      }
    });
    if (textDecoration) {
      finalStyle += "text-decoration: " + textDecoration.trim() + "; ";
    }
    return finalStyle.trim();
  };
  styles.getNoteWidth = function(element) {
    if (!dom.isEnnote(element)) {
      element = document.querySelector(uno.defs.containers.EDITOR_BODY_SELECTOR);
    }
    if (!element) {
      return null;
    }
    var computedStyle = window.getComputedStyle(element);
    var padding = parseInt(computedStyle.paddingLeft, 10) * 2;
    return element.getBoundingClientRect().width - (isNaN(padding) ? 0 : padding);
  };
  styles.getDevicePixelRatio = function() {
    if ("devicePixelRatio" in window) {
      return window.devicePixelRatio;
    } else {
      if (window.matchMedia) {
        var testDensity = function(density) {
          var mediaQuery = ["-webkit-min", "min--moz", "min"].map(function(prefix) {
            return "(" + prefix + "device-pixel-ratio: " + density + ")";
          }).concat("(min-resolution: " + density + "dppx)").join(",");
          return !!window.matchMedia(mediaQuery).matches;
        };
        if (testDensity("2")) {
          return 2;
        } else {
          if (testDensity("1.5")) {
            return 1.5;
          } else {
            if (testDensity("1")) {
              return 1;
            } else {
              if (testDensity("0.75")) {
                return 0.75;
              }
            }
          }
        }
      }
    }
    return 1;
  };
  styles.inlineStyles = ["alignmentBaseline", "backgroundColor", "baselineShift", "bottom", "breakAfter", "breakBefore", "breakInside", "color", "dominantBaseline", "fill", "fillOpacity", "fillRule", "fontFamily", "fontFeatureSettings", "fontKerning", "fontSize", "fontStretch", "fontStyle", "fontVariant", "fontVariantCaps", "fontVariantLigatures", "fontVariantNumeric", "fontWeight", "lineHeight", "textDecoration", "textDecorationColor", "textDecorationLine", "textDecorationSkip", "textDecorationStyle"];
})();
goog.provide("uno.util.user");
goog.require("uno.util.string");
(function() {
  var util = uno.util;
  var colorCache = {};
  var initialCache = {};
  var colorPickPalette = [];
  var colorPalette = ["#486460", "#84608b", "#607d8b", "#666666", "#7d6258", "#b9512a", "#ff7732", "#ffa900", "#ffc33e", "#ac1779", "#eb4f44", "#95ca2f", "#45cd66", "#35a951", "#32c8c3", "#429ddd", "#25b0ee", "#4a63d8", "#7844ff", "#cf44fe", "#f9475d", "#f3319e", "#973ded", "#6e12ca"];
  util.user.read = function(map, key) {
    var yUser = map.get(key);
    if (yUser) {
      var name = yUser.get("Name") || yUser.get("name");
      return {id:(yUser.get("id") || yUser.get("EvernoteUserID") || key) + "", initial:util.user.getInitial(name), color:util.user.getColor(name), name:name, username:yUser.get("username"), email:yUser.get("email"), photoUrl:yUser.get("photoUrl"), title:yUser.get("title"), location:yUser.get("location")};
    }
    return null;
  };
  util.user.readMany = function(map, keyName) {
    var users = {};
    if (!map || !map.keys()) {
      return users;
    }
    map.keys().forEach(function(key) {
      var user = util.user.read(map, key);
      if (user) {
        users[user[keyName] || key] = user;
      }
    });
    return users;
  };
  util.user.getInitial = function(name) {
    if (!name) {
      return "?";
    }
    var initial = initialCache[name];
    if (initial === undefined) {
      var parts = util.string.removeDiacritics(name.toLowerCase()).split(" ");
      var pattern = /^[a-z]/;
      if (parts.length > 0) {
        var p1 = parts[0] || "";
        var p2 = parts[1] || "";
        if (pattern.test(p1) && pattern.test(p2)) {
          initial = (p1[0] + p2[0]).toUpperCase();
        } else {
          if (pattern.test(p1)) {
            initial = p1[0].toUpperCase();
          }
        }
      }
      if (!initial) {
        initial = "?";
      }
      initialCache[name] = initial;
    }
    return initial;
  };
  util.user.getColor = function(username) {
    if (!username) {
      return "";
    }
    var color = colorCache[username];
    if (!color) {
      if (!colorPickPalette.length) {
        colorPickPalette = colorPalette.slice();
      }
      var index = Math.random() * colorPickPalette.length | 0;
      color = colorPickPalette[index];
      colorCache[username] = color;
      colorPickPalette.splice(index, 1);
    }
    return color;
  };
})();
goog.provide("uno.util.commenting");
goog.require("goog.dom");
goog.require("goog.string");
goog.require("uno.util.dom");
goog.require("uno.util.id");
goog.require("uno.util.react");
goog.require("uno.util.styles");
goog.require("uno.util.user");
(function() {
  var util = uno.util;
  var COMPACT_WIDTH = 688;
  util.commenting.initState = function(editor, userId) {
    var state = editor.context.commenting;
    var y = editor.realtime.y;
    var threadPlaceholders = {};
    state.comments = {};
    state.threads = {};
    state.threadPlaceholders = threadPlaceholders;
    state.ui = {user:util.user.readMany(y.share.metadata.get("Users"), "id")[userId] || null, findMentions:editor.context.userConnections.match, collapsed:true, compact:window.innerWidth <= COMPACT_WIDTH, archive:null, threads:[], readonly:!!editor.readOnly, field:editor.field};
    var yComments = y.share.comments;
    yComments.keys().forEach(function(key) {
      var comment = util.commenting.read(yComments, key);
      if (comment) {
        var threadId = comment.parentId;
        comment.editable = !!(state.ui.user && comment.userId === state.ui.user.id);
        if (comment.parentId && state.threads[threadId]) {
          state.threads[threadId].comments.push(comment);
        } else {
          if (comment.parentId && threadPlaceholders[threadId]) {
            threadPlaceholders[threadId].push(comment);
          } else {
            if (comment.parentId) {
              threadPlaceholders[comment.parentId] = [comment];
            } else {
              var comments = threadPlaceholders[comment.id] || [];
              state.threads[comment.id] = {id:comment.id, active:false, y:null, comments:comments.concat(comment)};
            }
          }
        }
        state.comments[comment.id] = comment;
      }
    });
    Object.values(state.threads).forEach(function(t) {
      t.comments.sort(commentSortComparator);
    });
  };
  util.commenting.setState = function(editor, events) {
    var changed = false;
    var state = editor.context.commenting;
    var y = editor.realtime.y;
    events.forEach(function(event) {
      if (!event.remote) {
        return;
      }
      var comment = null;
      var remoteComment = null;
      var keys = Array.from(event.keysChanged);
      if (!event.path.length) {
        keys.forEach(function(key) {
          comment = state.comments[key];
          remoteComment = util.commenting.read(y.share.comments, key);
          if (comment && comment.saved === null) {
            changed = true;
            comment.saved = true;
          } else {
            if (!comment && remoteComment) {
              changed = true;
              remoteComment.editable = !!(state.ui.user && remoteComment.userId === state.ui.user.id);
              util.commenting.append(state, remoteComment);
            }
          }
        });
      } else {
        if (event.path.length && state.comments[event.path[0]]) {
          var guid = event.path[0];
          comment = state.comments[guid];
          remoteComment = comment ? util.commenting.read(y.share.comments, guid) : null;
          var yComment = comment ? y.share.comments.get(guid) : null;
          if (!yComment) {
            return;
          }
          changed = true;
          if (!yComment.get("active")) {
            util.commenting.remove(state, null, {remote:true, id:guid, editor:editor});
          } else {
            if (remoteComment && remoteComment.resolved && !comment.resolved) {
              util.commenting.resolve(state, null, {remote:true, threadId:comment.parentId || comment.id, editor:editor});
            } else {
              if (remoteComment && !remoteComment.resolved && comment.resolved) {
                util.commenting.reopen(state, null, {remote:true, threadId:comment.parentId || comment.id, editor:editor});
              } else {
                if (remoteComment) {
                  util.commenting.edit(state, null, {remote:true, id:comment.id, text:remoteComment.text, updated:remoteComment.updated});
                }
              }
            }
          }
        }
      }
    });
    return changed;
  };
  util.commenting.setReadOnly = function(state, readonly) {
    if (!state || state.ui === readonly) {
      return;
    }
    state.ui.readonly = readonly;
    util.react.renderComments(state.ui);
  };
  util.commenting.updateCurrentUser = function(state, userId, userMap) {
    var user = util.user.readMany(userMap, "id")[userId] || null;
    var oldUserId = (state.ui.user || {}).id;
    var newUserId = (user || {}).id;
    if (oldUserId === newUserId) {
      return;
    }
    state.ui = Object.assign({}, state.ui, {user:user});
    Object.values(state.comments).forEach(function(comment) {
      var editable = comment.userId === newUserId;
      if (comment.editable !== editable) {
        transform(state, comment.id, {editable:editable});
      }
    });
    util.react.renderComments(state.ui);
  };
  util.commenting.init = function(editor) {
    var y = editor.realtime.y;
    var state = editor.context.commenting;
    var range = editor.getRange();
    if (!range || !goog.dom.getAncestor(range.getContainer(), util.dom.isEnnote, true)) {
      return;
    }
    var thread = {id:util.id.guid(), active:true, comments:[]};
    state.threads[thread.id] = thread;
    var plainText = editor.queryCommandValue("copy").plain;
    plainText = goog.string.isEmptySafe(plainText) ? null : plainText;
    var markerRange = util.commenting.createMarkers(range, thread.id);
    var point = util.commenting.getRangePoint(markerRange);
    thread.y = point.y;
    thread.x = point.x;
    thread.selectedText = plainText;
    var threads = state.ui.threads;
    var index = threads.findIndex(function(t) {
      return threadPositionSortComparator(t, thread) > 0;
    });
    if (index === -1) {
      state.ui.threads = threads.concat(thread);
    } else {
      state.ui.threads = threads.slice(0, index).concat(thread, threads.slice(index));
    }
    state.ui.collapsed = false;
    util.react.renderComments(state.ui);
  };
  util.commenting.edit = function(state, map, options) {
    var text = (options.text || "").trim();
    if (!text) {
      return false;
    }
    var comment = transform(state, options.id, {editing:false, updated:options.remote ? options.updated : Date.now(), text:text});
    if (!comment) {
      return false;
    }
    if (!options.remote) {
      util.commenting.write(map, comment);
      util.react.renderComments(state.ui);
    }
    return true;
  };
  util.commenting.setEditing = function(editor, id, flag) {
    var state = editor.context.commenting;
    var comment = transform(state, id, {editing:flag});
    if (!comment) {
      return false;
    }
    var threadId = comment.parentId || comment.id;
    var otherComment = state.threads[threadId].comments.find(function(c) {
      return c.id !== id && c.editing;
    });
    if (otherComment) {
      transform(state, otherComment.id, {editing:false});
    }
    util.commenting.highlight(editor, threadId, false);
    return true;
  };
  util.commenting.reopen = function(state, map, options) {
    return util.commenting.resolve(state, map, options, false);
  };
  util.commenting.resolve = function(state, map, options, flag) {
    var comment = transform(state, options.threadId, {resolved:flag === undefined ? true : flag});
    if (!comment) {
      return false;
    }
    if (!options.remote) {
      var style = comment.resolved ? "disabled" : "enabled";
      util.commenting.setMarkerStyle(style, options.threadId, options.editor.field);
      util.commenting.write(map, comment);
      util.react.renderComments(state.ui);
    }
    return true;
  };
  util.commenting.remove = function(state, map, options) {
    var comment = transform(state, options.id, {removed:true});
    if (!comment) {
      return false;
    }
    if (!options.remote) {
      if (!comment.parentId) {
        util.commenting.removeMarkers(comment.id, options.editor.field);
      }
      util.commenting.write(map, comment);
      util.react.renderComments(state.ui);
    }
    return true;
  };
  util.commenting.insert = function(state, map, options) {
    var text = (options.text || "").trim();
    var thread = state.threads[options.threadId];
    var isThread = thread.comments.length === 0;
    if (!text) {
      return false;
    }
    var user = state.ui.user;
    var id = isThread ? thread.id : util.id.guid();
    var comment = transform(state, id, {id:null, parentId:isThread ? null : thread.id, userId:user.id, name:user.name, initial:user.initial, color:user.color, created:Date.now(), updated:Date.now(), resolved:false, removed:false, text:text, saved:null, editable:true});
    if (thread.selectedText) {
      comment.selectedText = thread.selectedText;
      delete thread.selectedText;
    }
    util.commenting.write(map, comment);
    util.react.renderComments(state);
    return true;
  };
  util.commenting.highlight = function(editor, threadId, collapsed) {
    var state = editor.context.commenting;
    var threads = state.ui.threads;
    var thread = null;
    for (var i = threads.length - 1; i >= 0; i--) {
      var t = threads[i];
      if (t.id !== threadId && t.active && !t.comments.length) {
        thread = t;
        threads = threads.slice(0, i).concat(threads.slice(i + 1));
        delete state.threads[t.id];
        util.commenting.removeMarkers(t.id, editor.field);
      } else {
        if (t.id === threadId && !t.active || t.id !== threadId && t.active) {
          var comments = t.comments;
          thread = state.threads[t.id] = Object.assign({}, t, {active:!t.active});
          threads = threads.slice(0, i).concat(thread, threads.slice(i + 1));
          if (t.active) {
            var index = comments.findIndex(function(c) {
              return c.editing;
            });
            if (index > -1) {
              transform(state, comments[index].id, {editing:false});
            }
          }
        }
      }
    }
    if (thread || collapsed !== undefined) {
      state.ui.collapsed = !!collapsed;
      state.ui.threads = threads;
      util.commenting.setMarkerActive(threadId, editor.field);
      util.react.renderComments(state.ui);
      return true;
    }
    return false;
  };
  util.commenting.append = function(state, comment) {
    var threadId = comment.parentId || comment.id;
    var thread = state.threads[threadId];
    state.comments[comment.id] = comment;
    if (thread) {
      thread.comments = thread.comments.concat(comment).sort(commentSortComparator);
    } else {
      if (comment.parentId && state.threadPlaceholders[threadId]) {
        state.threadPlaceholders[threadId].push(comment);
      } else {
        if (comment.parentId) {
          state.threadPlaceholders[threadId] = [comment];
        } else {
          var comments = state.threadPlaceholders[threadId] || [];
          state.threads[threadId] = {id:threadId, active:false, y:null, comments:comments.concat(comment).sort(commentSortComparator)};
        }
      }
    }
    return true;
  };
  util.commenting.read = function(map, key) {
    var yComment = map.get(key);
    if (yComment && yComment.get("saved") && yComment.get("active")) {
      var name = yComment.get("tmpPrettyName");
      return {editable:false, id:key, userId:yComment.get("creator_info"), created:yComment.get("created_time"), updated:yComment.get("last_updated_time"), parentId:yComment.get("parent_comment_guid"), text:(yComment.get("content") || "").trim(), name:name, initial:util.user.getInitial(name), color:util.user.getColor(name), selectedText:yComment.get("selection_string"), removed:!yComment.get("active"), resolved:yComment.get("status") === "resolved", saved:yComment.get("saved")};
    }
    return null;
  };
  util.commenting.readMany = function(map) {
  };
  util.commenting.write = function(map, obj) {
    var yComment = map.get(obj.id);
    if (!yComment) {
      yComment = map.set(obj.id, window.Y.Map);
    }
    var status = obj.resolved ? "resolved" : "open";
    yComment._y.transact(function() {
      yComment.set("parent_comment_guid", obj.parentId);
      yComment.set("status", status);
      yComment.set("creator_info", obj.userId);
      yComment.set("content", obj.text);
      yComment.set("selection_string", obj.selectedText);
      yComment.set("created_time", obj.created);
      yComment.set("last_updated_time", obj.updated);
      yComment.set("tmpPrettyName", obj.name);
      yComment.set("saved", !!obj.saved);
      yComment.set("active", !obj.removed);
    });
  };
  util.commenting.fullsizeOpened = function(editor, opt) {
    var state = editor.context.commenting;
    state.ui.archive = {threads:[], title:editor.config.note.title || "Untitled", close:editor.closeFullSize.bind(editor, "archive")};
    filterAndSortThreads(state);
    util.react.renderComments(state.ui);
    return true;
  };
  util.commenting.fullsizeClosed = function(editor) {
    var state = editor.context.commenting;
    state.ui.archive = null;
    util.react.renderComments(state.ui);
  };
  util.commenting.createMarkers = function(range, threadId) {
    var caretRange = range.saveUsingCarets();
    var startSpan = caretRange.getCaret(true);
    var endSpan = caretRange.getCaret(false);
    util.commenting.wrap(startSpan, endSpan, threadId, "active");
    return caretRange.restore();
  };
  util.commenting.removeMarkers = function(target, field) {
    if (typeof target === "string") {
      target = Array.from(field.querySelectorAll('[data-en-comment="' + target + '"]'));
    }
    if (target && target.length > 0) {
      target.forEach(function(node) {
        goog.dom.flattenElement(node);
      });
    }
  };
  util.commenting.setMarkerStyle = function(style, target, field) {
    if (typeof target === "string") {
      target = Array.from(field.querySelectorAll('[data-en-comment="' + target + '"]'));
    }
    if (target && target.length > 0) {
      target.forEach(function(node) {
        node.setAttribute("class", style);
      });
    }
  };
  util.commenting.setMarkerActive = function(threadId, field) {
    var activeElements = Array.from(field.querySelectorAll("[data-en-comment].active"));
    activeElements.forEach(function(node) {
      if (node.getAttribute("data-en-comment") !== threadId) {
        util.commenting.setMarkerStyle("enabled", [node]);
      }
    });
    if (threadId) {
      var enabledElements = Array.from(field.querySelectorAll('[data-en-comment="' + threadId + '"].enabled'));
      util.commenting.setMarkerStyle("active", enabledElements);
    }
  };
  util.commenting.getMarkerNode = function(node) {
    var el = node;
    while (el) {
      if (el.tagName === "EN-NOTE" || el.tagName === "BODY") {
        return null;
      }
      if (el.tagName === "EN-COMMENT") {
        return el;
      }
      el = el.parentElement;
    }
    return null;
  };
  util.commenting.updateMarkers = function(state, field) {
    var elementMap = Array.from(field.querySelectorAll("[data-en-comment]")).reduce(function(acc, node) {
      var guid = node.getAttribute("data-en-comment");
      var obj = acc[guid];
      if (!obj) {
        obj = acc[guid] = [];
      }
      obj.push(node);
      return acc;
    }, {});
    Object.values(state.threads).forEach(function(thread) {
      var threadId = thread.id;
      if (!thread.comments.length && thread.active) {
        return;
      }
      state.threads[thread.id] = thread = Object.assign({}, thread, {y:null});
      var parent = thread.comments[0];
      var elements = elementMap[threadId] || [];
      if (!parent || parent.removed || parent.saved === false) {
        util.commenting.removeMarkers(elements);
      } else {
        if (parent.resolved) {
          util.commenting.setMarkerStyle("none", elements);
        } else {
          var style = thread.active ? "active" : "enabled";
          util.commenting.setMarkerStyle(style, elements);
        }
        if (elements.length > 0) {
          var markerRange = goog.dom.Range.createFromNodes(elements[0], 0, elements[0], 0);
          var point = util.commenting.getRangePoint(markerRange);
          thread.y = point.y;
          thread.x = point.x;
        }
      }
    });
    filterAndSortThreads(state);
    util.react.renderComments(state.ui);
  };
  util.commenting.getRangePoint = function(range) {
    var measureRange = document.createRange();
    measureRange.selectNode(range.getStartNode());
    var clientRects = measureRange.getClientRects();
    var clientRect = clientRects && clientRects.length > 0 ? clientRects[0] : null;
    return {x:clientRect ? clientRect.left : null, y:clientRect ? clientRect.top + window.scrollY : null};
  };
  util.commenting.changeColumnPaddingIfNeeded = function(state, field) {
    var oldWide = document.body.classList.contains("pr-comments");
    var newWide = window.innerWidth > COMPACT_WIDTH && !state.ui.collapsed && state.ui.threads.length > 0;
    var oldBase = document.body.classList.contains("pr80");
    var newBase = state.ui.threads.length > 0;
    var compact = window.innerWidth <= COMPACT_WIDTH;
    var fullsize = document.body.classList.contains("fullsize");
    if (fullsize || oldWide === newWide && oldBase === newBase && compact === state.ui.compact) {
      return false;
    }
    document.body.classList.toggle("pr80", newBase);
    document.body.classList.toggle("pr-comments", newWide);
    state.ui.compact = compact;
    util.commenting.updateMarkers(state, field);
    return true;
  };
  util.commenting.layoutAdder = function(state, range) {
    if (!range && state.ui.focusY) {
      state.ui.focusY = null;
      util.react.renderComments(state.ui);
      return true;
    } else {
      if (!state || !range) {
        return false;
      }
    }
    var rects = range.getBrowserRangeObject().getClientRects();
    var y = rects.length === 0 || rects[0].height === 0 ? null : window.scrollY + rects[0].top;
    if (state.ui.focusY !== y) {
      state.ui.focusY = y;
      util.react.renderComments(state.ui);
      return true;
    }
    return false;
  };
  function filterAndSortThreads(state) {
    var threads = Object.values(state.threads);
    state.ui.threads = threads.filter(function(t) {
      return t.y !== null && (!t.comments.length || !t.comments[0].resolved);
    }).sort(threadPositionSortComparator);
    if (state.ui.archive) {
      state.ui.archive.threads = threads.filter(function(t) {
        return t.y == null || t.comments.length && t.comments[0].resolved;
      }).sort(threadDateSortComparator);
    }
  }
  function threadPositionSortComparator(a, b) {
    return a.y === b.y ? a.x - b.x : a.y - b.y;
  }
  function threadDateSortComparator(a, b) {
    var dateA = a.comments[a.comments.length - 1].created;
    var dateB = b.comments[b.comments.length - 1].created;
    return dateB - dateA;
  }
  function commentSortComparator(a, b) {
    if (a.parentId && !b.parentId) {
      return 1;
    } else {
      if (!a.parentId && b.parentId) {
        return -1;
      }
    }
    return a.created - b.created;
  }
  function transform(state, id, obj) {
    var insert = obj.id === null;
    var comment = insert ? {id:id} : state.comments[id];
    var threadId = comment ? obj.parentId || comment.parentId || comment.id : null;
    var thread = comment ? state.threads[threadId] : null;
    if (insert) {
      obj.id = id;
    } else {
      if (!thread) {
        return null;
      }
    }
    state.comments[id] = comment = Object.assign({}, comment, obj);
    var comments = thread.comments;
    var index = comments.findIndex(function(c) {
      return c.id === id;
    });
    if (insert) {
      index = thread.comments.length;
    } else {
      if (index === -1) {
        return comment;
      }
    }
    var lhs = comments.slice(0, index);
    var rhs = comments.slice(index + 1);
    state.threads[threadId] = thread = Object.assign({}, thread, {comments:obj.removed ? lhs.concat(rhs) : lhs.concat(comment, rhs)});
    if (!thread.comments.length) {
      delete state.threads[threadId];
    }
    var threads = state.ui.threads;
    index = threads.findIndex(function(t) {
      return t.id === threadId;
    });
    if (index > -1) {
      lhs = threads.slice(0, index);
      rhs = threads.slice(index + 1);
      state.ui.threads = !comment.parentId && obj.removed ? lhs.concat(rhs) : lhs.concat(thread, rhs);
    }
    return comment;
  }
  util.commenting.wrap = function(start, end, threadId, style) {
    wrapInlineNodes(start, end, threadId, style);
  };
  function wrapInlineNodes(start, end, threadId, style, hasInlineParent, recursive) {
    var node = start;
    var nodes = [];
    var isInline = false;
    var isWrapper = false;
    var result = {wrappingOccurred:false, endFound:false};
    if (!recursive && isWrapped(start, threadId)) {
      return result;
    }
    while (node) {
      isInline = util.dom.isInlineNode(node);
      isWrapper = isWrapperElement(node, threadId);
      if (isWrapper || !util.dom.isInlineNode(node)) {
        wrapNodes(nodes, threadId, style);
        result.wrappingOccurred = true;
        nodes = [];
      }
      if (!isWrapper) {
        var childResults = wrapInlineNodes(node.firstChild, end, threadId, style, isInline, true);
        if (childResults.wrappingOccurred) {
          wrapNodes(nodes, threadId, style);
          nodes = [];
          if (childResults.wrappingOccurred) {
            result.wrappingOccurred = true;
          }
          if (childResults.endFound) {
            result.endFound = true;
          }
        }
        if (isInline && !result.endFound) {
          nodes.push(node);
        }
      }
      if (node === end || result.endFound || !node.nextSibling && !hasInlineParent) {
        wrapNodes(nodes, threadId, style);
        result.wrappingOccurred = true;
        nodes = [];
      }
      while (!recursive && !node.nextSibling && node !== end && !result.endFound) {
        node = node.parentElement;
      }
      if (node === end || result.endFound) {
        result.endFound = true;
        return result;
      }
      node = node && node.nextSibling;
    }
    return result;
  }
  function isWrapperElement(node, commentThreadId) {
    return node.tagName === "EN-COMMENT" && node.getAttribute("data-en-comment") === commentThreadId;
  }
  function isWrapped(node, commentThreadId) {
    var el = node;
    while (el) {
      el = el.parentElement;
      if (el.tagName === "EN-NOTE" || el.tagName === "BODY") {
        return false;
      }
      if (isWrapperElement(el, commentThreadId)) {
        return true;
      }
    }
    return false;
  }
  function wrapNodes(nodes, commentThreadId, style) {
    if (!nodes || nodes.length === 0) {
      return;
    }
    var wrapper = document.createElement("en-comment");
    if (style) {
      wrapper.setAttribute("class", style);
    }
    util.styles.setMetadata(wrapper, "data-en-comment", commentThreadId);
    goog.dom.replaceNode(wrapper, nodes[0]);
    nodes.forEach(function(n) {
      return wrapper.appendChild(n);
    });
  }
})();
goog.provide("uno.commands.Active");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.commenting");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Active");
  var util = uno.util;
  var Active = uno.commands.Active = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Active, uno.BasePlugin);
  Active.prototype.isSupportedCommand = function(command) {
    return command === "active";
  };
  Active.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Active.prototype.execCommand = function(command, makeActive) {
    if (makeActive === "true") {
      makeActive = true;
    } else {
      if (makeActive === "false") {
        makeActive = false;
      }
    }
    var prevReadonly = this.editor.readOnly;
    if (makeActive) {
      this.editor.readOnly = false;
      if (this.editor.config.stayInEditMode) {
        this.editor.enterEditMode({range:null, focus:false});
      }
    } else {
      this.editor.readOnly = true;
      this.editor.leaveEditMode();
    }
    if (this.editor.config.realtime.enabled && this.editor.config.realtime.commenting && prevReadonly !== this.editor.readOnly) {
      util.commenting.setReadOnly(this.editor.context.commenting, this.editor.readOnly);
    }
    this.editor.updateEmpty(!(this.editor.config.realtime && this.editor.config.realtime.enabled));
    return true;
  };
  Active.prototype.queryCommandValue = function() {
    return !this.editor.readOnly;
  };
})();
goog.provide("uno.commands.ApplyTemplate");
goog.require("goog.debug.Logger");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.ApplyTemplate");
  var ApplyTemplate = uno.commands.ApplyTemplate = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(ApplyTemplate, uno.BasePlugin);
  ApplyTemplate.prototype.isSupportedCommand = function(command) {
    return command === "applytemplate";
  };
  ApplyTemplate.prototype.activeOnUneditableFields = goog.functions.TRUE;
  ApplyTemplate.prototype.activeOnRangeOutsideOfEditor = goog.functions.TRUE;
  ApplyTemplate.prototype.execCommandInternal = function(command, value) {
    return EN.run("template-apply", {template:value});
  };
  ApplyTemplate.prototype.queryCommandValue = function() {
    return null;
  };
  ApplyTemplate.prototype.queryCommandEnabled = function(command) {
    return true;
  };
})();
goog.provide("goog.crypt");
goog.require("goog.array");
goog.require("goog.asserts");
goog.crypt.stringToByteArray = function(str) {
  var output = [], p = 0;
  for (var i = 0; i < str.length; i++) {
    var c = str.charCodeAt(i);
    while (c > 255) {
      output[p++] = c & 255;
      c >>= 8;
    }
    output[p++] = c;
  }
  return output;
};
goog.crypt.byteArrayToString = function(bytes) {
  var CHUNK_SIZE = 8192;
  if (bytes.length <= CHUNK_SIZE) {
    return String.fromCharCode.apply(null, bytes);
  }
  var str = "";
  for (var i = 0; i < bytes.length; i += CHUNK_SIZE) {
    var chunk = goog.array.slice(bytes, i, i + CHUNK_SIZE);
    str += String.fromCharCode.apply(null, chunk);
  }
  return str;
};
goog.crypt.byteArrayToHex = function(array) {
  return goog.array.map(array, function(numByte) {
    var hexByte = numByte.toString(16);
    return hexByte.length > 1 ? hexByte : "0" + hexByte;
  }).join("");
};
goog.crypt.hexToByteArray = function(hexString) {
  goog.asserts.assert(hexString.length % 2 == 0, "Key string length must be multiple of 2");
  var arr = [];
  for (var i = 0; i < hexString.length; i += 2) {
    arr.push(parseInt(hexString.substring(i, i + 2), 16));
  }
  return arr;
};
goog.crypt.stringToUtf8ByteArray = function(str) {
  var out = [], p = 0;
  for (var i = 0; i < str.length; i++) {
    var c = str.charCodeAt(i);
    if (c < 128) {
      out[p++] = c;
    } else {
      if (c < 2048) {
        out[p++] = c >> 6 | 192;
        out[p++] = c & 63 | 128;
      } else {
        if ((c & 64512) == 55296 && i + 1 < str.length && (str.charCodeAt(i + 1) & 64512) == 56320) {
          c = 65536 + ((c & 1023) << 10) + (str.charCodeAt(++i) & 1023);
          out[p++] = c >> 18 | 240;
          out[p++] = c >> 12 & 63 | 128;
          out[p++] = c >> 6 & 63 | 128;
          out[p++] = c & 63 | 128;
        } else {
          out[p++] = c >> 12 | 224;
          out[p++] = c >> 6 & 63 | 128;
          out[p++] = c & 63 | 128;
        }
      }
    }
  }
  return out;
};
goog.crypt.utf8ByteArrayToString = function(bytes) {
  var out = [], pos = 0, c = 0;
  while (pos < bytes.length) {
    var c1 = bytes[pos++];
    if (c1 < 128) {
      out[c++] = String.fromCharCode(c1);
    } else {
      if (c1 > 191 && c1 < 224) {
        var c2 = bytes[pos++];
        out[c++] = String.fromCharCode((c1 & 31) << 6 | c2 & 63);
      } else {
        if (c1 > 239 && c1 < 365) {
          var c2 = bytes[pos++];
          var c3 = bytes[pos++];
          var c4 = bytes[pos++];
          var u = ((c1 & 7) << 18 | (c2 & 63) << 12 | (c3 & 63) << 6 | c4 & 63) - 65536;
          out[c++] = String.fromCharCode(55296 + (u >> 10));
          out[c++] = String.fromCharCode(56320 + (u & 1023));
        } else {
          var c2 = bytes[pos++];
          var c3 = bytes[pos++];
          out[c++] = String.fromCharCode((c1 & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
        }
      }
    }
  }
  return out.join("");
};
goog.crypt.xorByteArray = function(bytes1, bytes2) {
  goog.asserts.assert(bytes1.length == bytes2.length, "XOR array lengths must match");
  var result = [];
  for (var i = 0; i < bytes1.length; i++) {
    result.push(bytes1[i] ^ bytes2[i]);
  }
  return result;
};
goog.provide("goog.crypt.Hash");
goog.crypt.Hash = function() {
  this.blockSize = -1;
};
goog.crypt.Hash.prototype.reset = goog.abstractMethod;
goog.crypt.Hash.prototype.update = goog.abstractMethod;
goog.crypt.Hash.prototype.digest = goog.abstractMethod;
goog.provide("goog.crypt.Md5");
goog.require("goog.crypt.Hash");
goog.crypt.Md5 = function() {
  goog.crypt.Md5.base(this, "constructor");
  this.blockSize = 512 / 8;
  this.chain_ = new Array(4);
  this.block_ = new Array(this.blockSize);
  this.blockLength_ = 0;
  this.totalLength_ = 0;
  this.reset();
};
goog.inherits(goog.crypt.Md5, goog.crypt.Hash);
goog.crypt.Md5.prototype.reset = function() {
  this.chain_[0] = 1732584193;
  this.chain_[1] = 4023233417;
  this.chain_[2] = 2562383102;
  this.chain_[3] = 271733878;
  this.blockLength_ = 0;
  this.totalLength_ = 0;
};
goog.crypt.Md5.prototype.compress_ = function(buf, opt_offset) {
  if (!opt_offset) {
    opt_offset = 0;
  }
  var X = new Array(16);
  if (goog.isString(buf)) {
    for (var i = 0; i < 16; ++i) {
      X[i] = buf.charCodeAt(opt_offset++) | buf.charCodeAt(opt_offset++) << 8 | buf.charCodeAt(opt_offset++) << 16 | buf.charCodeAt(opt_offset++) << 24;
    }
  } else {
    for (var i = 0; i < 16; ++i) {
      X[i] = buf[opt_offset++] | buf[opt_offset++] << 8 | buf[opt_offset++] << 16 | buf[opt_offset++] << 24;
    }
  }
  var A = this.chain_[0];
  var B = this.chain_[1];
  var C = this.chain_[2];
  var D = this.chain_[3];
  var sum = 0;
  sum = A + (D ^ B & (C ^ D)) + X[0] + 3614090360 & 4294967295;
  A = B + (sum << 7 & 4294967295 | sum >>> 25);
  sum = D + (C ^ A & (B ^ C)) + X[1] + 3905402710 & 4294967295;
  D = A + (sum << 12 & 4294967295 | sum >>> 20);
  sum = C + (B ^ D & (A ^ B)) + X[2] + 606105819 & 4294967295;
  C = D + (sum << 17 & 4294967295 | sum >>> 15);
  sum = B + (A ^ C & (D ^ A)) + X[3] + 3250441966 & 4294967295;
  B = C + (sum << 22 & 4294967295 | sum >>> 10);
  sum = A + (D ^ B & (C ^ D)) + X[4] + 4118548399 & 4294967295;
  A = B + (sum << 7 & 4294967295 | sum >>> 25);
  sum = D + (C ^ A & (B ^ C)) + X[5] + 1200080426 & 4294967295;
  D = A + (sum << 12 & 4294967295 | sum >>> 20);
  sum = C + (B ^ D & (A ^ B)) + X[6] + 2821735955 & 4294967295;
  C = D + (sum << 17 & 4294967295 | sum >>> 15);
  sum = B + (A ^ C & (D ^ A)) + X[7] + 4249261313 & 4294967295;
  B = C + (sum << 22 & 4294967295 | sum >>> 10);
  sum = A + (D ^ B & (C ^ D)) + X[8] + 1770035416 & 4294967295;
  A = B + (sum << 7 & 4294967295 | sum >>> 25);
  sum = D + (C ^ A & (B ^ C)) + X[9] + 2336552879 & 4294967295;
  D = A + (sum << 12 & 4294967295 | sum >>> 20);
  sum = C + (B ^ D & (A ^ B)) + X[10] + 4294925233 & 4294967295;
  C = D + (sum << 17 & 4294967295 | sum >>> 15);
  sum = B + (A ^ C & (D ^ A)) + X[11] + 2304563134 & 4294967295;
  B = C + (sum << 22 & 4294967295 | sum >>> 10);
  sum = A + (D ^ B & (C ^ D)) + X[12] + 1804603682 & 4294967295;
  A = B + (sum << 7 & 4294967295 | sum >>> 25);
  sum = D + (C ^ A & (B ^ C)) + X[13] + 4254626195 & 4294967295;
  D = A + (sum << 12 & 4294967295 | sum >>> 20);
  sum = C + (B ^ D & (A ^ B)) + X[14] + 2792965006 & 4294967295;
  C = D + (sum << 17 & 4294967295 | sum >>> 15);
  sum = B + (A ^ C & (D ^ A)) + X[15] + 1236535329 & 4294967295;
  B = C + (sum << 22 & 4294967295 | sum >>> 10);
  sum = A + (C ^ D & (B ^ C)) + X[1] + 4129170786 & 4294967295;
  A = B + (sum << 5 & 4294967295 | sum >>> 27);
  sum = D + (B ^ C & (A ^ B)) + X[6] + 3225465664 & 4294967295;
  D = A + (sum << 9 & 4294967295 | sum >>> 23);
  sum = C + (A ^ B & (D ^ A)) + X[11] + 643717713 & 4294967295;
  C = D + (sum << 14 & 4294967295 | sum >>> 18);
  sum = B + (D ^ A & (C ^ D)) + X[0] + 3921069994 & 4294967295;
  B = C + (sum << 20 & 4294967295 | sum >>> 12);
  sum = A + (C ^ D & (B ^ C)) + X[5] + 3593408605 & 4294967295;
  A = B + (sum << 5 & 4294967295 | sum >>> 27);
  sum = D + (B ^ C & (A ^ B)) + X[10] + 38016083 & 4294967295;
  D = A + (sum << 9 & 4294967295 | sum >>> 23);
  sum = C + (A ^ B & (D ^ A)) + X[15] + 3634488961 & 4294967295;
  C = D + (sum << 14 & 4294967295 | sum >>> 18);
  sum = B + (D ^ A & (C ^ D)) + X[4] + 3889429448 & 4294967295;
  B = C + (sum << 20 & 4294967295 | sum >>> 12);
  sum = A + (C ^ D & (B ^ C)) + X[9] + 568446438 & 4294967295;
  A = B + (sum << 5 & 4294967295 | sum >>> 27);
  sum = D + (B ^ C & (A ^ B)) + X[14] + 3275163606 & 4294967295;
  D = A + (sum << 9 & 4294967295 | sum >>> 23);
  sum = C + (A ^ B & (D ^ A)) + X[3] + 4107603335 & 4294967295;
  C = D + (sum << 14 & 4294967295 | sum >>> 18);
  sum = B + (D ^ A & (C ^ D)) + X[8] + 1163531501 & 4294967295;
  B = C + (sum << 20 & 4294967295 | sum >>> 12);
  sum = A + (C ^ D & (B ^ C)) + X[13] + 2850285829 & 4294967295;
  A = B + (sum << 5 & 4294967295 | sum >>> 27);
  sum = D + (B ^ C & (A ^ B)) + X[2] + 4243563512 & 4294967295;
  D = A + (sum << 9 & 4294967295 | sum >>> 23);
  sum = C + (A ^ B & (D ^ A)) + X[7] + 1735328473 & 4294967295;
  C = D + (sum << 14 & 4294967295 | sum >>> 18);
  sum = B + (D ^ A & (C ^ D)) + X[12] + 2368359562 & 4294967295;
  B = C + (sum << 20 & 4294967295 | sum >>> 12);
  sum = A + (B ^ C ^ D) + X[5] + 4294588738 & 4294967295;
  A = B + (sum << 4 & 4294967295 | sum >>> 28);
  sum = D + (A ^ B ^ C) + X[8] + 2272392833 & 4294967295;
  D = A + (sum << 11 & 4294967295 | sum >>> 21);
  sum = C + (D ^ A ^ B) + X[11] + 1839030562 & 4294967295;
  C = D + (sum << 16 & 4294967295 | sum >>> 16);
  sum = B + (C ^ D ^ A) + X[14] + 4259657740 & 4294967295;
  B = C + (sum << 23 & 4294967295 | sum >>> 9);
  sum = A + (B ^ C ^ D) + X[1] + 2763975236 & 4294967295;
  A = B + (sum << 4 & 4294967295 | sum >>> 28);
  sum = D + (A ^ B ^ C) + X[4] + 1272893353 & 4294967295;
  D = A + (sum << 11 & 4294967295 | sum >>> 21);
  sum = C + (D ^ A ^ B) + X[7] + 4139469664 & 4294967295;
  C = D + (sum << 16 & 4294967295 | sum >>> 16);
  sum = B + (C ^ D ^ A) + X[10] + 3200236656 & 4294967295;
  B = C + (sum << 23 & 4294967295 | sum >>> 9);
  sum = A + (B ^ C ^ D) + X[13] + 681279174 & 4294967295;
  A = B + (sum << 4 & 4294967295 | sum >>> 28);
  sum = D + (A ^ B ^ C) + X[0] + 3936430074 & 4294967295;
  D = A + (sum << 11 & 4294967295 | sum >>> 21);
  sum = C + (D ^ A ^ B) + X[3] + 3572445317 & 4294967295;
  C = D + (sum << 16 & 4294967295 | sum >>> 16);
  sum = B + (C ^ D ^ A) + X[6] + 76029189 & 4294967295;
  B = C + (sum << 23 & 4294967295 | sum >>> 9);
  sum = A + (B ^ C ^ D) + X[9] + 3654602809 & 4294967295;
  A = B + (sum << 4 & 4294967295 | sum >>> 28);
  sum = D + (A ^ B ^ C) + X[12] + 3873151461 & 4294967295;
  D = A + (sum << 11 & 4294967295 | sum >>> 21);
  sum = C + (D ^ A ^ B) + X[15] + 530742520 & 4294967295;
  C = D + (sum << 16 & 4294967295 | sum >>> 16);
  sum = B + (C ^ D ^ A) + X[2] + 3299628645 & 4294967295;
  B = C + (sum << 23 & 4294967295 | sum >>> 9);
  sum = A + (C ^ (B | ~D)) + X[0] + 4096336452 & 4294967295;
  A = B + (sum << 6 & 4294967295 | sum >>> 26);
  sum = D + (B ^ (A | ~C)) + X[7] + 1126891415 & 4294967295;
  D = A + (sum << 10 & 4294967295 | sum >>> 22);
  sum = C + (A ^ (D | ~B)) + X[14] + 2878612391 & 4294967295;
  C = D + (sum << 15 & 4294967295 | sum >>> 17);
  sum = B + (D ^ (C | ~A)) + X[5] + 4237533241 & 4294967295;
  B = C + (sum << 21 & 4294967295 | sum >>> 11);
  sum = A + (C ^ (B | ~D)) + X[12] + 1700485571 & 4294967295;
  A = B + (sum << 6 & 4294967295 | sum >>> 26);
  sum = D + (B ^ (A | ~C)) + X[3] + 2399980690 & 4294967295;
  D = A + (sum << 10 & 4294967295 | sum >>> 22);
  sum = C + (A ^ (D | ~B)) + X[10] + 4293915773 & 4294967295;
  C = D + (sum << 15 & 4294967295 | sum >>> 17);
  sum = B + (D ^ (C | ~A)) + X[1] + 2240044497 & 4294967295;
  B = C + (sum << 21 & 4294967295 | sum >>> 11);
  sum = A + (C ^ (B | ~D)) + X[8] + 1873313359 & 4294967295;
  A = B + (sum << 6 & 4294967295 | sum >>> 26);
  sum = D + (B ^ (A | ~C)) + X[15] + 4264355552 & 4294967295;
  D = A + (sum << 10 & 4294967295 | sum >>> 22);
  sum = C + (A ^ (D | ~B)) + X[6] + 2734768916 & 4294967295;
  C = D + (sum << 15 & 4294967295 | sum >>> 17);
  sum = B + (D ^ (C | ~A)) + X[13] + 1309151649 & 4294967295;
  B = C + (sum << 21 & 4294967295 | sum >>> 11);
  sum = A + (C ^ (B | ~D)) + X[4] + 4149444226 & 4294967295;
  A = B + (sum << 6 & 4294967295 | sum >>> 26);
  sum = D + (B ^ (A | ~C)) + X[11] + 3174756917 & 4294967295;
  D = A + (sum << 10 & 4294967295 | sum >>> 22);
  sum = C + (A ^ (D | ~B)) + X[2] + 718787259 & 4294967295;
  C = D + (sum << 15 & 4294967295 | sum >>> 17);
  sum = B + (D ^ (C | ~A)) + X[9] + 3951481745 & 4294967295;
  B = C + (sum << 21 & 4294967295 | sum >>> 11);
  this.chain_[0] = this.chain_[0] + A & 4294967295;
  this.chain_[1] = this.chain_[1] + B & 4294967295;
  this.chain_[2] = this.chain_[2] + C & 4294967295;
  this.chain_[3] = this.chain_[3] + D & 4294967295;
};
goog.crypt.Md5.prototype.update = function(bytes, opt_length) {
  if (!goog.isDef(opt_length)) {
    opt_length = bytes.length;
  }
  var lengthMinusBlock = opt_length - this.blockSize;
  var block = this.block_;
  var blockLength = this.blockLength_;
  var i = 0;
  while (i < opt_length) {
    if (blockLength == 0) {
      while (i <= lengthMinusBlock) {
        this.compress_(bytes, i);
        i += this.blockSize;
      }
    }
    if (goog.isString(bytes)) {
      while (i < opt_length) {
        block[blockLength++] = bytes.charCodeAt(i++);
        if (blockLength == this.blockSize) {
          this.compress_(block);
          blockLength = 0;
          break;
        }
      }
    } else {
      while (i < opt_length) {
        block[blockLength++] = bytes[i++];
        if (blockLength == this.blockSize) {
          this.compress_(block);
          blockLength = 0;
          break;
        }
      }
    }
  }
  this.blockLength_ = blockLength;
  this.totalLength_ += opt_length;
};
goog.crypt.Md5.prototype.digest = function() {
  var pad = new Array((this.blockLength_ < 56 ? this.blockSize : this.blockSize * 2) - this.blockLength_);
  pad[0] = 128;
  for (var i = 1; i < pad.length - 8; ++i) {
    pad[i] = 0;
  }
  var totalBits = this.totalLength_ * 8;
  for (var i = pad.length - 8; i < pad.length; ++i) {
    pad[i] = totalBits & 255;
    totalBits /= 256;
  }
  this.update(pad);
  var digest = new Array(16);
  var n = 0;
  for (var i = 0; i < 4; ++i) {
    for (var j = 0; j < 32; j += 8) {
      digest[n++] = this.chain_[i] >>> j & 255;
    }
  }
  return digest;
};
goog.provide("uno.util.copy.plain");
(function() {
  var util = uno.util;
  util.copy.plain.copy = function(root) {
    var resources = root.querySelectorAll("en-media");
    goog.array.forEach(resources, function(node) {
      goog.dom.removeNode(node);
    });
    var a = root.querySelectorAll("a");
    goog.array.forEach(a, function(node) {
      goog.dom.replaceNode(document.createTextNode(node.textContent), node);
    });
    if (util.todo.isTodo(root)) {
      return util.todo.isChecked(root) ? "[x] " : "[ ] ";
    }
    var todos = util.todo.all(root);
    goog.array.forEach(todos, function(node) {
      var todo = document.createTextNode(util.todo.isChecked(node) ? "[x] " : "[ ] ");
      goog.dom.replaceNode(todo, node);
    });
    plainifyLists(root, 0);
    var entools = document.querySelector("en-tools");
    entools.appendChild(root);
    var n, walk = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, null, false);
    while (n = walk.nextNode()) {
      n.data = n.data.replace(/ /g, "\u00a0");
    }
    var plainText = root.innerText;
    goog.dom.removeNode(root);
    plainText = plainText.replace(/<br>/g, "\n").replace(/-----PLACEHOLDER_TAB-----/g, "    ").replace(/\u00A0/g, " ").replace(/\n$/, "");
    return plainText;
  };
  function plainifyLists(node) {
    var parents = [];
    if (util.dom.isElementNode(node)) {
      parents = Array.prototype.slice.apply(node.querySelectorAll("ul, ol"));
    }
    if (util.dom.isUl(node) || util.dom.isOl(node)) {
      parents.unshift(node);
    }
    goog.array.forEach(parents, function(parent) {
      if (util.dom.isElementNode(parent)) {
        var isOL = util.dom.isOl(parent);
        var count = parseInt(parent.getAttribute("start"), 10) || 1;
        var tabsCount = getTabCounts(parent);
        goog.array.forEach(parent.childNodes, function(li) {
          if (util.dom.isLi(li) && li.firstChild) {
            if (util.dom.isDiv(li.firstChild)) {
              li.firstChild.style.display = "inline-block";
            }
            var prefix = goog.dom.createTextNode(insertTabs(tabsCount) + (isOL ? count + ". " : "* "));
            goog.dom.insertSiblingBefore(prefix, li.firstChild);
            count++;
          }
        });
      }
    });
  }
  function getTabCounts(node) {
    var tabsCount = 0;
    goog.dom.getAncestor(node, function(element) {
      if (util.dom.isUl(element) || util.dom.isOl(element)) {
        tabsCount++;
      }
      return !!util.dom.isEnnote(element);
    });
    return tabsCount;
  }
  function insertTabs(count) {
    var placeholder = "";
    for (var i = 0; i < count; i++) {
      placeholder += "-----PLACEHOLDER_TAB-----";
    }
    return placeholder;
  }
})();
goog.provide("goog.color.names");
goog.color.names = {"aliceblue":"#f0f8ff", "antiquewhite":"#faebd7", "aqua":"#00ffff", "aquamarine":"#7fffd4", "azure":"#f0ffff", "beige":"#f5f5dc", "bisque":"#ffe4c4", "black":"#000000", "blanchedalmond":"#ffebcd", "blue":"#0000ff", "blueviolet":"#8a2be2", "brown":"#a52a2a", "burlywood":"#deb887", "cadetblue":"#5f9ea0", "chartreuse":"#7fff00", "chocolate":"#d2691e", "coral":"#ff7f50", "cornflowerblue":"#6495ed", "cornsilk":"#fff8dc", "crimson":"#dc143c", "cyan":"#00ffff", "darkblue":"#00008b", "darkcyan":"#008b8b", 
"darkgoldenrod":"#b8860b", "darkgray":"#a9a9a9", "darkgreen":"#006400", "darkgrey":"#a9a9a9", "darkkhaki":"#bdb76b", "darkmagenta":"#8b008b", "darkolivegreen":"#556b2f", "darkorange":"#ff8c00", "darkorchid":"#9932cc", "darkred":"#8b0000", "darksalmon":"#e9967a", "darkseagreen":"#8fbc8f", "darkslateblue":"#483d8b", "darkslategray":"#2f4f4f", "darkslategrey":"#2f4f4f", "darkturquoise":"#00ced1", "darkviolet":"#9400d3", "deeppink":"#ff1493", "deepskyblue":"#00bfff", "dimgray":"#696969", "dimgrey":"#696969", 
"dodgerblue":"#1e90ff", "firebrick":"#b22222", "floralwhite":"#fffaf0", "forestgreen":"#228b22", "fuchsia":"#ff00ff", "gainsboro":"#dcdcdc", "ghostwhite":"#f8f8ff", "gold":"#ffd700", "goldenrod":"#daa520", "gray":"#808080", "green":"#008000", "greenyellow":"#adff2f", "grey":"#808080", "honeydew":"#f0fff0", "hotpink":"#ff69b4", "indianred":"#cd5c5c", "indigo":"#4b0082", "ivory":"#fffff0", "khaki":"#f0e68c", "lavender":"#e6e6fa", "lavenderblush":"#fff0f5", "lawngreen":"#7cfc00", "lemonchiffon":"#fffacd", 
"lightblue":"#add8e6", "lightcoral":"#f08080", "lightcyan":"#e0ffff", "lightgoldenrodyellow":"#fafad2", "lightgray":"#d3d3d3", "lightgreen":"#90ee90", "lightgrey":"#d3d3d3", "lightpink":"#ffb6c1", "lightsalmon":"#ffa07a", "lightseagreen":"#20b2aa", "lightskyblue":"#87cefa", "lightslategray":"#778899", "lightslategrey":"#778899", "lightsteelblue":"#b0c4de", "lightyellow":"#ffffe0", "lime":"#00ff00", "limegreen":"#32cd32", "linen":"#faf0e6", "magenta":"#ff00ff", "maroon":"#800000", "mediumaquamarine":"#66cdaa", 
"mediumblue":"#0000cd", "mediumorchid":"#ba55d3", "mediumpurple":"#9370db", "mediumseagreen":"#3cb371", "mediumslateblue":"#7b68ee", "mediumspringgreen":"#00fa9a", "mediumturquoise":"#48d1cc", "mediumvioletred":"#c71585", "midnightblue":"#191970", "mintcream":"#f5fffa", "mistyrose":"#ffe4e1", "moccasin":"#ffe4b5", "navajowhite":"#ffdead", "navy":"#000080", "oldlace":"#fdf5e6", "olive":"#808000", "olivedrab":"#6b8e23", "orange":"#ffa500", "orangered":"#ff4500", "orchid":"#da70d6", "palegoldenrod":"#eee8aa", 
"palegreen":"#98fb98", "paleturquoise":"#afeeee", "palevioletred":"#db7093", "papayawhip":"#ffefd5", "peachpuff":"#ffdab9", "peru":"#cd853f", "pink":"#ffc0cb", "plum":"#dda0dd", "powderblue":"#b0e0e6", "purple":"#800080", "red":"#ff0000", "rosybrown":"#bc8f8f", "royalblue":"#4169e1", "saddlebrown":"#8b4513", "salmon":"#fa8072", "sandybrown":"#f4a460", "seagreen":"#2e8b57", "seashell":"#fff5ee", "sienna":"#a0522d", "silver":"#c0c0c0", "skyblue":"#87ceeb", "slateblue":"#6a5acd", "slategray":"#708090", 
"slategrey":"#708090", "snow":"#fffafa", "springgreen":"#00ff7f", "steelblue":"#4682b4", "tan":"#d2b48c", "teal":"#008080", "thistle":"#d8bfd8", "tomato":"#ff6347", "turquoise":"#40e0d0", "violet":"#ee82ee", "wheat":"#f5deb3", "white":"#ffffff", "whitesmoke":"#f5f5f5", "yellow":"#ffff00", "yellowgreen":"#9acd32"};
goog.provide("goog.color");
goog.provide("goog.color.Hsl");
goog.provide("goog.color.Hsv");
goog.provide("goog.color.Rgb");
goog.require("goog.color.names");
goog.require("goog.math");
goog.color.Rgb;
goog.color.Hsv;
goog.color.Hsl;
goog.color.parse = function(str) {
  var result = {};
  str = String(str);
  var maybeHex = goog.color.prependHashIfNecessaryHelper(str);
  if (goog.color.isValidHexColor_(maybeHex)) {
    result.hex = goog.color.normalizeHex(maybeHex);
    result.type = "hex";
    return result;
  } else {
    var rgb = goog.color.isValidRgbColor_(str);
    if (rgb.length) {
      result.hex = goog.color.rgbArrayToHex(rgb);
      result.type = "rgb";
      return result;
    } else {
      if (goog.color.names) {
        var hex = goog.color.names[str.toLowerCase()];
        if (hex) {
          result.hex = hex;
          result.type = "named";
          return result;
        }
      }
    }
  }
  throw Error(str + " is not a valid color string");
};
goog.color.isValidColor = function(str) {
  var maybeHex = goog.color.prependHashIfNecessaryHelper(str);
  return !!(goog.color.isValidHexColor_(maybeHex) || goog.color.isValidRgbColor_(str).length || goog.color.names && goog.color.names[str.toLowerCase()]);
};
goog.color.parseRgb = function(str) {
  var rgb = goog.color.isValidRgbColor_(str);
  if (!rgb.length) {
    throw Error(str + " is not a valid RGB color");
  }
  return rgb;
};
goog.color.hexToRgbStyle = function(hexColor) {
  return goog.color.rgbStyle_(goog.color.hexToRgb(hexColor));
};
goog.color.hexTripletRe_ = /#(.)(.)(.)/;
goog.color.normalizeHex = function(hexColor) {
  if (!goog.color.isValidHexColor_(hexColor)) {
    throw Error("'" + hexColor + "' is not a valid hex color");
  }
  if (hexColor.length == 4) {
    hexColor = hexColor.replace(goog.color.hexTripletRe_, "#$1$1$2$2$3$3");
  }
  return hexColor.toLowerCase();
};
goog.color.hexToRgb = function(hexColor) {
  hexColor = goog.color.normalizeHex(hexColor);
  var r = parseInt(hexColor.substr(1, 2), 16);
  var g = parseInt(hexColor.substr(3, 2), 16);
  var b = parseInt(hexColor.substr(5, 2), 16);
  return [r, g, b];
};
goog.color.rgbToHex = function(r, g, b) {
  r = Number(r);
  g = Number(g);
  b = Number(b);
  if (r != (r & 255) || g != (g & 255) || b != (b & 255)) {
    throw Error('"(' + r + "," + g + "," + b + '") is not a valid RGB color');
  }
  var hexR = goog.color.prependZeroIfNecessaryHelper(r.toString(16));
  var hexG = goog.color.prependZeroIfNecessaryHelper(g.toString(16));
  var hexB = goog.color.prependZeroIfNecessaryHelper(b.toString(16));
  return "#" + hexR + hexG + hexB;
};
goog.color.rgbArrayToHex = function(rgb) {
  return goog.color.rgbToHex(rgb[0], rgb[1], rgb[2]);
};
goog.color.rgbToHsl = function(r, g, b) {
  var normR = r / 255;
  var normG = g / 255;
  var normB = b / 255;
  var max = Math.max(normR, normG, normB);
  var min = Math.min(normR, normG, normB);
  var h = 0;
  var s = 0;
  var l = 0.5 * (max + min);
  if (max != min) {
    if (max == normR) {
      h = 60 * (normG - normB) / (max - min);
    } else {
      if (max == normG) {
        h = 60 * (normB - normR) / (max - min) + 120;
      } else {
        if (max == normB) {
          h = 60 * (normR - normG) / (max - min) + 240;
        }
      }
    }
    if (0 < l && l <= 0.5) {
      s = (max - min) / (2 * l);
    } else {
      s = (max - min) / (2 - 2 * l);
    }
  }
  return [Math.round(h + 360) % 360, s, l];
};
goog.color.rgbArrayToHsl = function(rgb) {
  return goog.color.rgbToHsl(rgb[0], rgb[1], rgb[2]);
};
goog.color.hueToRgb_ = function(v1, v2, vH) {
  if (vH < 0) {
    vH += 1;
  } else {
    if (vH > 1) {
      vH -= 1;
    }
  }
  if (6 * vH < 1) {
    return v1 + (v2 - v1) * 6 * vH;
  } else {
    if (2 * vH < 1) {
      return v2;
    } else {
      if (3 * vH < 2) {
        return v1 + (v2 - v1) * (2 / 3 - vH) * 6;
      }
    }
  }
  return v1;
};
goog.color.hslToRgb = function(h, s, l) {
  var r = 0;
  var g = 0;
  var b = 0;
  var normH = h / 360;
  if (s == 0) {
    r = g = b = l * 255;
  } else {
    var temp1 = 0;
    var temp2 = 0;
    if (l < 0.5) {
      temp2 = l * (1 + s);
    } else {
      temp2 = l + s - s * l;
    }
    temp1 = 2 * l - temp2;
    r = 255 * goog.color.hueToRgb_(temp1, temp2, normH + 1 / 3);
    g = 255 * goog.color.hueToRgb_(temp1, temp2, normH);
    b = 255 * goog.color.hueToRgb_(temp1, temp2, normH - 1 / 3);
  }
  return [Math.round(r), Math.round(g), Math.round(b)];
};
goog.color.hslArrayToRgb = function(hsl) {
  return goog.color.hslToRgb(hsl[0], hsl[1], hsl[2]);
};
goog.color.validHexColorRe_ = /^#(?:[0-9a-f]{3}){1,2}$/i;
goog.color.isValidHexColor_ = function(str) {
  return goog.color.validHexColorRe_.test(str);
};
goog.color.normalizedHexColorRe_ = /^#[0-9a-f]{6}$/;
goog.color.isNormalizedHexColor_ = function(str) {
  return goog.color.normalizedHexColorRe_.test(str);
};
goog.color.rgbColorRe_ = /^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i;
goog.color.isValidRgbColor_ = function(str) {
  var regExpResultArray = str.match(goog.color.rgbColorRe_);
  if (regExpResultArray) {
    var r = Number(regExpResultArray[1]);
    var g = Number(regExpResultArray[2]);
    var b = Number(regExpResultArray[3]);
    if (r >= 0 && r <= 255 && g >= 0 && g <= 255 && b >= 0 && b <= 255) {
      return [r, g, b];
    }
  }
  return [];
};
goog.color.prependZeroIfNecessaryHelper = function(hex) {
  return hex.length == 1 ? "0" + hex : hex;
};
goog.color.prependHashIfNecessaryHelper = function(str) {
  return str.charAt(0) == "#" ? str : "#" + str;
};
goog.color.rgbStyle_ = function(rgb) {
  return "rgb(" + rgb.join(",") + ")";
};
goog.color.hsvToRgb = function(h, s, brightness) {
  var red = 0;
  var green = 0;
  var blue = 0;
  if (s == 0) {
    red = brightness;
    green = brightness;
    blue = brightness;
  } else {
    var sextant = Math.floor(h / 60);
    var remainder = h / 60 - sextant;
    var val1 = brightness * (1 - s);
    var val2 = brightness * (1 - s * remainder);
    var val3 = brightness * (1 - s * (1 - remainder));
    switch(sextant) {
      case 1:
        red = val2;
        green = brightness;
        blue = val1;
        break;
      case 2:
        red = val1;
        green = brightness;
        blue = val3;
        break;
      case 3:
        red = val1;
        green = val2;
        blue = brightness;
        break;
      case 4:
        red = val3;
        green = val1;
        blue = brightness;
        break;
      case 5:
        red = brightness;
        green = val1;
        blue = val2;
        break;
      case 6:
      case 0:
        red = brightness;
        green = val3;
        blue = val1;
        break;
    }
  }
  return [Math.floor(red), Math.floor(green), Math.floor(blue)];
};
goog.color.rgbToHsv = function(red, green, blue) {
  var max = Math.max(Math.max(red, green), blue);
  var min = Math.min(Math.min(red, green), blue);
  var hue;
  var saturation;
  var value = max;
  if (min == max) {
    hue = 0;
    saturation = 0;
  } else {
    var delta = max - min;
    saturation = delta / max;
    if (red == max) {
      hue = (green - blue) / delta;
    } else {
      if (green == max) {
        hue = 2 + (blue - red) / delta;
      } else {
        hue = 4 + (red - green) / delta;
      }
    }
    hue *= 60;
    if (hue < 0) {
      hue += 360;
    }
    if (hue > 360) {
      hue -= 360;
    }
  }
  return [hue, saturation, value];
};
goog.color.rgbArrayToHsv = function(rgb) {
  return goog.color.rgbToHsv(rgb[0], rgb[1], rgb[2]);
};
goog.color.hsvArrayToRgb = function(hsv) {
  return goog.color.hsvToRgb(hsv[0], hsv[1], hsv[2]);
};
goog.color.hexToHsl = function(hex) {
  var rgb = goog.color.hexToRgb(hex);
  return goog.color.rgbToHsl(rgb[0], rgb[1], rgb[2]);
};
goog.color.hslToHex = function(h, s, l) {
  return goog.color.rgbArrayToHex(goog.color.hslToRgb(h, s, l));
};
goog.color.hslArrayToHex = function(hsl) {
  return goog.color.rgbArrayToHex(goog.color.hslToRgb(hsl[0], hsl[1], hsl[2]));
};
goog.color.hexToHsv = function(hex) {
  return goog.color.rgbArrayToHsv(goog.color.hexToRgb(hex));
};
goog.color.hsvToHex = function(h, s, v) {
  return goog.color.rgbArrayToHex(goog.color.hsvToRgb(h, s, v));
};
goog.color.hsvArrayToHex = function(hsv) {
  return goog.color.hsvToHex(hsv[0], hsv[1], hsv[2]);
};
goog.color.hslDistance = function(hsl1, hsl2) {
  var sl1, sl2;
  if (hsl1[2] <= 0.5) {
    sl1 = hsl1[1] * hsl1[2];
  } else {
    sl1 = hsl1[1] * (1.0 - hsl1[2]);
  }
  if (hsl2[2] <= 0.5) {
    sl2 = hsl2[1] * hsl2[2];
  } else {
    sl2 = hsl2[1] * (1.0 - hsl2[2]);
  }
  var h1 = hsl1[0] / 360.0;
  var h2 = hsl2[0] / 360.0;
  var dh = (h1 - h2) * 2.0 * Math.PI;
  return (hsl1[2] - hsl2[2]) * (hsl1[2] - hsl2[2]) + sl1 * sl1 + sl2 * sl2 - 2 * sl1 * sl2 * Math.cos(dh);
};
goog.color.blend = function(rgb1, rgb2, factor) {
  factor = goog.math.clamp(factor, 0, 1);
  return [Math.round(factor * rgb1[0] + (1.0 - factor) * rgb2[0]), Math.round(factor * rgb1[1] + (1.0 - factor) * rgb2[1]), Math.round(factor * rgb1[2] + (1.0 - factor) * rgb2[2])];
};
goog.color.darken = function(rgb, factor) {
  var black = [0, 0, 0];
  return goog.color.blend(black, rgb, factor);
};
goog.color.lighten = function(rgb, factor) {
  var white = [255, 255, 255];
  return goog.color.blend(white, rgb, factor);
};
goog.color.highContrast = function(prime, suggestions) {
  var suggestionsWithDiff = [];
  for (var i = 0; i < suggestions.length; i++) {
    suggestionsWithDiff.push({color:suggestions[i], diff:goog.color.yiqBrightnessDiff_(suggestions[i], prime) + goog.color.colorDiff_(suggestions[i], prime)});
  }
  suggestionsWithDiff.sort(function(a, b) {
    return b.diff - a.diff;
  });
  return suggestionsWithDiff[0].color;
};
goog.color.yiqBrightness_ = function(rgb) {
  return Math.round((rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000);
};
goog.color.yiqBrightnessDiff_ = function(rgb1, rgb2) {
  return Math.abs(goog.color.yiqBrightness_(rgb1) - goog.color.yiqBrightness_(rgb2));
};
goog.color.colorDiff_ = function(rgb1, rgb2) {
  return Math.abs(rgb1[0] - rgb2[0]) + Math.abs(rgb1[1] - rgb2[1]) + Math.abs(rgb1[2] - rgb2[2]);
};
goog.provide("uno.util.observer");
goog.require("goog.array");
goog.require("goog.events");
goog.require("uno.defs");
goog.require("uno.util.dom");
(function() {
  var util = uno.util;
  var handlers = [];
  var target = null;
  var targetBottom = null;
  var sharedObserver = null;
  util.observer.addHandler = function(handler) {
    if (!handler) {
      return;
    }
    if (handlers.indexOf(handler) === -1) {
      handlers.push(handler);
      observeIfNeeded();
    }
  };
  util.observer.removeHandler = function(handler) {
    if (!handler) {
      return;
    }
    var index = handlers.indexOf(handler);
    if (index > -1) {
      handlers.splice(index, 1);
      observeIfNeeded();
    }
  };
  function invokeHandlers() {
    var bottom = getBottom(target);
    if (targetBottom !== bottom) {
      targetBottom = bottom;
      handlers.forEach(function(handler) {
        handler();
      });
    }
  }
  function handleObservation(mutations) {
    goog.array.forEach(mutations, function(mutation) {
      goog.array.forEach(mutation.addedNodes, function(node) {
        if (util.dom.isImg(node) && !node.naturalHeight) {
          goog.events.listenOnce(node, "load", invokeHandlers);
        }
      });
    });
    invokeHandlers();
  }
  function getBottom(node) {
    if (!node || !node.lastChild) {
      return 0;
    }
    return node.lastChild.offsetTop + node.lastChild.offsetHeight;
  }
  function observeIfNeeded() {
    if (!sharedObserver) {
      if (!window || !window.MutationObserver) {
        throw new Error("MutationObserver is missing.");
      }
      sharedObserver = new MutationObserver(handleObservation);
    }
    sharedObserver.disconnect();
    goog.events.unlisten(window, "resize", invokeHandlers);
    goog.events.unlisten(window, "input", invokeHandlers);
    if (handlers.length > 0) {
      target = document.querySelector(uno.defs.containers.EDITOR_BODY_SELECTOR);
      targetBottom = getBottom(target);
      sharedObserver.observe(target, {childList:true, subtree:true});
      goog.events.listen(window, "resize", invokeHandlers);
      goog.events.listen(window, "input", invokeHandlers);
    }
  }
})();
goog.provide("uno.util.table");
goog.require("goog.array");
goog.require("goog.color");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.editor.node");
goog.require("goog.editor.range");
goog.require("goog.events.KeyCodes");
goog.require("goog.object");
goog.require("goog.style");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.observer");
goog.require("uno.util.range");
goog.require("uno.util.styles");
(function() {
  var STRUCTTYPES = uno.defs.structuretypes;
  var log = goog.debug.Logger.getLogger("uno.util.table");
  var util = uno.util;
  var defs = uno.defs.table;
  var measureTable = null;
  var activeTable = null;
  var activeCell = null;
  var queryCache = null;
  util.table.State = {SELECTED:1 << 0, WHOLE_SELECTED:1 << 1, DRAGGABLE:1 << 2, MERGED:1 << 3, MERGE_CANDIDATE:1 << 4};
  util.table.Axis = {HORIZONTAL:"x", VERTICAL:"y"};
  util.table.for = function(node) {
    return goog.dom.getAncestor(node, util.dom.isTable, true);
  };
  util.table.enTablefor = function(node) {
    return goog.dom.getAncestor(node, util.dom.isEntable, true);
  };
  util.table.tdFor = function(node) {
    return goog.dom.getAncestor(node, util.dom.isTd, true);
  };
  util.table.getParagraphs = function(table) {
    return util.table.cellsForNode(table);
  };
  util.table.cellsForRange = function(range) {
    var td = goog.dom.getAncestor(range.getContainer(), util.dom.isTd, true);
    if (td) {
      return [td];
    }
    var tds = [];
    goog.iter.forEach(goog.iter.filter(range, function(node, _, iter) {
      return iter.isStartTag() && uno.util.dom.isTd(node);
    }), function(node) {
      tds.push(node);
    });
    return tds;
  };
  util.table.cellsForNode = function(root) {
    if (!root) {
      return [];
    }
    var table = null;
    if (util.dom.isTable(root)) {
      table = root;
    } else {
      if (util.dom.isEntable(root)) {
        table = util.table.query_(root, "table");
      } else {
        table = root.querySelector("table");
      }
    }
    if (!table) {
      return [];
    }
    return [].concat.apply([], goog.array.map(table.rows, function(row) {
      return [].slice.call(row.children);
    }));
  };
  util.table.upCell = function(node) {
    var td = goog.dom.getAncestor(node, util.dom.isTd, true);
    if (!td) {
      return null;
    }
    var matrix = util.table.matrix(goog.dom.getAncestor(td, util.dom.isTable));
    var info = util.table.infoForCell(td, matrix);
    return info.startRowIndex === 0 ? null : matrix[info.startRowIndex - 1][info.startColIndex].info.node;
  };
  util.table.downCell = function(node) {
    var td = goog.dom.getAncestor(node, util.dom.isTd, true);
    if (!td) {
      return null;
    }
    var matrix = util.table.matrix(goog.dom.getAncestor(td, util.dom.isTable));
    var info = util.table.infoForCell(td, matrix);
    return info.endRowIndex < matrix.length - 1 ? matrix[info.endRowIndex + 1][info.startColIndex].info.node : null;
  };
  util.table.prevCell = function(node, navigateByDOM) {
    return prevNextCell(node, navigateByDOM, -1);
  };
  util.table.nextCell = function(node, navigateByDOM) {
    return prevNextCell(node, navigateByDOM, 1);
  };
  util.table.darkenBorderColor = function(backgroundColor) {
    var obj = goog.color.parse(backgroundColor);
    var rgb = obj.type === "rgb" ? backgroundColor : goog.color.hexToRgb(obj.hex);
    return goog.color.rgbToHex.apply(goog.color, goog.color.darken(rgb, 0.2));
  };
  util.table.create = function(options) {
    options = options || {};
    options.rows = options.rows || 2;
    options.columns = options.columns || 2;
    options.align = options.align || "left";
    var bgColor = goog.color.isValidColor(options.cellColor || "") ? goog.color.parse(options.cellColor).hex : null;
    var borderColor = options.borderColor !== defs.BORDER_COLOR && goog.color.isValidColor(options.borderColor || "") ? options.borderColor : null;
    if (bgColor && !borderColor) {
      borderColor = util.table.darkenBorderColor(bgColor);
    }
    var colgroup = document.createElement("colgroup");
    var tbody = document.createElement("tbody");
    var width = "width: " + defs.CELL_WIDTH + "px;";
    var style = [borderColor && "border-color: " + borderColor, bgColor && "background-color: " + bgColor].filter(Boolean).join("; ");
    var table = goog.dom.createDom("table", null, [colgroup, tbody]);
    table.compat = true;
    for (var rowIndex = 0; rowIndex < options.rows; rowIndex++) {
      var tr = document.createElement("tr");
      tbody.appendChild(tr);
      for (var colIndex = 0; colIndex < options.columns; colIndex++) {
        if (rowIndex === 0) {
          colgroup.appendChild(goog.dom.createDom("col", {style:width}));
        }
        tr.appendChild(util.table.createEmptyTd({style:style}));
      }
    }
    util.table.setAlignment(table, options.align);
    return util.table.attachAdornments(table);
  };
  util.table.delete = function(target) {
    var isEntable = util.dom.isEntable(target);
    if (!isEntable && !util.dom.isTable(target) || !target.parentNode) {
      return false;
    }
    if (isEntable && util.table.getActive() === target) {
      util.table.setActive(null);
    }
    var tableIndex = util.dom.index(target);
    var tableParent = target.parentElement;
    goog.dom.removeNode(target);
    goog.dom.Range.createCaret(tableParent, tableIndex).select();
    return true;
  };
  util.table.getAlignment = function(table) {
    var marginLeft = table.style.marginLeft;
    var marginRight = table.style.marginRight;
    if (marginLeft === "auto" && marginRight === "auto") {
      return "center";
    } else {
      if (marginLeft === "auto") {
        return "right";
      }
    }
    return "left";
  };
  util.table.setAlignment = function(table, align) {
    table.style.marginLeft = align === "left" ? "" : "auto";
    table.style.marginRight = align === "center" ? "auto" : "";
  };
  util.table.createEmptyTd = function(attrs) {
    var td = goog.dom.createDom("td");
    attrs = attrs || {};
    if (attrs.style) {
      td.setAttribute("style", attrs.style);
    }
    if (attrs.class) {
      td.setAttribute("class", attrs.class);
    }
    if (attrs.colSpan > 1) {
      util.table.setColSpan(td, attrs.colSpan);
    }
    if (attrs.rowSpan > 1) {
      util.table.setRowSpan(td, attrs.rowSpan);
    }
    td.innerHTML = defs.CELL_HTML;
    return td;
  };
  util.table.resetTd = function(td) {
    if (!util.dom.isTd(td)) {
      return false;
    }
    td.innerHTML = "";
    var paragraph = util.paragraph.create();
    td.appendChild(paragraph);
    return true;
  };
  util.table.insertTd = function(node, rowIndex, colIndex, table, optMatrix) {
    var matrix = optMatrix || util.table.matrix(table);
    var refNode = null;
    var info;
    while (info = (matrix[rowIndex][colIndex] || {}).info) {
      if (info.startRowIndex !== rowIndex || info.startColIndex !== colIndex) {
        colIndex = info.endColIndex + 1;
      } else {
        refNode = info.node;
        break;
      }
    }
    table.rows[rowIndex].insertBefore(node, refNode);
  };
  util.table.insertColumns = function(target, index, count) {
    var colgroup = util.table.query_(target, "colgroup");
    if (index < 0 || index > colgroup.children.length) {
      return false;
    }
    var isEntable = util.dom.isEntable(target);
    var table = isEntable ? util.table.query_(target, "table") : target;
    var matrix = util.table.matrix(table);
    var colIndex = Math.max(index - 1, 0);
    var refCol = colgroup.children[index] || null;
    var col = colgroup.children[colIndex];
    count = count || 1;
    for (var i = count; i > 0; i--) {
      colgroup.insertBefore(col.cloneNode(), refCol);
    }
    matrix.forEach(function(row, rowIndex) {
      var info = row[colIndex].info;
      var cell = info.node;
      if (info.startRowIndex !== rowIndex) {
        return;
      }
      if (index !== colIndex && info.startColIndex < index && info.endColIndex >= index) {
        util.table.setColSpan(cell, cell.colSpan + count);
        return;
      }
      for (var j = count; j > 0; j--) {
        var newTd = util.table.createEmptyTd({style:cell.getAttribute("style"), rowSpan:cell.rowSpan});
        util.table.insertTd(newTd, rowIndex, index, table, matrix);
      }
    });
    if (isEntable) {
      util.table.normalizeCellBorders(table);
      util.table.layout(target);
    }
    return true;
  };
  util.table.insertRows = function(target, index, count) {
    var isEntable = util.dom.isEntable(target);
    var table = isEntable ? util.table.query_(target, "table") : target;
    if (index < 0 || index > table.rows.length) {
      return false;
    }
    var matrix = util.table.matrix(table);
    var rowIndex = Math.max(index - 1, 0);
    var tbody = table.rows[0].parentElement;
    var refRow = table.rows[index] || null;
    count = count || 1;
    for (var c = count; c > 0; c--) {
      var newRow = goog.dom.createDom("tr");
      tbody.insertBefore(newRow, refRow);
      matrix[rowIndex].forEach(function(obj, colIndex) {
        var info = obj.info;
        var cell = info.node;
        if (info.startColIndex !== colIndex) {
          return;
        }
        if (index !== rowIndex && info.startRowIndex < index && info.endRowIndex >= index) {
          util.table.setRowSpan(cell, cell.rowSpan + count);
          return;
        }
        var newTd = util.table.createEmptyTd({style:cell.getAttribute("style"), colSpan:cell.colSpan});
        newTd.style.height = "";
        newRow.appendChild(newTd);
      });
    }
    if (isEntable) {
      util.table.normalizeCellBorders(table);
      util.table.updateAdornments(target, util.table.Axis.HORIZONTAL);
      util.table.layoutMenuButton();
    }
    return true;
  };
  util.table.deleteColumns = function(target, indexes) {
    var isEntable = util.dom.isEntable(target);
    var table = isEntable ? util.table.query_(target, "table") : target;
    if (!table || !indexes || indexes.length === 0) {
      return false;
    }
    var matrix = util.table.matrix(table);
    indexes = processDeleteIndexes(indexes, 0, matrix[0].length - 1);
    if (!indexes) {
      return false;
    }
    if (indexes.length === matrix[0].length) {
      return util.table.delete(target);
    }
    var cols = util.table.query_(target, "colgroup").children;
    indexes.forEach(function(colIndex) {
      matrix.forEach(function(row, rowIndex) {
        var info = row[colIndex].info;
        var td = info.node;
        if (info.startRowIndex === rowIndex) {
          if (info.startColIndex === colIndex) {
            if (td.colSpan > 1) {
              util.table.setColSpan(td, td.colSpan - 1);
              util.table.insertTd(td, rowIndex, colIndex + 1, table, matrix);
            } else {
              td.remove();
            }
          } else {
            util.table.setColSpan(td, td.colSpan - 1);
          }
        }
        row.splice(colIndex, 1);
      });
      cols[colIndex].remove();
    });
    if (isEntable) {
      util.table.normalizeCellBorders(table);
      util.table.layout(target);
    }
    return true;
  };
  util.table.deleteRows = function(target, indexes) {
    var isEntable = util.dom.isEntable(target);
    var table = isEntable ? util.table.query_(target, "table") : target;
    if (!table || !indexes || indexes.length === 0) {
      return false;
    }
    var matrix = util.table.matrix(table);
    indexes = processDeleteIndexes(indexes, 0, matrix.length - 1);
    if (!indexes) {
      return false;
    }
    if (indexes.length === matrix.length) {
      return util.table.delete(target);
    }
    indexes.forEach(function(rowIndex) {
      matrix[rowIndex].forEach(function(obj, colIndex) {
        var info = obj.info;
        var td = info.node;
        if (info.startColIndex === colIndex) {
          if (info.startRowIndex === rowIndex) {
            if (td.rowSpan > 1) {
              util.table.setRowSpan(td, td.rowSpan - 1);
              util.table.insertTd(td, rowIndex + 1, colIndex, table, matrix);
            } else {
              td.remove();
            }
          } else {
            util.table.setRowSpan(td, td.rowSpan - 1);
          }
        }
      });
      table.rows[rowIndex].remove();
      matrix.splice(rowIndex, 1);
    });
    if (isEntable) {
      util.table.normalizeCellBorders(table);
      util.table.updateAdornments(target, util.table.Axis.HORIZONTAL);
      util.table.layoutMenuButton();
    }
    return true;
  };
  util.table.mergeable = function(nodes, optMatrix) {
    if (nodes.length <= 1) {
      return false;
    }
    var matrix = optMatrix || util.table.matrix(goog.dom.getAncestor(nodes[0], util.dom.isTable));
    var infos = util.table.infosForMerge(nodes, matrix);
    return !!infos;
  };
  util.table.unmergeable = function(nodes) {
    for (var i = 0, l = nodes.length; i < l; i++) {
      if (nodes[i].rowSpan > 1 || nodes[i].colSpan > 1) {
        return true;
      }
    }
    return false;
  };
  util.table.mergeCells = function(nodes, optMatrix) {
    if (nodes.length <= 1) {
      return null;
    }
    var table = goog.dom.getAncestor(nodes[0], util.dom.isTable);
    var matrix = optMatrix || util.table.matrix(table);
    var infos = util.table.infosForMerge(nodes, matrix);
    if (!infos) {
      return null;
    }
    var firstInfo = infos[0];
    var targetCell = firstInfo.node;
    var empty = util.dom.isEmpty(targetCell);
    var colSpan = 1;
    var rowSpan = 1;
    infos.forEach(function(info) {
      var cell = info.node;
      if (!cell.parentNode || cell === targetCell) {
        return;
      }
      colSpan = Math.max(info.endColIndex - firstInfo.startColIndex + 1, colSpan);
      rowSpan = Math.max(info.endRowIndex - firstInfo.startRowIndex + 1, rowSpan);
      goog.dom.removeNode(cell);
      if (util.dom.isEmpty(cell)) {
        return;
      }
      if (empty) {
        empty = false;
        targetCell.innerHTML = cell.innerHTML;
      } else {
        var lastTargetChild = targetCell.lastChild;
        var lastMovedChild = null;
        goog.array.forEachRight(cell.childNodes, function(child) {
          lastTargetChild.parentNode.insertBefore(child, lastTargetChild.nextSibling);
          lastMovedChild = child;
        });
        if (util.dom.isInlineNode(lastTargetChild) && util.dom.isInlineNode(lastMovedChild)) {
          lastTargetChild.parentNode.insertBefore(document.createTextNode(" "), lastTargetChild.nextSibling);
        }
      }
    });
    util.table.setColSpan(targetCell, colSpan);
    util.table.setRowSpan(targetCell, rowSpan);
    var enTable = goog.dom.getAncestor(table, util.dom.isEntable);
    if (enTable) {
      util.table.normalizeCellBorders(table);
      util.table.layout(enTable);
    }
    return targetCell;
  };
  util.table.splitCell = function(node, optMatrix) {
    if (node.rowSpan <= 1 && node.colSpan <= 1) {
      return [node];
    }
    var table = goog.dom.getAncestor(node, util.dom.isTable);
    var matrix = optMatrix || util.table.matrix(table);
    var info = util.table.infoForCell(node, matrix);
    var nodes = [node];
    node.style.height = "";
    var style = node.getAttribute("style");
    for (var i = 0; i < node.rowSpan; i++) {
      for (var j = 0; j < node.colSpan; j++) {
        if (i > 0 || j > 0) {
          var newTd = util.table.createEmptyTd({style:style});
          nodes.push(newTd);
          util.table.insertTd(newTd, info.startRowIndex + i, info.startColIndex + j, table, matrix);
        }
      }
    }
    util.table.setColSpan(node, 1);
    util.table.setRowSpan(node, 1);
    var enTable = goog.dom.getAncestor(table, util.dom.isEntable);
    if (enTable) {
      util.table.normalizeCellBorders(table);
    }
    return nodes;
  };
  util.table.splitCells = function(tds) {
    if (tds.length === 0) {
      return [];
    }
    var nodes = [];
    goog.array.forEach(tds, function(td) {
      nodes = nodes.concat(util.table.splitCell(td));
    });
    return nodes;
  };
  util.table.setColSpan = function(td, value) {
    if (td.colSpan !== value) {
      if (value > 1) {
        td.colSpan = value;
      } else {
        td.removeAttribute("colspan");
      }
    }
  };
  util.table.setRowSpan = function(td, value) {
    if (td.rowSpan !== value) {
      if (value > 1) {
        td.rowSpan = value;
        td.style.height = (value * 2 - 2) * defs.CELL_PADDING + value * defs.CELL_LINE_HEIGHT + "px";
      } else {
        td.removeAttribute("rowspan");
        td.style.height = "";
      }
    }
  };
  util.table.cellForStructureChange = function(range) {
    if (!range) {
      return null;
    }
    var cell = util.table.getActiveCell();
    if (cell) {
      return cell;
    }
    var table = null;
    var nested = false;
    var node = range.getStartNode();
    while (node && node.parentNode) {
      if (util.dom.isTable(node)) {
        if (table) {
          nested = true;
          break;
        }
        table = node;
      } else {
        if (util.dom.isTd(node)) {
          cell = node;
        }
      }
      node = node.parentNode;
    }
    if (nested || !cell || goog.dom.getAncestor(range.getEndNode(), util.dom.isTable) !== table) {
      return null;
    }
    return cell;
  };
  util.table.matrix = function(table, opt) {
    opt = opt || {selection:false};
    if (util.dom.isEntable(table)) {
      table = util.table.query_(table, "table");
    }
    if (!util.dom.isTable(table)) {
      return null;
    }
    var matrix = [];
    var rowCount = table.rows.length;
    var getWithDefault = function(arr, index, def) {
      var obj = arr[index];
      if (!obj) {
        obj = def;
        arr[index] = obj;
      }
      return obj;
    };
    goog.array.forEach(table.rows, function(tr, trIndex) {
      var row = getWithDefault(matrix, trIndex, []);
      var colIndex = 0;
      var tds = goog.array.filter(tr.children, function(node) {
        return util.dom.isTd(node) || util.dom.isTh(node);
      });
      goog.array.forEach(tds, function(td, tdIndex) {
        var colSpan = td.colSpan;
        var rowSpan = Math.min(rowCount - trIndex, td.rowSpan);
        while (row[colIndex]) {
          colIndex += 1;
        }
        var info = {startRowIndex:trIndex, endRowIndex:trIndex + rowSpan - 1, startColIndex:colIndex, endColIndex:colIndex + colSpan - 1, nodeRowIndex:trIndex, nodeColIndex:tdIndex, node:td, state:0};
        if (opt.selection && td.classList.contains("selected")) {
          info.state |= util.table.State.SELECTED;
        }
        if (rowSpan > 1 || colSpan > 1) {
          info.state |= util.table.State.MERGED;
        }
        var obj = getWithDefault(row, tdIndex, {});
        obj.origin = info;
        for (var c = colSpan; c > 0; c--) {
          obj = getWithDefault(row, colIndex, {});
          obj.info = info;
          for (var r = 1; r < rowSpan; r++) {
            var nextRow = getWithDefault(matrix, trIndex + r, []);
            obj = getWithDefault(nextRow, colIndex, {});
            obj.info = info;
          }
          colIndex += 1;
        }
      });
    });
    return matrix;
  };
  util.table.rowIndex = function(td, next, optMatrix) {
    var info = util.table.infoForCell(td, optMatrix);
    return next ? info.endRowIndex + 1 : info.startRowIndex;
  };
  util.table.colIndex = function(td, next, optMatrix) {
    var info = util.table.infoForCell(td, optMatrix);
    return next ? info.endColIndex + 1 : info.startColIndex;
  };
  util.table.infoForCell = function(td, optMatrix) {
    if (!util.dom.isTd(td)) {
      return null;
    }
    var matrix = optMatrix || util.table.matrix(goog.dom.getAncestor(td, util.dom.isTable));
    var info = matrix[util.dom.index(td.parentNode)][util.dom.index(td)].origin;
    if (!info || info.node !== td) {
      throw new Error("Failed to get info object for a td", td, matrix);
    }
    return info;
  };
  util.table.infosForMerge = function(tds, matrix) {
    if (tds.length <= 1) {
      return null;
    }
    var startRowIndex = Infinity;
    var startColIndex = Infinity;
    var endRowIndex = 0;
    var endColIndex = 0;
    var infos = [];
    var info;
    tds.forEach(function(cell) {
      info = util.table.infoForCell(cell, matrix);
      startRowIndex = Math.min(info.startRowIndex, startRowIndex);
      startColIndex = Math.min(info.startColIndex, startColIndex);
      endRowIndex = Math.max(info.endRowIndex, endRowIndex);
      endColIndex = Math.max(info.endColIndex, endColIndex);
      info.state |= util.table.State.MERGE_CANDIDATE;
    });
    for (var rowIndex = startRowIndex; rowIndex <= endRowIndex; rowIndex++) {
      for (var colIndex = startColIndex; colIndex <= endColIndex; colIndex++) {
        info = matrix[rowIndex][colIndex].info;
        if (!(info.state & util.table.State.MERGE_CANDIDATE)) {
          return null;
        }
        if (info.startRowIndex === rowIndex && info.startColIndex === colIndex) {
          infos.push(info);
        }
      }
    }
    return infos;
  };
  util.table.expandIntoRectIndexes = function(matrix, startRowIndex, endRowIndex, startColIndex, endColIndex) {
    loop: while (true) {
      for (var rowIndex = startRowIndex; rowIndex <= endRowIndex; rowIndex++) {
        for (var colIndex = startColIndex; colIndex <= endColIndex; colIndex++) {
          var info = matrix[rowIndex][colIndex].info;
          if (info.startRowIndex < startRowIndex || info.startColIndex < startColIndex || info.endRowIndex > endRowIndex || info.endColIndex > endColIndex) {
            startRowIndex = Math.min(info.startRowIndex, startRowIndex);
            startColIndex = Math.min(info.startColIndex, startColIndex);
            endRowIndex = Math.max(info.endRowIndex, endRowIndex);
            endColIndex = Math.max(info.endColIndex, endColIndex);
            continue loop;
          }
        }
      }
      break;
    }
    return {startRowIndex:startRowIndex, endRowIndex:endRowIndex, startColIndex:startColIndex, endColIndex:endColIndex};
  };
  util.table.isProcessedRange = function(range, rangeState) {
    return range && rangeState && range.isCollapsed() === rangeState.isCollapsed && range.getStartNode() === rangeState.startNode && range.getEndNode() === rangeState.endNode;
  };
  util.table.processRange = function(range, noteEnTables, source) {
    var startNode = range.getStartNode();
    var endNode = range.getEndNode();
    var isCollapsed = range.isCollapsed();
    var isMulticlick = source === "multiclick";
    var isArrowSelection = source === "arrowkey";
    var startAncestor = goog.dom.getAncestor(startNode, util.dom.isEntable, true);
    var endAncestor = goog.dom.getAncestor(endNode, util.dom.isEntable, true);
    var anchorNode = range.getAnchorNode();
    var focusNode = range.getFocusNode();
    if (goog.userAgent.WEBKIT && isMulticlick && range.getEndOffset() === 0) {
      if (startAncestor.nextSibling && startAncestor.nextSibling === focusNode) {
        endAncestor = startAncestor;
        var tableCells = endAncestor.querySelectorAll("td");
        focusNode = tableCells[tableCells.length - 1];
      } else {
        if (!startAncestor.nextSibling && !endAncestor) {
          endAncestor = startAncestor;
          focusNode = anchorNode;
        } else {
          var startCell = goog.dom.getAncestor(startNode, util.dom.isTd, true);
          var nextCell = util.table.nextCell(startCell);
          var endCell = goog.dom.getAncestor(focusNode, util.dom.isTd, true);
          if (nextCell && nextCell === endCell) {
            focusNode = startCell;
          }
        }
      }
    }
    if (goog.userAgent.GECKO && anchorNode.nodeName === "TR") {
      anchorNode = anchorNode.childNodes[range.getAnchorOffset()];
      if (isMulticlick) {
        focusNode = anchorNode;
      }
    }
    var enTable = startAncestor && startAncestor === endAncestor ? startAncestor : null;
    if (isArrowSelection) {
      enTable = goog.dom.getAncestor(anchorNode, util.dom.isEntable, true);
    }
    var cell = enTable ? goog.dom.getAncestor(anchorNode, util.dom.isTd, true) : null;
    if (!cell) {
      enTable = null;
    }
    if (!enTable && (startAncestor || endAncestor)) {
      var newStartNode = null;
      var newStartOffset = 0;
      var newEndNode = null;
      var newEndOffset = 0;
      if (startAncestor && startAncestor !== startNode) {
        newStartNode = startAncestor;
        newStartOffset = 0;
      } else {
        newStartNode = startNode;
        newStartOffset = range.getStartOffset();
      }
      if (endAncestor && endAncestor !== endNode) {
        newEndNode = endAncestor;
        newEndOffset = endAncestor.childNodes.length;
      } else {
        newEndNode = endNode;
        newEndOffset = range.getEndOffset();
      }
      if (newStartNode) {
        if (range.isReversed()) {
          goog.dom.Range.createFromNodes(newEndNode, newEndOffset, newStartNode, newStartOffset).select();
        } else {
          goog.dom.Range.createFromNodes(newStartNode, newStartOffset, newEndNode, newEndOffset).select();
        }
        range = goog.dom.Range.createFromWindow();
        startNode = range.getStartNode();
        endNode = range.getEndNode();
      }
    }
    var isSelection = false;
    var focusCell;
    if (enTable && cell && !range.isCollapsed()) {
      var isCellContentSelection = cell.contains(startNode) && cell.contains(endNode);
      if (!isCellContentSelection) {
        focusNode = goog.dom.getAncestor(focusNode, util.dom.isTd, true);
      }
      if (cell === focusNode || !isCellContentSelection) {
        isSelection = true;
        focusCell = focusNode;
      }
    }
    goog.array.forEach(noteEnTables, function(enTableNode) {
      var contained = range.containsNode(enTableNode, true);
      if (enTable || !contained) {
        enTableNode.classList.remove("selected");
      } else {
        if (contained) {
          enTableNode.classList.add("selected");
        }
      }
    });
    return {startNode:startNode, endNode:endNode, isCollapsed:isCollapsed, isSelection:isSelection, enTable:enTable, cell:cell, focusCell:focusCell};
  };
  util.table.createKeyState = function(enTable, cell, event) {
    return {scrollLeft:util.table.query_(enTable, ".container").scrollLeft, keyCode:event.keyCode, shiftKey:event.shiftKey, cell:cell, enTable:enTable};
  };
  util.table.navigateByKeyState = function(keyState) {
    if (keyState.shiftKey) {
      return false;
    }
    var KeyCodes = goog.events.KeyCodes;
    var atEnd = false;
    var isCell = true;
    var targetNode;
    var getTableSibling = function(enTable, fnName) {
      var node = enTable[fnName];
      while (node && node.childNodes.length === 0) {
        node = node[fnName];
      }
      return enTable === node ? null : node;
    };
    if (keyState.keyCode === KeyCodes.UP) {
      targetNode = util.table.upCell(keyState.cell);
      atEnd = true;
      if (!targetNode) {
        isCell = false;
        targetNode = getTableSibling(keyState.enTable, "previousSibling");
      }
    } else {
      if (keyState.keyCode === KeyCodes.DOWN) {
        targetNode = util.table.downCell(keyState.cell);
        if (!targetNode) {
          isCell = false;
          targetNode = getTableSibling(keyState.enTable, "nextSibling");
        }
      } else {
        if (keyState.keyCode === KeyCodes.LEFT) {
          targetNode = util.table.prevCell(keyState.cell);
          atEnd = true;
        } else {
          if (keyState.keyCode === KeyCodes.RIGHT) {
            targetNode = util.table.nextCell(keyState.cell);
          }
        }
      }
    }
    if (!targetNode) {
      return false;
    }
    goog.dom.Range.createCaret(targetNode, atEnd ? targetNode.childNodes.length : 0).select();
    if (isCell) {
      util.table.setActive(keyState.enTable, targetNode);
      util.table.query_(keyState.enTable, ".container").scrollLeft = keyState.scrollLeft;
      util.table.scrollCellIntoView(targetNode);
    } else {
      util.table.setActive();
    }
    return true;
  };
  util.table.navigatedFocusSelectionCell = function(keyState) {
    if (!keyState.shiftKey) {
      return null;
    }
    var KeyCodes = goog.events.KeyCodes;
    var matrix = util.table.matrix(keyState.enTable);
    var info = util.table.infoForCell(keyState.cell, matrix);
    if (keyState.scrollLeft !== undefined) {
      util.table.query_(keyState.enTable, ".container").scrollLeft = keyState.scrollLeft;
    }
    if (keyState.keyCode === KeyCodes.UP && info.startRowIndex > 0) {
      return matrix[info.startRowIndex - 1][info.startColIndex].info.node;
    } else {
      if (keyState.keyCode === KeyCodes.DOWN && info.endRowIndex < matrix.length - 1) {
        return matrix[info.endRowIndex + 1][info.startColIndex].info.node;
      } else {
        if (keyState.keyCode === KeyCodes.LEFT && info.startColIndex > 0) {
          return matrix[info.startRowIndex][info.startColIndex - 1].info.node;
        } else {
          if (keyState.keyCode === KeyCodes.RIGHT && info.endColIndex < matrix[0].length - 1) {
            return matrix[info.startRowIndex][info.endColIndex + 1].info.node;
          }
        }
      }
    }
    return null;
  };
  util.table.navigateInto = function(range, direction) {
  };
  util.table.getActive = function() {
    return activeTable;
  };
  util.table.getActiveCell = function() {
    return activeCell;
  };
  var fixMissingAdornments = function(enTable) {
    if (util.dom.getTagName(enTable) === "en-table" && !enTable.querySelector("en-adornments")) {
      var table = enTable.querySelector("table");
      if (table) {
        enTable.appendChild(goog.dom.createDom("en-adornments", {contentEditable:"false"}));
        enTable.setAttribute("data-lazy", 1);
        util.table.generateAdornments(enTable);
        util.table.updateWidth(enTable);
      }
    }
    return enTable;
  };
  util.table.setActive = function(enTable, cell) {
    enTable = fixMissingAdornments(enTable);
    if (!enTable && !activeTable || enTable && !util.dom.isEntable(enTable)) {
      return;
    }
    if (enTable !== activeTable) {
      if (activeTable) {
        activeTable.classList.remove("active");
        activeTable = null;
        util.observer.removeHandler(updateActiveTableAdornmentRows);
      }
      if (enTable) {
        activeTable = enTable;
        activeTable.classList.add("active");
        util.table.layout(enTable, true);
        util.observer.addHandler(updateActiveTableAdornmentRows);
      }
    }
    if (cell !== activeCell) {
      if (cell && (!activeTable || !goog.dom.getAncestor(cell, function(node) {
        return node === activeTable;
      }))) {
        throw new Error("Active cell is not part of active table:", activeTable);
      }
      activeCell = cell;
      util.table.layoutMenuButton();
    }
  };
  util.table.setLine = function(enTable, index, axis) {
    enTable = fixMissingAdornments(enTable);
    enTable.classList.remove("xline-visible");
    enTable.classList.remove("yline-visible");
    if (axis) {
      enTable.classList.add(axis + "line-visible");
      var selector = "." + axis + "line";
      var line = util.table.query_(enTable, selector);
      if (axis === util.table.Axis.HORIZONTAL) {
        var top = 0;
        if (index > 0) {
          var row = util.table.query_(enTable, "table").rows[index - 1];
          top = row.offsetTop + row.offsetHeight;
        }
        line.style.top = (top === 0 ? top - 5 : top - 7) + "px";
      } else {
        var left = 0;
        if (index > 0) {
          var cols = util.table.query_(enTable, "colgroup").children;
          left = goog.array.reduce(cols, function(sum, col, i) {
            return i < index ? sum + parseInt(col.style.width, 10) : sum;
          }, 0);
        }
        line.style.left = (left === 0 ? left - 5 : left - 7) + "px";
      }
    }
  };
  util.table.handleToObject = function(node) {
    var index = util.dom.index(node);
    var axis = node.parentNode.parentNode.parentNode.classList.contains("columns") ? util.table.Axis.VERTICAL : util.table.Axis.HORIZONTAL;
    return {axis:axis, index:index};
  };
  util.table.insertionToObject = function(node) {
    var parent = node.parentNode;
    var index = parent.classList.contains("insertions") ? util.dom.index(node) + 1 : 0;
    var axis = parent.classList.contains("columns") || parent.parentNode.parentNode.classList.contains("columns") ? util.table.Axis.VERTICAL : util.table.Axis.HORIZONTAL;
    return {axis:axis, index:index};
  };
  util.table.scrollCellIntoView = function(targetCell) {
    if (!util.dom.isTd(targetCell)) {
      return;
    }
    var enTable = goog.dom.getAncestor(targetCell, util.dom.isEntable);
    var container = util.table.query_(enTable, ".container");
    var offset = 16;
    var offsetLeft = targetCell.offsetLeft;
    var offsetWidth = targetCell.offsetWidth;
    if (container.scrollLeft > offsetLeft) {
      container.scrollLeft -= container.scrollLeft - offsetLeft + offset;
      util.table.translateX(enTable);
    } else {
      if (container.scrollLeft + container.clientWidth < offsetLeft + offsetWidth) {
        container.scrollLeft += offsetLeft + offsetWidth - container.scrollLeft - container.clientWidth + offset;
        util.table.translateX(enTable);
      }
    }
  };
  util.table.translateX = function(enTable) {
    if (!util.dom.isEntable(enTable) || enTable.getAttribute("data-lazy")) {
      return;
    }
    if (!util.table.query_(enTable, "en-adornments")) {
      console.warn("translateX called on en-table that does not contain adornments");
      return;
    }
    var container = util.table.query_(enTable, ".container");
    var transAttr = container.style.transform === undefined ? "webkitTransform" : "transform";
    var left = container.scrollLeft;
    var scrollWidth = container.scrollWidth;
    var offsetWidth = container.offsetWidth;
    util.table.query_(enTable, ".columns .handles").style[transAttr] = "translateX(" + -left + "px)";
    util.table.query_(enTable, ".columns .insertions").style[transAttr] = "translateX(" + -left + "px)";
    util.table.query_(enTable, ".content").style[transAttr] = "translateX(" + -left + "px)";
    util.table.query_(enTable, ".lscroll").style.opacity = Math.max(Math.min(1, left / 10), 0);
    util.table.query_(enTable, ".rscroll").style.opacity = Math.max(Math.min(1, (scrollWidth - offsetWidth - left) / 10), 0);
    var thumb = util.table.query_(enTable, ".scrollbar-thumb");
    var scale = offsetWidth / scrollWidth;
    if (scale >= 1) {
      thumb.parentNode.style.display = "";
    } else {
      thumb.parentNode.style.display = "block";
      thumb.style.width = offsetWidth * scale + "px";
      thumb.style[transAttr] = "translateX(" + left * scale + "px)";
    }
  };
  util.table.layout = function(enTable, generateMissingAdornemnts) {
    var width = util.table.updateWidth(enTable);
    if (generateMissingAdornemnts || enTable.getAttribute("data-lazy") && enTable.clientWidth < width) {
      util.table.generateAdornments(enTable);
      util.table.updateWidth(enTable);
    }
    util.table.updateAdornments(enTable);
    util.table.translateX(enTable);
    util.table.layoutMenuButton();
  };
  util.table.layoutMenuButton = function() {
    var button = document.querySelector(".en-cell-btn");
    if (!activeCell || !activeTable) {
      if (button) {
        button.remove();
      }
      return;
    }
    if (!button) {
      button = goog.dom.createDom("div", {class:"en-cell-btn"});
    }
    button.style.top = activeCell.offsetTop + 5 + "px";
    button.style.left = activeCell.offsetLeft + activeCell.offsetWidth - 23 + "px";
    activeTable.querySelector(".content").appendChild(button);
  };
  util.table.equalizeColumns = function(enTable, indexes) {
    if (indexes.length < 2) {
      return;
    }
    var cols = util.table.query_(enTable, "colgroup").children;
    var widths = util.table.getColumnsMinWidth(enTable);
    var totalWidth = 0;
    var columns = [];
    widths.forEach(function(width, index) {
      if (indexes.indexOf(index) > -1) {
        totalWidth += parseInt(cols[index].style.width, 10);
        columns.push({index:index, minWidth:width});
      }
    });
    var sumWidth = 0;
    var avg = totalWidth / indexes.length;
    columns.sort(function(a, b) {
      return b.minWidth - a.minWidth;
    }).forEach(function(obj, n) {
      var width = obj.minWidth;
      if (width > avg) {
        sumWidth += width;
        avg = (totalWidth - sumWidth) / (indexes.length - n - 1);
      } else {
        width = avg;
      }
      cols[obj.index].style.width = Math.round(width) + "px";
    });
    util.table.layout(enTable);
  };
  util.table.fitNote = function(enTable) {
    var tableWidth = enTable ? parseInt(enTable.style.width, 10) : null;
    if (isNaN(tableWidth) || !tableWidth) {
      return false;
    }
    var cols = util.table.query_(enTable, "colgroup").children;
    var noteWidth = util.styles.getNoteWidth();
    var scale = noteWidth / tableWidth;
    var remainder = 0;
    var objs = util.table.getColumnsMinWidth(enTable).map(function(width, index) {
      return {index:index, minWidth:width, width:parseInt(cols[index].style.width, 10)};
    });
    objs.sort(function(a, b) {
      return b.minWidth - a.minWidth;
    }).forEach(function(obj, n) {
      var width = obj.width * scale - remainder;
      if (width < obj.minWidth) {
        remainder += (obj.minWidth - width) / (cols.length - n - 1);
        width = obj.minWidth;
      }
      cols[obj.index].style.width = Math.floor(width) + "px";
    });
    util.table.layout(enTable);
    return true;
  };
  util.table.fitColumnContent = function(enTable, colIndex) {
    var width = util.table.getColumnContentWidth(enTable, colIndex);
    if (width === null) {
      return false;
    }
    util.table.setColumnWidth(enTable, colIndex, width);
    return true;
  };
  util.table.fitColumnIfNeeded = function(enTable, index) {
    var colWidth = util.table.getColumnsMinWidth(enTable, index);
    var colgroup = util.table.query_(enTable, "colgroup");
    var currentWidth = parseInt(colgroup.children[index].style.width, 10) || 0;
    if (colWidth[index] && colWidth[index] > currentWidth) {
      util.table.setColumnWidth(enTable, index, colWidth[index]);
    }
  };
  util.table.getColumnsMinWidth = function(enTable, colIndex) {
    var table = util.table.query_(enTable, "table");
    var matrix = util.table.matrix(table);
    var left = null;
    var selector = ["ul", "ol", "object", ".en-media-file"].join(",");
    var widths = [];
    for (var c = 0, l = matrix[0].length; c < l; c++) {
      widths[c] = colIndex === undefined || colIndex === c ? defs.CELL_MIN_WIDTH : null;
    }
    goog.array.forEach(table.querySelectorAll(selector), function(node) {
      var cell = goog.dom.getAncestor(node, util.dom.isTd);
      var info = util.table.infoForCell(cell, matrix);
      if (colIndex !== undefined && info.startColIndex !== colIndex) {
        return;
      }
      if (!left) {
        left = cell.getBoundingClientRect().left;
      }
      var width = widths[info.startColIndex];
      if (node.classList.contains("en-media-file")) {
        width = Math.max(node.offsetWidth, width);
      } else {
        if (node.tagName === "OBJECT") {
          width = Math.max(node.getBoundingClientRect().left - left + 12, width);
        } else {
          width = Math.max(node.getBoundingClientRect().left - left + 76, width);
        }
      }
      widths[info.startColIndex] = Math.ceil(width);
    });
    return widths;
  };
  util.table.getColumnContentWidth = function(enTable, colIndex) {
    if (!measureTable) {
      measureTable = goog.dom.createDom("table", {class:"en-measure-table"});
      measureTable.innerHTML = "<tbody><tr><td></td></tr></tbody>";
    }
    var table = util.table.query_(enTable, "table");
    var matrix = util.table.matrix(table);
    var width = defs.CELL_MIN_WIDTH;
    var empty = true;
    var measureCell = measureTable.rows[0].firstChild;
    enTable.parentNode.appendChild(measureTable);
    matrix.forEach(function(row, rowIndex) {
      var info = row[colIndex].info;
      var cell = info.node;
      if (info.startColIndex < colIndex || info.startRowIndex < rowIndex) {
        return;
      }
      if (!util.dom.isEmpty(cell)) {
        measureCell.innerHTML = cell.innerHTML;
        measureCell.setAttribute("style", cell.getAttribute("style"));
        width = Math.max(measureCell.offsetWidth, width);
        empty = false;
      }
    });
    measureTable.remove();
    return empty ? null : Math.min(width, util.styles.getNoteWidth());
  };
  util.table.setColumnWidth = function(enTable, colIndex, width) {
    var colgroup = util.table.query_(enTable, "colgroup");
    colgroup.children[colIndex].style.width = Math.max(width, defs.CELL_MIN_WIDTH) + "px";
    util.table.layout(enTable);
    util.table.setLine(enTable);
  };
  util.table.updateWidth = function(enTable, width) {
    if (!util.dom.isEntable(enTable)) {
      return null;
    }
    var table = util.table.query_(enTable, "table");
    if (!table) {
      return null;
    }
    if (!width) {
      var colgroup = util.table.query_(enTable, "colgroup");
      if (!colgroup) {
        return null;
      }
      width = 0;
      goog.array.forEach(colgroup.children, function(col) {
        width += parseInt(col.style.width, 10);
      });
    }
    var widthStr = width + "px";
    enTable.style.width = widthStr;
    table.style.width = widthStr;
    if (!enTable.getAttribute("data-lazy")) {
      util.table.query_(enTable, ".columns .handles").style.width = widthStr;
      util.table.query_(enTable, ".columns .insertions").style.width = widthStr;
      util.table.query_(enTable, ".content").style.width = widthStr;
    }
    return width;
  };
  util.table.updateAdornments = function(enTable, axis) {
    if (!util.dom.isEntable(enTable) || enTable.getAttribute("data-lazy")) {
      return;
    }
    var table = util.table.query_(enTable, "table");
    if (axis !== util.table.Axis.VERTICAL) {
      var rowHandles = util.table.query_(enTable, ".rows .handles");
      var rowInsertions = util.table.query_(enTable, ".rows .insertions");
      var rowCount = table.rows.length;
      goog.array.forEach(table.rows, function(tr, index) {
        var height = tr.getBoundingClientRect().height;
        var handle = rowHandles.children[index];
        if (!handle) {
          handle = goog.dom.createDom("div", {class:"handle"});
          rowHandles.appendChild(handle);
        }
        handle.style.height = height + "px";
        var insertion = rowInsertions.children[index];
        if (!insertion) {
          insertion = goog.dom.createDom("div", {class:"insertion"}, goog.dom.createDom("div", {class:"insertion-shape"}));
          rowInsertions.appendChild(insertion);
        }
        insertion.style.marginTop = height - 18 + "px";
      });
      if (rowHandles.children.length - rowCount > 0) {
        goog.array.forEachRight([].slice.call(rowHandles.children, rowCount), goog.dom.removeNode);
        goog.array.forEachRight([].slice.call(rowInsertions.children, rowCount), goog.dom.removeNode);
      }
    }
    if (axis !== util.table.Axis.HORIZONTAL) {
      var colgroup = util.table.query_(enTable, "colgroup");
      var colHandles = util.table.query_(enTable, ".columns .handles");
      var colInsertions = util.table.query_(enTable, ".columns .insertions");
      var colCount = colgroup.children.length;
      goog.array.forEach(colgroup.children, function(col, index) {
        var width = parseInt(col.style.width, 10);
        var handle = colHandles.children[index];
        if (!handle) {
          handle = goog.dom.createDom("div", {class:"handle"});
          colHandles.appendChild(handle);
        }
        handle.style.width = width + "px";
        var insertion = colInsertions.children[index];
        if (!insertion) {
          insertion = goog.dom.createDom("div", {class:"insertion"}, goog.dom.createDom("div", {class:"insertion-shape"}));
          colInsertions.appendChild(insertion);
        }
        insertion.style.marginLeft = width - 18 + "px";
      });
      if (colHandles.children.length - colCount > 0) {
        goog.array.forEachRight([].slice.call(colHandles.children, colCount), goog.dom.removeNode);
        goog.array.forEachRight([].slice.call(colInsertions.children, colCount), goog.dom.removeNode);
      }
    }
  };
  util.table.attachAdornments = function(table, options) {
    if (!util.table.isCompatible(table, options) || goog.dom.getAncestor(table, util.dom.isEntable)) {
      return table;
    }
    util.table.normalizeColgroup(table);
    var placeholder = null;
    var inDOMTree = !!table.parentNode;
    if (inDOMTree) {
      placeholder = goog.dom.createDom("div");
      goog.dom.replaceNode(placeholder, table);
    }
    var enTable = goog.dom.createDom("en-table", {"data-lazy":1}, [goog.dom.createDom("div", {class:"container"}, table), goog.dom.createDom("en-adornments", {contentEditable:"false"})]);
    enTable.style.marginLeft = table.style.marginLeft;
    enTable.style.marginRight = table.style.marginRight;
    table.style.marginLeft = "";
    table.style.marginRight = "";
    util.table.updateWidth(enTable);
    if (inDOMTree) {
      goog.dom.replaceNode(enTable, placeholder);
    }
    return enTable;
  };
  util.table.generateAdornments = function(enTable) {
    if (!enTable.getAttribute("data-lazy")) {
      return;
    }
    enTable.removeAttribute("data-lazy");
    var adornments = util.table.query_(enTable, "en-adornments");
    if (adornments == null) {
      log.warning("Expected adornments not found for table", enTable);
      fixMissingAdornments(enTable);
      return;
    }
    adornments.appendChild(goog.dom.createDom("div", {class:"columns"}, [goog.dom.createDom("div", {class:"handles-container"}, goog.dom.createDom("div", {class:"handles"})), goog.dom.createDom("div", {class:"insertions-container"}, goog.dom.createDom("div", {class:"insertions"})), goog.dom.createDom("div", {class:"insertion"}, goog.dom.createDom("div", {class:"insertion-shape"}))]));
    adornments.appendChild(goog.dom.createDom("div", {class:"rows"}, [goog.dom.createDom("div", {class:"handles-container"}, goog.dom.createDom("div", {class:"handles"})), goog.dom.createDom("div", {class:"insertions-container"}, goog.dom.createDom("div", {class:"insertions"})), goog.dom.createDom("div", {class:"insertion"}, goog.dom.createDom("div", {class:"insertion-shape"}))]));
    adornments.appendChild(goog.dom.createDom("div", {class:"content-container"}, [goog.dom.createDom("div", {class:"content"}, [goog.dom.createDom("div", {class:"xline"}), goog.dom.createDom("div", {class:"yline"})]), goog.dom.createDom("div", {class:"lscroll"}), goog.dom.createDom("div", {class:"rscroll"})]));
    adornments.appendChild(goog.dom.createDom("div", {class:"scrollbar"}, goog.dom.createDom("div", {class:"scrollbar-thumb"})));
    adornments.appendChild(goog.dom.createDom("div", {class:"en-table-btn"}));
  };
  util.table.clearAdornments = function(enTable, legacyCompatible) {
    if (!util.dom.isEntable(enTable)) {
      return enTable;
    }
    var table = enTable.querySelectorAll("table")[0];
    if (!util.dom.isTable(table)) {
      return enTable;
    }
    table.style.marginLeft = enTable.style.marginLeft;
    table.style.marginRight = enTable.style.marginRight;
    var colgroup, tableWidth, widths;
    if (legacyCompatible) {
      colgroup = enTable.querySelectorAll("colgroup")[0];
      widths = goog.array.map(colgroup.children, function(col) {
        return parseInt(col.style.width, 10);
      });
      table.style.borderCollapse = "collapse";
      table.style.width = "";
      table.style.minWidth = "100%";
    }
    goog.dom.removeNode(table.querySelector("cursor-proxy"));
    goog.dom.replaceNode(table, enTable);
    var getWidthStr = function(from, length) {
      var width = 0;
      for (var i = from; i < from + length; i++) {
        width += widths[i];
      }
      return width + "px";
    };
    var matrix = util.table.matrix(table);
    matrix.forEach(function(row, rowIndex) {
      row.forEach(function(obj, colIndex) {
        var info = obj.info;
        var td = info.node;
        if (info.startRowIndex > rowIndex || info.startColIndex > colIndex) {
          return;
        }
        var borderWidth = td.style.borderWidth || "1px";
        var borderStyle = td.style.borderStyle || "solid";
        var borderColor = td.style.borderColor || defs.BORDER_COLOR;
        if (legacyCompatible) {
          td.style.width = getWidthStr(info.startColIndex, info.endColIndex - info.startColIndex + 1);
          if (!td.style.padding) {
            td.style.padding = defs.CELL_PADDING + "px";
          }
        }
        td.style.border = [borderWidth, borderStyle, borderColor].join(" ");
      });
    });
    return table;
  };
  util.table.migrateToEnTable = function(table) {
    if (goog.dom.getAncestor(table, util.dom.isEntable) || !util.table.isCompatible(table, {loose:true})) {
      return false;
    }
    util.table.normalizeColgroup(table, true, true);
    util.table.normalizeStyles(table);
    util.table.flatten(table);
    util.table.normalizeCellBorders(table);
    var enTable = util.table.attachAdornments(table);
    util.table.normalizeDOMPlacement(enTable);
    util.table.layout(enTable);
    return true;
  };
  util.table.flatten = function(table) {
    var childTables;
    var colgroup = util.table.query_(table, "colgroup");
    while ((childTables = goog.array.filter(table.querySelectorAll("table"), function(node) {
      return goog.dom.getAncestor(node, util.dom.isTable) === table;
    })).length > 0) {
      var expansions = [];
      childTables.forEach(function(childTable) {
        var info = processTableForExpansion(childTable, expansions);
        if (info.addRowCount) {
          util.table.insertRows(table, info.insertRowIndex, info.addRowCount);
        }
        if (info.addColCount) {
          var col = colgroup.children[info.endColIndex];
          var width = Math.ceil(parseInt(col.style.width, 10) / (info.addColCount + 1));
          col.style.width = Math.max(width, defs.CELL_MIN_WIDTH) + "px";
          util.table.insertColumns(table, info.insertColIndex, info.addColCount);
        }
        var rootMatrix = util.table.matrix(table);
        var rootInfo = null;
        var rowOffset = info.beforeHTML ? 1 : 0;
        if (info.afterHTML) {
          rootInfo = rootMatrix[info.endRowIndex + info.rowCount - 1][info.startColIndex].info;
          rootInfo.node.innerHTML = info.afterHTML;
        }
        info.matrix.forEach(function(row, rowIndex) {
          row.forEach(function(obj, colIndex) {
            rootInfo = rootMatrix[rowIndex + info.startRowIndex + rowOffset][colIndex + info.startColIndex].info;
            rootInfo.node.innerHTML = obj.info.node.innerHTML;
          });
        });
        var exp = {startRowIndex:info.startRowIndex, startColIndex:info.startColIndex, endRowIndex:info.startRowIndex + info.rowCount - 1, endColIndex:info.startColIndex + info.colCount - 1, rowCount:info.rowCount, colCount:info.colCount};
        expansions.push(exp);
        if (info.afterHTML) {
          rootInfo = rootMatrix[exp.endRowIndex][exp.startColIndex].info;
          rootInfo.node.innerHTML = info.afterHTML;
          mergeColumnTdsAfterFlattening(rootMatrix, exp.endRowIndex, exp.endRowIndex, exp.startColIndex, exp.endColIndex);
        }
        if (info.beforeHTML) {
          mergeColumnTdsAfterFlattening(rootMatrix, exp.startRowIndex, exp.startRowIndex, exp.startColIndex, exp.endColIndex);
        }
      });
    }
  };
  util.table.isMSTable = function(table) {
    var tableMSO = (table.getAttribute("style") || "").indexOf("mso-") > -1;
    if (tableMSO) {
      return true;
    }
    var col = table.querySelector("col");
    return col ? (col.getAttribute("style") || "").indexOf("mso-") > -1 : false;
  };
  util.table.isCompatible = function(table, options) {
    options = options || {};
    var loose = options.loose;
    var foreignSource = options.foreignSource;
    if (table.compat !== undefined) {
      return table.compat;
    }
    table.compat = true;
    if (!util.dom.isTable(table)) {
      table.compat = false;
    } else {
      if (table.tBodies.length === 0 || table.rows.length === 0) {
        table.compat = false;
      } else {
        if (table.querySelectorAll("tfoot").length > 1 || table.querySelectorAll("thead").length > 1) {
          table.compat = false;
        } else {
          if (goog.dom.getAncestor(table, util.dom.isTable)) {
            table.compat = false;
          } else {
            if (!loose && table.querySelector("table")) {
              table.compat = false;
            } else {
              if (!loose && util.table.isMSTable(table)) {
                table.compat = true;
              } else {
                if (!loose && (table.cellPadding || table.cellSpacing || table.border)) {
                  if (table.border === "1" && table.cellPadding === "2" && table.cellSpacing === "0") {
                    if (table.width === "100%") {
                      table.width = "";
                    }
                    table.compat = true;
                  } else {
                    if ((!table.border || table.border === "1") && (!table.cellPadding || table.cellPadding === "0") && (!table.cellSpacing || table.cellSpacing === "0")) {
                      table.border = "";
                      table.cellPadding = "";
                      table.cellSpacing = "";
                      table.compat = true;
                    } else {
                      table.compat = false;
                    }
                  }
                } else {
                  if (!loose && table.style.borderColor === "transparent") {
                    table.compat = false;
                  } else {
                    if (foreignSource && !table.querySelector('colgroup col[style*="width:"]')) {
                      table.compat = false;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    return table.compat;
  };
  util.table.normalize = function(root, options) {
    options = options || {};
    var foreignSource = options.foreignSource;
    var tables = util.dom.isTable(root) ? [root] : root.querySelectorAll("table");
    goog.array.forEach(tables, function(table) {
      var wasEnTable = false;
      var enTable = util.table.enTablefor(table);
      if (enTable) {
        wasEnTable = !!enTable;
        util.table.clearAdornments(enTable);
      }
      var isCompatible = util.table.isCompatible(table, {foreignSource:foreignSource});
      util.table.normalizeStructure(table);
      if (isCompatible) {
        util.table.normalizeColgroup(table, true);
        util.table.normalizeStyles(table);
        util.table.normalizeCellBorders(table);
      } else {
        util.table.normalizeColgroup(table);
      }
      if (wasEnTable) {
        util.table.attachAdornments(table);
      }
    });
  };
  util.table.normalizeTd = function(td) {
    goog.array.forEachRight(td.childNodes, function(child) {
      if (!util.dom.isBlockNode(child)) {
        var wrapper = document.createElement("div");
        td.insertBefore(wrapper, child.nextSibling || null);
        wrapper.appendChild(child);
      }
    });
  };
  util.table.normalizeStructure = function(table) {
    if (table.tBodies.length === 0) {
      table.appendChild(document.createElement("tbody"));
    }
    var tBody = table.tBodies[0];
    goog.array.forEachRight(tBody.childNodes || [], function(child) {
      if (!util.dom.isTr(child)) {
        goog.dom.removeNode(child);
      }
    });
    if (tBody.childNodes.length === 0) {
      tBody.innerHTML = "<tr><td>" + defs.CELL_HTML + "</td></tr>";
      return;
    }
    if (table.tHead) {
      goog.array.forEachRight(table.tHead.childNodes || [], function(child) {
        if (util.dom.isTr(child)) {
          goog.dom.insertSiblingBefore(child, tBody.firstChild);
        }
      });
    }
    if (table.tFoot) {
      goog.array.forEachRight(table.tFoot.childNodes || [], function(child) {
        if (util.dom.isTr(child)) {
          goog.dom.insertSiblingAfter(child, tBody.lastChild);
        }
      });
    }
    goog.array.forEachRight(table.childNodes || [], function(child) {
      if (!util.dom.isTbody(child) && !util.dom.isColgroup(child)) {
        goog.dom.removeNode(child);
      }
    });
    goog.array.forEach(table.rows, function(tr) {
      goog.array.forEachRight(tr.childNodes || [], function(child) {
        if (util.dom.isTd(child) || util.dom.isTh(child)) {
          if (util.dom.isTh(child)) {
            child = util.dom.changeTagName(child, "td");
          }
          if (util.dom.isEmpty(child)) {
            child.innerHTML = defs.CELL_HTML;
          }
        } else {
          goog.dom.removeNode(child);
        }
      });
    });
    var matrix = util.table.matrix(table);
    var colCount = Math.max.apply(null, matrix.map(function(row) {
      return row.length;
    }));
    if (colCount === 0 && matrix.length > 0) {
      table.rows[0].appendChild(util.table.createEmptyTd());
      matrix = util.table.matrix(table);
    }
    matrix.forEach(function(row, rowIndex) {
      for (var colIndex = 0; colIndex < colCount; colIndex++) {
        if (row[colIndex] === undefined) {
          util.table.insertTd(util.table.createEmptyTd(), rowIndex, colIndex, table, matrix);
        }
      }
    });
  };
  util.table.normalizeColgroup = function(table, normalizeToPixel, layoutCalculation) {
    var colgroup = util.table.query_(table, "colgroup");
    var matrix = util.table.matrix(table);
    var colEquations = [];
    var colWidthUnit = colgroup ? null : matrix.length && matrix[0].length ? parseWidth(matrix[0][0].info.node.style.width).unit : null;
    var colCount = matrix.length && matrix[0].length;
    if (layoutCalculation) {
      colWidthUnit = "px";
    }
    if (layoutCalculation && !normalizeToPixel) {
      throw new Error("Invalid combination of normalizeToPixel=false and layoutCalculation=true.");
    }
    var rowIndex, colIndex, row, info, td;
    for (rowIndex = 0; rowIndex < matrix.length; rowIndex++) {
      for (colIndex = 0, row = matrix[rowIndex]; colIndex < row.length; colIndex++) {
        info = row[colIndex].info;
        if (info.startRowIndex > rowIndex || info.startColIndex > colIndex) {
          continue;
        }
        td = info.node;
        if (colWidthUnit || layoutCalculation) {
          var obj = parseWidth(td.style.width);
          var value = layoutCalculation ? td.offsetWidth : obj.value;
          if (!layoutCalculation && value && obj.unit !== colWidthUnit) {
            colWidthUnit = null;
            colEquations = [];
          } else {
            if (value) {
              colEquations.push([value].concat(goog.array.repeat(0, td.colSpan).map(function(_, i) {
                return i + info.startColIndex;
              })));
            }
          }
        }
        if (!layoutCalculation) {
          td.style.width = "";
          td.style.minWidth = "";
          td.style.maxWidth = "";
        }
      }
    }
    if (layoutCalculation) {
      for (rowIndex = 0; rowIndex < matrix.length; rowIndex++) {
        for (colIndex = 0, row = matrix[0]; colIndex < row.length; colIndex++) {
          info = row[colIndex].info;
          if (info.startRowIndex > rowIndex || info.startColIndex > colIndex) {
            continue;
          }
          td = info.node;
          td.style.width = "";
          td.style.minWidth = "";
          td.style.maxWidth = "";
        }
      }
    }
    var styleWidths = [];
    var tableWidthObj = parseWidth(table.style.width);
    if (!tableWidthObj.unit && table.hasAttribute("width")) {
      tableWidthObj = parseWidth(table.getAttribute("width"));
    }
    if (colgroup && !layoutCalculation) {
      styleWidths = calculateStyleWidthsFromColgroup(colCount, tableWidthObj, colgroup, normalizeToPixel);
    } else {
      if (colEquations.length > 0) {
        styleWidths = calculateStyleWidthsFromEquations(colCount, tableWidthObj, colWidthUnit, colEquations, normalizeToPixel);
      } else {
        if (normalizeToPixel || tableWidthObj.unit === "px") {
          styleWidths = calculateStyleWidthsFromRatio(colCount, tableWidthObj);
        } else {
        }
      }
    }
    var newColgroup = document.createElement("colgroup");
    for (var i = 0; i < colCount; i++) {
      var col = document.createElement("col");
      col.style.width = styleWidths[i] || "";
      newColgroup.appendChild(col);
    }
    goog.dom.removeNode(colgroup);
    goog.dom.insertSiblingBefore(newColgroup, table.tBodies[0]);
  };
  util.table.normalizeStyles = function(table) {
    var matrix = util.table.matrix(table);
    var marginLeft = table.style.marginLeft === "auto" ? "auto" : "";
    var marginRight = table.style.marginRight === "auto" ? "auto" : "";
    table.removeAttribute("border");
    table.removeAttribute("align");
    table.removeAttribute("valign");
    table.removeAttribute("bordercolor");
    table.removeAttribute("cellspacing");
    table.removeAttribute("cellpadding");
    table.style.borderCollapse = "";
    table.style.border = "";
    table.style.width = "";
    table.style.minWidth = "";
    table.style.maxWidth = "";
    table.style.padding = "";
    table.style.margin = "";
    table.style.marginLeft = marginLeft;
    table.style.marginRight = marginRight;
    goog.array.forEach(table.rows, function(tr) {
      if (tr.hasAttribute("style")) {
        tr.style.border = "";
        tr.style.margin = "";
        tr.style.paddig = "";
        tr.style.height = "";
        tr.style.minHeight = "";
        tr.style.maxHeight = "";
      }
    });
    matrix.forEach(function(row, rowIndex) {
      row.forEach(function(obj, colIndex) {
        var info = obj.info;
        var td = info.node;
        if (info.startRowIndex > rowIndex || info.startColIndex > colIndex) {
          return;
        }
        var backgroundColor = td.style.backgroundColor;
        td.style.background = "";
        td.style.backgroundColor = goog.color.isValidColor(backgroundColor) ? backgroundColor : "";
        var borderColor = td.style.borderColor;
        td.style.border = "";
        td.style.borderColor = goog.color.isValidColor(borderColor) ? borderColor : "";
        td.style.padding = "";
        td.style.margin = "";
        td.style.width = "";
        td.style.minWidth = "";
        td.style.maxWidth = "";
        td.style.minHeight = "";
        td.style.maxHeight = "";
        if (td.colSpan === 1) {
          td.removeAttribute("colSpan");
        }
        util.table.setRowSpan(td, td.rowSpan);
        td.removeAttribute("width");
        td.removeAttribute("align");
        td.removeAttribute("valign");
      });
    });
  };
  util.table.normalizeCellBorders = function(table, optMatrix) {
    var matrix = optMatrix || util.table.matrix(table);
    goog.array.forEach(table.rows, function(row, rowIndex) {
      var td = row.firstChild;
      if (td) {
        td.style.borderLeftStyle = matrix[rowIndex][0].info.node === td ? "" : "none";
      }
    });
  };
  util.table.normalizeDOMPlacement = function(enTable) {
    var prev = enTable.previousElementSibling;
    if (util.dom.isDiv(prev) && util.dom.isBr(prev.firstChild) && prev.children.length === 1) {
      prev.remove();
    }
    var next = enTable.nextElementSibling;
    if (util.dom.isBr(next)) {
      next.remove();
    }
    var invalidSibling = function(node) {
      return !node || !node.innerHTML && !util.dom.isBr(node) || node.classList && node.classList.contains("en-code") || util.dom.isEntable(node) || util.dom.isHr(node);
    };
    if (invalidSibling(enTable.previousElementSibling)) {
      goog.dom.insertSiblingBefore(goog.dom.createDom("div", null, document.createElement("br")), enTable);
    }
    if (invalidSibling(enTable.nextElementSibling)) {
      goog.dom.insertSiblingAfter(goog.dom.createDom("div", null, document.createElement("br")), enTable);
    }
  };
  util.table.getDraggableTarget = function(node) {
    return util.table.isDraggableHandle(node) && goog.dom.getAncestor(node, util.dom.isEntable, true);
  };
  util.table.isDraggableHandle = function(node) {
    if (!node || util.dom.isTextNode(node)) {
      return false;
    }
    return goog.dom.classlist.contains(node, "en-table-btn");
  };
  util.table.getDragContentTypes = function(node) {
    return [STRUCTTYPES.TABLE];
  };
  util.table.getDraggedNodes = function(state) {
    return [state.target];
  };
  util.table.getGhostImage = function(node) {
    var ghost = goog.dom.createDom("div", "en-dragdrop-table-ghost");
    ghost.innerHTML = "<div>" + '<div class="ghost-row">' + '<div class="ghost-cell first-ghost-cell"></div>' + '<div class="ghost-cell"></div>' + "</div>" + '<div class="ghost-row">' + '<div class="ghost-cell"></div>' + '<div class="ghost-cell"></div>' + "</div>" + "</div>";
    return ghost;
  };
  util.table.shouldSelectCell = function(cell, range) {
    if (!goog.userAgent.WEBKIT) {
      return false;
    }
    var enTable = util.table.getActive();
    var cells = util.table.cellsForNode(enTable);
    var isLastCell = cells.length && cells[cells.length - 1] === cell;
    if (!isLastCell) {
      return false;
    }
    var startNode = range.getStartNode();
    var endNode = range.getEndNode();
    var isPastContents = startNode === endNode && range.getStartOffset() === range.getEndOffset() && cell.childNodes[cell.childNodes.length - 1].contains(endNode);
    var isEmptyCell = cell.innerHTML === uno.defs.table.CELL_HTML;
    return isEmptyCell || isPastContents;
  };
  util.table.isSelectableCellCandidate = function(cell, range) {
    if (!goog.userAgent.product.SAFARI) {
      return false;
    }
    var enTable = util.table.getActive();
    var cells = util.table.cellsForNode(enTable);
    var isLastCell = cells.length && cells[cells.length - 1] === cell;
    if (!isLastCell) {
      return false;
    }
    return cell.textContent === range.getText() || cell.lastChild.textContent === range.getText();
  };
  util.table.query_ = function(owner, selector) {
    if (!queryCache || queryCache.owner !== owner) {
      queryCache = {owner:owner};
    }
    var node = queryCache[selector];
    if (!node || !node.parentNode) {
      node = owner.querySelector(selector);
      queryCache[selector] = node;
    }
    return node;
  };
  function updateActiveTableAdornmentRows() {
    if (activeTable) {
      util.table.updateAdornments(activeTable, util.table.Axis.HORIZONTAL);
    }
  }
  function calculateStyleWidthsFromColgroup(colCount, tableWidthObj, colgroup, normalizeToPixel) {
    if (colCount !== colgroup.children.length) {
      return goog.array.repeat(normalizeToPixel ? defs.CELL_WIDTH + "px" : null, colCount);
    }
    var colFlexIndexes = [];
    var colWidthSum = 0;
    var unit = normalizeToPixel ? "px" : tableWidthObj.unit;
    var tableWidth;
    var widths = [];
    if (tableWidthObj.unit === "%") {
      tableWidth = tableWidthObj.value * (util.styles.getNoteWidth() - 1);
    } else {
      if (tableWidthObj.unit === "px") {
        tableWidth = tableWidthObj.value;
      } else {
        tableWidth = util.styles.getNoteWidth();
      }
    }
    goog.array.forEach(colgroup.children, function(col, i) {
      var colWidthStr = col.getAttribute("width") || col.style.width;
      var colWidthObj = parseWidth(colWidthStr);
      var width;
      if (colWidthStr === "*") {
        colFlexIndexes.push(i);
        unit = "px";
        width = 0;
      } else {
        if (colWidthObj.unit === "%" && normalizeToPixel) {
          width = tableWidth * colWidthObj.value;
        } else {
          if (colWidthObj.unit === "%") {
            unit = "%";
            width = colWidthObj.value;
          } else {
            if (colWidthObj.unit === "px" || normalizeToPixel) {
              unit = "px";
              width = colWidthObj.value || defs.CELL_WIDTH;
            }
          }
        }
      }
      colWidthSum += width;
      for (var j = parseInt(col.getAttribute("span"), 10) || 1; j > 0; j--) {
        widths.push(width);
      }
    });
    if (!unit) {
      return goog.array.repeat(defs.CELL_WIDTH + "px", colCount);
    }
    var flexCount = colFlexIndexes.length;
    var flexTotal = unit === "%" ? 1 : tableWidth;
    var flexWidth = Math.max(0, flexTotal - colWidthSum);
    colFlexIndexes.forEach(function(i) {
      widths[i] = Math.round(flexWidth / flexCount);
    });
    var styleWidths = [];
    for (var i = 0; i < colCount; i++) {
      var width;
      if (unit === "px" && normalizeToPixel) {
        width = Math.max(widths[i] || defs.CELL_WIDTH, defs.CELL_MIN_WIDTH);
      } else {
        if (unit === "px") {
          width = widths[i] || defs.CELL_WIDTH;
        } else {
          width = widths[i] * 100;
        }
      }
      styleWidths.push(Math.round(width) + unit);
    }
    return styleWidths;
  }
  function calculateStyleWidthsFromEquations(colCount, tableWidthObj, colWidthUnit, colEquations, normalizeToPixel) {
    var change = true;
    var divide = false;
    var tableWidth;
    var widthIndexCount = 0;
    var widths = [];
    if (tableWidthObj.unit === "%") {
      tableWidth = tableWidthObj.value * (util.styles.getNoteWidth() - 1);
    } else {
      if (tableWidthObj.unit === "px") {
        tableWidth = tableWidthObj.value;
      } else {
        tableWidth = util.styles.getNoteWidth();
      }
    }
    colEquations.sort(function(a, b) {
      return b.length - a.length;
    });
    while (change && widthIndexCount < colCount) {
      change = false;
      goog.array.forEachRight(colEquations, function(eq, i) {
        if (eq.length > 2) {
          for (var j = eq.length - 1; j > 0; j--) {
            var wval = widths[eq[j]];
            if (wval) {
              change = true;
              eq[0] -= wval;
              eq.splice(j, 1);
            }
          }
        }
        if (divide || eq.length === 2) {
          for (var l = eq.length - 1, k = l; k > 0; k--) {
            if (!widths[eq[k]]) {
              change = true;
              widthIndexCount += 1;
              widths[eq[k]] = eq[0] / l;
            }
          }
          colEquations.splice(i, 1);
        }
      });
      if (!change && !divide) {
        divide = true;
        change = true;
      }
    }
    for (var i = 0; i < colCount; i++) {
      var width = widths[i];
      if (colWidthUnit === "px" && normalizeToPixel) {
        widths[i] = Math.max(width || defs.CELL_WIDTH, defs.CELL_MIN_WIDTH);
      } else {
        if (colWidthUnit === "px") {
          widths[i] = width || defs.CELL_WIDTH;
        } else {
          if (colWidthUnit === "%" && width) {
            widths[i] = tableWidth * width;
          } else {
            if (colWidthUnit === "%" || !width) {
              widths[i] = defs.CELL_WIDTH;
            }
          }
        }
      }
    }
    return widths.map(function(num) {
      return Math.round(num) + "px";
    });
  }
  function calculateStyleWidthsFromRatio(colCount, tableWidthObj) {
    var noteWidth = util.styles.getNoteWidth() - 1;
    var styleWidths = [];
    var width = null;
    if (tableWidthObj.unit === "%") {
      width = noteWidth * tableWidthObj.value / colCount;
    } else {
      if (tableWidthObj.unit === "px") {
        width = tableWidthObj.value / colCount;
      } else {
        width = defs.CELL_WIDTH;
      }
    }
    for (var i = 0; i < colCount; i++) {
      styleWidths.push(Math.round(Math.max(width, defs.CELL_MIN_WIDTH)) + "px");
    }
    return styleWidths;
  }
  function processDeleteIndexes(indexes, lowerBound, upperBound) {
    var inBounds = goog.array.every(indexes, function(index) {
      return index >= lowerBound && index <= upperBound;
    });
    if (!inBounds) {
      return null;
    }
    return indexes.slice().sort(function(a, b) {
      return b - a;
    });
  }
  function parseWidth(val) {
    if (val && val.indexOf("%") > -1) {
      return {unit:"%", value:parseInt(val, 10) / 100};
    } else {
      if (val && (val.indexOf("px") > -1 || val.indexOf("pt") > -1 || !isNaN(parseInt(val, 10)))) {
        return {unit:"px", value:parseInt(val, 10)};
      }
    }
    return {unit:null, value:null};
  }
  function prevNextCell(node, navigateByDOM, direction) {
    var td = goog.dom.getAncestor(node, util.dom.isTd, true);
    if (!td) {
      return null;
    }
    var matrix = util.table.matrix(goog.dom.getAncestor(td, util.dom.isTable));
    var info = util.table.infoForCell(td, matrix);
    var maxColIndex = matrix[0].length - 1;
    var maxRowIndex = matrix.length - 1;
    var rowIndex = info.startRowIndex;
    var colIndex = info.startColIndex;
    while (true) {
      if (direction < 0 && colIndex === 0) {
        rowIndex += direction;
        colIndex = maxColIndex;
      } else {
        if (direction > 0 && colIndex >= maxColIndex) {
          rowIndex += direction;
          colIndex = 0;
        } else {
          colIndex += direction;
        }
      }
      if (rowIndex < 0 || rowIndex > maxRowIndex) {
        break;
      }
      var itInfo = matrix[rowIndex][colIndex].info;
      if (!navigateByDOM && itInfo !== info || navigateByDOM && itInfo !== info && itInfo.startRowIndex === rowIndex) {
        return itInfo.node;
      }
    }
    return null;
  }
  function mergeColumnTdsAfterFlattening(matrix, startRowIndex, endRowIndex, startColIndex, endColIndex) {
    for (var rowIndex = startRowIndex; rowIndex <= endRowIndex; rowIndex++) {
      var tds = [];
      for (var colIndex = startColIndex; colIndex <= endColIndex; colIndex++) {
        var info = matrix[rowIndex][colIndex].info;
        if (info.startRowIndex === rowIndex && info.startColIndex === colIndex) {
          tds.push(info.node);
        }
      }
      util.table.mergeCells(tds);
    }
  }
  function mergeRowTdsAfterFlattening(matrix, startRowIndex, endRowIndex, startColIndex, endColIndex) {
    for (var colIndex = startColIndex; colIndex <= endColIndex; colIndex++) {
      var tds = [];
      for (var rowIndex = startRowIndex; rowIndex <= endRowIndex; rowIndex++) {
        var info = matrix[rowIndex][colIndex].info;
        if (info.startRowIndex === rowIndex && info.startColIndex === colIndex) {
          tds.push(info.node);
        }
      }
      util.table.mergeCells(tds);
    }
  }
  function mergeTdsAfterFlattening(matrix, expansions) {
  }
  function processTableForExpansion(table, expansions) {
    var td = goog.dom.getAncestor(table, util.dom.isTd);
    var cellInfo = util.table.infoForCell(td);
    var matrix = util.table.matrix(table);
    var afterHTML = null;
    var beforeHTML = null;
    var rowOffset = 0;
    var nextNode = util.dom.nextNodeDescendants(table, td);
    if (nextNode) {
      var afterNodeSplit = goog.editor.node.splitDomTreeAt(nextNode, nextNode, td);
      if (!util.dom.isEmptyContent(afterNodeSplit)) {
        afterHTML = afterNodeSplit.innerHTML;
        rowOffset += 1;
      }
    }
    goog.editor.node.splitDomTreeAt(table, table, td);
    if (!util.dom.isEmptyContent(td)) {
      beforeHTML = td.innerHTML;
      rowOffset += 1;
    }
    var info = {matrix:matrix, beforeHTML:beforeHTML, afterHTML:afterHTML, startRowIndex:cellInfo.startRowIndex, endRowIndex:cellInfo.endRowIndex, startColIndex:cellInfo.startColIndex, endColIndex:cellInfo.endColIndex, rowCount:matrix.length + rowOffset, colCount:matrix[0].length, insertRowIndex:cellInfo.endRowIndex + 1, insertColIndex:cellInfo.endColIndex + 1, addRowCount:matrix.length - 1 + rowOffset, addColCount:matrix[0].length - 1};
    var rowExp = expansions.reduce(function(prev, cur) {
      return !prev && cur.startRowIndex === info.startRowIndex || prev && prev.rowCount < cur.rowCount && cur.startRowIndex === info.startRowIndex ? cur : prev;
    }, null);
    if (rowExp) {
      info.addRowCount = Math.max(0, info.addRowCount + 1 - (rowExp.rowCount - (rowExp.startRowIndex - info.startRowIndex)));
      if (info.addRowCount) {
        info.insertRowIndex = Math.max(rowExp.endRowIndex + 1, info.insertRowIndex);
      }
    }
    var colExp = expansions.reduce(function(prev, cur) {
      return !prev && cur.startColIndex === info.startColIndex || prev && prev.colCount < cur.colCount && cur.startColIndex === info.startColIndex ? cur : prev;
    }, null);
    if (colExp) {
      info.addColCount = Math.max(0, info.addColCount + 1 - (colExp.colCount - (colExp.startColIndex - info.startColIndex)));
      if (info.addColCount) {
        info.insertColIndex = Math.max(colExp.endColIndex + 1, info.insertColIndex);
      }
    }
    return info;
  }
  function mergeExpansions(expansions, info) {
    var addition = {startRowIndex:info.startRowIndex, startColIndex:info.startColIndex, endRowIndex:info.startRowIndex + info.rowCount - 1, endColIndex:info.startColIndex + info.colCount - 1, rowCount:info.rowCount, colCount:info.colCount};
    var index = goog.array.findIndex(expansions, function(obj) {
      return obj.startRowIndex === addition.startRowIndex && obj.startColIndex === addition.startColIndex && (obj.rowCount < addition.rowCount || obj.colCount < addition.colCount);
    });
    if (index > -1) {
      var exp = expansions[index];
      exp.endRowIndex = Math.max(exp.endRowIndex, addition.endRowIndex);
      exp.endColIndex = Math.max(exp.endColIndex, addition.endColIndex);
      exp.rowCount = Math.max(exp.rowCount, addition.rowCount);
      exp.colCount = Math.max(exp.colCount, addition.colCount);
    } else {
      expansions.push(addition);
    }
  }
})();
goog.provide("uno.util.table.selection");
goog.require("goog.debug.Logger");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("uno.util.dom");
goog.require("uno.util.range");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.table.selection");
  var util = uno.util;
  var State = util.table.State;
  var Axis = util.table.Axis;
  var model = null;
  util.table.selection.isActive = function(enTable) {
    return !!(model && !model.activationTimer && (enTable === undefined || model.enTable === enTable));
  };
  util.table.selection.isPending = function(enTable) {
    return !!(model && model.activationTimer && (enTable === undefined || model.enTable === enTable));
  };
  util.table.selection.create = function(enTable, multirange, anchorCell, focusCell, axis) {
    var matrix = util.table.matrix(enTable, {selection:true});
    var info = !anchorCell ? findSelectedInfo(matrix) : null;
    util.table.selection.clear();
    if (!anchorCell) {
      if (!info) {
        enTable.classList.remove("multirange");
        return false;
      }
      anchorCell = info.node;
    }
    enTable.classList.add("multirange");
    var timer = null;
    if (!util.touch.touching) {
      timer = setTimeout(function() {
        util.range.selectNodeContents(model.cursorProxy);
        model.activationTimer = setTimeout(function() {
          if (model) {
            model.activationTimer = null;
          }
        }, 10);
      }, 10);
    }
    model = {enTable:enTable, cursorProxy:createCursorProxy(enTable), multirange:multirange, activationTimer:timer, anchorCell:anchorCell, colVector:createVector(util.table.query_(enTable, ".columns .handles").children), rowVector:createVector(util.table.query_(enTable, ".rows .handles").children), matrix:util.table.matrix(enTable)};
    if (info) {
      return applyDiff(model, matrix, true);
    }
    return util.table.selection.selectTo(focusCell || anchorCell, axis);
  };
  util.table.selection.selectTo = function(focusCell, axis) {
    if (!model) {
      throw new Error("Calling util.table.selection.selectTo on inactive model.");
    }
    var matrix = util.table.matrix(model.enTable);
    if (!axis && model.anchorCell === focusCell) {
      util.table.infoForCell(focusCell, matrix).state |= State.SELECTED;
      util.table.setActive(model.enTable, focusCell);
      return applyDiff(model, matrix);
    }
    var aInfo = util.table.infoForCell(model.anchorCell, matrix);
    var fInfo = model.anchorCell === focusCell ? aInfo : util.table.infoForCell(focusCell, matrix);
    var startRowIndex = axis === Axis.VERTICAL ? 0 : Math.min(aInfo.startRowIndex, fInfo.startRowIndex);
    var endRowIndex = axis === Axis.VERTICAL ? matrix.length - 1 : Math.max(aInfo.endRowIndex, fInfo.endRowIndex);
    var startColIndex = axis === Axis.HORIZONTAL ? 0 : Math.min(aInfo.startColIndex, fInfo.startColIndex);
    var endColIndex = axis === Axis.HORIZONTAL ? matrix[0].length - 1 : Math.max(aInfo.endColIndex, fInfo.endColIndex);
    setSelectedInRect(matrix, startRowIndex, endRowIndex, startColIndex, endColIndex, true);
    if (axis === Axis.VERTICAL) {
      focusCell = model.matrix[0][fInfo.startColIndex].info.node;
    } else {
      if (axis === Axis.HORIZONTAL) {
        focusCell = model.matrix[fInfo.startRowIndex][0].info.node;
      }
    }
    util.table.setActive(model.enTable, focusCell);
    return applyDiff(model, matrix);
  };
  util.table.selection.toggleAt = function(focusCell, axis) {
    if (!model) {
      throw new Error("Calling util.table.selection.toggleAt on inactive model.");
    }
    var matrix = cloneMatrix(model.enTable, model.matrix);
    var info = util.table.infoForCell(focusCell, matrix);
    if (!axis) {
      info.state ^= State.SELECTED;
      util.table.setActive(model.enTable, focusCell);
      return applyDiff(model, matrix);
    }
    var vert = axis === Axis.VERTICAL;
    var state = vert ? model.colVector[info.startColIndex].state : model.rowVector[info.startRowIndex].state;
    var selected = !(state & State.WHOLE_SELECTED);
    var startRowIndex = vert ? 0 : info.startRowIndex;
    var endRowIndex = vert ? matrix.length - 1 : info.endRowIndex;
    var startColIndex = !vert ? 0 : info.startColIndex;
    var endColIndex = !vert ? matrix[0].length - 1 : info.endColIndex;
    setSelectedInRect(matrix, startRowIndex, endRowIndex, startColIndex, endColIndex, selected);
    focusCell = vert ? model.matrix[0][info.startColIndex].info.node : model.matrix[info.startRowIndex][0].info.node;
    util.table.setActive(model.enTable, focusCell);
    return applyDiff(model, matrix);
  };
  util.table.selection.clear = function() {
    if (!util.table.selection.isActive()) {
      return;
    }
    if (!document.body.contains(model.enTable)) {
      return;
    }
    clearTimeout(model.activationTimer);
    applyDiff(model, util.table.matrix(model.enTable));
    model.multirange.clear();
    model.cursorProxy.remove();
    model.enTable.classList.remove("multirange");
    model = null;
  };
  util.table.selection.getColumnIndexes = function(state) {
    if (!model) {
      return [];
    }
    return model.colVector.map(function(obj, index) {
      return obj.state & (state || State.SELECTED) ? index : null;
    }).filter(goog.isDefAndNotNull);
  };
  util.table.selection.getRowIndexes = function(state) {
    if (!model) {
      return [];
    }
    return model.rowVector.map(function(obj, index) {
      return obj.state & (state || State.SELECTED) ? index : null;
    }).filter(goog.isDefAndNotNull);
  };
  util.table.selection.getCells = function() {
    if (!model) {
      return [];
    }
    var nodes = [];
    model.matrix.forEach(function(row, rowIndex) {
      row.forEach(function(obj, colIndex) {
        var info = obj.info;
        if (info.state & State.SELECTED && info.startRowIndex === rowIndex && info.startColIndex === colIndex) {
          nodes.push(info.node);
        }
      });
    });
    return nodes;
  };
  util.table.selection.getPasteCell = function() {
    if (!model) {
      return null;
    }
    var rowIndexes = util.table.selection.getRowIndexes();
    var colIndexes = util.table.selection.getColumnIndexes();
    if (rowIndexes.length === 0 || colIndexes.length === 0) {
      return null;
    }
    return model.matrix[rowIndexes[0]][colIndexes[0]].info.node;
  };
  function applyDiff(mod, matrix, force) {
    var hasSelection = false;
    var clen = mod.colVector.length;
    var rlen = mod.rowVector.length;
    var colSelectedCounts = goog.array.repeat(0, clen);
    var rowSelectedCounts = goog.array.repeat(0, rlen);
    var colOverlapIndexes = goog.array.repeat(undefined, clen);
    var rowOverlapIndexes = goog.array.repeat(undefined, rlen);
    mod.matrix.forEach(function(row, rowIndex) {
      row.forEach(function(obj, colIndex) {
        var info = obj.info;
        var state = matrix[rowIndex][colIndex].info.state;
        var selected = state & State.SELECTED;
        var root = info.startRowIndex === rowIndex && info.startColIndex === colIndex;
        if (root && (force || (info.state & State.SELECTED) !== selected)) {
          var cell = info.node;
          var range = goog.dom.Range.createFromNodeContents(cell);
          range.getBrowserRangeObject().fillContainer = true;
          mod.multirange.toggleTextRange(range, selected);
          cell.classList.toggle("selected", selected);
          info.state = state;
        }
        if (selected) {
          hasSelection = true;
          colSelectedCounts[colIndex] += 1;
          rowSelectedCounts[rowIndex] += 1;
          storeOverlapIndexes(colOverlapIndexes, colIndex, info.startColIndex, info.endColIndex);
          storeOverlapIndexes(rowOverlapIndexes, rowIndex, info.startRowIndex, info.endRowIndex);
        }
      });
    });
    applyVectorDiff(mod.colVector, colSelectedCounts, colOverlapIndexes, rlen);
    applyVectorDiff(mod.rowVector, rowSelectedCounts, rowOverlapIndexes, clen);
    return hasSelection;
  }
  function applyVectorDiff(vector, selectedCounts, overlapIndexes, length) {
    overlapIndexes = overlapIndexes.map(function(obj) {
      return Object.keys(obj || {}).map(function(key) {
        return parseInt(key, 10);
      });
    });
    var compare = function(i) {
      return selectedCounts[i] === length;
    };
    vector.forEach(function(obj, index) {
      var state = 0;
      var count = selectedCounts[index];
      if (count === length) {
        state |= State.WHOLE_SELECTED;
        if (goog.array.every(overlapIndexes[index], compare)) {
          state |= State.DRAGGABLE;
        }
      }
      if (count > 0) {
        state |= State.SELECTED;
      }
      obj.state = state;
      obj.node.classList.toggle("wselected", state & State.WHOLE_SELECTED);
      obj.node.classList.toggle("selected", state & State.SELECTED);
      obj.node.classList.toggle("draggable", state & State.DRAGGABLE);
    });
  }
  function storeOverlapIndexes(arr, index, startIndex, endIndex) {
    if (startIndex === index && endIndex === index) {
      return;
    }
    var obj = arr[index];
    if (!obj) {
      obj = {};
      arr[index] = obj;
    }
    for (var i = startIndex; i <= endIndex; i++) {
      if (i !== index) {
        obj[i] = true;
      }
    }
  }
  function findSelectedInfo(matrix) {
    var info = null;
    for (var i = 0, il = matrix.length; i < il; i++) {
      for (var j = 0, jl = matrix[i].length; j < jl; j++) {
        var obj = matrix[i][j];
        if (obj.info.state & State.SELECTED) {
          info = obj.info;
          break;
        }
      }
      if (info) {
        break;
      }
    }
    return info;
  }
  function setSelectedInRect(matrix, startRowIndex, endRowIndex, startColIndex, endColIndex, selected) {
    var indexes = util.table.expandIntoRectIndexes(matrix, startRowIndex, endRowIndex, startColIndex, endColIndex);
    for (var rowIndex = indexes.startRowIndex; rowIndex <= indexes.endRowIndex; rowIndex++) {
      for (var colIndex = indexes.startColIndex; colIndex <= indexes.endColIndex; colIndex++) {
        if (selected) {
          matrix[rowIndex][colIndex].info.state |= State.SELECTED;
        } else {
          matrix[rowIndex][colIndex].info.state &= ~State.SELECTED;
        }
      }
    }
  }
  function cloneMatrix(enTable, matrix) {
    var newMatrix = util.table.matrix(enTable);
    matrix.forEach(function(row, rowIndex) {
      row.forEach(function(obj, colIndex) {
        newMatrix[rowIndex][colIndex].info.state = obj.info.state;
      });
    });
    return newMatrix;
  }
  function createVector(nodesOrVector) {
    return goog.array.map(nodesOrVector, function(obj) {
      return {node:util.dom.isElementNode(obj) ? obj : obj.node, state:0};
    });
  }
  function createCursorProxy(enTable) {
    var node = enTable.querySelector(".cursor-proxy");
    if (!node) {
      node = goog.dom.createDom("cursor-proxy");
      node.innerHTML = "&nbsp;";
      enTable.querySelector("table").appendChild(node);
    }
    return node;
  }
})();
goog.provide("uno.util.copy.table");
goog.require("uno.defs");
goog.require("uno.util.table");
goog.require("uno.util.table.selection");
(function() {
  var util = uno.util;
  var defs = uno.defs;
  util.copy.table.getPastableHtml = function() {
    var selectedCells = util.table.selection.getCells();
    if (selectedCells.length === 0) {
      return "";
    } else {
      if (selectedCells.length === 1) {
        return selectedCells[0].innerHTML;
      }
    }
    var table = util.table.getActive().querySelector("table").cloneNode(true);
    var cols = table.querySelector("colgroup").children;
    var matrix = util.table.matrix(table, {selection:true});
    var colIndexes = util.table.selection.getColumnIndexes();
    var rowIndexes = util.table.selection.getRowIndexes();
    var indexes = util.table.expandIntoRectIndexes(matrix, rowIndexes[0], goog.array.peek(rowIndexes), colIndexes[0], goog.array.peek(colIndexes));
    var proxy = table.querySelector("cursor-proxy");
    if (proxy) {
      proxy.remove();
    }
    goog.array.forEachRight(matrix, function(row, rowIndex) {
      if (!(indexes.startRowIndex <= rowIndex && rowIndex <= indexes.endRowIndex)) {
        table.rows[rowIndex].remove();
      } else {
        goog.array.forEachRight(row, function(obj, colIndex) {
          var info = obj.info;
          if (!info.node.style.borderWidth) {
            info.node.style.borderWidth = "1px";
          }
          if (!info.node.style.borderStyle) {
            info.node.style.borderStyle = "solid";
          }
          if (!info.node.style.borderColor) {
            info.node.style.borderColor = "#ccc";
          }
          if (info.startRowIndex > rowIndex && info.startColIndex > colIndex) {
            return;
          }
          if (!(indexes.startColIndex <= colIndex && colIndex <= indexes.endColIndex)) {
            info.node.remove();
          } else {
            if (info.state & util.table.State.SELECTED) {
              info.node.classList.remove("selected");
            } else {
              info.node.innerHTML = defs.table.CELL_HTML;
            }
          }
        });
      }
    });
    goog.array.forEachRight(matrix[0], function(row, colIndex) {
      if (!(indexes.startColIndex <= colIndex && colIndex <= indexes.endColIndex)) {
        cols[colIndex].remove();
      }
    });
    return table.outerHTML;
  };
})();
goog.provide("uno.util.copy.rich");
(function() {
  var util = uno.util;
  var dom = util.dom;
  util.copy.rich.copy = function(root, options) {
    var addMarker = options.addMarker || typeof options.addMarker === "undefined";
    var node = root.childNodes.length === 1 && dom.isDiv(root.firstChild) && !dom.isImg(root.firstChild.firstChild) ? root.firstChild : root;
    if (addMarker) {
      goog.array.some(node.childNodes, function(element) {
        if (dom.isElementNode(element)) {
          util.styles.setStyle(element, "-en-clipboard", "true");
          return true;
        }
        return false;
      });
    }
    return node.innerHTML;
  };
})();
goog.provide("uno.util.canvas");
goog.require("goog.debug.Logger");
goog.require("uno.util.styles");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.canvas");
  var util = uno.util;
  util.canvas.create = function(width, height) {
    var canvas = document.createElement("canvas");
    var ratio = util.styles.getDevicePixelRatio();
    canvas.width = width * ratio;
    canvas.height = height * ratio;
    canvas.style.width = width + "px";
    canvas.style.height = height + "px";
    var ctx = canvas.getContext("2d");
    ctx.scale(ratio, ratio);
    ctx.save();
    ctx.fillStyle = "#fff";
    ctx.fillRect(0, 0, width, height);
    ctx.restore();
    return canvas;
  };
  util.canvas.width = function(canvas) {
    return parseFloat(canvas.style.width) || canvas.width;
  };
  util.canvas.height = function(canvas) {
    return parseFloat(canvas.style.height) || canvas.height;
  };
  util.canvas.fillText = function(ctx, text, x, y, width) {
    if (text) {
      var len = text.length - 4;
      var metrics = ctx.measureText(text);
      while (metrics.width > width && len > 0) {
        text = text.substring(0, len) + "...";
        len--;
        metrics = ctx.measureText(text);
      }
      ctx.fillText(text, x, y);
    }
  };
  util.canvas.rad = function(deg) {
    return deg * Math.PI / 180;
  };
})();
goog.provide("uno.components.ImageResizer");
goog.require("goog.dom");
goog.require("goog.events");
goog.require("goog.style");
goog.require("uno.util.dom");
goog.require("uno.util.styles");
goog.require("uno.util.table");
goog.require("uno.util.zoomscale");
(function() {
  var BORDER_WIDTH = 2;
  var MIN_WIDTH = 50 + BORDER_WIDTH * 2;
  var util = uno.util;
  var ImageResizer = uno.components.ImageResizer = function(editor) {
    this.resizing = false;
    this.editor_ = editor;
    this.target_ = null;
    this.meta_ = null;
    this.frame_ = goog.dom.createDom("div", {class:"en-imageresizer-frame"});
    this.element = goog.dom.createDom("div", {class:"en-imageresizer-trigger"});
    goog.events.listen(this.element, "mousedown", handleResizeStart.bind(this));
    goog.events.listen(window, "mousemove", handleResizeChange.bind(this));
    goog.events.listen(window, "mouseup", handleResizeEnd.bind(this));
    goog.events.listen(window, "contextmenu", handleContextMenu.bind(this));
  };
  Object.defineProperty(ImageResizer.prototype, "attached", {get:function() {
    return !!this.target_;
  }});
  ImageResizer.prototype.attach = function(img) {
    if (this.resizing || !img) {
      return;
    }
    this.detach();
    this.element.style.display = "block";
    this.target_ = img;
    this.layout();
  };
  ImageResizer.prototype.detach = function() {
    if (this.resizing) {
      return;
    }
    this.element.style.display = "none";
    this.frame_.remove();
    this.target_ = null;
  };
  ImageResizer.prototype.layout = function() {
    if (!this.target_) {
      return false;
    }
    var zoom = uno.util.zoomscale.getZoom();
    var rect = getInnerClientRect(this.target_);
    if (rect.width <= 0 || rect.height <= 0) {
      return false;
    }
    this.element.style.zoom = zoom;
    this.element.style.top = rect.top + rect.height + util.dom.scrollTop(document.body) / zoom + "px";
    this.element.style.left = rect.left + rect.width + util.dom.scrollLeft(document.body) / zoom + "px";
    return true;
  };
  function getInnerClientRect(node) {
    var rect = node.getBoundingClientRect();
    var styles = getComputedStyle(node);
    var rectOffsets = {left:!isNaN(parseFloat(styles.paddingLeft)) ? parseFloat(styles.paddingLeft) : 0, top:!isNaN(parseFloat(styles.paddingTop)) ? parseFloat(styles.paddingTop) : 0, right:!isNaN(parseFloat(styles.paddingRight)) ? parseFloat(styles.paddingRight) : 0, bottom:!isNaN(parseFloat(styles.paddingBottom)) ? parseFloat(styles.paddingBottom) : 0};
    rect.x += rectOffsets.left;
    rect.y += rectOffsets.top;
    rect.width -= rectOffsets.left + rectOffsets.right;
    rect.height -= rectOffsets.top + rectOffsets.bottom;
    return rect;
  }
  function handleResizeEnd(evt) {
    if (!this.meta_) {
      return;
    }
    evt.preventDefault();
    evt.stopPropagation();
    if (this.meta_.width) {
      this.target_.setAttribute("width", this.meta_.width);
      this.target_.setAttribute("data-width", this.meta_.width);
    }
    this.frame_.remove();
    this.meta_ = null;
    this.resizing = false;
    document.documentElement.classList.remove("nwse-resizing");
    this.layout();
    var enTable = goog.dom.getAncestor(this.target_, util.dom.isEntable);
    if (enTable) {
      util.table.layout(enTable);
    }
    this.editor_.execCommand("focus", true);
    this.editor_.dispatchChange();
  }
  function handleResizeChange(evt) {
    if (!this.meta_) {
      return;
    }
    evt.preventDefault();
    evt.stopPropagation();
    var d = this.meta_;
    var x = evt.clientX - d.rect.left;
    var y = evt.clientY - d.rect.top;
    var scaleX = x / d.fromPoint.x;
    var scaleY = y / d.fromPoint.y;
    var belowDiagonal = d.ratio > Math.abs(x / y);
    var scaledWidth = belowDiagonal ? d.rect.height * scaleY * d.ratio : scaleX * d.rect.width;
    var width = Math.round(Math.max(Math.min(scaledWidth, d.maxWidth), d.minWidth));
    var height = width / d.ratio;
    if (this.meta_.width !== width) {
      this.meta_.width = width;
      this.frame_.style.width = width + "px";
      this.frame_.style.height = height + "px";
    }
  }
  function handleResizeStart(evt) {
    if (!this.target_) {
      return;
    }
    evt.preventDefault();
    evt.stopPropagation();
    this.resizing = true;
    var zoom = uno.util.zoomscale.getZoom();
    var noteWidth = uno.util.styles.getNoteWidth(this.editor_.field);
    var rect = getInnerClientRect(this.target_);
    this.frame_.style.zoom = zoom;
    this.frame_.style.top = rect.top - BORDER_WIDTH + util.dom.scrollTop(document.body) / zoom + "px";
    this.frame_.style.left = rect.left - BORDER_WIDTH + util.dom.scrollLeft(document.body) / zoom + "px";
    this.frame_.style.width = rect.width + "px";
    this.frame_.style.height = rect.height + "px";
    var tdWidth = Infinity;
    var td = goog.dom.getAncestor(this.target_, util.dom.isTd);
    if (td) {
      tdWidth = td.getBoundingClientRect().width - 20;
    }
    this.meta_ = {fromPoint:{x:evt.clientX - rect.left, y:evt.clientY - rect.top}, rect:rect, ratio:this.target_.naturalWidth / this.target_.naturalHeight, width:null, maxWidth:Math.min(this.target_.naturalWidth, noteWidth, tdWidth), minWidth:MIN_WIDTH};
    this.element.parentNode.appendChild(this.frame_);
    document.documentElement.classList.add("nwse-resizing");
  }
  function handleContextMenu(evt) {
    if (this.resizing) {
      evt.preventDefault();
    }
  }
})();
goog.provide("uno.i18n.ar");
uno.i18n.ar.textEntries = {"Not available offline":"\u0644\u0627 \u064a\u062a\u0648\u0641\u0631 \u062f\u0648\u0646 \u0627\u062a\u0635\u0627\u0644 \u0628\u0627\u0644\u0625\u0646\u062a\u0631\u0646\u062a", "Not available":"\u063a\u064a\u0631 \u0645\u062a\u0627\u062d", "Tap to request access":"\u0627\u0636\u063a\u0637 \u0644\u0637\u0644\u0628 \u0627\u0644\u0648\u0635\u0648\u0644", "Click to request access":"\u0627\u0636\u063a\u0637 \u0644\u0637\u0644\u0628 \u0627\u0644\u0648\u0635\u0648\u0644", "Open":"\u0641\u062a\u062d", 
"Copy link":"\u0646\u0633\u062e \u0627\u0644\u0631\u0627\u0628\u0637", "Google Drive":"\u062c\u0648\u062c\u0644 \u062f\u0631\u0627\u064a\u0641", "Google Docs":"\u0645\u0633\u062a\u0646\u062f\u0627\u062a \u062c\u0648\u062c\u0644", "Google Sheets":"\u0623\u0648\u0631\u0627\u0642 \u062c\u0648\u062c\u0644", "Google Slides":"\u0634\u0631\u0627\u0626\u062d \u062c\u0648\u062c\u0644", "PDF":"PDF", "Word Document":"\u0645\u0633\u062a\u0646\u062f Word", "Excel Spreadsheet":"\u062c\u062f\u0648\u0644 \u0628\u064a\u0627\u0646\u0627\u062a Excel", 
"Modified":"\u062a\u0645 \u062a\u0639\u062f\u064a\u0644\u0647", "Connect":"\u0627\u062a\u0635\u0627\u0644", "Connect to see more":"\u0627\u0631\u0628\u0637 \u0627\u0644\u062d\u0633\u0627\u0628 \u0644\u0627\u0633\u062a\u0639\u0631\u0627\u0636 \u0627\u0644\u0645\u0632\u064a\u062f", "Connect Google account":"\u0631\u0628\u0637 \u062d\u0633\u0627\u0628 \u062c\u0648\u062c\u0644", "Title not available":"\u0627\u0644\u0639\u0646\u0648\u0627\u0646 \u063a\u064a\u0631 \u0645\u062a\u0627\u062d", "Open containing folder":"\u0641\u062a\u062d \u0627\u0644\u0645\u062c\u0644\u062f \u0627\u0644\u0631\u0626\u064a\u0633\u064a", 
"Cell Background":"\u062e\u0644\u0641\u064a\u0629 \u0627\u0644\u062e\u0644\u064a\u0629", "Cell Alignment":"\u0645\u062e\u0627\u0630\u0627\u0629 \u0627\u0644\u062e\u0644\u064a\u0629", "Align content to top":"\u0645\u062d\u0627\u0630\u0627\u0629 \u0627\u0644\u0645\u062d\u062a\u0648\u0649 \u0644\u0644\u0623\u0639\u0644\u0649", "Align content to center":"\u0645\u062d\u0627\u0630\u0627\u0629 \u0627\u0644\u0645\u062d\u062a\u0648\u0649 \u0644\u0644\u0648\u0633\u0637", "Align content to bottom":"\u0645\u062d\u0627\u0630\u0627\u0629 \u0627\u0644\u0645\u062d\u062a\u0648\u0649 \u0644\u0644\u0623\u0633\u0641\u0644", 
"Distribute Columns Evenly":"\u062a\u0648\u0632\u064a\u0639 \u0627\u0644\u0623\u0639\u0645\u062f\u0629 \u0628\u0627\u0644\u062a\u0633\u0627\u0648\u064a", "Match Note Width":"\u0645\u0637\u0627\u0628\u0642\u0629 \u0639\u0631\u0636 \u0627\u0644\u0645\u0644\u0627\u062d\u0638\u0629", "Delete Selected Column(s)":"\u062d\u0630\u0641 \u0627\u0644\u0623\u0639\u0645\u062f\u0629 \u0627\u0644\u0645\u062d\u062f\u062f\u0629", "Delete Selected Row(s)":"\u062d\u0630\u0641 \u0627\u0644\u0635\u0641\u0648\u0641 \u0627\u0644\u0645\u062d\u062f\u062f\u0629", 
"Delete Table":"\u062d\u0630\u0641 \u0627\u0644\u062c\u062f\u0648\u0644", "Merge Cells":"\u062f\u0645\u062c \u0627\u0644\u062e\u0644\u0627\u064a\u0627", "Unmerge Cells":"\u0625\u0644\u063a\u0627\u0621 \u062f\u0645\u062c \u0627\u0644\u062e\u0644\u0627\u064a\u0627", "Find text in note":"\u0627\u0644\u0628\u062d\u062b \u0639\u0644\u0649 \u0646\u0635 \u0641\u064a \u0627\u0644\u0645\u0644\u0627\u062d\u0638\u0629", "Next":"\u0627\u0644\u062a\u0627\u0644\u064a", "Previous":"\u0627\u0644\u0633\u0627\u0628\u0642", 
"Match case":"\u0645\u0637\u0627\u0628\u0642\u0629 \u0627\u0644\u062d\u0627\u0644\u0629", "Replace with":"\u0627\u0633\u062a\u0628\u062f\u0627\u0644 \u0628\u0640", "Replace":"\u0627\u0633\u062a\u0628\u062f\u0627\u0644", "Replace All":"\u0627\u0633\u062a\u0628\u062f\u0627\u0644 \u0627\u0644\u0643\u0644", "No matches found":"\u0644\u0627 \u062a\u0648\u062c\u062f \u0646\u062a\u0627\u0626\u062c \u0645\u0637\u0627\u0628\u0642\u0629", "Match":"\u0645\u0637\u0627\u0628\u0642\u0629", "of":"\u0645\u0646", 
"Edit & Annotate":"\u062a\u062d\u0631\u064a\u0631 \u0648\u0625\u0636\u0627\u0641\u0629 \u062a\u0639\u0644\u064a\u0642\u0627\u062a", "Full Screen Preview":"\u0645\u0639\u0627\u064a\u0646\u0629 \u0628\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629", "More Actions":"\u0645\u0632\u064a\u062f \u0645\u0646 \u0627\u0644\u0625\u062c\u0631\u0627\u0621\u0627\u062a", "Full Screen":"\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629", "Annotate":"\u0625\u0636\u0627\u0641\u0629 \u062a\u0639\u0644\u064a\u0642", 
"Reset Image Size":"\u0625\u0639\u0627\u062f\u0629 \u062a\u0639\u064a\u064a\u0646 \u062d\u062c\u0645 \u0627\u0644\u0635\u0648\u0631\u0629", "Edit":"\u062a\u062d\u0631\u064a\u0631", "Delete":"\u062d\u0630\u0641", "Cancel":"\u0625\u0644\u063a\u0627\u0621", "Save":"\u062d\u0641\u0638", "Undo":"\u062a\u0631\u0627\u062c\u0639", "Download failed":"\u0641\u0634\u0644\u062a \u0639\u0645\u0644\u064a\u0629 \u0627\u0644\u062a\u0646\u0632\u064a\u0644", "Tap to Download":"\u0627\u0636\u063a\u0637 \u0644\u0628\u062f\u0621 \u0627\u0644\u062a\u0646\u0632\u064a\u0644", 
"placeholder-copy":"\u0627\u0628\u062f\u0623 \u0627\u0644\u0643\u062a\u0627\u0628\u0629 \u0623\u0648 \u0627\u0633\u062d\u0628 \u0627\u0644\u0645\u0644\u0641\u0627\u062a \u0647\u0646\u0627", "placeholder-copy-templates":"\u0627\u0628\u062f\u0623 \u0627\u0644\u0643\u062a\u0627\u0628\u0629\u060c \u0648\u0627\u0633\u062d\u0628 \u0627\u0644\u0645\u0644\u0641\u0627\u062a\u060c \u0623\u0648 \u0627\u062e\u062a\u0631 <button>\u0642\u0627\u0644\u0628</button>", "placeholder-copy-mobile":"\u0627\u0628\u062f\u0623 \u0627\u0644\u0643\u062a\u0627\u0628\u0629", 
"placeholder-copy-mobile-templates":"\u0627\u0628\u062f\u0623 \u0627\u0644\u0643\u062a\u0627\u0628\u0629 \u0623\u0648 \u0627\u062e\u062a\u0631 <button>\u0642\u0627\u0644\u0628</button>", "Template":"\u0642\u0627\u0644\u0628", "New Template":"\u0642\u0627\u0644\u0628 \u062c\u062f\u064a\u062f", "Title":"\u0627\u0644\u0639\u0646\u0648\u0627\u0646", "Save as template":"\u062d\u0641\u0638 \u0643\u0642\u0627\u0644\u0628", "Save as Template":"\u062d\u0641\u0638 \u0643\u0642\u0627\u0644\u0628", "template-dialogs-create-warning":"\u0644\u0646 \u064a\u062a\u0645 \u062a\u0636\u0645\u064a\u0646 \u0627\u0644\u0645\u0631\u0641\u0642\u0627\u062a \u0648\u0627\u0644\u0635\u0648\u0631 \u0627\u0644\u0643\u0628\u064a\u0631\u0629 \u0641\u064a \u0627\u0644\u0642\u0627\u0644\u0628.", 
"Rename template":"\u062a\u063a\u064a\u064a\u0631 \u0627\u0633\u0645 \u0627\u0644\u0642\u0627\u0644\u0628", "Rename Template":"\u062a\u063a\u064a\u064a\u0631 \u0627\u0633\u0645 \u0627\u0644\u0642\u0627\u0644\u0628", "Delete template":"\u062d\u0630\u0641 \u0627\u0644\u0642\u0627\u0644\u0628", "Delete Template":"\u062d\u0630\u0641 \u0627\u0644\u0642\u0627\u0644\u0628", "template-dialogs-delete-info":"\u0647\u0644 \u062a\u0631\u064a\u062f \u0628\u0627\u0644\u062a\u0623\u0643\u064a\u062f \u062d\u0630\u0641 \u0627\u0644\u0642\u0627\u0644\u0628 \u201c{TITLE}\u201d?\n\n\u0644\u0646 \u062a\u062a\u0623\u062b\u0631 \u0627\u0644\u0645\u0644\u0627\u062d\u0638\u0629 \u0627\u0644\u0623\u0635\u0644\u064a\u0629 \u0623\u0648 \u0623\u064a \u0645\u0646 \u0627\u0644\u0645\u0644\u0627\u062d\u0638\u0627\u062a \u0627\u0644\u0623\u062e\u0631\u0649 \u0627\u0644\u062a\u064a \u062a\u0645 \u0625\u0646\u0634\u0627\u0624\u0647\u0627 \u0627\u0633\u062a\u0646\u0627\u062f\u064b\u0627 \u0625\u0644\u0649 \u0647\u0630\u0627 \u0627\u0644\u0642\u0627\u0644\u0628.", 
"Write task":"\u0627\u0643\u062a\u0628 \u0627\u0644\u0645\u0647\u0645\u0629", "Due Date":"\u062a\u0627\u0631\u064a\u062e \u0627\u0644\u0627\u0633\u062a\u062d\u0642\u0627\u0642", "Tomorrow":"\u063a\u062f\u064b\u0627", "Today":"\u0627\u0644\u064a\u0648\u0645", "Yesterday":"\u0627\u0644\u0623\u0645\u0633", "Retry":"\u0625\u0639\u0627\u062f\u0629 \u0627\u0644\u0645\u062d\u0627\u0648\u0644\u0629", "Unable to load task":"\u063a\u064a\u0631 \u0642\u0627\u062f\u0631 \u0639\u0644\u0649 \u062a\u062d\u0645\u064a\u0644 \u0627\u0644\u0645\u0647\u0645\u0629", 
"Change to task":"\u0627\u0644\u062a\u062d\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u0647\u0645\u0629"};
goog.provide("uno.i18n.cs");
uno.i18n.cs.textEntries = {"Not available offline":"Offline nen\u00ed dostupn\u00fd", "Not available":"Nen\u00ed k dispozici", "Tap to request access":"Klepnut\u00edm vy\u017e\u00e1dejte p\u0159\u00edstup", "Click to request access":"Kliknut\u00edm vy\u017e\u00e1dejte p\u0159\u00edstup", "Open":"Otev\u0159\u00edt", "Copy link":"Kop\u00edrovat odkaz", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Google Sheets", "Google Slides":"Google Slides", "PDF":"PDF", "Word Document":"Dokument aplikace Word", 
"Excel Spreadsheet":"Tabulka v aplikaci Excel", "Modified":"Zm\u011bn\u011bno", "Connect":"P\u0159ipojit", "Connect to see more":"Chcete-li zobrazit v\u00edce, p\u0159ipojte se", "Connect Google account":"P\u0159ipojit \u00fa\u010det Google", "Title not available":"N\u00e1zev nen\u00ed k dispozici", "Open containing folder":"Otev\u0159\u00edt slo\u017eku se soubory", "Cell Background":"Pozad\u00ed bu\u0148ky", "Cell Alignment":"Zarovn\u00e1n\u00ed bu\u0148ky", "Align content to top":"Zarovnat nahoru", 
"Align content to center":"Zarovnat na st\u0159ed", "Align content to bottom":"Zarovnat dol\u016f", "Distribute Columns Evenly":"Rozd\u011blit sloupce rovnom\u011brn\u011b", "Match Note Width":"P\u0159izp\u016fsobit \u0161\u00ed\u0159ku pozn\u00e1mky", "Delete Selected Column(s)":"Odstranit vybran\u00e9 sloupce", "Delete Selected Row(s)":"Odstranit vybran\u00e9 \u0159\u00e1dky", "Delete Table":"Odstranit tabulku", "Merge Cells":"Slou\u010dit bu\u0148ky", "Unmerge Cells":"Zru\u0161it slou\u010den\u00ed bun\u011bk", 
"Find text in note":"Naj\u00edt text v pozn\u00e1mce", "Next":"Dal\u0161\u00ed", "Previous":"P\u0159edchoz\u00ed", "Match case":"Rozli\u0161ovat mal\u00e1 a velk\u00e1 p\u00edsmena", "Replace with":"Nahradit za", "Replace":"Nahradit", "Replace All":"Nahradit v\u0161e", "No matches found":"Nebyly nalezeny \u017e\u00e1dn\u00e9 shody", "Match":"Dle", "of":"z", "Edit & Annotate":"Upravit a komentovat", "Full Screen Preview":"N\u00e1hled na celou obrazovku", "More Actions":"V\u00edce akc\u00ed", "Full Screen":"Cel\u00e1 obrazovka", 
"Annotate":"Komentovat", "Reset Image Size":"Resetovat velikost obr\u00e1zku", "Edit":"Upravit", "Delete":"Smazat", "Cancel":"Zru\u0161it", "Save":"Ulo\u017eit", "Undo":"Zp\u011bt", "Download failed":"Sta\u017een\u00ed se nezda\u0159ilo", "Tap to Download":"Klepnut\u00edm st\u00e1hn\u011bte", "placeholder-copy":"Za\u010dn\u011bte ps\u00e1t, nebo sem p\u0159et\u00e1hn\u011bte soubory", "placeholder-copy-templates":"Za\u010dn\u011bte ps\u00e1t, p\u0159etahovat soubory nebo si vyberte <button>\u0161ablonu</button>", 
"placeholder-copy-mobile":"Za\u010d\u00edt ps\u00e1t", "placeholder-copy-mobile-templates":"Za\u010dn\u011bte ps\u00e1t, nebo si vyberte <button>\u0161ablonu</button>", "Template":"\u0160ablona", "New Template":"Nov\u00e1 \u0161ablona", "Title":"N\u00e1zev", "Save as template":"Ulo\u017eit jako \u0161ablonu", "Save as Template":"Ulo\u017eit jako \u0161ablonu", "template-dialogs-create-warning":"P\u0159\u00edlohy a velk\u00e9 obr\u00e1zky do \u0161ablony nebudou zahrnuty.", "Rename template":"P\u0159ejmenovat \u0161ablonu", 
"Rename Template":"P\u0159ejmenovat \u0161ablonu", "Delete template":"Smazat \u0161ablonu", "Delete Template":"Smazat \u0161ablonu", "template-dialogs-delete-info":"Opravdu chcete smazat \u0161ablonu \u201e{TITLE}\u201c?\n\nNa p\u016fvodn\u00ed pozn\u00e1mku a pozn\u00e1mky vytvo\u0159en\u00e9 z t\u00e9to \u0161ablony to nebude m\u00edt vliv.", "Write task":"Napsat \u00fakol", "Due Date":"Term\u00edn", "Tomorrow":"Z\u00edtra", "Today":"Dnes", "Yesterday":"V\u010dera", "Retry":"Opakovat", "Unable to load task":"Tento \u00fakol nelze na\u010d\u00edst", 
"Change to task":"Zm\u011bnit na \u00fakol"};
goog.provide("uno.i18n.da");
uno.i18n.da.textEntries = {"Not available offline":"Ikke tilg\u00e6ngelig offline", "Not available":"Ikke tilg\u00e6ngelig", "Tap to request access":"Tryk for at anmode om adgang", "Click to request access":"Klik for at anmode om adgang", "Open":"\u00c5bn", "Copy link":"Kopi\u00e9r link", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Google Sheets", "Google Slides":"Google Slides", "PDF":"PDF", "Word Document":"Word-dokument", "Excel Spreadsheet":"Excel-regneark", "Modified":"\u00c6ndret", 
"Connect":"Opret forbindelse", "Connect to see more":"Opret forbindelse for at se mere", "Connect Google account":"Tilslut Google-konto", "Title not available":"Titel ikke tilg\u00e6ngelig", "Open containing folder":"\u00c5bn indeholdende mappe", "Cell Background":"Cellebaggrund", "Cell Alignment":"Cellejustering", "Align content to top":"Juster indhold til toppen", "Align content to center":"Juster indhold til midten", "Align content to bottom":"Juster indhold til bunden", "Distribute Columns Evenly":"Fordel kolonner j\u00e6vnt", 
"Match Note Width":"Match notebredde", "Delete Selected Column(s)":"Slet valgte kolonne(r)", "Delete Selected Row(s)":"Slet valgte r\u00e6kker(r)", "Delete Table":"Slet tabel", "Merge Cells":"Sammenflet celler", "Unmerge Cells":"Fortryd sammenfletning af celler", "Find text in note":"Find tekst i note", "Next":"N\u00e6ste", "Previous":"Forrige", "Match case":"Match store/sm\u00e5 bogstaver", "Replace with":"Erstat med", "Replace":"Erstat", "Replace All":"Erstat alle", "No matches found":"Ingen match fundet", 
"Match":"Match", "of":"af", "Edit & Annotate":"Rediger og annoter", "Full Screen Preview":"Forh\u00e5ndsvisning i fuld sk\u00e6rm", "More Actions":"Flere handlinger", "Full Screen":"Fuld sk\u00e6rm", "Annotate":"Annoter", "Reset Image Size":"Nulstil billedst\u00f8rrelse", "Edit":"Rediger", "Delete":"Slet", "Cancel":"Annuller", "Save":"Gem", "Undo":"Fortryd", "Download failed":"Download mislykkedes", "Tap to Download":"Tryk for at downloade", "placeholder-copy":"Start med at skrive eller tr\u00e6kke filer hertil", 
"placeholder-copy-templates":"Start med at skrive, tr\u00e6k filer eller v\u00e6lg en <button>skabelon</button>", "placeholder-copy-mobile":"Skriv nu", "placeholder-copy-mobile-templates":"Start med at skrive eller v\u00e6lg en <button>skabelon</button>", "Template":"Skabelon", "New Template":"Ny skabelon", "Title":"Titel", "Save as template":"Gem som skabelon", "Save as Template":"Gem som skabelon", "template-dialogs-create-warning":"Vedh\u00e6ftninger og store billeder vil ikke blive inkluderet i skabelonen.", 
"Rename template":"Omd\u00f8b skabelon", "Rename Template":"Omd\u00f8b skabelon", "Delete template":"Slet skabelon", "Delete Template":"Slet skabelon", "template-dialogs-delete-info":"Er du sikker p\u00e5, at du vil slette skabelonen \u201c{TITLE}\u201d?\n\nDen originale note og eventuelle noter, der er oprettet fra denne skabelon, vil ikke blive p\u00e5virket.", "Write task":"Skriv opgave", "Due Date":"Forfaldsdato:", "Tomorrow":"I morgen", "Today":"I dag", "Yesterday":"I g\u00e5r", "Retry":"Pr\u00f8v igen", 
"Unable to load task":"Kan ikke hente opgave", "Change to task":"Skift til opgave"};
goog.provide("uno.i18n.de");
uno.i18n.de.textEntries = {"Not available offline":"Nicht offline verf\u00fcgbar", "Not available":"Nicht verf\u00fcgbar", "Tap to request access":"Zum Anfordern des Zugriffs tippen", "Click to request access":"Zum Anfordern des Zugriffs klicken", "Open":"\u00d6ffnen", "Copy link":"Link kopieren", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Google Tabellen", "Google Slides":"Google Pr\u00e4sentationen", "PDF":"PDF", "Word Document":"Word-Dokument", "Excel Spreadsheet":"Excel-Tabelle", 
"Modified":"Ge\u00e4ndert", "Connect":"Verkn\u00fcpfen", "Connect to see more":"Verkn\u00fcpfen f\u00fcr erweiterte Ansicht", "Connect Google account":"Google-Konto verkn\u00fcpfen", "Title not available":"Titel nicht verf\u00fcgbar", "Open containing folder":"\u00dcbergeordneten Ordner \u00f6ffnen", "Cell Background":"Zellenhintergrund", "Cell Alignment":"Zellenausrichtung", "Align content to top":"Inhalt oben ausrichten", "Align content to center":"Inhalt zentriert ausrichten", "Align content to bottom":"Inhalt unten ausrichten", 
"Distribute Columns Evenly":"Spalten gleichm\u00e4\u00dfig verteilen", "Match Note Width":"An Notizbreite anpassen", "Delete Selected Column(s)":"Ausgew\u00e4hlte Spalte(n) l\u00f6schen", "Delete Selected Row(s)":"Ausgew\u00e4hlte Zeile(n) l\u00f6schen", "Delete Table":"Tabelle l\u00f6schen", "Merge Cells":"Zellen verbinden", "Unmerge Cells":"Zellverbund aufheben", "Find text in note":"Text in Notiz suchen", "Next":"Weiter", "Previous":"Zur\u00fcck", "Match case":"Gro\u00df-/Kleinschreibung beachten", 
"Replace with":"Ersetzen durch", "Replace":"Ersetzen", "Replace All":"Alle ersetzen", "No matches found":"Es wurden keine Treffer gefunden", "Match":"Treffer", "of":"von", "Edit & Annotate":"Bearbeiten/Kommentieren", "Full Screen Preview":"Vorschau im Vollbildmodus", "More Actions":"Weitere Aktionen", "Full Screen":"Vollbildmodus", "Annotate":"Kommentieren", "Reset Image Size":"Bildgr\u00f6\u00dfe zur\u00fccksetzen", "Edit":"Bearbeiten", "Delete":"L\u00f6schen", "Cancel":"Abbrechen", "Save":"Speichern", 
"Undo":"R\u00fcckg\u00e4ngig", "Download failed":"Download fehlgeschlagen", "Tap to Download":"Zum Herunterladen antippen", "placeholder-copy":"Schreibe hier oder ziehe Dateien hierher", "placeholder-copy-templates":"Schreibe hier, ziehe Dateien hierher oder w\u00e4hle eine <button>Vorlage</button> aus", "placeholder-copy-mobile":"Schreibe hier", "placeholder-copy-mobile-templates":"Schreibe hier oder w\u00e4hle eine <button>Vorlage</button> aus", "Template":"Vorlage", "New Template":"Neue Vorlage", 
"Title":"Titel", "Save as template":"Als Vorlage speichern", "Save as Template":"Als Vorlage speichern", "template-dialogs-create-warning":"Anh\u00e4nge und gro\u00dfe Bilder werden nicht mit in die Vorlage \u00fcbernommen.", "Rename template":"Vorlage umbenennen", "Rename Template":"Vorlage umbenennen", "Delete template":"Vorlage l\u00f6schen", "Delete Template":"Vorlage l\u00f6schen", "template-dialogs-delete-info":"M\u00f6chtest du die Vorlage \u201e{TITLE}\u201c wirklich l\u00f6schen?\n\nDie urspr\u00fcngliche Notiz und jegliche auf Basis dieser Vorlage erstellten Notizen bleiben davon unber\u00fchrt.", 
"Write task":"Aufgabe schreiben", "Due Date":"F\u00e4lligkeitsdatum", "Tomorrow":"Morgen", "Today":"Heute", "Yesterday":"Gestern", "Retry":"Wiederholen", "Unable to load task":"Aufgabe konnte nicht geladen werden", "Change to task":"Zu einer Aufgabe machen"};
goog.provide("uno.i18n.en");
uno.i18n.en.textEntries = {"Not available offline":"Not available offline", "Not available":"Not available", "Tap to request access":"Tap to request access", "Click to request access":"Click to request access", "Open":"Open", "Copy link":"Copy link", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Google Sheets", "Google Slides":"Google Slides", "PDF":"PDF", "Word Document":"Word Document", "Excel Spreadsheet":"Excel Spreadsheet", "Modified":"Modified", "Connect":"Connect", 
"Connect to see more":"Connect to see more", "Connect Google account":"Connect Google account", "Title not available":"Title not available", "Open containing folder":"Open containing folder", "Cell Background":"Cell Background", "Cell Alignment":"Cell Alignment", "Align content to top":"Align content to top", "Align content to center":"Align content to center", "Align content to bottom":"Align content to bottom", "Distribute Columns Evenly":"Distribute Columns Evenly", "Match Note Width":"Match Note Width", 
"Delete Selected Column(s)":"Delete Selected Column(s)", "Delete Selected Row(s)":"Delete Selected Row(s)", "Delete Table":"Delete Table", "Merge Cells":"Merge Cells", "Unmerge Cells":"Unmerge Cells", "Find text in note":"Find text in note", "Next":"Next", "Previous":"Previous", "Match case":"Match case", "Replace with":"Replace with", "Replace":"Replace", "Replace All":"Replace All", "No matches found":"No matches found", "Match":"Match", "of":"of", "Edit & Annotate":"Edit & Annotate", "Full Screen Preview":"Full Screen Preview", 
"More Actions":"More Actions", "Full Screen":"Full Screen", "Annotate":"Annotate", "Reset Image Size":"Reset Image Size", "Edit":"Edit", "Delete":"Delete", "Cancel":"Cancel", "Save":"Save", "Undo":"Undo", "Download failed":"Download failed", "Tap to Download":"Tap to Download", "placeholder-copy":"Start writing or drag files here", "placeholder-copy-templates":"Start writing, drag files, or choose a <button>Template</button>", "placeholder-copy-mobile":"Start writing", "placeholder-copy-mobile-templates":"Start writing or choose a <button>Template</button>", 
"Template":"Template", "New Template":"New Template", "Title":"Title", "Save as template":"Save as template", "Save as Template":"Save as Template", "template-dialogs-create-warning":"Attachments and large images will not be included in the template.", "Rename template":"Rename template", "Rename Template":"Rename Template", "Delete template":"Delete template", "Delete Template":"Delete Template", "template-dialogs-delete-info":"Are you sure you want to delete the template \u201c{TITLE}\u201d?\n\nThe original note and any notes created from this template will not be affected.", 
"Write task":"Write task", "Due Date":"Due Date", "Tomorrow":"Tomorrow", "Today":"Today", "Yesterday":"Yesterday", "Retry":"Retry", "Unable to load task":"Unable to load task", "Change to task":"Change to task"};
goog.provide("uno.i18n.es");
uno.i18n.es.textEntries = {"Not available offline":"No disponible sin conexi\u00f3n", "Not available":"No disponible", "Tap to request access":"Pulsa para solicitar acceso", "Click to request access":"Haz clic para solicitar acceso", "Open":"Abrir", "Copy link":"Copiar enlace", "Google Drive":"Google Drive", "Google Docs":"Documentos de Google", "Google Sheets":"Hojas de c\u00e1lculo de Google", "Google Slides":"Presentaciones de Google", "PDF":"PDF", "Word Document":"Documento Word", "Excel Spreadsheet":"Hoja de c\u00e1lculo Excel", 
"Modified":"Modificado", "Connect":"Conectar", "Connect to see more":"Con\u00e9ctate para ver m\u00e1s", "Connect Google account":"Conectar cuenta de Google", "Title not available":"T\u00edtulo no disponible", "Open containing folder":"Abrir carpeta archivadora de contenidos", "Cell Background":"Fondo de la celda", "Cell Alignment":"Alineaci\u00f3n de la celda", "Align content to top":"Alinear contenido a la parte superior", "Align content to center":"Alinear contenido al centro", "Align content to bottom":"Alinear contenido a la parte inferior", 
"Distribute Columns Evenly":"Distribuir columnas uniformemente", "Match Note Width":"Coincidir con el ancho de nota", "Delete Selected Column(s)":"Eliminar columna(s) seleccionada(s)", "Delete Selected Row(s)":"Eliminar fila(s) seleccionada(s)", "Delete Table":"Eliminar Tabla", "Merge Cells":"Combinar celdas", "Unmerge Cells":"Anular la combinaci\u00f3n de celdas", "Find text in note":"Encuentra texto en una nota", "Next":"Siguiente", "Previous":"Anterior", "Match case":"Coincidir may\u00fasculas y min\u00fasculas", 
"Replace with":"Reemplazar con", "Replace":"Reemplazar", "Replace All":"Reemplazar todo", "No matches found":"No se encontraron coincidencias", "Match":"Coincidencia", "of":"de", "Edit & Annotate":"Editar y anotar", "Full Screen Preview":"Vista previa en pantalla completa", "More Actions":"M\u00e1s acciones", "Full Screen":"Pantalla completa", "Annotate":"Anota", "Reset Image Size":"Restablecer tama\u00f1o de la imagen", "Edit":"Editar", "Delete":"Eliminar", "Cancel":"Cancelar", "Save":"Guardar", 
"Undo":"Deshacer", "Download failed":"Descarga fallida", "Tap to Download":"Toca para descargar", "placeholder-copy":"Empieza a escribir o arrastra archivos aqu\u00ed", "placeholder-copy-templates":"Empieza a escribir, arrastra archivos o elige una <button>Plantilla</button>", "placeholder-copy-mobile":"Empieza a escribir", "placeholder-copy-mobile-templates":"Empieza a escribir o elige una <button>Plantilla</button>", "Template":"Plantilla", "New Template":"Plantilla nueva", "Title":"T\u00edtulo", 
"Save as template":"Guardar como plantilla", "Save as Template":"Guardar como plantilla", "template-dialogs-create-warning":"Los archivos adjuntos y las im\u00e1genes grandes no se incluir\u00e1n en la plantilla.", "Rename template":"Cambiar el nombre de la plantilla", "Rename Template":"Cambiar el nombre de la plantilla", "Delete template":"Eliminar plantilla", "Delete Template":"Eliminar plantilla", "template-dialogs-delete-info":"\u00bfEst\u00e1s seguro de que quieres eliminar la plantilla \u201c{TITLE}\u201d?\n\nLa nota original y las notas creadas a partir de esta plantilla no se ver\u00e1n afectadas.", 
"Write task":"Escribir tarea", "Due Date":"Fecha de vencimiento", "Tomorrow":"Ma\u00f1ana", "Today":"Hoy", "Yesterday":"Ayer", "Retry":"Reintentar", "Unable to load task":"No ha sido posible cargar la tarea", "Change to task":"Convertir a tarea"};
goog.provide("uno.i18n.fi");
uno.i18n.fi.textEntries = {"Not available offline":"Ei k\u00e4ytett\u00e4viss\u00e4 offline", "Not available":"Ei k\u00e4ytett\u00e4viss\u00e4", "Tap to request access":"Pyyd\u00e4 k\u00e4ytt\u00f6oikeus napauttamalla", "Click to request access":"Napsauta pyyt\u00e4\u00e4ksesi k\u00e4ytt\u00f6oikeuksia", "Open":"Avaa", "Copy link":"Kopioi linkki", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Google Sheets", "Google Slides":"Google Slides", "PDF":"PDF", "Word Document":"Word-asiakirja", 
"Excel Spreadsheet":"Excel-laskentataulukko", "Modified":"Muokattu", "Connect":"Yhdist\u00e4", "Connect to see more":"Yhdist\u00e4 n\u00e4hd\u00e4ksesi enemm\u00e4n", "Connect Google account":"Yhdist\u00e4 Google-tili", "Title not available":"Otsikko ei saatavilla", "Open containing folder":"Avaa tallennuskansio", "Cell Background":"Solun tausta", "Cell Alignment":"Solun tasaus", "Align content to top":"Tasaa sis\u00e4lt\u00f6 yl\u00e4osaan", "Align content to center":"Tasaa sis\u00e4lt\u00f6 keskelle", 
"Align content to bottom":"Tasaa sis\u00e4lt\u00f6 alaosaan", "Distribute Columns Evenly":"Muuta sarakkeet tasalevyisiksi", "Match Note Width":"T\u00e4sm\u00e4\u00e4 muistiinpanon leveys", "Delete Selected Column(s)":"Poista valitut sarakkeet", "Delete Selected Row(s)":"Poista valitut rivit", "Delete Table":"Poista taulukko", "Merge Cells":"Yhdist\u00e4 solut", "Unmerge Cells":"Pura solujen yhdist\u00e4minen", "Find text in note":"Etsi teksti\u00e4 muistiinpanosta", "Next":"Seuraava", "Previous":"Edellinen", 
"Match case":"Sama kirjainkoko", "Replace with":"Korvaa kohteella", "Replace":"Korvaa", "Replace All":"Korvaa kaikki", "No matches found":"Osumia ei l\u00f6ytynyt", "Match":"Osuma", "of":"/", "Edit & Annotate":"Muokkaa ja merkitse", "Full Screen Preview":"Koko n\u00e4yt\u00f6n esikatselu", "More Actions":"Lis\u00e4\u00e4 toimintoja", "Full Screen":"Kokoruututila", "Annotate":"Merkitse", "Reset Image Size":"Nollaa kuvan koko", "Edit":"Muokkaa", "Delete":"Poista", "Cancel":"Peruuta", "Save":"Tallenna", 
"Undo":"Kumoa", "Download failed":"Lataus ep\u00e4onnistui", "Tap to Download":"Lataa napauttamalla", "placeholder-copy":"Aloita kirjoittaminen tai ved\u00e4 tiedostoja t\u00e4nne", "placeholder-copy-templates":"Aloita kirjoittaminen, ved\u00e4 tiedostoja tai valitse <button>malli</button>", "placeholder-copy-mobile":"Aloita kirjoittaminen", "placeholder-copy-mobile-templates":"Aloita kirjoittaminen tai valitse <button>malli</button>", "Template":"Malli", "New Template":"Uusi malli", "Title":"Otsikko", 
"Save as template":"Tallenna mallina", "Save as Template":"Tallenna mallina", "template-dialogs-create-warning":"Liitteit\u00e4 ja suuria kuvia ei sis\u00e4llytet\u00e4 malliin.", "Rename template":"Nime\u00e4 malli uudelleen", "Rename Template":"Nime\u00e4 malli uudelleen", "Delete template":"Poista malli", "Delete Template":"Poista malli", "template-dialogs-delete-info":"Haluatko varmasti poistaa mallin \u201c{TITLE}\u201d?\n\nT\u00e4m\u00e4 ei vaikuta alkuper\u00e4iseen muistiinpanoon tai mihink\u00e4\u00e4n t\u00e4st\u00e4 mallista luotuun muistiinpanoon.", 
"Write task":"Kirjoita teht\u00e4v\u00e4", "Due Date":"M\u00e4\u00e4r\u00e4p\u00e4iv\u00e4", "Tomorrow":"Huomenna", "Today":"T\u00e4n\u00e4\u00e4n", "Yesterday":"Eilen", "Retry":"Yrit\u00e4 uudelleen", "Unable to load task":"Teht\u00e4v\u00e4\u00e4 ei voi ladata", "Change to task":"Vaihda teht\u00e4v\u00e4\u00e4n"};
goog.provide("uno.i18n.fr");
uno.i18n.fr.textEntries = {"Not available offline":"Non disponible hors-ligne", "Not available":"Indisponible", "Tap to request access":"Appuyez pour demander l'acc\u00e8s", "Click to request access":"Cliquez pour demander l'acc\u00e8s", "Open":"Ouvrir", "Copy link":"Copier le lien", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Google Sheets", "Google Slides":"Google Slides", "PDF":"PDF", "Word Document":"Document Word", "Excel Spreadsheet":"Feuille de calcul Excel", 
"Modified":"Modifi\u00e9", "Connect":"Connecter", "Connect to see more":"Connectez-vous pour en voir davantage", "Connect Google account":"Connecter un compte Google", "Title not available":"Titre non disponible", "Open containing folder":"Ouvrir le dossier conteneur", "Cell Background":"Arri\u00e8re-plan de cellule", "Cell Alignment":"Alignement de cellule", "Align content to top":"Aligner le contenu en haut", "Align content to center":"Aligner le contenu au centre", "Align content to bottom":"Aligner le contenu en bas", 
"Distribute Columns Evenly":"Uniformiser la largeur des colonnes", "Match Note Width":"Respecter la largeur de la note", "Delete Selected Column(s)":"Supprimer la ou les colonne(s) s\u00e9lectionn\u00e9e(s)", "Delete Selected Row(s)":"Supprimer la ou les ligne(s) s\u00e9lectionn\u00e9e(s)", "Delete Table":"Supprimer le tableau", "Merge Cells":"Fusionner les cellules", "Unmerge Cells":"Annuler Fusionner les cellules", "Find text in note":"Trouver du texte dans la note", "Next":"Suivant", "Previous":"Pr\u00e9c\u00e9dent", 
"Match case":"Respecter la casse", "Replace with":"Remplacer par", "Replace":"Remplacer", "Replace All":"Tout remplacer", "No matches found":"Aucune correspondance trouv\u00e9e", "Match":"Correspondance", "of":"de", "Edit & Annotate":"Modifier et annoter", "Full Screen Preview":"Aper\u00e7u en plein \u00e9cran", "More Actions":"Plus d'actions", "Full Screen":"Plein \u00e9cran", "Annotate":"Annoter", "Reset Image Size":"R\u00e9tablir la taille de l'image", "Edit":"Modifier", "Delete":"Supprimer", 
"Cancel":"Annuler", "Save":"Enregistrer", "Undo":"Annuler", "Download failed":"\u00c9chec du t\u00e9l\u00e9chargement", "Tap to Download":"Appuyez sur le bouton pour t\u00e9l\u00e9charger", "placeholder-copy":"Commencez \u00e0 \u00e9crire ou faites glisser des fichiers ici", "placeholder-copy-templates":"Commencez \u00e0 \u00e9crire, faites glisser des fichiers ou choisissez un <button>mod\u00e8le</button>", "placeholder-copy-mobile":"Commencer \u00e0 \u00e9crire", "placeholder-copy-mobile-templates":"Commencez \u00e0 \u00e9crire ou choisissez un <button>mod\u00e8le</button>", 
"Template":"Mod\u00e8le", "New Template":"Nouveau mod\u00e8le", "Title":"Titre", "Save as template":"Enregistrer en tant que mod\u00e8le", "Save as Template":"Enregistrer en tant que mod\u00e8le", "template-dialogs-create-warning":"Les pi\u00e8ces jointes et les images volumineuses ne seront pas incluses dans le mod\u00e8le.", "Rename template":"Renommer le mod\u00e8le", "Rename Template":"Renommer le mod\u00e8le", "Delete template":"Supprimer le mod\u00e8le", "Delete Template":"Supprimer le mod\u00e8le", 
"template-dialogs-delete-info":"Voulez-vous vraiment supprimer le mod\u00e8le \u00ab {TITLE} \u00bb ?\n\nLa note originale et les notes cr\u00e9\u00e9es \u00e0 partir de ce mod\u00e8le ne seront pas affect\u00e9es.", "Write task":"Noter une t\u00e2che", "Due Date":"Date d'\u00e9ch\u00e9ance", "Tomorrow":"Demain", "Today":"Aujourd'hui", "Yesterday":"Hier", "Retry":"R\u00e9essayer", "Unable to load task":"Impossible de charger la t\u00e2che", "Change to task":"Transformer en t\u00e2che"};
goog.provide("uno.i18n.id");
uno.i18n.id.textEntries = {"Not available offline":"Tidak tersedia offline", "Not available":"Tidak tersedia", "Tap to request access":"Tekan untuk meminta akses", "Click to request access":"Klik untuk meminta akses", "Open":"Buka", "Copy link":"Salin tautan", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Google Sheets", "Google Slides":"Google Slides", "PDF":"PDF", "Word Document":"Dokumen Word", "Excel Spreadsheet":"Lembar Lajur Excel", "Modified":"Diubah", "Connect":"Sambungkan", 
"Connect to see more":"Sambungkan untuk melihat lebih banyak", "Connect Google account":"Sambungkan akun Google", "Title not available":"Judul tidak tersedia", "Open containing folder":"Buka map yang menampung", "Cell Background":"Latar Belakang Sel", "Cell Alignment":"Perataan Sel", "Align content to top":"Ratakan konten ke atas", "Align content to center":"Ratakan konten ke tengah", "Align content to bottom":"Ratakan konten ke bawah", "Distribute Columns Evenly":"Distribusikan Kolom Merata", "Match Note Width":"Sesuaikan Lebar Catatan", 
"Delete Selected Column(s)":"Hapus Kolom yang Dipilih", "Delete Selected Row(s)":"Hapus Baris yang Dipilih", "Delete Table":"Hapus Tabel", "Merge Cells":"Gabungkan Sel", "Unmerge Cells":"Batalkan Penggabungan Sel", "Find text in note":"Temukan teks dalam catatan", "Next":"Berikutnya", "Previous":"Sebelumnya", "Match case":"Sama persis", "Replace with":"Gantikan dengan", "Replace":"Ganti", "Replace All":"Ganti Semua", "No matches found":"Tidak ditemukan yang cocok", "Match":"Cocokkan", "of":"dari", 
"Edit & Annotate":"Edit & Anotasikan", "Full Screen Preview":"Pratinjau Layar Penuh", "More Actions":"Lebih Banyak Tindakan", "Full Screen":"Layar Penuh", "Annotate":"Buat anotasi", "Reset Image Size":"Reset Ukuran Gambar", "Edit":"Edit", "Delete":"Hapus", "Cancel":"Batal", "Save":"Simpan", "Undo":"Undo", "Download failed":"Unduhan gagal", "Tap to Download":"Tap untuk Mengunduh", "placeholder-copy":"Mulai tulis atau seret berkas ke sini", "placeholder-copy-templates":"Mulai menulis, menyeret berkas, atau memilih <button>Kerangka</button>", 
"placeholder-copy-mobile":"Mulailah menulis", "placeholder-copy-mobile-templates":"Mulai tulis atau pilih <button>Kerangka</button>", "Template":"Kerangka", "New Template":"Kerangka Baru", "Title":"Judul", "Save as template":"Simpan sebagai kerangka", "Save as Template":"Simpan sebagai Kerangka", "template-dialogs-create-warning":"Lampiran dan gambar besar tidak akan dimasukkan dalam kerangka.", "Rename template":"Ubah nama kerangka", "Rename Template":"Ubah Nama Kerangka", "Delete template":"Hapus kerangka", 
"Delete Template":"Hapus Kerangka", "template-dialogs-delete-info":'Anda yakin ingin menghapus kerangka "{TITLE}"?\n\nCatatan asli dan catatan apa pun yang dibuat dari kerangka ini tidak akan terpengaruh.', "Write task":"Menulis tugas", "Due Date":"Batas tanggal terakhir", "Tomorrow":"Besok", "Today":"Hari ini", "Yesterday":"Kemarin", "Retry":"Coba lagi", "Unable to load task":"Tidak dapat memuat tugas", "Change to task":"Ubah ke tugas"};
goog.provide("uno.i18n.it");
uno.i18n.it.textEntries = {"Not available offline":"Non disponibile offline", "Not available":"Non disponibile", "Tap to request access":"Tocca per richiedere accesso", "Click to request access":"Fai clic per richiedere accesso", "Open":"Apri", "Copy link":"Copia link", "Google Drive":"Google Drive", "Google Docs":"Documenti Google", "Google Sheets":"Fogli Google", "Google Slides":"Presentazioni Google", "PDF":"PDF", "Word Document":"Documento di Word", "Excel Spreadsheet":"Foglio di lavoro di Excel", 
"Modified":"Modificato", "Connect":"Connettiti", "Connect to see more":"Connettitti per vedere di pi\u00f9", "Connect Google account":"Collega account Google", "Title not available":"Titolo non disponibile", "Open containing folder":"Apri cartella contenente", "Cell Background":"Sfondo cella", "Cell Alignment":"Allineamento cella", "Align content to top":"Allineare il contenuto in alto", "Align content to center":"Allineare contenuto al centro", "Align content to bottom":"Allineare il contenuto in basso", 
"Distribute Columns Evenly":"Distribuire colonne uniformemente", "Match Note Width":"Adegua alla larghezza della nota", "Delete Selected Column(s)":"Eliminare colonne selezionate", "Delete Selected Row(s)":"Eliminare righe selezionate", "Delete Table":"Eliminare Tabella", "Merge Cells":"Unire celle", "Unmerge Cells":"Annulla unione celle", "Find text in note":"Trova testo nella nota", "Next":"Successivo", "Previous":"Precedente", "Match case":"Maiuscola/minuscola corrispondente", "Replace with":"Sostituisci con", 
"Replace":"Sostituisci", "Replace All":"Sostituisci tutto", "No matches found":"Nessuna corrispondenza trovata", "Match":"Confronta", "of":"di", "Edit & Annotate":"Modifica e annota", "Full Screen Preview":"Anteprima a schermo intero", "More Actions":"Altre azioni", "Full Screen":"Schermo intero", "Annotate":"Annota", "Reset Image Size":"Reimposta dimensioni immagine", "Edit":"Modifica", "Delete":"Elimina", "Cancel":"Annulla", "Save":"Salva", "Undo":"Annulla", "Download failed":"Download non riuscito", 
"Tap to Download":"Tocca per scaricare", "placeholder-copy":"Inizia a scrivere o trascina file qui", "placeholder-copy-templates":"Inizia a scrivere, trascina file o scegli un <button>Modello</button>", "placeholder-copy-mobile":"Iniziare a scrivere", "placeholder-copy-mobile-templates":"Inizia a scrivere o scegli un <button>modello</button>", "Template":"Modello", "New Template":"Nuovo modello", "Title":"Titolo", "Save as template":"Salva come modello", "Save as Template":"Salva come modello", "template-dialogs-create-warning":"Allegati e immagini di grandi dimensioni non verranno inclusi nel modello.", 
"Rename template":"Rinomina modello", "Rename Template":"Rinomina modello", "Delete template":"Elimina modello", "Delete Template":"Elimina modello", "template-dialogs-delete-info":'Eliminare il modello "{TITLE}"?\n\nLa nota originale e tutte le note create da questo modello resteranno inalterate.', "Write task":"Scrivi attivit\u00e0", "Due Date":"Data di scadenza", "Tomorrow":"Domani", "Today":"Oggi", "Yesterday":"Ieri", "Retry":"Riprova", "Unable to load task":"Unable to load task", "Change to task":"Change to task"};
goog.provide("uno.i18n.ja");
uno.i18n.ja.textEntries = {"Not available offline":"\u30aa\u30d5\u30e9\u30a4\u30f3\u3067\u306f\u5229\u7528\u3067\u304d\u307e\u305b\u3093", "Not available":"\u5229\u7528\u3067\u304d\u307e\u305b\u3093", "Tap to request access":"\u30bf\u30c3\u30d7\u3067\u30a2\u30af\u30bb\u30b9\u6a29\u3092\u30ea\u30af\u30a8\u30b9\u30c8", "Click to request access":"\u30af\u30ea\u30c3\u30af\u3067\u30a2\u30af\u30bb\u30b9\u6a29\u3092\u30ea\u30af\u30a8\u30b9\u30c8", "Open":"\u958b\u304f", "Copy link":"\u30ea\u30f3\u30af\u3092\u30b3\u30d4\u30fc", 
"Google Drive":"Google \u30c9\u30e9\u30a4\u30d6", "Google Docs":"Google \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8", "Google Sheets":"Google \u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8", "Google Slides":"Google \u30b9\u30e9\u30a4\u30c9", "PDF":"PDF", "Word Document":"Word \u6587\u66f8", "Excel Spreadsheet":"Excel \u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8", "Modified":"\u5909\u66f4", "Connect":"\u63a5\u7d9a", "Connect to see more":"\u63a5\u7d9a\u3057\u3066\u8a73\u7d30\u3092\u898b\u308b", "Connect Google account":"Google \u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u63a5\u7d9a", 
"Title not available":"\u30bf\u30a4\u30c8\u30eb\u3092\u8868\u793a\u3067\u304d\u307e\u305b\u3093", "Open containing folder":"\u30d5\u30a9\u30eb\u30c0\u3092\u958b\u304f", "Cell Background":"\u30bb\u30eb\u306e\u80cc\u666f", "Cell Alignment":"\u30bb\u30eb\u306e\u914d\u7f6e", "Align content to top":"\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u4e0a\u5074\u306b\u914d\u7f6e", "Align content to center":"\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u4e2d\u592e\u306b\u914d\u7f6e", "Align content to bottom":"\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u4e0b\u5074\u306b\u914d\u7f6e", 
"Distribute Columns Evenly":"\u5217\u306e\u5e45\u3092\u5747\u7b49\u5316", "Match Note Width":"\u30ce\u30fc\u30c8\u306e\u5e45\u306b\u5408\u308f\u305b\u308b", "Delete Selected Column(s)":"\u9078\u629e\u3057\u305f\u5217\u3092\u524a\u9664", "Delete Selected Row(s)":"\u9078\u629e\u3057\u305f\u884c\u3092\u524a\u9664", "Delete Table":"\u8868\u3092\u524a\u9664", "Merge Cells":"\u30bb\u30eb\u3092\u7d50\u5408", "Unmerge Cells":"\u30bb\u30eb\u306e\u7d50\u5408\u3092\u89e3\u9664", "Find text in note":"\u30ce\u30fc\u30c8\u5185\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u691c\u7d22", 
"Next":"\u6b21", "Previous":"\u524d", "Match case":"\u5927\u6587\u5b57\u3068\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3059\u308b", "Replace with":"\u6b21\u3068\u7f6e\u63db:", "Replace":"\u7f6e\u63db", "Replace All":"\u3059\u3079\u3066\u7f6e\u63db", "No matches found":"\u8a72\u5f53\u306a\u3057", "Match":"\u4e00\u81f4", "of":"/", "Edit & Annotate":"\u7de8\u96c6\uff06\u6ce8\u91c8", "Full Screen Preview":"\u5168\u753b\u9762\u30d7\u30ec\u30d3\u30e5\u30fc", "More Actions":"\u305d\u306e\u4ed6\u306e\u64cd\u4f5c", 
"Full Screen":"\u5168\u753b\u9762", "Annotate":"\u6ce8\u91c8", "Reset Image Size":"\u753b\u50cf\u30b5\u30a4\u30ba\u3092\u30ea\u30bb\u30c3\u30c8", "Edit":"\u7de8\u96c6", "Delete":"\u524a\u9664", "Cancel":"\u30ad\u30e3\u30f3\u30bb\u30eb", "Save":"\u4fdd\u5b58", "Undo":"\u53d6\u308a\u6d88\u3059", "Download failed":"\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306b\u5931\u6557\u3057\u307e\u3057\u305f", "Tap to Download":"\u30bf\u30c3\u30d7\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9", "placeholder-copy":"\u5165\u529b\u3092\u958b\u59cb\u3059\u308b\u304b\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u3053\u3053\u306b\u30c9\u30e9\u30c3\u30b0\u3057\u307e\u3059", 
"placeholder-copy-templates":"\u5165\u529b\u3092\u958b\u59cb\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u30c9\u30e9\u30c3\u30b0\u3001\u307e\u305f\u306f<button>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8</button>\u3092\u9078\u629e\u3057\u307e\u3059", "placeholder-copy-mobile":"\u5165\u529b\u3092\u958b\u59cb\u3059\u308b", "placeholder-copy-mobile-templates":"\u5165\u529b\u3092\u958b\u59cb\u3059\u308b\u304b\u3001<button>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8</button>\u3092\u9078\u629e\u3057\u307e\u3059", "Template":"\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8", 
"New Template":"\u65b0\u898f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8", "Title":"\u30bf\u30a4\u30c8\u30eb", "Save as template":"\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3068\u3057\u3066\u4fdd\u5b58", "Save as Template":"\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3068\u3057\u3066\u4fdd\u5b58", "template-dialogs-create-warning":"\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u5927\u304d\u306a\u753b\u50cf\u306f\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u542b\u307e\u308c\u307e\u305b\u3093\u3002", "Rename template":"\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u540d\u524d\u3092\u5909\u66f4", 
"Rename Template":"\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u540d\u524d\u3092\u5909\u66f4\u3059\u308b", "Delete template":"\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u524a\u9664", "Delete Template":"\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u524a\u9664\u3059\u308b", "template-dialogs-delete-info":"\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u300c{TITLE}\u300d\u3092\u672c\u5f53\u306b\u524a\u9664\u3057\u307e\u3059\u304b\uff1f\n\n\u5143\u306e\u30ce\u30fc\u30c8\u3001\u304a\u3088\u3073\u3053\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304b\u3089\u4f5c\u6210\u3055\u308c\u305f\u30ce\u30fc\u30c8\u306b\u306f\u5f71\u97ff\u3042\u308a\u307e\u305b\u3093\u3002", 
"Write task":"\u30bf\u30b9\u30af\u3092\u66f8\u304f", "Due Date":"\u671f\u65e5", "Tomorrow":"\u660e\u65e5", "Today":"\u4eca\u65e5", "Yesterday":"\u6628\u65e5", "Retry":"\u518d\u8a66\u884c", "Unable to load task":"\u30bf\u30b9\u30af\u3092\u8aad\u307f\u8fbc\u3081\u307e\u305b\u3093", "Change to task":"\u30bf\u30b9\u30af\u306b\u5909\u66f4"};
goog.provide("uno.i18n.ko");
uno.i18n.ko.textEntries = {"Not available offline":"\uc624\ud504\ub77c\uc778\uc5d0\uc11c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc74c", "Not available":"\uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4", "Tap to request access":"\ub20c\ub7ec\uc11c \uc561\uc138\uc2a4 \uc694\uccad", "Click to request access":"\ud074\ub9ad\ud558\uc5ec \uc561\uc138\uc2a4 \uc694\uccad", "Open":"\uc5f4\uae30", "Copy link":"\ub9c1\ud06c \ubcf5\uc0ac", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Google Sheets", 
"Google Slides":"Google \ud504\ub808\uc820\ud14c\uc774\uc158", "PDF":"PDF", "Word Document":"Word \ubb38\uc11c", "Excel Spreadsheet":"Excel \uc2a4\ud504\ub808\ub4dc\uc2dc\ud2b8", "Modified":"\uc218\uc815", "Connect":"\uc5f0\uacb0", "Connect to see more":"\ub354 \ubcf4\ub824\uba74 \uc5f0\uacb0\ud558\uc138\uc694", "Connect Google account":"Google \uacc4\uc815 \uc5f0\uacb0", "Title not available":"\uc81c\ubaa9 \uc54c \uc218 \uc5c6\uc74c", "Open containing folder":"\ud3ec\ud568 \ud3f4\ub354 \uc5f4\uae30", 
"Cell Background":"\uc140 \ubc30\uacbd", "Cell Alignment":"\uc140 \uc815\ub82c", "Align content to top":"\uc704\ucabd \ub9de\ucda4", "Align content to center":"\uac00\uc6b4\ub370 \ub9de\ucda4", "Align content to bottom":"\uc544\ub798\ucabd \ub9de\ucda4", "Distribute Columns Evenly":"\uc5f4 \ub108\ube44\ub97c \uac19\uac8c", "Match Note Width":"\ub178\ud2b8 \ud3ed\uc5d0 \ub9de\ucda4", "Delete Selected Column(s)":"\uc120\ud0dd\ud55c \uc5f4 \uc0ad\uc81c", "Delete Selected Row(s)":"\uc120\ud0dd\ud55c \ud589 \uc0ad\uc81c", 
"Delete Table":"\ud45c \uc0ad\uc81c", "Merge Cells":"\uc140 \ud569\uce58\uae30", "Unmerge Cells":"\uc140 \ud569\uce58\uae30 \ucde8\uc18c", "Find text in note":"\ub178\ud2b8\uc5d0\uc11c \ud14d\uc2a4\ud2b8 \ucc3e\uae30", "Next":"\ub2e4\uc74c", "Previous":"\uc774\uc804", "Match case":"\ub300\uc18c\ubb38\uc790 \uc77c\uce58", "Replace with":"\ubc14\uafb8\uae30", "Replace":"\ubc14\uafb8\uae30", "Replace All":"\ubaa8\ub450 \ubc14\uafb8\uae30", "No matches found":"\uc77c\uce58 \ud56d\ubaa9\uc774 \uc5c6\uc2b5\ub2c8\ub2e4", 
"Match":"\uc77c\uce58", "of":"\uc758", "Edit & Annotate":"\ud3b8\uc9d1 & \uc8fc\uc11d \ub2ec\uae30", "Full Screen Preview":"\uc804\uccb4 \ud654\uba74 \ubbf8\ub9ac\ubcf4\uae30", "More Actions":"\ub2e4\ub978 \uc791\uc5c5", "Full Screen":"\uc804\uccb4 \ud654\uba74", "Annotate":"\uc8fc\uc11d \ub2ec\uae30", "Reset Image Size":"\uc774\ubbf8\uc9c0 \ud06c\uae30 \uc7ac\uc124\uc815", "Edit":"\ud3b8\uc9d1", "Delete":"\uc0ad\uc81c", "Cancel":"\ucde8\uc18c", "Save":"\uc800\uc7a5", "Undo":"\uc2e4\ud589 \ucde8\uc18c", 
"Download failed":"\ub2e4\uc6b4\ub85c\ub4dc \uc2e4\ud328", "Tap to Download":"\ub20c\ub7ec\uc11c \ub2e4\uc6b4\ub85c\ub4dc", "placeholder-copy":"\uc791\uc131\uc744 \uc2dc\uc791\ud558\uac70\ub098 \uc5ec\uae30\ub85c \ud30c\uc77c\uc744 \ub04c\uc5b4\uc624\uc138\uc694", "placeholder-copy-templates":"\uc791\uc131\uc744 \uc2dc\uc791\ud558\uac70\ub098 \ud30c\uc77c\uc744 \ub04c\uc5b4\uc624\uac70\ub098 <button>\ud15c\ud50c\ub9bf</button>\uc744 \uace0\ub974\uc138\uc694", "placeholder-copy-mobile":"\ud544\uae30 \uc2dc\uc791", 
"placeholder-copy-mobile-templates":"\uc791\uc131\uc744 \uc2dc\uc791\ud558\uac70\ub098 <button>\ud15c\ud50c\ub9bf</button>\uc744 \uace0\ub974\uc138\uc694", "Template":"\ud15c\ud50c\ub9bf", "New Template":"\uc0c8 \ud15c\ud50c\ub9bf", "Title":"\uc81c\ubaa9", "Save as template":"\ud15c\ud50c\ub9bf\uc73c\ub85c \uc800\uc7a5", "Save as Template":"\ud15c\ud50c\ub9bf\uc73c\ub85c \uc800\uc7a5", "template-dialogs-create-warning":"\ucca8\ubd80\ud30c\uc77c\uacfc \ub300\uc6a9\ub7c9 \uc774\ubbf8\uc9c0\ub294 \ud15c\ud50c\ub9bf\uc5d0 \ud3ec\ud568\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", 
"Rename template":"\ud15c\ud50c\ub9bf \uc774\ub984 \ubc14\uafb8\uae30", "Rename Template":"\ud15c\ud50c\ub9bf \uc774\ub984 \ubc14\uafb8\uae30", "Delete template":"\ud15c\ud50c\ub9bf \uc0ad\uc81c", "Delete Template":"\ud15c\ud50c\ub9bf \uc0ad\uc81c", "template-dialogs-delete-info":"\ud15c\ud50c\ub9bf \u201c{TITLE}\u201d\uc744 \uc815\ub9d0 \uc0ad\uc81c\ud560\uae4c\uc694?\n\n\uc6d0\ubcf8 \ub178\ud2b8\uc640 \uc774 \ud15c\ud50c\ub9bf\uc73c\ub85c \ub9cc\ub4e0 \ub178\ud2b8\ub294 \uc601\ud5a5\uc744 \ubc1b\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.", 
"Write task":"\uc791\uc5c5 \uc4f0\uae30", "Due Date":"\uae30\ud55c", "Tomorrow":"\ub0b4\uc77c", "Today":"\uc624\ub298", "Yesterday":"\uc5b4\uc81c", "Retry":"\uc7ac\uc2dc\ub3c4", "Unable to load task":"\uc791\uc5c5\uc744 \ubd88\ub7ec\uc62c \uc218 \uc5c6\uc2b5\ub2c8\ub2e4", "Change to task":"\uc791\uc5c5\uc73c\ub85c \uc804\ud658"};
goog.provide("uno.i18n.ms");
uno.i18n.ms.textEntries = {"Not available offline":"Tidak tersedia di luar talian", "Not available":"Tidak tersedia", "Tap to request access":"Ketik untuk meminta akses", "Click to request access":"Klik untuk meminta akses", "Open":"Buka", "Copy link":"Salin pautan", "Google Drive":"Google Drive", "Google Docs":"Dokumen Google", "Google Sheets":"Helaian Google", "Google Slides":"Slaid Google", "PDF":"PDF", "Word Document":"Dokumen Word", "Excel Spreadsheet":"Hamparan Excel", "Modified":"Diubah suai", 
"Connect":"Sambung", "Connect to see more":"Sambung untuk melihat lebih banyak", "Connect Google account":"Sambung ke akaun Google", "Title not available":"Tajuk tidak tersedia", "Open containing folder":"Buka folder yang mengandungi", "Cell Background":"Latar Belakang Sel", "Cell Alignment":"Penjajaran Sel", "Align content to top":"Jajarkan kandungan ke atas", "Align content to center":"Jajarkan kandungan ke tengah", "Align content to bottom":"Jajarkan kandungan ke bawah", "Distribute Columns Evenly":"Jajarkan Lajur Secara Sama Rata", 
"Match Note Width":"Padankan Lebar Nota", "Delete Selected Column(s)":"Padamkan Lajur Dipilih", "Delete Selected Row(s)":"Padamkan Baris Dipilih", "Delete Table":"Padam Jadual", "Merge Cells":"Gabung Sel", "Unmerge Cells":"Leraikan Sel", "Find text in note":"Dapatkan teks dalam nota", "Next":"Seterusnya", "Previous":"Sebelumnya", "Match case":"Kes sepadan", "Replace with":"Gantikan dengan", "Replace":"Ganti", "Replace All":"Gantikan Semua", "No matches found":"Padanan tidak ditemui", "Match":"Padan", 
"of":"daripada", "Edit & Annotate":"Edit & Anotasi", "Full Screen Preview":"Pratonton Skrin Penuh", "More Actions":"Tindakan Lanjut", "Full Screen":"Skrin Penuh", "Annotate":"Anotasi", "Reset Image Size":"Tetapkan Semula Saiz Imej", "Edit":"Edit", "Delete":"Padam", "Cancel":"Batal", "Save":"Simpan", "Undo":"Buat asal", "Download failed":"Muat turun gagal", "Tap to Download":"Ketik untuk Muat Turun", "placeholder-copy":"Mula menulis atau seret fail ke sini", "placeholder-copy-templates":"Mula menulis, seret fail atau pilih <button>Templat</button>", 
"placeholder-copy-mobile":"Mula menulis", "placeholder-copy-mobile-templates":"Mula menulis atau pilih <button>Templat</button>", "Template":"Templat", "New Template":"Templat Baru", "Title":"Tajuk", "Save as template":"Simpan sebagai templat", "Save as Template":"Simpan sebagai Templat", "template-dialogs-create-warning":"Lampiran dan imej yang besar tidak akan disertakan dalam templat.", "Rename template":"Namakan semula templat", "Rename Template":"Namakan Semula Templat", "Delete template":"Padam templat", 
"Delete Template":"Padam Templat", "template-dialogs-delete-info":'Adakah anda pasti mahu memadamkan templat "{TITLE}"?\n\nNota asal dan sebarang nota yang dibuat daripada templat ini tidak akan dipengaruhi.', "Write task":"Tulis tugas", "Due Date":"Tarikh Jangka", "Tomorrow":"Esok", "Today":"Hari Ini", "Yesterday":"Semalam", "Retry":"Cuba semula", "Unable to load task":"Tidak boleh memuatkan tugas", "Change to task":"Tukar kepada tugasan"};
goog.provide("uno.i18n.nl");
uno.i18n.nl.textEntries = {"Not available offline":"Niet offline beschikbaar", "Not available":"Niet beschikbaar", "Tap to request access":"Tik om toegang aan te vragen", "Click to request access":"Klik om toegang aan te vragen", "Open":"Open", "Copy link":"Kopieer link", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Google Sheets", "Google Slides":"Google Slides", "PDF":"PDF", "Word Document":"Word-document", "Excel Spreadsheet":"Excel-spreadsheet", "Modified":"Aangepast", 
"Connect":"Koppel", "Connect to see more":"Koppel om meer te zien", "Connect Google account":"Koppel Google account", "Title not available":"Titel niet beschikbaar", "Open containing folder":"Open bijbehorende map", "Cell Background":"Achtergrond cel", "Cell Alignment":"Uitlijning cel", "Align content to top":"Lijn content bovenin uit", "Align content to center":"Lijn content uit in het midden", "Align content to bottom":"Lijn content onderin uit", "Distribute Columns Evenly":"Verdeel kolommen gelijkmatig", 
"Match Note Width":"Pas notitiebreedte aan", "Delete Selected Column(s)":"Verwijder geselecteerde kolom(men)", "Delete Selected Row(s)":"Verwijder geselecteerde rij(en)", "Delete Table":"Verwijder tabel", "Merge Cells":"Voeg cellen samen", "Unmerge Cells":"Voeg cellen niet meer samen", "Find text in note":"Zoek naar tekst in notitie", "Next":"Volgende", "Previous":"Vorige", "Match case":"Hoofdlettergevoelig", "Replace with":"Vervang met", "Replace":"Vervang", "Replace All":"Vervang alles", "No matches found":"Geen overeenkomsten gevonden", 
"Match":"Treffer", "of":"van", "Edit & Annotate":"Bewerk & Annoteer", "Full Screen Preview":"Full Screen voorbeeld", "More Actions":"Meer acties", "Full Screen":"Volledig scherm", "Annotate":"Annoteer", "Reset Image Size":"Reset Afbeeldingsgrootte", "Edit":"Bewerk", "Delete":"Verwijder", "Cancel":"Annuleer", "Save":"Sla op", "Undo":"Maak ongedaan", "Download failed":"Download mislukt", "Tap to Download":"Tik om te downloaden", "placeholder-copy":"Begin met schrijven of sleep bestanden hierheen", 
"placeholder-copy-templates":"Begin met schrijven, sleep bestanden of kies een <button>Sjabloon</button>", "placeholder-copy-mobile":"Begin met schrijven", "placeholder-copy-mobile-templates":"Begin met schrijven of kies een <button>Sjabloon</button>", "Template":"Sjabloon", "New Template":"Nieuw sjabloon", "Title":"Titel", "Save as template":"Sla op als sjabloon", "Save as Template":"Sla op als sjabloon", "template-dialogs-create-warning":"Bijlagen en grote afbeeldingen zijn geen onderdeel van de sjabloon.", 
"Rename template":"Wijzig naam sjabloon", "Rename Template":"Wijzig naam sjabloon", "Delete template":"Verwijder sjabloon", "Delete Template":"Verwijder sjabloon", "template-dialogs-delete-info":'Weet je zeker dat je het sjabloon "{TITLE}" wil verwijderen?\n\nDe originele notitie en notities die vanuit dit sjabloon aangemaakt worden, worden niet be\u00efnvloed.', "Write task":"Maak taak", "Due Date":"Vervaldatum", "Tomorrow":"Morgen", "Today":"Vandaag", "Yesterday":"Gisteren", "Retry":"Opnieuw", 
"Unable to load task":"De taak kan niet geladen worden", "Change to task":"Wijzig in taak"};
goog.provide("uno.i18n.no");
uno.i18n.no.textEntries = {"Not available offline":"Ikke tilgjengelig offline", "Not available":"Ikke tilgjengelig", "Tap to request access":"Trykk for \u00e5 be om tilgang", "Click to request access":"Klikk for \u00e5 be om tilgang", "Open":"\u00c5pne", "Copy link":"Kopier lenke", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Google Sheets", "Google Slides":"Google Slides", "PDF":"PDF", "Word Document":"Word-dokument", "Excel Spreadsheet":"Excel regneark", "Modified":"Modifisert", 
"Connect":"Koble til", "Connect to see more":"Koble til for \u00e5 se mer", "Connect Google account":"Koble til Google-konto", "Title not available":"Tittel ikke tilgjengelig", "Open containing folder":"\u00c5pne mappe med innhold", "Cell Background":"Cellebakgrunn", "Cell Alignment":"Cellejustering", "Align content to top":"Toppjuster innhold", "Align content to center":"Midtstill innhold", "Align content to bottom":"Bunnjuster innhold", "Distribute Columns Evenly":"Distribuer kolonner jevnt", "Match Note Width":"Tilpass notatbredde", 
"Delete Selected Column(s)":"Slett valgt(e) kolonne(r)", "Delete Selected Row(s)":"Slett valgt(e) rad(er)", "Delete Table":"Slett tabell", "Merge Cells":"Sl\u00e5 sammen celler", "Unmerge Cells":"Del celler", "Find text in note":"Finn tekst i notat", "Next":"Neste", "Previous":"Forrige", "Match case":"Skill mellom store/sm\u00e5 bokstaver", "Replace with":"Erstatt med", "Replace":"Erstatt", "Replace All":"Erstatt alle", "No matches found":"Finner ingen treff", "Match":"Treff", "of":"i", "Edit & Annotate":"Rediger og kommenter", 
"Full Screen Preview":"Forh\u00e5ndsvisning av fullskjerm", "More Actions":"Flere handlinger", "Full Screen":"Fullskjerm", "Annotate":"Kommenter", "Reset Image Size":"Tilbakestill bildest\u00f8rrelse", "Edit":"Rediger", "Delete":"Slett", "Cancel":"Avbryt", "Save":"Lagre", "Undo":"Angre", "Download failed":"Nedlasting mislyktes", "Tap to Download":"Ber\u00f8r for \u00e5 laste ned", "placeholder-copy":"Begynn \u00e5 skrive eller dra filer hit", "placeholder-copy-templates":"Begynn \u00e5 skrive, dra filer eller velg en <button>Mal</button>", 
"placeholder-copy-mobile":"Begynn \u00e5 skrive", "placeholder-copy-mobile-templates":"Begynn \u00e5 skrive eller velg en <button>Mal</button>", "Template":"Mal", "New Template":"Ny mal", "Title":"Tittel", "Save as template":"Lagre som mal", "Save as Template":"Lagre som mal", "template-dialogs-create-warning":"Vedlegg og store bilder blir ikke inkludert i malen.", "Rename template":"Gi nytt navn til mal", "Rename Template":"Gi nytt navn til mal", "Delete template":"Slett mal", "Delete Template":"Slett mal", 
"template-dialogs-delete-info":"Er du sikker p\u00e5 at du vil slette malen \u201c{TITLE}\u201d?\n\nDet opprinnelige notatet og notater som er opprettet via denne malen blir ikke p\u00e5virket.", "Write task":"Skriv oppgave", "Due Date":"Forfallsdato", "Tomorrow":"I morgen", "Today":"I dag", "Yesterday":"I g\u00e5r", "Retry":"Pr\u00f8v p\u00e5 nytt", "Unable to load task":"Kunne ikke laste oppgave", "Change to task":"Endre til oppgave"};
goog.provide("uno.i18n.pl");
uno.i18n.pl.textEntries = {"Not available offline":"Niedost\u0119pne w trybie offline", "Not available":"Niedost\u0119pne", "Tap to request access":"Dotknij, aby za\u017c\u0105da\u0107 dost\u0119pu", "Click to request access":"Kliknij, aby poprosi\u0107 o dost\u0119p", "Open":"Otw\u00f3rz", "Copy link":"Kopiuj \u0142\u0105cze", "Google Drive":"Dysk Google", "Google Docs":"Dokumenty Google", "Google Sheets":"Arkusze Google", "Google Slides":"Prezentacje Google", "PDF":"PDF", "Word Document":"Dokument Word", 
"Excel Spreadsheet":"Arkusz Excel", "Modified":"Edytowany", "Connect":"Po\u0142\u0105cz", "Connect to see more":"Po\u0142\u0105cz, aby zobaczy\u0107 wi\u0119cej", "Connect Google account":"Po\u0142\u0105cz z kontem Google", "Title not available":"Nazwa jest niedost\u0119pna", "Open containing folder":"Otw\u00f3rz folder zawieraj\u0105cy", "Cell Background":"T\u0142o kom\u00f3rki", "Cell Alignment":"Wyr\u00f3wnanie kom\u00f3rki", "Align content to top":"Wyr\u00f3wnaj zawarto\u015b\u0107 do g\u00f3ry", 
"Align content to center":"Wyr\u00f3wnaj zawarto\u015b\u0107 do \u015brodka", "Align content to bottom":"Wyr\u00f3wnaj zawarto\u015b\u0107 do do\u0142u", "Distribute Columns Evenly":"Roz\u0142\u00f3\u017c kolumny r\u00f3wnomiernie", "Match Note Width":"Dopasuj do szeroko\u015bci notatki", "Delete Selected Column(s)":"Usu\u0144 zaznaczon\u0105 kolumn\u0119", "Delete Selected Row(s)":"Usu\u0144 zaznaczony wiersz", "Delete Table":"Usu\u0144 tabel\u0119", "Merge Cells":"Po\u0142\u0105cz kom\u00f3rki", 
"Unmerge Cells":"Roz\u0142\u0105cz kom\u00f3rki", "Find text in note":"Poszukaj tekstu w notatce", "Next":"Dalej", "Previous":"Wstecz", "Match case":"Uwzgl\u0119dnij wielko\u015b\u0107 liter", "Replace with":"Zamie\u0144 na", "Replace":"Zamie\u0144", "Replace All":"Zamie\u0144 wszystko", "No matches found":"Nie znaleziono dopasowa\u0144", "Match":"Dopasowanie", "of":"z", "Edit & Annotate":"Edytuj i opisuj", "Full Screen Preview":"Podgl\u0105d na pe\u0142nym ekranie", "More Actions":"Wi\u0119cej akcji", 
"Full Screen":"Pe\u0142ny ekran", "Annotate":"Opisz", "Reset Image Size":"Zresetuj rozmiar obrazu", "Edit":"Edytuj", "Delete":"Usu\u0144", "Cancel":"Anuluj", "Save":"Zapisz", "Undo":"Cofnij", "Download failed":"Pobieranie nie powiod\u0142o si\u0119", "Tap to Download":"Dotknij, aby pobra\u0107", "placeholder-copy":"Zacznij pisa\u0107 lub przeci\u0105gaj pliki tutaj", "placeholder-copy-templates":"Zacznij pisa\u0107, przeci\u0105gnij pliki lub wybierz <button>szablon</button>", "placeholder-copy-mobile":"Zacznij pisa\u0107", 
"placeholder-copy-mobile-templates":"Zacznij pisa\u0107 lub wybierz <button>szablon</button>", "Template":"Szablon", "New Template":"Nowy szablon", "Title":"Tytu\u0142", "Save as template":"Zapisz jako szablon", "Save as Template":"Zapisz jako szablon", "template-dialogs-create-warning":"Za\u0142\u0105czniki i du\u017ce obrazy nie zostan\u0105 uwzgl\u0119dnione w szablonie.", "Rename template":"Zmie\u0144 nazw\u0119 szablonu", "Rename Template":"Zmie\u0144 nazw\u0119 szablonu", "Delete template":"Usu\u0144 szablon", 
"Delete Template":"Usu\u0144 szablon", "template-dialogs-delete-info":"Czy na pewno chcesz usun\u0105\u0107 szablon \u201e{TITLE}\u201d?\n\nNie wp\u0142ynie to na oryginaln\u0105 notatk\u0119 i notatki utworzone w oparciu o ten szablon.", "Write task":"Utw\u00f3rz zadanie", "Due Date":"Termin", "Tomorrow":"Jutro", "Today":"Dzisiaj", "Yesterday":"Wczoraj", "Retry":"Pon\u00f3w", "Unable to load task":"Nie uda\u0142o si\u0119 za\u0142adowa\u0107 zadania", "Change to task":"Zmie\u0144 w zadanie"};
goog.provide("uno.i18n.pt_BR");
uno.i18n.pt_BR.textEntries = {"Not available offline":"N\u00e3o dispon\u00edvel offline", "Not available":"N\u00e3o est\u00e1 dispon\u00edvel", "Tap to request access":"Toque para solicitar acesso", "Click to request access":"Clique para solicitar acesso", "Open":"Abrir", "Copy link":"Copiar link", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Planilhas do Google", "Google Slides":"Apresenta\u00e7\u00f5es do Google", "PDF":"PDF", "Word Document":"Documento do Word", 
"Excel Spreadsheet":"Planilha do Excel", "Modified":"Modificado em", "Connect":"Conectar", "Connect to see more":"Conecte-se para ver mais", "Connect Google account":"Conectar conta do Google", "Title not available":"T\u00edtulo n\u00e3o dispon\u00edvel", "Open containing folder":"Abrir pasta de destino", "Cell Background":"Fundo da C\u00e9lula", "Cell Alignment":"Alinhamento da C\u00e9lula", "Align content to top":"Alinhar conte\u00fado no topo", "Align content to center":"Alinhar conte\u00fado no centro", 
"Align content to bottom":"Alinhar conte\u00fado embaixo", "Distribute Columns Evenly":"Distribuir Colunas Igualmente", "Match Note Width":"Igualar Largura da Coluna", "Delete Selected Column(s)":"Excluir Coluna(s) Selecionada(s)", "Delete Selected Row(s)":"Excluir Linha(s) Selecionada(s)", "Delete Table":"Excluir Tabela", "Merge Cells":"Mesclar C\u00e9lulas", "Unmerge Cells":"Desfazer Mesclagem de C\u00e9lulas", "Find text in note":"Encontrar texto na nota", "Next":"Pr\u00f3ximo", "Previous":"Anterior", 
"Match case":"Correspondentes", "Replace with":"Substituir por", "Replace":"Substituir", "Replace All":"Substituir Todos", "No matches found":"Nenhuma ocorr\u00eancia encontrada", "Match":"Combinar", "of":"de", "Edit & Annotate":"Editar e Anotar", "Full Screen Preview":"Pr\u00e9via de Tela Cheia", "More Actions":"Mais A\u00e7\u00f5es", "Full Screen":"Tela Cheia", "Annotate":"Anotar", "Reset Image Size":"Redefinir Tamanho da Imagem", "Edit":"Editar", "Delete":"Excluir", "Cancel":"Cancelar", "Save":"Salvar", 
"Undo":"Desfazer", "Download failed":"Falha no download", "Tap to Download":"Toque para Baixar", "placeholder-copy":"Comece a escrever ou arraste arquivos aqui", "placeholder-copy-templates":"Comece a escrever, arraste arquivos, ou escolha um <button>Template</button>", "placeholder-copy-mobile":"Comece a escrever", "placeholder-copy-mobile-templates":"Comece a escrever ou escolha um <button>Template</button>", "Template":"Template", "New Template":"Novo Template", "Title":"T\u00edtulo", "Save as template":"Salvar como template", 
"Save as Template":"Salvar como Template", "template-dialogs-create-warning":"Anexos e imagens grandes n\u00e3o ser\u00e3o inclu\u00eddos no template.", "Rename template":"Renomear template", "Rename Template":"Renomear Template", "Delete template":"Excluir template", "Delete Template":"Excluir Template", "template-dialogs-delete-info":'Tem certeza que deseja excluir o template "{TITLE}"?\n\nA nota original e quaisquer notas criadas deste template n\u00e3o ser\u00e3o afetadas.', "Write task":"Escrever tarefa", 
"Due Date":"Data de Conclus\u00e3o", "Tomorrow":"Amanh\u00e3", "Today":"Hoje", "Yesterday":"Ontem", "Retry":"Tentar novamente", "Unable to load task":"N\u00e3o foi poss\u00edvel carregar a tarefa", "Change to task":"Alterar para tarefa"};
goog.provide("uno.i18n.pt");
uno.i18n.pt.textEntries = {"Not available offline":"Indispon\u00edvel no modo off-line", "Not available":"Indispon\u00edvel", "Tap to request access":"Toque para solicitar acesso", "Click to request access":"Clique para solicitar acesso", "Open":"Abrir", "Copy link":"Copiar liga\u00e7\u00e3o", "Google Drive":"Google Drive", "Google Docs":"Documentos do Google", "Google Sheets":"Folhas de c\u00e1lculo do Google", "Google Slides":"Apresenta\u00e7\u00f5es do Google", "PDF":"PDF", "Word Document":"Documento do Word", 
"Excel Spreadsheet":"Tabela do Excel", "Modified":"Modificado em", "Connect":"Ligar", "Connect to see more":"Ligue para ver mais", "Connect Google account":"Ligar \u00e0 conta Google", "Title not available":"T\u00edtulo indispon\u00edvel", "Open containing folder":"Abrir pasta de destino", "Cell Background":"Fundo da c\u00e9lula", "Cell Alignment":"Alinhamento da c\u00e9lula", "Align content to top":"Alinhar conte\u00fado no topo", "Align content to center":"Alinhar conte\u00fado ao centro", "Align content to bottom":"Alinhar conte\u00fado no fundo", 
"Distribute Columns Evenly":"Distribuir colunas uniformemente", "Match Note Width":"Ajustar largura da nota", "Delete Selected Column(s)":"Eliminar a(s) coluna(s) selecionada(s)", "Delete Selected Row(s)":"Eliminar a(s) linha(s) selecionada(s)", "Delete Table":"Eliminar tabela", "Merge Cells":"Fundir c\u00e9lulas", "Unmerge Cells":"Desfazer c\u00e9lulas fundidas", "Find text in note":"Encontrar texto na nota", "Next":"Seguinte", "Previous":"Anterior", "Match case":"Correspondentes", "Replace with":"Substituir por", 
"Replace":"Substituir", "Replace All":"Substituir Todos", "No matches found":"N\u00e3o foram encontrados resultados", "Match":"Corresponde", "of":"de", "Edit & Annotate":"Editar e anotar", "Full Screen Preview":"Pr\u00e9-visualiza\u00e7\u00e3o de ecr\u00e3 completo", "More Actions":"Mais a\u00e7\u00f5es", "Full Screen":"Ecr\u00e3 completo", "Annotate":"Anotar", "Reset Image Size":"Redefinir tamanho da imagem", "Edit":"Editar", "Delete":"Eliminar", "Cancel":"Cancelar", "Save":"Guardar", "Undo":"Desfazer", 
"Download failed":"Falha no download", "Tap to Download":"Toque para fazer o Download", "placeholder-copy":"Comece a escrever ou arraste ficheiros para aqui", "placeholder-copy-templates":"Comece a escrever, arraste ficheiros ou escolha um <button>Modelo</button>", "placeholder-copy-mobile":"Come\u00e7ar a escrever", "placeholder-copy-mobile-templates":"Comece a escrever ou escolha um <button>Modelo</button>", "Template":"Modelo", "New Template":"Novo modelo", "Title":"T\u00edtulo", "Save as template":"Guardar como modelo", 
"Save as Template":"Guardar como modelo", "template-dialogs-create-warning":"Os anexos e imagens grandes n\u00e3o ser\u00e3o inclu\u00eddos no modelo.", "Rename template":"Renomear modelo", "Rename Template":"Renomear modelo", "Delete template":"Eliminar modelo", "Delete Template":"Eliminar modelo", "template-dialogs-delete-info":"Tem certeza que deseja eliminar o modelo \u201c{TITLE}\u201d?\n\nA nota original e quaisquer notas criadas a partir deste modelo n\u00e3o ser\u00e3o afetadas.", "Write task":"Escrever tarefa", 
"Due Date":"Data para conclus\u00e3o", "Tomorrow":"Amanh\u00e3", "Today":"Hoje", "Yesterday":"Ontem", "Retry":"Tentar novamente", "Unable to load task":"N\u00e3o foi poss\u00edvel carregar a tarefa", "Change to task":"Mudar para a tarefa"};
goog.provide("uno.i18n.ru");
uno.i18n.ru.textEntries = {"Not available offline":"\u041d\u0435\u0442 \u043e\u0444\u043b\u0430\u0439\u043d-\u0434\u043e\u0441\u0442\u0443\u043f\u0430", "Not available":"\u041d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d", "Tap to request access":"\u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430", "Click to request access":"\u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430", 
"Open":"\u041e\u0442\u043a\u0440\u044b\u0442\u044c", "Copy link":"\u0421\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Google Sheets", "Google Slides":"Google Slides", "PDF":"PDF", "Word Document":"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442 Word", "Excel Spreadsheet":"\u0422\u0430\u0431\u043b\u0438\u0446\u0430 Excel", "Modified":"\u0418\u0437\u043c\u0435\u043d\u0435\u043d", 
"Connect":"\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c", "Connect to see more":"\u0412\u043e\u0439\u0442\u0438 \u0432 Google Drive", "Connect Google account":"\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0430\u043a\u043a\u0430\u0443\u043d\u0442 Google", "Title not available":"\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e", "Open containing folder":"\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0443", 
"Cell Background":"\u0424\u043e\u043d \u044f\u0447\u0435\u0439\u043a\u0438", "Cell Alignment":"\u0412\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435 \u044f\u0447\u0435\u0439\u043a\u0438", "Align content to top":"\u0412\u044b\u0440\u043e\u0432\u043d\u044f\u0442\u044c \u043f\u043e \u0432\u0435\u0440\u0445\u043d\u0435\u043c\u0443 \u043a\u0440\u0430\u044e", "Align content to center":"\u0412\u044b\u0440\u043e\u0432\u043d\u044f\u0442\u044c \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443", 
"Align content to bottom":"\u0412\u044b\u0440\u043e\u0432\u043d\u044f\u0442\u044c \u043f\u043e \u043d\u0438\u0436\u043d\u0435\u043c\u0443 \u043a\u0440\u0430\u044e", "Distribute Columns Evenly":"\u0412\u044b\u0440\u043e\u0432\u043d\u044f\u0442\u044c \u0448\u0438\u0440\u0438\u043d\u0443 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432", "Match Note Width":"\u0420\u0430\u0437\u043c\u0435\u0440 \u043f\u043e \u0448\u0438\u0440\u0438\u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u043a\u0438", "Delete Selected Column(s)":"\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446", 
"Delete Selected Row(s)":"\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443", "Delete Table":"\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443", "Merge Cells":"\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u044f\u0447\u0435\u0439\u043a\u0438", "Unmerge Cells":"\u0420\u0430\u0437\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u044f\u0447\u0435\u0439\u043a\u0438", 
"Find text in note":"\u041d\u0430\u0445\u043e\u0434\u0438\u0442\u0435 \u0442\u0435\u043a\u0441\u0442 \u0432 \u0437\u0430\u043c\u0435\u0442\u043a\u0435", "Next":"\u0414\u0430\u043b\u0435\u0435", "Previous":"\u041d\u0430\u0437\u0430\u0434", "Match case":"\u0421 \u0443\u0447\u0435\u0442\u043e\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430", "Replace with":"\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430", "Replace":"\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c", "Replace All":"\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0441\u0435", 
"No matches found":"\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b", "Match":"\u0421\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435", "of":"\u0438\u0437", "Edit & Annotate":"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c & \u0412\u043d\u0435\u0441\u0442\u0438 \u043f\u043e\u043c\u0435\u0442\u043a\u0438", "Full Screen Preview":"\u041f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440", 
"More Actions":"\u0411\u043e\u043b\u044c\u0448\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439", "Full Screen":"\u0412\u043e \u0432\u0435\u0441\u044c \u044d\u043a\u0440\u0430\u043d", "Annotate":"\u0412\u043d\u0435\u0441\u0442\u0438 \u043f\u043e\u043c\u0435\u0442\u043a\u0438", "Reset Image Size":"\u0421\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f", "Edit":"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c", 
"Delete":"\u0423\u0434\u0430\u043b\u0438\u0442\u044c", "Cancel":"\u041e\u0442\u043c\u0435\u043d\u0430", "Save":"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c", "Undo":"\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c", "Download failed":"\u041e\u0448\u0438\u0431\u043a\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438", "Tap to Download":"\u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438", "placeholder-copy":"\u041d\u0430\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0435\u043a\u0441\u0442 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043b\u044b", 
"placeholder-copy-templates":"\u041d\u0430\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0435\u043a\u0441\u0442, \u043f\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043b\u044b \u0438\u043b\u0438 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 <button>\u0448\u0430\u0431\u043b\u043e\u043d</button>", "placeholder-copy-mobile":"\u041d\u0430\u0447\u043d\u0438\u0442\u0435 \u043f\u0438\u0441\u0430\u0442\u044c", "placeholder-copy-mobile-templates":"\u041d\u0430\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0435\u043a\u0441\u0442 \u0438\u043b\u0438 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 <button>\u0448\u0430\u0431\u043b\u043e\u043d</button>", 
"Template":"\u0428\u0430\u0431\u043b\u043e\u043d", "New Template":"\u041d\u043e\u0432\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d", "Title":"\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435", "Save as template":"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d", "Save as Template":"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d", "template-dialogs-create-warning":"\u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435.", 
"Rename template":"\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d", "Rename Template":"\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d", "Delete template":"\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d", "Delete Template":"\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d", "template-dialogs-delete-info":"\u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u201c{TITLE}\u201d?\n\n\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0437\u0430\u043c\u0435\u0442\u043a\u0438 \u0438 \u0432\u0441\u0435 \u0437\u0430\u043c\u0435\u0442\u043a\u0438, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b.", 
"Write task":"\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443", "Due Date":"\u0414\u0430\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f", "Tomorrow":"\u0417\u0430\u0432\u0442\u0440\u0430", "Today":"\u0421\u0435\u0433\u043e\u0434\u043d\u044f", "Yesterday":"\u0412\u0447\u0435\u0440\u0430", "Retry":"\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c", "Unable to load task":"\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443", 
"Change to task":"\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0435\u0439"};
goog.provide("uno.i18n.sv");
uno.i18n.sv.textEntries = {"Not available offline":"Ej tillg\u00e4nglig offline", "Not available":"Ej tillg\u00e4ngligt", "Tap to request access":"Tryck f\u00f6r att beg\u00e4ra \u00e5tkomst", "Click to request access":"Klicka f\u00f6r att beg\u00e4ra \u00e5tkomst", "Open":"\u00d6ppna", "Copy link":"Kopiera l\u00e4nk", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Google Sheets", "Google Slides":"Google Slides", "PDF":"PDF", "Word Document":"Word-dokument", "Excel Spreadsheet":"Excel-kalkylblad", 
"Modified":"\u00c4ndrad", "Connect":"Anslut", "Connect to see more":"Anslut n\u00e4r du vill se mer", "Connect Google account":"Anslut Google-konto", "Title not available":"Titeln finns inte", "Open containing folder":"\u00d6ppna objektets mapp", "Cell Background":"Cellbakgrund", "Cell Alignment":"Celljustering", "Align content to top":"Justera inneh\u00e5ll upp\u00e5t", "Align content to center":"Justera inneh\u00e5ll \u00e5t mitten", "Align content to bottom":"Justera inneh\u00e5ll ned\u00e5t", 
"Distribute Columns Evenly":"F\u00f6rdela kolumner j\u00e4mnt", "Match Note Width":"Matcha anteckningens bredd", "Delete Selected Column(s)":"Radera markerade kolumner", "Delete Selected Row(s)":"Radera markerade rader", "Delete Table":"Radera tabell", "Merge Cells":"Sammanfoga celler", "Unmerge Cells":"Separera celler", "Find text in note":"Hitta text i anteckning", "Next":"N\u00e4sta", "Previous":"F\u00f6reg\u00e5ende", "Match case":"Matcha gemener/VERSALER", "Replace with":"Ers\u00e4tt med", "Replace":"Ers\u00e4tt", 
"Replace All":"Ers\u00e4tt alla", "No matches found":"Inga tr\u00e4ffar hittades", "Match":"Tr\u00e4ff", "of":"av", "Edit & Annotate":"Redigera och kommentera", "Full Screen Preview":"F\u00f6rhandsgranskning i helsk\u00e4rm", "More Actions":"Fler \u00e5tg\u00e4rder", "Full Screen":"Helsk\u00e4rmsl\u00e4ge", "Annotate":"Kommentera", "Reset Image Size":"\u00c5terst\u00e4ll bildstorlek", "Edit":"Redigera", "Delete":"Ta bort", "Cancel":"Avbryt", "Save":"Spara", "Undo":"\u00c5ngra", "Download failed":"Det gick inte att h\u00e4mta filen", 
"Tap to Download":"Tryck f\u00f6r att ladda ner", "placeholder-copy":"B\u00f6rja skriva h\u00e4r eller dra filer hit", "placeholder-copy-templates":"B\u00f6rja skriva, dra filer eller v\u00e4lj en <button>mall</button>", "placeholder-copy-mobile":"B\u00f6rja skriva", "placeholder-copy-mobile-templates":"B\u00f6rja skriva eller v\u00e4lj en <button>mall</button>", "Template":"Mall", "New Template":"Ny mall", "Title":"Titel", "Save as template":"Spara som mall", "Save as Template":"Spara som mall", 
"template-dialogs-create-warning":"Bilagor och stora bilder kommer inte att inkluderas i mallen.", "Rename template":"Byt namn p\u00e5 mall", "Rename Template":"Byt namn p\u00e5 mall", "Delete template":"Radera mall", "Delete Template":"Radera mall", "template-dialogs-delete-info":"\u00c4r du s\u00e4ker p\u00e5 att du vill radera mallen \u201c{TITLE}\u201d?\n\nDen ursprungliga anteckningen och eventuella anteckningar som skapats med den h\u00e4r mallen p\u00e5verkas inte.", "Write task":"Ange uppgift", 
"Due Date":"F\u00f6rfallodatum", "Tomorrow":"Imorgon", "Today":"Idag", "Yesterday":"Ig\u00e5r", "Retry":"F\u00f6rs\u00f6k igen", "Unable to load task":"Det gick inte att l\u00e4sa in uppgiften", "Change to task":"\u00c4ndras till uppgift"};
goog.provide("uno.i18n.th");
uno.i18n.th.textEntries = {"Not available offline":"\u0e44\u0e21\u0e48\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e15\u0e2d\u0e19\u0e2d\u0e2d\u0e1f\u0e44\u0e25\u0e19\u0e4c\u0e44\u0e14\u0e49", "Not available":"\u0e44\u0e21\u0e48\u0e21\u0e35", "Tap to request access":"\u0e41\u0e15\u0e30\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e02\u0e2d\u0e40\u0e02\u0e49\u0e32\u0e16\u0e36\u0e07", "Click to request access":"\u0e04\u0e25\u0e34\u0e4a\u0e01\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e02\u0e2d\u0e40\u0e02\u0e49\u0e32\u0e16\u0e36\u0e07", 
"Open":"\u0e40\u0e1b\u0e34\u0e14", "Copy link":"\u0e04\u0e31\u0e14\u0e25\u0e2d\u0e01\u0e25\u0e34\u0e07\u0e01\u0e4c", "Google Drive":"Google Drive", "Google Docs":"Google Docs", "Google Sheets":"Google Sheets", "Google Slides":"Google Slides", "PDF":"PDF", "Word Document":"\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23 Word", "Excel Spreadsheet":"\u0e2a\u0e40\u0e1b\u0e23\u0e14\u0e0a\u0e35\u0e17 Excel", "Modified":"\u0e1b\u0e23\u0e31\u0e1a\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e41\u0e25\u0e49\u0e27", "Connect":"\u0e40\u0e0a\u0e37\u0e48\u0e2d\u0e21\u0e15\u0e48\u0e2d", 
"Connect to see more":"\u0e40\u0e0a\u0e37\u0e48\u0e2d\u0e21\u0e15\u0e48\u0e2d\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e14\u0e39\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e15\u0e34\u0e21", "Connect Google account":"\u0e40\u0e0a\u0e37\u0e48\u0e2d\u0e21\u0e15\u0e48\u0e2d\u0e1a\u0e31\u0e0d\u0e0a\u0e35 Google", "Title not available":"\u0e44\u0e21\u0e48\u0e21\u0e35\u0e0a\u0e37\u0e48\u0e2d", "Open containing folder":"\u0e40\u0e1b\u0e34\u0e14\u0e41\u0e1f\u0e49\u0e21\u0e40\u0e2d\u0e01\u0e2a\u0e32\u0e23\u0e17\u0e35\u0e48\u0e40\u0e01\u0e47\u0e1a", 
"Cell Background":"\u0e1e\u0e37\u0e49\u0e19\u0e2b\u0e25\u0e31\u0e07\u0e02\u0e2d\u0e07\u0e0a\u0e48\u0e2d\u0e07\u0e15\u0e32\u0e23\u0e32\u0e07", "Cell Alignment":"\u0e01\u0e32\u0e23\u0e08\u0e31\u0e14\u0e41\u0e19\u0e27\u0e02\u0e2d\u0e07\u0e0a\u0e48\u0e2d\u0e07\u0e15\u0e32\u0e23\u0e32\u0e07", "Align content to top":"\u0e08\u0e31\u0e14\u0e41\u0e19\u0e27\u0e40\u0e19\u0e37\u0e49\u0e2d\u0e2b\u0e32\u0e44\u0e27\u0e49\u0e14\u0e49\u0e32\u0e19\u0e1a\u0e19\u0e2a\u0e38\u0e14", "Align content to center":"\u0e08\u0e31\u0e14\u0e41\u0e19\u0e27\u0e40\u0e19\u0e37\u0e49\u0e2d\u0e2b\u0e32\u0e44\u0e27\u0e49\u0e15\u0e23\u0e07\u0e01\u0e25\u0e32\u0e07", 
"Align content to bottom":"\u0e08\u0e31\u0e14\u0e41\u0e19\u0e27\u0e40\u0e19\u0e37\u0e49\u0e2d\u0e2b\u0e32\u0e44\u0e27\u0e49\u0e14\u0e49\u0e32\u0e19\u0e25\u0e48\u0e32\u0e07\u0e2a\u0e38\u0e14", "Distribute Columns Evenly":"\u0e17\u0e33\u0e43\u0e2b\u0e49\u0e0a\u0e48\u0e2d\u0e07\u0e04\u0e2d\u0e25\u0e31\u0e21\u0e19\u0e4c\u0e21\u0e35\u0e02\u0e19\u0e32\u0e14\u0e40\u0e17\u0e48\u0e32\u0e01\u0e31\u0e19\u0e2b\u0e21\u0e14", "Match Note Width":"\u0e08\u0e31\u0e14\u0e04\u0e27\u0e32\u0e21\u0e01\u0e27\u0e49\u0e32\u0e07\u0e02\u0e2d\u0e07\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e43\u0e2b\u0e49\u0e1e\u0e2d\u0e14\u0e35", 
"Delete Selected Column(s)":"\u0e25\u0e1a\u0e04\u0e2d\u0e25\u0e31\u0e21\u0e19\u0e4c\u0e17\u0e35\u0e48\u0e40\u0e25\u0e37\u0e2d\u0e01\u0e44\u0e27\u0e49", "Delete Selected Row(s)":"\u0e25\u0e1a\u0e41\u0e16\u0e27\u0e17\u0e35\u0e48\u0e40\u0e25\u0e37\u0e2d\u0e01\u0e44\u0e27\u0e49", "Delete Table":"\u0e25\u0e1a\u0e15\u0e32\u0e23\u0e32\u0e07", "Merge Cells":"\u0e23\u0e27\u0e21\u0e40\u0e0b\u0e25\u0e25\u0e4c", "Unmerge Cells":"\u0e41\u0e22\u0e01\u0e40\u0e0b\u0e25\u0e25\u0e4c", "Find text in note":"\u0e04\u0e49\u0e19\u0e2b\u0e32\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e43\u0e19\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e22\u0e48\u0e2d", 
"Next":"\u0e16\u0e31\u0e14\u0e44\u0e1b", "Previous":"\u0e01\u0e48\u0e2d\u0e19\u0e2b\u0e19\u0e49\u0e32\u0e19\u0e35\u0e49", "Match case":"\u0e15\u0e23\u0e07\u0e15\u0e32\u0e21\u0e15\u0e31\u0e27\u0e1e\u0e34\u0e21\u0e1e\u0e4c\u0e43\u0e2b\u0e0d\u0e48-\u0e40\u0e25\u0e47\u0e01", "Replace with":"\u0e41\u0e17\u0e19\u0e17\u0e35\u0e48\u0e14\u0e49\u0e27\u0e22", "Replace":"\u0e41\u0e17\u0e19\u0e17\u0e35\u0e48", "Replace All":"\u0e41\u0e17\u0e19\u0e17\u0e35\u0e48\u0e17\u0e31\u0e49\u0e07\u0e2b\u0e21\u0e14", "No matches found":"\u0e44\u0e21\u0e48\u0e1e\u0e1a\u0e23\u0e32\u0e22\u0e01\u0e32\u0e23\u0e17\u0e35\u0e48\u0e15\u0e23\u0e07\u0e01\u0e31\u0e19", 
"Match":"\u0e15\u0e23\u0e07", "of":"\u0e02\u0e2d\u0e07", "Edit & Annotate":"\u0e41\u0e01\u0e49\u0e44\u0e02 & \u0e43\u0e2a\u0e48\u0e04\u0e33\u0e2d\u0e18\u0e34\u0e1a\u0e32\u0e22\u0e1b\u0e23\u0e30\u0e01\u0e2d\u0e1a", "Full Screen Preview":"\u0e14\u0e39\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e41\u0e1a\u0e1a\u0e40\u0e15\u0e47\u0e21\u0e2b\u0e19\u0e49\u0e32\u0e08\u0e2d", "More Actions":"\u0e01\u0e32\u0e23\u0e14\u0e33\u0e40\u0e19\u0e34\u0e19\u0e01\u0e32\u0e23\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e15\u0e34\u0e21", 
"Full Screen":"\u0e2b\u0e19\u0e49\u0e32\u0e08\u0e2d\u0e41\u0e1a\u0e1a\u0e40\u0e15\u0e47\u0e21\u0e2b\u0e19\u0e49\u0e32", "Annotate":"\u0e43\u0e2a\u0e48\u0e04\u0e33\u0e2d\u0e18\u0e34\u0e1a\u0e32\u0e22\u0e1b\u0e23\u0e30\u0e01\u0e2d\u0e1a", "Reset Image Size":"\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32\u0e02\u0e19\u0e32\u0e14\u0e23\u0e39\u0e1b\u0e20\u0e32\u0e1e\u0e43\u0e2b\u0e21\u0e48", "Edit":"\u0e41\u0e01\u0e49\u0e44\u0e02", "Delete":"\u0e25\u0e1a", "Cancel":"\u0e22\u0e01\u0e40\u0e25\u0e34\u0e01", 
"Save":"\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01", "Undo":"\u0e40\u0e25\u0e34\u0e01\u0e17\u0e33", "Download failed":"\u0e44\u0e21\u0e48\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e14\u0e32\u0e27\u0e19\u0e4c\u0e42\u0e2b\u0e25\u0e14\u0e44\u0e14\u0e49", "Tap to Download":"\u0e41\u0e15\u0e30\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e14\u0e32\u0e27\u0e19\u0e4c\u0e42\u0e2b\u0e25\u0e14", "placeholder-copy":"\u0e40\u0e23\u0e34\u0e48\u0e21\u0e40\u0e02\u0e35\u0e22\u0e19\u0e2b\u0e23\u0e37\u0e2d\u0e25\u0e32\u0e01\u0e44\u0e1f\u0e25\u0e4c\u0e21\u0e32\u0e17\u0e35\u0e48\u0e19\u0e35\u0e48", 
"placeholder-copy-templates":"\u0e40\u0e23\u0e34\u0e48\u0e21\u0e40\u0e02\u0e35\u0e22\u0e19, \u0e25\u0e32\u0e01\u0e44\u0e1f\u0e25\u0e4c \u0e2b\u0e23\u0e37\u0e2d\u0e40\u0e25\u0e37\u0e2d\u0e01 <button>\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a</button>", "placeholder-copy-mobile":"\u0e40\u0e23\u0e34\u0e48\u0e21\u0e40\u0e02\u0e35\u0e22\u0e19", "placeholder-copy-mobile-templates":"\u0e40\u0e23\u0e34\u0e48\u0e21\u0e40\u0e02\u0e35\u0e22\u0e19\u0e2b\u0e23\u0e37\u0e2d\u0e40\u0e25\u0e37\u0e2d\u0e01 <button>\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a</button>", 
"Template":"\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a", "New Template":"\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e43\u0e2b\u0e21\u0e48", "Title":"\u0e0a\u0e37\u0e48\u0e2d\u0e40\u0e23\u0e37\u0e48\u0e2d\u0e07", "Save as template":"\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e40\u0e1b\u0e47\u0e19\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e2b\u0e25\u0e31\u0e01", "Save as Template":"\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e40\u0e1b\u0e47\u0e19\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e2b\u0e25\u0e31\u0e01", "template-dialogs-create-warning":"\u0e44\u0e1f\u0e25\u0e4c\u0e41\u0e19\u0e1a\u0e41\u0e25\u0e30\u0e23\u0e39\u0e1b\u0e20\u0e32\u0e1e\u0e02\u0e19\u0e32\u0e14\u0e43\u0e2b\u0e0d\u0e48\u0e08\u0e30\u0e44\u0e21\u0e48\u0e16\u0e39\u0e01\u0e23\u0e27\u0e21\u0e2d\u0e22\u0e39\u0e48\u0e43\u0e19\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e2b\u0e25\u0e31\u0e01", 
"Rename template":"\u0e15\u0e31\u0e49\u0e07\u0e0a\u0e37\u0e48\u0e2d\u0e43\u0e2b\u0e21\u0e48\u0e43\u0e2b\u0e49\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a", "Rename Template":"\u0e15\u0e31\u0e49\u0e07\u0e0a\u0e37\u0e48\u0e2d\u0e43\u0e2b\u0e21\u0e48\u0e43\u0e2b\u0e49\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a", "Delete template":"\u0e25\u0e1a\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a", "Delete Template":"\u0e25\u0e1a\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a", "template-dialogs-delete-info":"\u0e04\u0e38\u0e13\u0e41\u0e19\u0e48\u0e43\u0e08\u0e2b\u0e23\u0e37\u0e2d\u0e27\u0e48\u0e32\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e25\u0e1a\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u201c{TITLE}\u201d?\n\n\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e14\u0e31\u0e49\u0e07\u0e40\u0e14\u0e34\u0e21\u0e41\u0e25\u0e30\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e43\u0e14\u0e01\u0e47\u0e15\u0e32\u0e21\u0e17\u0e35\u0e48\u0e16\u0e39\u0e01\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e02\u0e36\u0e49\u0e19\u0e21\u0e32\u0e08\u0e32\u0e01\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a\u0e19\u0e35\u0e49\u0e08\u0e30\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e1c\u0e25\u0e01\u0e23\u0e30\u0e17\u0e1a\u0e41\u0e15\u0e48\u0e2d\u0e22\u0e48\u0e32\u0e07", 
"Write task":"\u0e40\u0e02\u0e35\u0e22\u0e19\u0e07\u0e32\u0e19", "Due Date":"\u0e27\u0e31\u0e19\u0e04\u0e23\u0e1a\u0e01\u0e33\u0e2b\u0e19\u0e14", "Tomorrow":"\u0e1e\u0e23\u0e38\u0e48\u0e07\u0e19\u0e35\u0e49", "Today":"\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49", "Yesterday":"\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e27\u0e32\u0e19\u0e19\u0e35\u0e49", "Retry":"\u0e25\u0e2d\u0e07\u0e43\u0e2b\u0e21\u0e48", "Unable to load task":"\u0e44\u0e21\u0e48\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e42\u0e2b\u0e25\u0e14\u0e07\u0e32\u0e19\u0e44\u0e14\u0e49", 
"Change to task":"\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e07\u0e32\u0e19"};
goog.provide("uno.i18n.tr");
uno.i18n.tr.textEntries = {"Not available offline":"\u00c7evrimd\u0131\u015f\u0131 kullan\u0131lamaz", "Not available":"Eri\u015fim sa\u011flanam\u0131yor", "Tap to request access":"Eri\u015fim talebi i\u00e7in t\u0131klay\u0131n", "Click to request access":"Eri\u015fim talebi i\u00e7in t\u0131klay\u0131n", "Open":"A\u00e7", "Copy link":"Ba\u011flant\u0131y\u0131 kopyala", "Google Drive":"Google Drive", "Google Docs":"Google Dok\u00fcmanlar", "Google Sheets":"Google E-Tablolar", "Google Slides":"Google Slaytlar", 
"PDF":"PDF", "Word Document":"Word Belgesi", "Excel Spreadsheet":"Excel Tablosu", "Modified":"De\u011fi\u015ftirildi", "Connect":"Ba\u011flan", "Connect to see more":"Daha fazla g\u00f6rmek i\u00e7in ba\u011flan\u0131n", "Connect Google account":"Google hesab\u0131na ba\u011flan\u0131n", "Title not available":"Ba\u015fl\u0131\u011fa eri\u015filemiyor", "Open containing folder":"Bulundu\u011fu klas\u00f6r\u00fc a\u00e7", "Cell Background":"H\u00fccre Arka Plan\u0131", "Cell Alignment":"H\u00fccre Hizalama", 
"Align content to top":"\u0130\u00e7eri\u011fi \u00fcste yasla", "Align content to center":"\u0130\u00e7eri\u011fi ortaya hizala", "Align content to bottom":"\u0130\u00e7eri\u011fi alta yasla", "Distribute Columns Evenly":"S\u00fctunlar\u0131 E\u015fit Olarak Da\u011f\u0131t", "Match Note Width":"Not Geni\u015fli\u011fini E\u015fle", "Delete Selected Column(s)":"Se\u00e7ili S\u00fctunlar\u0131 Sil", "Delete Selected Row(s)":"Se\u00e7ili Sat\u0131rlar\u0131 Sil", "Delete Table":"Tabloyu Sil", "Merge Cells":"H\u00fccreleri Birle\u015ftir", 
"Unmerge Cells":"H\u00fccreleri \u00c7\u00f6z", "Find text in note":"Not i\u00e7indeki metni bulun", "Next":"\u0130leri", "Previous":"\u00d6nceki", "Match case":"B\u00fcy\u00fck k\u00fc\u00e7\u00fck harf e\u015fle\u015ftir", "Replace with":"\u015eununla de\u011fi\u015ftir:", "Replace":"De\u011fi\u015ftir", "Replace All":"T\u00fcm\u00fcn\u00fc De\u011fi\u015ftir", "No matches found":"E\u015fle\u015fme bulunamad\u0131", "Match":"E\u015fle\u015ftir", "of":"/", "Edit & Annotate":"D\u00fczenle ve A\u00e7\u0131klama Ekle", 
"Full Screen Preview":"Tam Ekran \u00d6nizleme", "More Actions":"Di\u011fer \u0130\u015flemler", "Full Screen":"Tam Ekran", "Annotate":"A\u00e7\u0131klama ekle", "Reset Image Size":"G\u00f6r\u00fcnt\u00fc Boyutunu S\u0131f\u0131rla", "Edit":"D\u00fczenle", "Delete":"Sil", "Cancel":"\u0130ptal", "Save":"Kaydet", "Undo":"Geri al", "Download failed":"\u0130ndirme ba\u015far\u0131s\u0131z", "Tap to Download":"\u0130ndirmek i\u00e7in Dokunun", "placeholder-copy":"Yazmaya ba\u015flay\u0131n veya dosyalar\u0131 buraya s\u00fcr\u00fckleyin", 
"placeholder-copy-templates":"Yazmaya ba\u015flay\u0131n, dosyalar\u0131 s\u00fcr\u00fckleyin veya <button>\u015eablon</button> se\u00e7in", "placeholder-copy-mobile":"Yazmaya ba\u015flay\u0131n", "placeholder-copy-mobile-templates":"Yazmaya ba\u015flay\u0131n veya <button>\u015eablon</button> se\u00e7in", "Template":"\u015eablon", "New Template":"Yeni \u015eablon", "Title":"Ba\u015fl\u0131k", "Save as template":"\u015eablon olarak kaydet", "Save as Template":"\u015eablon Olarak Kaydet", "template-dialogs-create-warning":"Ekler ve b\u00fcy\u00fck resimler \u015fablona dahil edilmez.", 
"Rename template":"\u015eablonu yeniden adland\u0131r", "Rename Template":"\u015eablonu Yeniden Adland\u0131r", "Delete template":"\u015eablonu sil", "Delete Template":"\u015eablonu Sil", "template-dialogs-delete-info":'"{TITLE}" adl\u0131 \u015fablonu silmek istedi\u011finizden emin misiniz?\n\nOrijinal not ve bu \u015fablondan olu\u015fturulan notlar etkilenmeyecek.', "Write task":"G\u00f6revi yaz", "Due Date":"Biti\u015f Tarihi", "Tomorrow":"Yar\u0131n", "Today":"Bug\u00fcn", "Yesterday":"D\u00fcn", 
"Retry":"Yeniden dene", "Unable to load task":"G\u00f6rev y\u00fcklenemiyor", "Change to task":"G\u00f6reve d\u00f6n\u00fc\u015ft\u00fcr"};
goog.provide("uno.i18n.uk");
uno.i18n.uk.textEntries = {"Not available offline":"\u041d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0438\u0439 \u0432 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u043e\u043c\u0443 \u0440\u0435\u0436\u0438\u043c\u0456", "Not available":"\u041d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0438\u0439", "Tap to request access":"\u0422\u043e\u0440\u043a\u043d\u0456\u0442\u044c\u0441\u044f, \u0449\u043e\u0431 \u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 \u0434\u043e\u0441\u0442\u0443\u043f", 
"Click to request access":"\u041d\u0430\u0442\u0438\u0441\u043d\u0456\u0442\u044c, \u0449\u043e\u0431 \u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 \u0434\u043e\u0441\u0442\u0443\u043f", "Open":"\u0412\u0456\u0434\u043a\u0440\u0438\u0442\u0438", "Copy link":"\u041a\u043e\u043f\u0456\u044e\u0432\u0430\u0442\u0438 \u043f\u043e\u0441\u0438\u043b\u0430\u043d\u043d\u044f", "Google Drive":"\u0414\u0438\u0441\u043a Google", "Google Docs":"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438 Google", 
"Google Sheets":"\u0422\u0430\u0431\u043b\u0438\u0446\u044f Google", "Google Slides":"\u041f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0456\u044f Google", "PDF":"PDF", "Word Document":"\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442 Word", "Excel Spreadsheet":"\u0422\u0430\u0431\u043b\u0438\u0446\u044f Excel", "Modified":"\u0417\u043c\u0456\u043d\u0435\u043d\u0438\u0439", "Connect":"\u041f\u0456\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0438\u0441\u044f", "Connect to see more":"\u041f\u0456\u0434\u043a\u043b\u044e\u0447\u0456\u0442\u044c, \u0449\u043e\u0431 \u0434\u0456\u0437\u043d\u0430\u0442\u0438\u0441\u044f \u0431\u0456\u043b\u044c\u0448\u0435", 
"Connect Google account":"\u041f\u0456\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0438 \u043e\u0431\u043b\u0456\u043a\u043e\u0432\u0438\u0439 \u0437\u0430\u043f\u0438\u0441 Google", "Title not available":"\u041d\u0430\u0437\u0432\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430", "Open containing folder":"\u0412\u0456\u0434\u043a\u0440\u0438\u0442\u0438 \u043f\u0430\u043f\u043a\u0443", "Cell Background":"\u0424\u043e\u043d \u043a\u043b\u0456\u0442\u0438\u043d\u043a\u0438", "Cell Alignment":"\u0412\u0438\u0440\u0456\u0432\u043d\u044e\u0432\u0430\u043d\u043d\u044f \u0443 \u043a\u043b\u0456\u0442\u0438\u043d\u0446\u0456", 
"Align content to top":"\u0412\u0438\u0440\u0456\u0432\u043d\u044f\u0442\u0438 \u0437\u0430 \u0432\u0435\u0440\u0445\u043d\u0456\u043c \u043a\u0440\u0430\u0454\u043c", "Align content to center":"\u0412\u0438\u0440\u0456\u0432\u043d\u044f\u0442\u0438 \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443", "Align content to bottom":"\u0412\u0438\u0440\u0456\u0432\u043d\u044f\u0442\u0438 \u0437\u0430 \u043d\u0438\u0436\u043d\u0456\u043c \u043a\u0440\u0430\u0454\u043c", "Distribute Columns Evenly":"\u0412\u0438\u0440\u0456\u0432\u043d\u044f\u0442\u0438 \u0448\u0438\u0440\u0438\u043d\u0443 \u0441\u0442\u043e\u0432\u043f\u0446\u0456\u0432", 
"Match Note Width":"\u0412\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u043d\u043e \u0434\u043e \u0448\u0438\u0440\u0438\u043d\u0438 \u043d\u043e\u0442\u0430\u0442\u043a\u0438", "Delete Selected Column(s)":"\u0412\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u0432\u0438\u0431\u0440\u0430\u043d\u0438\u0439 \u0441\u0442\u043e\u0432\u043f\u0435\u0446\u044c", "Delete Selected Row(s)":"\u0412\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u0432\u0438\u0431\u0440\u0430\u043d\u0438\u0439 \u0440\u044f\u0434\u043e\u043a", 
"Delete Table":"\u0412\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044e", "Merge Cells":"\u041e\u0431'\u0454\u0434\u043d\u0430\u0442\u0438 \u043a\u043b\u0456\u0442\u0438\u043d\u043a\u0438", "Unmerge Cells":"\u0421\u043a\u0430\u0441\u0443\u0432\u0430\u0442\u0438 \u043e\u0431\u2019\u0454\u0434\u043d\u0430\u043d\u043d\u044f \u043a\u043b\u0456\u0442\u0438\u043d\u043e\u043a", "Find text in note":"\u0428\u0443\u043a\u0430\u0442\u0438 \u0432 \u043d\u043e\u0442\u0430\u0442\u0446\u0456", 
"Next":"\u0412\u043f\u0435\u0440\u0435\u0434", "Previous":"\u041d\u0430\u0437\u0430\u0434", "Match case":"\u0417 \u0443\u0440\u0430\u0445\u0443\u0432\u0430\u043d\u043d\u044f\u043c \u0440\u0435\u0433\u0456\u0441\u0442\u0440\u0443", "Replace with":"\u0417\u0430\u043c\u0456\u043d\u0438\u0442\u0438 \u043d\u0430", "Replace":"\u0417\u0430\u043c\u0456\u043d\u0438\u0442\u0438", "Replace All":"\u0417\u0430\u043c\u0456\u043d\u0438\u0442\u0438 \u0432\u0441\u0456", "No matches found":"\u0417\u0431\u0456\u0433\u0456\u0432 \u043d\u0435 \u0437\u043d\u0430\u0439\u0434\u0435\u043d\u043e", 
"Match":"\u0417\u0431\u0456\u0433", "of":"\u0437", "Edit & Annotate":"\u0420\u0435\u0434\u0430\u0433\u0443\u0432\u0430\u0442\u0438 \u0442\u0430 \u0434\u043e\u0434\u0430\u0442\u0438 \u043f\u0440\u0438\u043c\u0456\u0442\u043a\u0438", "Full Screen Preview":"\u041f\u043e\u043f\u0435\u0440\u0435\u0434\u043d\u0456\u0439 \u043f\u0435\u0440\u0435\u0433\u043b\u044f\u0434 \u043d\u0430 \u0432\u0435\u0441\u044c \u0435\u043a\u0440\u0430\u043d", "More Actions":"\u0411\u0456\u043b\u044c\u0448\u0435 \u0434\u0456\u0439", 
"Full Screen":"\u041d\u0430 \u0432\u0435\u0441\u044c \u0435\u043a\u0440\u0430\u043d", "Annotate":"\u0414\u043e\u0434\u0430\u0442\u0438 \u043f\u0440\u0438\u043c\u0456\u0442\u043a\u0443", "Reset Image Size":"\u0412\u0456\u0434\u043d\u043e\u0432\u0438\u0442\u0438 \u0440\u043e\u0437\u043c\u0456\u0440 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f", "Edit":"\u0420\u0435\u0434\u0430\u0433\u0443\u0432\u0430\u0442\u0438", "Delete":"\u0412\u0438\u0434\u0430\u043b\u0438\u0442\u0438", "Cancel":"\u0421\u043a\u0430\u0441\u0443\u0432\u0430\u0442\u0438", 
"Save":"\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438", "Undo":"\u0421\u043a\u0430\u0441\u0443\u0432\u0430\u0442\u0438", "Download failed":"\u041d\u0435 \u0432\u0434\u0430\u043b\u043e\u0441\u044f \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0438\u0442\u0438", "Tap to Download":"\u0422\u043e\u0440\u043a\u043d\u0456\u0442\u044c\u0441\u044f, \u0449\u043e\u0431 \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0438\u0442\u0438", "placeholder-copy":"\u041f\u043e\u0447\u043d\u0456\u0442\u044c \u043d\u0430\u0431\u0438\u0440\u0430\u0442\u0438 \u0442\u0435\u043a\u0441\u0442 \u0430\u0431\u043e \u043f\u0435\u0440\u0435\u0442\u044f\u0433\u043d\u0456\u0442\u044c \u0441\u044e\u0434\u0438 \u0444\u0430\u0439\u043b\u0438", 
"placeholder-copy-templates":"\u041f\u043e\u0447\u043d\u0456\u0442\u044c \u043d\u0430\u0431\u0438\u0440\u0430\u0442\u0438 \u0442\u0435\u043a\u0441\u0442, \u043f\u0435\u0440\u0435\u0442\u044f\u0433\u043d\u0456\u0442\u044c \u0444\u0430\u0439\u043b\u0438 \u0430\u0431\u043e \u0432\u0438\u0431\u0435\u0440\u0456\u0442\u044c <button>\u0448\u0430\u0431\u043b\u043e\u043d</button>", "placeholder-copy-mobile":"\u041f\u043e\u0447\u043d\u0456\u0442\u044c \u043d\u0430\u0431\u0438\u0440\u0430\u0442\u0438 \u0442\u0435\u043a\u0441\u0442", 
"placeholder-copy-mobile-templates":"\u041f\u043e\u0447\u043d\u0456\u0442\u044c \u043d\u0430\u0431\u0438\u0440\u0430\u0442\u0438 \u0442\u0435\u043a\u0441\u0442 \u0430\u0431\u043e \u0432\u0438\u0431\u0435\u0440\u0456\u0442\u044c <button>\u0448\u0430\u0431\u043b\u043e\u043d</button>", "Template":"\u0428\u0430\u0431\u043b\u043e\u043d", "New Template":"\u041d\u043e\u0432\u0438\u0439 \u0448\u0430\u0431\u043b\u043e\u043d", "Title":"\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a", "Save as template":"\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438 \u044f\u043a \u0448\u0430\u0431\u043b\u043e\u043d", 
"Save as Template":"\u0417\u0431\u0435\u0440\u0435\u0433\u0442\u0438 \u044f\u043a \u0448\u0430\u0431\u043b\u043e\u043d", "template-dialogs-create-warning":"\u0412\u043a\u043b\u0430\u0434\u0435\u043d\u043d\u044f \u0442\u0430 \u0432\u0435\u043b\u0438\u043a\u0456 \u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043d\u044f \u043d\u0435 \u0431\u0443\u0434\u0435 \u0434\u043e\u0434\u0430\u043d\u043e \u0434\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443.", "Rename template":"\u041f\u0435\u0440\u0435\u0439\u043c\u0435\u043d\u0443\u0432\u0430\u0442\u0438 \u0448\u0430\u0431\u043b\u043e\u043d", 
"Rename Template":"\u041f\u0435\u0440\u0435\u0439\u043c\u0435\u043d\u0443\u0432\u0430\u0442\u0438 \u0448\u0430\u0431\u043b\u043e\u043d", "Delete template":"\u0412\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u0448\u0430\u0431\u043b\u043e\u043d", "Delete Template":"\u0412\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u0448\u0430\u0431\u043b\u043e\u043d", "template-dialogs-delete-info":"\u0421\u043f\u0440\u0430\u0432\u0434\u0456 \u0432\u0438\u0434\u0430\u043b\u0438\u0442\u0438 \u0448\u0430\u0431\u043b\u043e\u043d \u00ab{TITLE}\u00bb?\n\n\u0426\u044f \u0434\u0456\u044f \u043d\u0435 \u043f\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0440\u0438\u0433\u0456\u043d\u0430\u043b\u0456 \u043d\u043e\u0442\u0430\u0442\u043a\u0438 \u0442\u0430 \u043d\u0430 \u0431\u0443\u0434\u044c-\u044f\u043a\u0456\u0439 \u043d\u043e\u0442\u0430\u0442\u0446\u0456, \u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0456\u0439 \u0456\u0437 \u0446\u044c\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443.", 
"Write task":"\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u0438 \u0437\u0430\u0432\u0434\u0430\u043d\u043d\u044f", "Due Date":"\u0422\u0435\u0440\u043c\u0456\u043d", "Tomorrow":"\u0417\u0430\u0432\u0442\u0440\u0430", "Today":"\u0421\u044c\u043e\u0433\u043e\u0434\u043d\u0456", "Yesterday":"\u0412\u0447\u043e\u0440\u0430", "Retry":"\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0438", "Unable to load task":"\u041d\u0435 \u0432\u0434\u0430\u043b\u043e\u0441\u044f \u0437\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0438\u0442\u0438 \u0437\u0430\u0432\u0434\u0430\u043d\u043d\u044f", 
"Change to task":"\u0417\u0440\u043e\u0431\u0438\u0442\u0438 \u0437\u0430\u0432\u0434\u0430\u043d\u043d\u044f\u043c"};
goog.provide("uno.i18n.vi");
uno.i18n.vi.textEntries = {"Not available offline":"Kh\u00f4ng d\u00f9ng \u0111\u01b0\u1ee3c \u1edf ch\u1ebf \u0111\u1ed9 ngo\u1ea1i tuy\u1ebfn", "Not available":"Kh\u00f4ng c\u00f3 s\u1eb5n", "Tap to request access":"Nh\u1ea5p \u0111\u1ec3 y\u00eau c\u1ea7u quy\u1ec1n truy c\u1eadp", "Click to request access":"Nh\u1ea5p \u0111\u1ec3 y\u00eau c\u1ea7u quy\u1ec1n truy c\u1eadp", "Open":"M\u1edf", "Copy link":"Sao ch\u00e9p li\u00ean k\u1ebft", "Google Drive":"Google Drive", "Google Docs":"Google Docs", 
"Google Sheets":"Google Sheets", "Google Slides":"Google Slides", "PDF":"PDF", "Word Document":"T\u00e0i li\u1ec7u Word", "Excel Spreadsheet":"B\u1ea3ng t\u00ednh Excel", "Modified":"\u0110\u00e3 s\u1eeda \u0111\u1ed5i", "Connect":"K\u1ebft n\u1ed1i", "Connect to see more":"K\u1ebft n\u1ed1i \u0111\u1ec3 xem chi ti\u1ebft", "Connect Google account":"K\u1ebft n\u1ed1i v\u1edbi t\u00e0i kho\u1ea3n Google", "Title not available":"Ti\u00eau \u0111\u1ec1 kh\u00f4ng c\u00f3 s\u1eb5n", "Open containing folder":"M\u1edf th\u01b0 m\u1ee5c ch\u1ee9a", 
"Cell Background":"H\u00ecnh n\u1ec1n c\u1ee7a \u00f4", "Cell Alignment":"C\u0103n ch\u1ec9nh \u00f4", "Align content to top":"C\u0103n ch\u1ec9nh n\u1ed9i dung l\u00ean tr\u00ean c\u00f9ng", "Align content to center":"C\u0103n ch\u1ec9nh n\u1ed9i dung v\u00e0o trung t\u00e2m", "Align content to bottom":"C\u0103n ch\u1ec9nh n\u1ed9i dung xu\u1ed1ng d\u01b0\u1edbi c\u00f9ng", "Distribute Columns Evenly":"Ph\u00e2n b\u1ed1 c\u00e1c c\u1ed9t \u0111\u1ec1u nhau", "Match Note Width":"Kh\u1edbp chi\u1ec1u r\u1ed9ng ghi ch\u00fa", 
"Delete Selected Column(s)":"X\u00f3a (nh\u1eefng) c\u1ed9t \u0111\u00e3 ch\u1ecdn", "Delete Selected Row(s)":"X\u00f3a (nh\u1eefng) h\u00e0ng \u0111\u00e3 ch\u1ecdn", "Delete Table":"X\u00f3a b\u1ea3ng", "Merge Cells":"H\u1ee3p nh\u1ea5t \u00f4", "Unmerge Cells":"H\u1ee7y h\u1ee3p nh\u1ea5t \u00f4", "Find text in note":"T\u00ecm v\u0103n b\u1ea3n trong ghi ch\u00fa", "Next":"Ti\u1ebfp theo", "Previous":"Tr\u01b0\u1edbc", "Match case":"Kh\u1edbp ch\u1eef hoa/th\u01b0\u1eddng", "Replace with":"Thay th\u1ebf b\u1eb1ng", 
"Replace":"Thay th\u1ebf", "Replace All":"Thay th\u1ebf T\u1ea5t c\u1ea3", "No matches found":"Kh\u00f4ng so kh\u1edbp n\u00e0o \u0111\u01b0\u1ee3c t\u00ecm th\u1ea5y", "Match":"Kh\u1edbp", "of":"c\u1ee7a", "Edit & Annotate":"Ch\u1ec9nh s\u1eeda & ch\u00fa th\u00edch", "Full Screen Preview":"Xem tr\u01b0\u1edbc \u1edf ch\u1ebf \u0111\u1ed9 to\u00e0n m\u00e0n h\u00ecnh", "More Actions":"Thao t\u00e1c kh\u00e1c", "Full Screen":"To\u00e0n M\u00e0n H\u00ecnh", "Annotate":"Ch\u00fa th\u00edch", "Reset Image Size":"\u0110\u1eb7t l\u1ea1i k\u00edch th\u01b0\u1edbc \u1ea3nh", 
"Edit":"Ch\u1ec9nh s\u1eeda", "Delete":"X\u00f3a", "Cancel":"H\u1ee7y", "Save":"L\u01b0u", "Undo":"Ho\u00e0n t\u00e1c", "Download failed":"Kh\u00f4ng th\u1ec3 t\u1ea3i xu\u1ed1ng", "Tap to Download":"G\u00f5 \u0111\u1ec3 T\u1ea3i xu\u1ed1ng", "placeholder-copy":"B\u1eaft \u0111\u1ea7u vi\u1ebft ho\u1eb7c k\u00e9o t\u1ec7p v\u00e0o \u0111\u00e2y", "placeholder-copy-templates":"B\u1eaft \u0111\u1ea7u vi\u1ebft, k\u00e9o t\u1ec7p ho\u1eb7c ch\u1ecdn m\u1ed9t <button>M\u1eabu</button>", "placeholder-copy-mobile":"B\u1eaft \u0111\u1ea7u vi\u1ebft", 
"placeholder-copy-mobile-templates":"B\u1eaft \u0111\u1ea7u vi\u1ebft ho\u1eb7c ch\u1ecdn m\u1ed9t <button>M\u1eabu</button>", "Template":"M\u1eabu", "New Template":"M\u1eabu m\u1edbi", "Title":"Ti\u00eau \u0111\u1ec1", "Save as template":"L\u01b0u th\u00e0nh m\u1eabu", "Save as Template":"L\u01b0u th\u00e0nh m\u1eabu", "template-dialogs-create-warning":"Kh\u00f4ng th\u1ec3 \u0111\u01b0a t\u1ec7p \u0111\u00ednh k\u00e8m v\u00e0 h\u00ecnh \u1ea3nh c\u1ee1 l\u1edbn v\u00e0o m\u1eabu.", "Rename template":"\u0110\u1ed5i t\u00ean m\u1eabu", 
"Rename Template":"\u0110\u1ed5i t\u00ean m\u1eabu", "Delete template":"X\u00f3a m\u1eabu", "Delete Template":"X\u00f3a m\u1eabu", "template-dialogs-delete-info":"B\u1ea1n c\u00f3 ch\u1eafc b\u1ea1n mu\u1ed1n x\u00f3a m\u1eabu \u201c{TITLE}\u201d kh\u00f4ng?\n\nGhi ch\u00fa ban \u0111\u1ea7u v\u00e0 m\u1ecdi ghi ch\u00fa t\u1ea1o t\u1eeb m\u1eabu n\u00e0y s\u1ebd kh\u00f4ng b\u1ecb \u1ea3nh h\u01b0\u1edfng.", "Write task":"Vi\u1ebft nhi\u1ec7m v\u1ee5", "Due Date":"Ng\u00e0y h\u1ebft h\u1ea1n", "Tomorrow":"Ng\u00e0y mai", 
"Today":"H\u00f4m nay", "Yesterday":"H\u00f4m qua", "Retry":"Th\u1eed l\u1ea1i", "Unable to load task":"Unable to load task", "Change to task":"Change to task"};
goog.provide("uno.i18n.zh_CN");
uno.i18n.zh_CN.textEntries = {"Not available offline":"\u672a\u79bb\u7ebf\u7684\u7b14\u8bb0\u672c", "Not available":"\u4e0d\u53ef\u7528", "Tap to request access":"\u70b9\u51fb\u7533\u8bf7\u6743\u9650", "Click to request access":"\u70b9\u51fb\u7533\u8bf7\u6743\u9650", "Open":"\u6253\u5f00", "Copy link":"\u590d\u5236\u94fe\u63a5", "Google Drive":"Google Drive", "Google Docs":"Google\u6587\u6863", "Google Sheets":"Google Sheets", "Google Slides":"Google Slides", "PDF":"PDF", "Word Document":"Word\u6587\u6863", 
"Excel Spreadsheet":"Excel\u6570\u636e\u8868\u683c", "Modified":"\u5df2\u4fee\u6539", "Connect":"\u8fde\u63a5", "Connect to see more":"\u8fde\u63a5\u67e5\u770b\u66f4\u591a", "Connect Google account":"\u8fde\u63a5Google\u5e10\u6237", "Title not available":"\u6807\u9898\u4e0d\u53ef\u7528", "Open containing folder":"\u6253\u5f00\u5305\u542b\u7684\u6587\u4ef6\u5939", "Cell Background":"\u5355\u5143\u683c\u80cc\u666f", "Cell Alignment":"\u5355\u5143\u683c\u5bf9\u9f50", "Align content to top":"\u9876\u7aef\u5bf9\u9f50", 
"Align content to center":"\u5c45\u4e2d\u5bf9\u9f50", "Align content to bottom":"\u5e95\u90e8\u5bf9\u9f50", "Distribute Columns Evenly":"\u5e73\u5747\u5206\u5e03\u5404\u5217", "Match Note Width":"\u5339\u914d\u7b14\u8bb0\u5bbd\u5ea6", "Delete Selected Column(s)":"\u5220\u9664\u9009\u4e2d\u7684\u5217", "Delete Selected Row(s)":"\u5220\u9664\u9009\u4e2d\u7684\u884c", "Delete Table":"\u5220\u9664\u8868\u683c", "Merge Cells":"\u5408\u5e76\u5355\u5143\u683c", "Unmerge Cells":"\u53d6\u6d88\u5408\u5e76\u5355\u5143\u683c", 
"Find text in note":"\u5728\u7b14\u8bb0\u4e2d\u641c\u7d22\u6587\u5b57", "Next":"\u4e0b\u4e00\u6761", "Previous":"\u4e0a\u4e00\u6761", "Match case":"\u5339\u914d\u5927\u5c0f\u5199", "Replace with":"\u66ff\u6362\u4e3a", "Replace":"\u66ff\u6362", "Replace All":"\u66ff\u6362\u5168\u90e8", "No matches found":"\u627e\u4e0d\u5230\u7b26\u5408\u9879\u76ee", "Match":"\u5339\u914d", "of":"\u7684", "Edit & Annotate":"\u7f16\u8f91 & \u6807\u6ce8", "Full Screen Preview":"\u5168\u5c4f\u9884\u89c8", "More Actions":"\u66f4\u591a\u64cd\u4f5c", 
"Full Screen":"\u5168\u5c4f", "Annotate":"\u6807\u6ce8", "Reset Image Size":"\u91cd\u65b0\u8bbe\u7f6e\u56fe\u7247\u5927\u5c0f", "Edit":"\u7f16\u8f91", "Delete":"\u5220\u9664", "Cancel":"\u53d6\u6d88", "Save":"\u4fdd\u5b58", "Undo":"\u64a4\u9500", "Download failed":"\u4e0b\u8f7d\u5931\u8d25", "Tap to Download":"\u70b9\u51fb\u4e0b\u8f7d", "placeholder-copy":"\u5f00\u59cb\u4e66\u5199\u6216\u8005\u5c06\u6587\u4ef6\u62d6\u5230\u6b64\u5904", "placeholder-copy-templates":"\u5f00\u59cb\u4e66\u5199\u3001\u62d6\u52a8\u6587\u4ef6\u6216\u9009\u62e9<button>\u6a21\u677f</button>", 
"placeholder-copy-mobile":"\u5f00\u59cb\u4e66\u5199", "placeholder-copy-mobile-templates":"\u5f00\u59cb\u4e66\u5199\u6216\u9009\u62e9<button>\u6a21\u677f</button>", "Template":"\u6a21\u677f", "New Template":"\u65b0\u5efa\u6a21\u677f", "Title":"\u6807\u9898", "Save as template":"\u4fdd\u5b58\u4e3a\u6a21\u677f", "Save as Template":"\u4fdd\u5b58\u4e3a\u6a21\u677f", "template-dialogs-create-warning":"\u6a21\u677f\u4e2d\u5c06\u4e0d\u5305\u542b\u9644\u4ef6\u548c\u5927\u56fe\u7247\u3002", "Rename template":"\u91cd\u547d\u540d\u6a21\u677f", 
"Rename Template":"\u91cd\u547d\u540d\u6a21\u677f", "Delete template":"\u5220\u9664\u6a21\u677f", "Delete Template":"\u5220\u9664\u6a21\u677f", "template-dialogs-delete-info":"\u786e\u5b9a\u8981\u5220\u9664\u6a21\u677f\u201c{TITLE}\u201d\u5417?\n\n\u539f\u59cb\u7b14\u8bb0\u4ee5\u53ca\u901a\u8fc7\u6b64\u6a21\u677f\u521b\u5efa\u7684\u4efb\u4f55\u7b14\u8bb0\u5747\u4e0d\u4f1a\u53d7\u5230\u5f71\u54cd\u3002", "Write task":"\u5199\u4e0b\u4efb\u52a1", "Due Date":"\u5230\u671f\u65e5\u671f", "Tomorrow":"\u660e\u5929", 
"Today":"\u4eca\u5929", "Yesterday":"\u6628\u5929", "Retry":"\u91cd\u8bd5", "Unable to load task":"\u65e0\u6cd5\u52a0\u8f7d\u4efb\u52a1", "Change to task":"\u4efb\u52a1\u66f4\u6539"};
goog.provide("uno.i18n.zh_TW");
uno.i18n.zh_TW.textEntries = {"Not available offline":"\u4e0d\u53ef\u96e2\u7dda\u5b58\u53d6", "Not available":"\u4e0d\u9069\u7528", "Tap to request access":"\u9ede\u64ca\u4ee5\u8acb\u6c42\u5b58\u53d6", "Click to request access":"\u9ede\u64ca\u4ee5\u8acb\u6c42\u5b58\u53d6", "Open":"\u958b\u555f", "Copy link":"\u8907\u88fd\u9023\u7d50", "Google Drive":"Google \u96f2\u7aef\u786c\u789f", "Google Docs":"Google \u6587\u4ef6", "Google Sheets":"Google \u8a66\u7b97\u8868", "Google Slides":"Google \u7c21\u5831", 
"PDF":"PDF", "Word Document":"Word \u6587\u4ef6", "Excel Spreadsheet":"Excel \u8a66\u7b97\u8868", "Modified":"\u5df2\u4fee\u6539", "Connect":"\u9023\u7d50", "Connect to see more":"\u9023\u7d50\u4ee5\u770b\u5230\u66f4\u591a", "Connect Google account":"\u9023\u7d50 Google \u5e33\u6236", "Title not available":"\u7121\u6a19\u984c", "Open containing folder":"\u958b\u555f\u6240\u5c6c\u8cc7\u6599\u593e", "Cell Background":"\u8868\u683c\u5132\u5b58\u683c\u80cc\u666f\u984f\u8272", "Cell Alignment":"\u5132\u5b58\u683c\u5167\u6587\u5b57\u5c0d\u9f4a", 
"Align content to top":"\u9f4a\u9802", "Align content to center":"\u7f6e\u4e2d\u5c0d\u9f4a", "Align content to bottom":"\u9f4a\u5e95", "Distribute Columns Evenly":"\u5e73\u5747\u5206\u4f48\u6b04\u4f4d", "Match Note Width":"\u7b26\u5408\u8a18\u4e8b\u5bec", "Delete Selected Column(s)":"\u522a\u9664\u9078\u53d6\u7684\u6b04", "Delete Selected Row(s)":"\u522a\u9664\u9078\u53d6\u7684\u5217", "Delete Table":"\u522a\u9664\u8868\u683c", "Merge Cells":"\u5408\u4f75\u5132\u5b58\u683c", "Unmerge Cells":"\u53d6\u6d88\u5408\u4f75\u5132\u5b58\u683c", 
"Find text in note":"\u641c\u5c0b\u8a18\u4e8b\u88e1\u7684\u6587\u5b57", "Next":"\u4e0b\u4e00\u500b", "Previous":"\u4e0a\u4e00\u9801", "Match case":"\u7b26\u5408\u5927\u5c0f\u5beb", "Replace with":"\u53d6\u4ee3\u70ba", "Replace":"\u53d6\u4ee3", "Replace All":"\u5168\u90e8\u53d6\u4ee3", "No matches found":"\u627e\u4e0d\u5230\u7b26\u5408\u9805\u76ee", "Match":"\u7b26\u5408", "of":"\u5171", "Edit & Annotate":"\u7de8\u8f2f & \u6a19\u8a3b", "Full Screen Preview":"\u5168\u87a2\u5e55\u9810\u89bd", "More Actions":"\u66f4\u591a\u64cd\u4f5c", 
"Full Screen":"\u5168\u87a2\u5e55", "Annotate":"\u6a19\u8a3b", "Reset Image Size":"\u91cd\u8a2d\u5716\u7247\u5927\u5c0f", "Edit":"\u7de8\u8f2f", "Delete":"\u522a\u9664", "Cancel":"\u53d6\u6d88", "Save":"\u5132\u5b58", "Undo":"\u5fa9\u539f", "Download failed":"\u4e0b\u8f09\u5931\u6557", "Tap to Download":"\u6309\u4e00\u4e0b\u958b\u59cb\u4e0b\u8f09", "placeholder-copy":"\u958b\u59cb\u5c07\u66f8\u5beb\uff0c\u6216\u5c07\u6a94\u6848\u62d6\u66f3\u5230\u6b64", "placeholder-copy-templates":"\u958b\u59cb\u5beb\u4e0b\u3001\u62d6\u66f3\u6a94\u6848\u3001\u6216\u9078\u64c7\u4e00\u500b<button>\u7bc4\u672c</button>", 
"placeholder-copy-mobile":"\u958b\u59cb\u66f8\u5beb", "placeholder-copy-mobile-templates":"\u958b\u59cb\u5beb\u4e0b\u6216\u9078\u64c7\u4e00\u500b<button>\u7bc4\u672c</button>", "Template":"\u7bc4\u672c", "New Template":"\u65b0\u7bc4\u672c", "Title":"\u6a19\u984c", "Save as template":"\u5132\u5b58\u70ba\u7bc4\u672c", "Save as Template":"\u5132\u5b58\u70ba\u7bc4\u672c", "template-dialogs-create-warning":"\u9644\u6a94\u548c\u5927\u578b\u5716\u7247\u4e0d\u6703\u88ab\u5305\u542b\u5728\u7bc4\u672c\u4e2d\u3002", 
"Rename template":"\u91cd\u65b0\u547d\u540d\u7bc4\u672c", "Rename Template":"\u91cd\u65b0\u547d\u540d\u7bc4\u672c", "Delete template":"\u522a\u9664\u7bc4\u672c", "Delete Template":"\u522a\u9664\u7bc4\u672c", "template-dialogs-delete-info":"\u78ba\u5b9a\u8981\u522a\u9664\u7bc4\u672c \u201c{TITLE}\u201d \u55ce\uff1f\n\n\u539f\u59cb\u8a18\u4e8b\u548c\u4efb\u4f55\u4f7f\u7528\u9019\u500b\u7bc4\u672c\u5efa\u7acb\u7684\u8a18\u4e8b\u90fd\u4e0d\u6703\u53d7\u5230\u4efb\u4f55\u5f71\u97ff\u3002", "Write task":"\u5beb\u4e0b\u4efb\u52d9", 
"Due Date":"\u5230\u671f\u65e5", "Tomorrow":"\u660e\u5929", "Today":"\u4eca\u65e5", "Yesterday":"\u6628\u65e5", "Retry":"\u91cd\u8a66", "Unable to load task":"\u7121\u6cd5\u8f09\u5165\u4efb\u52d9", "Change to task":"\u8b8a\u66f4\u70ba\u4efb\u52d9"};
goog.provide("uno.i18n.en_XA");
uno.i18n.en_XA.textEntries = {"Not available offline":"[Not available offline xxxxxxxxx]", "Not available":"[Not available xxxxxxxx]", "Tap to request access":"[Tap to request access xxxxxxxxx]", "Click to request access":"[Click to request access xxxxxxxxxx]", "Open":"[Open xxx]", "Copy link":"[Copy link xxxxxxxx]", "Google Drive":"[Google Drive xxxxxxx]", "Google Docs":"[Google Docs xxxxxx]", "Google Sheets":"[Google Sheets xxxxxxxx]", "Google Slides":"[Google Slides xxxxxxxx]", "PDF":"[PDF xx]", 
"Word Document":"[Word Document xxxxxxxx]", "Excel Spreadsheet":"[Excel Spreadsheet xxxxxxxxxx]", "Modified":"[Modified xxxxxxx]", "Connect":"[Connect xxxxxx]", "Connect to see more":"[Connect to see more xxxxxxxxxx x]", "Connect Google account":"[Connect Google account xxxxxxxxxx]", "Title not available":"[Title not available xxxxxxxxxx x]", "Open containing folder":"[Open containing folder xxxxxxxxxx]", "Cell Background":"[Cell Background xxxxxxxxx]", "Cell Alignment":"[Cell Alignment xxxxxxxx]", 
"Align content to top":"[Align content to top xxxxxxxxx]", "Align content to center":"[Align content to center xxxxxxxxxx]", "Align content to bottom":"[Align content to bottom xxxxxxxxxx]", "Distribute Columns Evenly":"[Distribute Columns Evenly xxxxxxxxxx ]", "Match Note Width":"[Match Note Width xxxxxxxxxx]", "Delete Selected Column(s)":"[Delete Selected Column(s) xxxxxxxxxx ]", "Delete Selected Row(s)":"[Delete Selected Row(s) xxxxxxxxxx]", "Delete Table":"[Delete Table xxxxxxx]", "Merge Cells":"[Merge Cells xxxxxx]", 
"Unmerge Cells":"[Unmerge Cells xxxxxxxx]", "Find text in note":"[Find text in note xxxxxxxxxx]", "Next":"[Next xxx]", "Previous":"[Previous xxxxxxx]", "Match case":"[Match case xxxxxx]", "Replace with":"[Replace with xxxxxxx]", "Replace":"[Replace xxxxxx]", "Replace All":"[Replace All xxxxxx]", "No matches found":"[No matches found xxxxxxxxxx]", "Match":"[Match xxxx]", "of":"[of x]", "Edit & Annotate":"[Edit & Annotate xxxxxxxxx]", "Full Screen Preview":"[Full Screen Preview xxxxxxxxxx x]", "More Actions":"[More Actions xxxxxxx]", 
"Full Screen":"[Full Screen xxxxxx]", "Annotate":"[Annotate xxxxxxx]", "Reset Image Size":"[Reset Image Size xxxxxxxxxx]", "Edit":"[Edit xxx]", "Delete":"[Delete xxxxx]", "Cancel":"[Cancel xxxxx]", "Save":"[Save xxx]", "Undo":"[Undo xxx]", "Download failed":"[Download failed xxxxxxxxx]", "Tap to Download":"[Tap to Download xxxxxxxxx]", "placeholder-copy":"[Start writing or drag files here xxxxxxxxxx xxxx]", "placeholder-copy-templates":"[Start writing, drag files, or choose a <button>Template</button> xxxxxxxxxx xxxxxxxxxx xxxxxxxxx]", 
"placeholder-copy-mobile":"[Start writing xxxxxxxx]", "placeholder-copy-mobile-templates":"[Start writing or choose a <button>Template</button> xxxxxxxxxx xxxxxxxxxx xx]", "Template":"[Template xxxxxxx]", "New Template":"[New Template xxxxxxx]", "Title":"[Title xxxx]", "Save as template":"[Save as template xxxxxxxxxx]", "Save as Template":"[Save as Template xxxxxxxxxx]", "template-dialogs-create-warning":"[Attachments and large images will not be included in the template. xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx]", 
"Rename template":"[Rename template xxxxxxxxx]", "Rename Template":"[Rename Template xxxxxxxxx]", "Delete template":"[Delete template xxxxxxxxx]", "Delete Template":"[Delete Template xxxxxxxxx]", "template-dialogs-delete-info":"[Are you sure you want to delete the template \u201c{TITLE}\u201d?\n\nThe original note and any notes created from this template will not be affected. xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx x]", "Write task":"[Write task xxxxxx]", "Due Date":"[Due Date xxxxxxx]", 
"Tomorrow":"[Tomorrow xxxxxxx]", "Today":"[Today xxxx]", "Yesterday":"[Yesterday xxxxxxxx]", "Retry":"[Retry xxxx]", "Unable to load task":"[Unable to load task xxxxxxxxxx x]", "Change to task":"[Change to task xxxxxxxx]"};
goog.provide("uno.i18n.all");
goog.require("uno.i18n.ar");
goog.require("uno.i18n.cs");
goog.require("uno.i18n.da");
goog.require("uno.i18n.de");
goog.require("uno.i18n.en");
goog.require("uno.i18n.es");
goog.require("uno.i18n.fi");
goog.require("uno.i18n.fr");
goog.require("uno.i18n.id");
goog.require("uno.i18n.it");
goog.require("uno.i18n.ja");
goog.require("uno.i18n.ko");
goog.require("uno.i18n.ms");
goog.require("uno.i18n.nl");
goog.require("uno.i18n.no");
goog.require("uno.i18n.pl");
goog.require("uno.i18n.pt_BR");
goog.require("uno.i18n.pt");
goog.require("uno.i18n.ru");
goog.require("uno.i18n.sv");
goog.require("uno.i18n.th");
goog.require("uno.i18n.tr");
goog.require("uno.i18n.uk");
goog.require("uno.i18n.vi");
goog.require("uno.i18n.zh_CN");
goog.require("uno.i18n.zh_TW");
goog.require("uno.i18n.en_XA");
uno.i18n.all.textEntries = {"ar":uno.i18n.ar.textEntries, "cs":uno.i18n.cs.textEntries, "da":uno.i18n.da.textEntries, "de":uno.i18n.de.textEntries, "en":uno.i18n.en.textEntries, "es":uno.i18n.es.textEntries, "fi":uno.i18n.fi.textEntries, "fr":uno.i18n.fr.textEntries, "id":uno.i18n.id.textEntries, "it":uno.i18n.it.textEntries, "ja":uno.i18n.ja.textEntries, "ko":uno.i18n.ko.textEntries, "ms":uno.i18n.ms.textEntries, "nl":uno.i18n.nl.textEntries, "no":uno.i18n.no.textEntries, "pl":uno.i18n.pl.textEntries, 
"pt_BR":uno.i18n.pt_BR.textEntries, "pt":uno.i18n.pt.textEntries, "ru":uno.i18n.ru.textEntries, "sv":uno.i18n.sv.textEntries, "th":uno.i18n.th.textEntries, "tr":uno.i18n.tr.textEntries, "uk":uno.i18n.uk.textEntries, "vi":uno.i18n.vi.textEntries, "zh_CN":uno.i18n.zh_CN.textEntries, "zh_TW":uno.i18n.zh_TW.textEntries, "en_XA":uno.i18n.en_XA.textEntries};
goog.provide("uno.util.loc");
goog.require("uno.i18n.all");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.loc");
  var util = uno.util;
  var customFallbacks = {zh:"zh_CN"};
  var setDefaults = function() {
    util.loc.defaultLocale = "en";
    util.loc.translation = null;
    util.loc.translations = {};
    util.loc.missingLocales = {};
    util.loc.missingStrings = {};
  };
  setDefaults();
  util.loc.init = function(locale) {
    setDefaults();
    if (locale && customFallbacks[locale]) {
      locale = customFallbacks[locale];
    }
    util.loc.locale = locale;
    if (!util.loc.locale) {
      util.loc.locale = "en";
    }
    util.loc.locale = util.loc.locale.replace(/-/g, "_");
    Object.keys(uno.i18n.all.textEntries).forEach(function(lang) {
      var value = uno.i18n.all.textEntries[lang];
      util.loc.addTranslation(lang, value);
    });
  };
  util.loc.addTranslation = function(locale, translation) {
    util.loc.translations[locale] = translation;
    util.loc.missingStrings[locale] = {};
  };
  util.loc.loadTranslation = function(locale) {
    if (locale && customFallbacks[locale]) {
      locale = customFallbacks[locale];
    }
    if (locale) {
      util.loc.locale = locale;
    }
    if (util.loc.locale == null) {
      log.warning("Language locale has not been configured. Defaulting to " + util.loc.defaultLocale);
      util.loc.locale = util.loc.defaultLocale;
    }
    util.loc.locale = util.loc.locale.replace(/-/g, "_");
    if (util.loc.missingLocales[util.loc.locale]) {
      return;
    }
    if (util.loc.translation !== null && util.loc.translation === util.loc.translations[util.loc.locale]) {
      return;
    }
    util.loc.translation = util.loc.translations[util.loc.locale];
    if (util.loc.translation == null) {
      log.info("There are no translations available for the " + util.loc.locale + " locale");
      util.loc.missingLocales[util.loc.locale] = true;
      if (util.loc.locale.indexOf("_") !== -1) {
        util.loc.locale = util.loc.locale.substr(0, util.loc.locale.indexOf("_"));
        util.loc.translation = util.loc.translations[util.loc.locale];
        if (util.loc.translation == null) {
          log.warning("There are also no translations for the fallback locale " + util.loc.locale);
          util.loc.missingLocales[util.loc.locale] = true;
        }
      }
    }
    if (util.loc.translation != null) {
      log.fine("Using text for " + util.loc.locale);
      Object.keys(util.loc.translation).forEach(function(key) {
        var text = util.loc.translation[key];
        if (text === "") {
          util.loc.translation[key] = null;
        }
      });
      util.loc.missingStrings[locale] = util.loc.missingStrings[locale] || {};
    }
  };
  util.loc.t = function(text, placeholders) {
    var result;
    if (util.loc.translation == null) {
      util.loc.loadTranslation(util.loc.locale);
    }
    if (util.loc.missingLocales[util.loc.locale]) {
      result = text;
    } else {
      if (util.loc.translation[text] == null) {
        if (!util.loc.missingStrings[util.loc.locale]) {
          log.warning("No missingStrings object defined for " + util.loc.locale);
          util.loc.missingStrings[util.loc.locale] = {};
        }
        if (!util.loc.missingStrings[util.loc.locale][text]) {
          log.warning("The " + util.loc.locale + ' locale does not have a translation for "' + text + '"');
          util.loc.missingStrings[util.loc.locale][text] = true;
        }
        result = text;
      } else {
        result = util.loc.translation[text];
      }
    }
    if (placeholders) {
      result = util.loc.replace(result, placeholders);
    }
    return result;
  };
  util.loc.replace = function(text, placeholders) {
    Object.keys(placeholders).forEach(function(token) {
      var value = placeholders[token];
      text = text.replace(new RegExp("{" + token + "}", "g"), value);
    });
    return text;
  };
})();
goog.provide("uno.util.popovermenu.definitions");
goog.require("uno.util.loc");
(function() {
  var t = uno.util.loc.t;
  var popoverMenuDefinitions = {image:[{id:"annotate", icon:"action-edit", label:"Edit & Annotate"}, {id:"fullScreen", icon:"action-preview", label:"Full Screen Preview"}, {id:"moreActions", icon:"action-more-options", label:"More Actions"}]};
  function translateDefinitionLabels(definitions) {
    definitions = JSON.parse(JSON.stringify(definitions));
    Object.keys(definitions).forEach(function(defName) {
      definitions[defName].forEach(function(menuItem) {
        if (menuItem.label) {
          menuItem.label = t(menuItem.label);
        }
      });
    });
    return definitions;
  }
  uno.util.popovermenu.definitions.retrieve = function() {
    return translateDefinitionLabels(popoverMenuDefinitions);
  };
})();
goog.provide("uno.util.popovermenu");
goog.require("goog.debug.Logger");
goog.require("uno.util.popovermenu.definitions");
goog.require("uno.util.react");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.popovermenu");
  var util = uno.util;
  util.popovermenu.setupPopoverMenus = function() {
    util.react.renderPopoverMenu({popoverDefinitions:util.popovermenu.definitions.retrieve(), showPopover:null, targetElement:null, settings:{}});
  };
  util.popovermenu.showPopoverMenu = function(popoverType, targetElement, settings) {
    util.react.renderPopoverMenu({showPopover:popoverType, targetElement:targetElement, settings:settings});
  };
  util.popovermenu.clearPopoverMenu = function() {
    util.react.renderPopoverMenu({showPopover:null, targetElement:null});
  };
  util.popovermenu.presentImagePopoverMenu = function(targetImage, editor) {
    if (!editor.context.images.popoverMenu) {
      return null;
    }
    var annotateSettings = {enabled:editor.config.images.annotate};
    if (annotateSettings.enabled) {
      annotateSettings.action = function() {
        editor.dispatchEvent({type:"annotate", module:"ui-img-buttons", src:util.resource.urlFor(targetImage)});
      };
    }
    var fullScreenSettings = {enabled:editor.config.images.preview};
    if (fullScreenSettings.enabled) {
      fullScreenSettings.action = function() {
        util.preview.requestOpen(editor, targetImage);
      };
    }
    util.popovermenu.showPopoverMenu("image", targetImage, {annotate:annotateSettings, fullScreen:fullScreenSettings, moreActions:{action:function(value, options) {
      options = options || {};
      util.menu.presentImageContextMenu(targetImage, editor, {x:options.x || 0, y:options.y || 0});
    }}});
    return true;
  };
})();
goog.provide("uno.util.img");
goog.require("goog.asserts");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.dom.classlist");
goog.require("uno.components.ImageResizer");
goog.require("uno.util.dom");
goog.require("uno.util.observer");
goog.require("uno.util.popovermenu");
goog.require("uno.util.styles");
goog.require("uno.util.tools");
goog.require("uno.util.zoomscale");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.img");
  var util = uno.util;
  var dom = util.dom;
  var STRUCTTYPES = uno.defs.structuretypes;
  var selectedImage = null;
  var resizer = null;
  var scrollableCandidate = null;
  var scrollableTimeout = null;
  var toolsHiddenByScroll = false;
  util.img.all = function(root) {
    return root.querySelectorAll("img.en-media-image");
  };
  util.img.convertMediaToSlug = function(enmedia, props, editor) {
    var img = new Image;
    goog.dom.classlist.addAll(img, ["en-media", "en-media-image"]);
    img.setAttribute("data-hash", props.hash);
    img.setAttribute("data-type", props.type);
    img.setAttribute("data-url", props.url);
    if (props.elementId) {
      img.id = props.elementId;
    }
    if (props.width != null) {
      img.setAttribute("width", props.width);
    }
    if (props.height != null && editor.hasForeignSource()) {
      img.setAttribute("height", props.height);
    }
    if (img.getAttribute("width")) {
      img.setAttribute("data-width", img.getAttribute("width"));
    }
    if (typeof props.overlayOpacity !== "undefined") {
      img.style.opacity = 1 - parseInt(props.overlayOpacity, 10);
    }
    if (props.overlayImageURL) {
      img.src = props.overlayImageURL;
      img.style.backgroundImage = "url(" + props.url + ")";
      img.style.backgroundSize = "cover";
    } else {
      if (props.url) {
        img.src = props.url;
      }
    }
    goog.dom.replaceNode(img, enmedia);
    return img;
  };
  util.img.createImage = function(src) {
    var img = new Image;
    if (src != null) {
      img.src = src;
    }
    return img;
  };
  util.img.convertClientElementToSlug = function(img) {
    return img;
  };
  util.img.isImage = function(node) {
    return node && goog.dom.classlist.contains(node, "en-media-image");
  };
  util.img.isResource = function(node) {
    return util.img.isImage(node);
  };
  util.img.getSelectedImage = function() {
    return selectedImage;
  };
  util.img.removeOverlay = function(img) {
    if (util.img.isResource(img) && !!img.style.backgroundImage) {
      img.src = img.getAttribute("data-url");
      img.style.backgroundImage = "";
      img.style.backgroundSize = "";
    }
  };
  util.img.loadAsync = function(src) {
    return new Promise(function(resolve, reject) {
      var img = document.createElement("img");
      img.crossOrigin = "Anonymous";
      img.src = src;
      goog.events.listenOnce(img, "load", function() {
        resolve(img);
      });
      goog.events.listenOnce(img, "error", reject);
    });
  };
  util.img.loadFromClientAsync = function(src, client) {
    var fixtures = client && client.fixtures ? client.fixtures.map : null;
    if (fixtures && fixtures[src]) {
      return new Promise(function(resolve, reject) {
        var img = new Image;
        img.crossOrigin = "Anonymous";
        img.src = fixtures[src];
        goog.events.listenOnce(img, "load", function() {
          resolve(img);
        });
        goog.events.listenOnce(img, "error", reject);
      });
    } else {
      return util.img.loadAsync(src);
    }
  };
  util.img.ratioResizeIfNeeded = function(node) {
    return new Promise(function(resolve) {
      var ratio = util.styles.getDevicePixelRatio();
      if (!util.dom.isImg(node) || !node.parentNode || node.hasAttribute("width") || ratio === 1) {
        resolve(false);
        return;
      }
      var resize = function() {
        var width = Math.round(node.naturalWidth / ratio);
        node.setAttribute("width", width);
        node.setAttribute("data-width", width);
        resolve(node);
      };
      if (node.naturalWidth) {
        resize();
      } else {
        goog.events.listenOnce(node, "load", resize);
      }
    });
  };
  util.img.isNaturalSize = function(node) {
    if (!util.dom.isImg(node)) {
      return null;
    }
    var width = parseInt(node.getAttribute("width"), 10);
    var ratio = util.styles.getDevicePixelRatio();
    return !node.hasAttribute("height") && (isNaN(width) || width >= node.naturalWidth / ratio);
  };
  util.img.restoreNaturalSize = function(node, editor) {
    if (!util.dom.isImg(node)) {
      return null;
    }
    var ratio = util.styles.getDevicePixelRatio();
    var changedDimensions = false;
    if (ratio === 1) {
      node.removeAttribute("width");
      node.removeAttribute("data-width");
      changedDimensions = true;
    } else {
      if (node.naturalWidth) {
        var newWidth = Math.round(node.naturalWidth / ratio);
        node.setAttribute("width", newWidth);
        node.setAttribute("data-width", newWidth);
        changedDimensions = true;
      }
    }
    if (changedDimensions) {
      node.removeAttribute("height");
      node.removeAttribute("data-height");
      setTimeout(util.img.layoutResizer, 0);
      editor.dispatchChange();
    }
    return changedDimensions;
  };
  util.img.isSelected = function(nodeOrRange) {
    if (!selectedImage) {
      return false;
    }
    if (util.dom.isElementNode(nodeOrRange)) {
      return nodeOrRange === selectedImage;
    } else {
      if (nodeOrRange && nodeOrRange.isCollapsed && !nodeOrRange.isCollapsed()) {
        var anchorNode = nodeOrRange.getAnchorNode();
        var focusNode = nodeOrRange.getFocusNode();
        if (anchorNode === focusNode && anchorNode.children) {
          for (var i = 0, l = anchorNode.children.length; i < l; i++) {
            if (anchorNode.children[i] === selectedImage) {
              return true;
            }
          }
        }
      }
    }
    return false;
  };
  util.img.preloadTools = function(editor) {
    if (resizer) {
      resizer.element.remove();
      resizer = null;
    }
    if (editor.config.images.resize) {
      resizer = new uno.components.ImageResizer(editor);
      util.tools.append(resizer.element);
    }
  };
  util.img.setSelected = function(img, editor) {
    if (resizer && resizer.resizing || img === selectedImage || !img && !selectedImage) {
      return;
    }
    if (selectedImage) {
      selectedImage.classList.remove("en-media-selected");
      selectedImage = null;
    }
    if (img) {
      scrollableCandidate = getScrollableCandidate(img);
      selectedImage = img;
      selectedImage.classList.add("en-media-selected");
      goog.dom.Range.createFromNodeContents(img).select();
    } else {
      scrollableCandidate = null;
    }
    if (img) {
      if (resizer) {
        resizer.attach(img);
        util.observer.addHandler(util.img.layoutResizer);
      }
      util.popovermenu.presentImagePopoverMenu(img, editor);
    } else {
      if (resizer) {
        resizer.detach();
        util.observer.removeHandler(util.img.layoutResizer);
      }
      util.popovermenu.clearPopoverMenu();
    }
  };
  util.img.hideToolsOnScrollIfNeeded = function(scrollingTarget) {
    if (!scrollableCandidate || scrollingTarget !== scrollableCandidate) {
      return;
    } else {
      if (!toolsHiddenByScroll) {
        document.documentElement.classList.add("scrolling-x");
        toolsHiddenByScroll = true;
      }
    }
    clearTimeout(scrollableTimeout);
    scrollableTimeout = setTimeout(function() {
      util.img.layoutResizer();
      document.documentElement.classList.remove("scrolling-x");
      toolsHiddenByScroll = false;
    }, 200);
  };
  util.img.layoutResizer = function() {
    if (!resizer || !selectedImage || resizer.resizing || !resizer.attached) {
      return;
    }
    var result = resizer.layout();
    if (!result) {
      util.img.setSelected(null);
    }
  };
  function getScrollableCandidate(node) {
    while (node !== document.body) {
      if (getComputedStyle(node).overflowX !== "visible") {
        return node;
      }
      node = node.parentNode;
    }
    return null;
  }
  util.img.getDraggableTarget = function(node) {
    return util.img.isImage(node) && node;
  };
  util.img.getDragContentTypes = function(state) {
    return [STRUCTTYPES.RESOURCE];
  };
  util.img.getDraggedNodes = function(state) {
    return [state.target];
  };
})();
goog.provide("uno.util.attachment");
goog.require("uno.defs");
goog.require("uno.util.loc");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.attachment");
  var defs = uno.defs;
  var util = uno.util;
  var dom = util.dom;
  var STRUCTTYPES = uno.defs.structuretypes;
  util.attachment.CLASS_PREFIX = "en-attach-icon-";
  util.attachment.all = function(root) {
    return root.querySelectorAll(".en-media.en-media-file");
  };
  util.attachment.isAttachment = function(node) {
    return goog.dom.classes.has(node, "en-media-file");
  };
  util.attachment.getIconInfoFromFile = function(displayType, mime, fileName) {
    var fileType;
    if (typeof mime === "string" || typeof fileName === "string") {
      if (mime) {
        fileType = util.attachment.getFileTypeFromMime(mime);
      }
      if (!fileType && fileName) {
        var extension = fileName.match(/^.+\.([0-9a-z]+)$/i);
        if (extension) {
          fileType = extensionToFileType[extension[1]];
        }
      }
    }
    return util.attachment.CLASS_PREFIX + (fileType || "generic");
  };
  util.attachment.getBase64IconFromMime = function(mime) {
    if (mime) {
      var fileType = util.attachment.getFileTypeFromMime(mime);
      if (fileType) {
        var base64Img = extensionIconBase64[fileType];
        if (base64Img) {
          return base64Img;
        }
      }
    }
    return extensionIconBase64.unknown;
  };
  util.attachment.getStringFromFilesize = function(filesize) {
    if (typeof filesize === "string") {
      if (isNaN(+filesize)) {
        return filesize;
      }
      filesize = parseInt(filesize, 10);
    }
    if (typeof filesize !== "number" || isNaN(filesize)) {
      return "";
    }
    var sizes = ["B", "KB", "MB", "GB", "TB"];
    if (filesize === 0) {
      return "0 B";
    }
    var i = Math.floor(Math.log(filesize) / Math.log(1024));
    return Math.round(filesize / Math.pow(1024, i) * 10) / 10 + " " + sizes[i];
  };
  util.attachment.getDraggableTarget = function(node) {
    if (!node || dom.isTextNode(node)) {
      return false;
    }
    return util.attachment.isAttachment(node) && node;
  };
  util.attachment.getDragContentTypes = function(state) {
    return [STRUCTTYPES.RESOURCE];
  };
  util.attachment.getDraggedNodes = function(state) {
    return [state.target];
  };
  var extensionToFileType = {"pdf":"pdf", "djvu":"pdf", "wav":"audio", "aiff":"audio", "flac":"audio", "ogg":"audio", "ac3":"audio", "mp3":"audio", "avi":"video", "mp4":"video", "mpg":"video", "mpeg":"video", "vob":"video", "pptx":"ppt", "ppt":"ppt", "sdd":"ppt", "odp":"ppt", "doc":"word", "dot":"word", "docx":"word", "odt":"word", "xls":"excel", "xlsx":"excel", "ods":"excel", "csv":"excel", "zip":"zip", "zipx":"zip", "gz":"zip", "tgz":"zip", "rar":"zip", "iso":"zip", "tar":"zip", "mar":"zip", "bz2":"zip", 
  "cab":"zip", "arc":"zip", "dmg":"zip", "jar":"zip", "war":"zip", "7z":"zip", "svg":"svg", "svgz":"svg", "ai":"svg", "cdr":"svg", "wmf":"svg", "drw":"svg", "eps":"svg", "emz":"svg", "odg":"svg", "pic":"svg", "sda":"svg", "swf":"svg", "sketch":"svg", "cad":"3d", "skp":"3d", "stl":"3d", "123dx":"3d", "anim":"3d", "3d":"3d", "3dr":"3d", "3ds":"3d", "dwg":"3d", "dxf":"3d", "pfb":"font", "ttf":"font", "otf":"font", "pages":"pages", "rtf":"pages", "txt":"pages", "numbers":"num", "keynote":"keynote", "key":"keynote", 
  "psd":"edit", "ptg":"edit", "skba":"edit", "pxm":"edit", "xcf":"edit"};
  var mimeToFileType = {"application/pdf":"pdf", "application/mspowerpoint":"ppt", "application/powerpoint":"ppt", "application/vnd.ms-powerpoint":"ppt", "application/x-mspowerpoint":"ppt", "application/vnd.oasis.opendocument.presentation":"ppt", "application/vnd.openxmlformats-officedocument.presentationml.slideshow":"ppt", "application/msword":"word", "application/vnd.oasis.opendocument.text":"word", "application/vnd.openxmlformats-officedocument.wordprocessingml.document":"word", "application/excel":"excel", 
  "application/vnd.ms-excel":"excel", "application/x-excel":"excel", "text/csv":"excel", "application/vnd.oasis.opendocument.spreadsheet":"excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"excel", "application/zip":"zip", "application/x-compress":"zip", "application/x-compressed":"zip", "application/x-zip-compressed":"zip", "multipart/x-zip":"zip", "application/x-gzip":"zip", "application/x-rar-compressed":"zip", "application/x-gtar":"zip", "application/vnd.ms-cab-compressed":"zip", 
  "application/x-apple-diskimage":"zip", "application/x-7z-compressed":"zip", "image/svg+xml":"svg", "application/postscript":"svg", "windows/metafile":"svg", "application/drafting":"svg", "image/pict":"svg", "application/x-shockwave-flash":"svg", "application/x-koan":"3d", "application/sla":"3d", "x-world/x-3dmf":"3d", "application/acad":"3d", "application/dxf":"3d", "application/rtf":"pages", "application/x-rtf":"pages", "text/richtext":"pages", "application/vnd.apple.pages":"pages", "application/x-iwork-pages-sffpages":"pages", 
  "application/vnd.apple.numbers":"numbers", "application/x-iwork-numbers-sffnumbers":"numbers", "application/vnd.apple.keynote":"keynote", "application/x-iwork-keynote-sffkey":"keynote", "application/vnd.google-apps.document":"gdocs", "application/vnd.google-apps.spreadsheet":"gsheets", "application/vnd.google-apps.presentation":"gslides", "unknown":"unknown"};
  var extensionIconBase64 = {"zip":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iIzhGOEM4QSIgZD0iTS0yNTcsNDEwaC0xNmMtMS4xMDUsMC0yLTAuODk1LTItMnYtMjJjMC0xLjEwNSwwLjg5NS0yLDItMmg4djJoLTJ2MmgydjJoLTJ2MmgydjJoLTJ2MmgydjJoLTJ2NGg0di0yaC0ydi0yaDJ2LTJoLTJ2LTJoMnYtMmgtMnYtMmgydi0yaC0ydi0yaDJ2LTJoNmMxLjEwNSwwLDIsMC44OTUsMiwydjIyQy0yNTUsNDA5LjEwNS0yNTUuODk1LDQxMC0yNTcsNDEweiIvPjwvc3ZnPg==", 
  "video":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iI0FENzZBOCIgZD0iTS0yNTMsNDA3aC0yNGMtMS4xMDUsMC0yLTAuODk1LTItMnYtMTZjMC0xLjEwNSwwLjg5NS0yLDItMmgyNGMxLjEwNSwwLDIsMC44OTUsMiwydjE2Qy0yNTEsNDA2LjEwNS0yNTEuODk1LDQwNy0yNTMsNDA3eiBNLTI3NSwzOTBoLTJ2MmgyVjM5MHogTS0yNzUsMzk0aC0ydjJoMlYzOTR6IE0tMjc1LDM5OGgtMnYyaDJWMzk4eiBNLTI3NSw0MDJoLTJ2MmgyVjQwMnogTS0yNTcsMzg5aC0xNnYxNmgxNlYzODl6IE0tMjUzLDM5MGgtMnYyaDJWMzkweiBNLTI1MywzOTRoLTJ2MmgyVjM5NHogTS0yNTMsMzk4aC0ydjJoMlYzOTh6IE0tMjUzLDQwMmgtMnYyaDJWNDAyeiBNLTI1OCw0MDRoLTE0di0xNGgxNFY0MDR6Ii8+PC9zdmc+", 
  "unknown":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iI0YyRjJGMiIgZD0iTS0yNTMuMTE0LDM5NS40NTljMi4yOTUtMy42NTYsMC45MzMtOC4zMy0zLjA0Mi0xMC40NGMtMy45NzUtMi4xMS05LjA1Ny0wLjg1OC0xMS4zNTIsMi43OTdjLTIuMjk1LDMuNjU2LTcuMDE5LDExLjE4LTguNjg4LDEzLjgzOWMtMS42NjksMi42NTgtMC42NzksNi4wNTcsMi4yMTIsNy41OTJjMi44OTEsMS41MzUsNi41ODcsMC42MjQsOC4yNTYtMi4wMzRjMS42NjktMi42NTksNy42NDUtMTIuMTc3LDguNjg4LTEzLjgzOWMxLjA0My0xLjY2MSwwLjQyNC0zLjc4Ni0xLjM4Mi00Ljc0NWMtMS44MDctMC45NTktNC4xMTctMC4zOS01LjE2LDEuMjcyYy0xLjA0NCwxLjY2MS04LjI3MSwxMy4xNzMtOC42ODksMTMuODM4Yy0wLjQxNywwLjY2NS0wLjE2OSwxLjUxNCwwLjU1NCwxLjg5OGMwLjcyMiwwLjM4NCwxLjY0NiwwLjE1NiwyLjA2NC0wLjUwOGMwLjQxNy0wLjY2NSw4LjQ3OS0xMy41MDcsOC42ODgtMTMuODM5YzAuMjA4LTAuMzMyLDAuNjctMC40NDYsMS4wMzItMC4yNTRjMC4zNjEsMC4xOTIsMC40ODUsMC42MTcsMC4yNzYsMC45NDljLTAuMjA5LDAuMzMyLTcuODUzLDEyLjUwOS04LjY4OCwxMy44MzhjLTAuODM0LDEuMzI5LTIuNjgyLDEuNzg1LTQuMTI4LDEuMDE3Yy0xLjQ0NS0wLjc2Ny0xLjk0LTIuNDY3LTEuMTA2LTMuNzk2YzAuODM1LTEuMzI5LDcuMjI4LTExLjUxMiw4LjY4OC0xMy44MzhjMS40Ni0yLjMyNiw0LjY5NS0zLjEyMyw3LjIyNC0xLjc4YzIuNTI5LDEuMzQzLDMuMzk2LDQuMzE3LDEuOTM2LDYuNjQzYy0xLjQ2MSwyLjMyNi01LjI0OSw4LjM2MS01LjY2Nyw5LjAyNWMtMC40MTcsMC42NjUtMC4xNjksMS41MTUsMC41NTQsMS44OThjMC43MjIsMC4zODQsMS42NDYsMC4xNTYsMi4wNjQtMC41MDhDLTI1OC4zNjMsNDAzLjgxOS0yNTUuNDA5LDM5OS4xMTQtMjUzLjExNCwzOTUuNDU5eiIvPjwvc3ZnPg==", 
  "pdf":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iI0Q1NTk0QSIgZD0iTS0yNTAuMzcsNDAzLjM2Yy0wLjgxNSwxLjczOC0yLjU0NCwyLjQ5Mi00LjUxNCwxLjk2NGMtMS40NTMtMC4zODgtMy4zMjYtMS41ODktNS4xMTYtMy4zMjRjLTIuMDg1LDAuMTYzLTQuMzc3LDAuMzAzLTcsMWMtMS45MDQsMy4wNjItNC4wNDgsNS42OTQtNS42NjIsNi41MzFjLTAuNjQyLDAuMzMyLTEuMjQ4LDAuNDctMS43OTgsMC40N2MtMC45NTgsMC0xLjc0NC0wLjQxOC0yLjI1NC0wLjk0NGMtMS42NDctMS43LTEuNzEtMy44NTYtMC4xNjQtNS42MjhjMS4yNDgtMS40MzEsMy44MTktMi40NDQsNi44NzgtMy40MjljMC45MDYtMS41OSwxLjc5OC0zLjY1NiwyLjU3Ni01LjUzOWMwLjI0Ni0wLjU5NSwwLjI0My0wLjk1NCwwLjQyNC0xLjQ2MWMtMS4yODMtMi4zOTItMi4xLTQuNzktMS44OTctNi4yNDdjMC4yMjgtMS42NDMsMS43NzYtMi43MTksMy41MDgtMi43NGMwLjAxOSwwLDAuMDM4LDAsMC4wNTcsMGMxLjgwMSwwLDMuNTIzLDEuMzc0LDMuOTk5LDMuMDk1YzAuMzcsMS4zNCwwLjIxNSwzLjQ4MS0wLjY2Nyw1Ljg5MmMxLjE0OSwxLjgwOCwyLjQ2NiwzLjEwNSwzLjg5MSw0LjcyN2MyLjY0NS0wLjAyOCw0LjkyOCwwLjMwMiw2LjI4MywxLjA5OUMtMjUwLjEyLDM5OS44My0yNDkuNTQ4LDQwMS42MDktMjUwLjM3LDQwMy4zNnogTS0yNzQuNDk0LDQwNi40NmMwLjQ5MywwLjQ0NCwxLjU0NC0wLjk3MiwyLjQ3NS0yLjQ3MkMtMjc0LjE4NSw0MDUuMzg5LTI3NC45ODgsNDA2LjAxNy0yNzQuNDk0LDQwNi40NnogTS0yNjUuMTIsMzg3LjI2M2MtMC4wNDQtMC4wMDQtMC4xNjgtMC4yNTQtMC4yNDMtMC4yNTNjLTAuNDY1LDAuMDE2LTAuNTI4LDAuNTA0LTAuNTMxLDAuNTA1Yy0wLjExNCwwLjI2MywwLjE2MiwwLjg1MiwwLjg5NCwyLjQ4NUMtMjY1LjAxMSwzODguMzU4LTI2NC45MjgsMzg3LjYzNy0yNjUuMTIsMzg3LjI2M3ogTS0yNjQuMDMxLDM5Ni4zNDRsLTEuMjUzLDIuNjY4bDMuMTExLTAuMzcyTC0yNjQuMDMxLDM5Ni4zNDR6IE0tMjU2LDQwMWMwLjY0MywwLjQyLDEuMTE2LDAuOTQ0LDEuODc5LDEuMDFjMC4wNjEtMC4xNjEsMC4wOTctMC4yODIsMC4xMTctMC4zNjdDLTI1NC40NDcsNDAxLjA3OS0yNTUuMDk3LDQwMS4wNzgtMjU2LDQwMXoiLz48L3N2Zz4=", 
  "audio":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iIzY4QkVCRCIgZD0iTS0yNTcsMzk2di0xYzAtMC41NTItMC40NDgtMS0xLTFzLTEsMC40NDgtMSwxdjRjMCwwLjU1MiwwLjQ0OCwxLDEsMXMxLTAuNDQ4LDEtMXYtMWg0Ljk1bDAsMGgyLjA1YzAuNTUyLDAsMSwwLjQ0OCwxLDFzLTAuNDQ4LDEtMSwxaC0yLjM2MmMtMS4zNTYsNS43MzEtNi40OTMsMTAtMTIuNjM4LDEwcy0xMS4yODItNC4yNjktMTIuNjM4LTEwSC0yODBjLTAuNTUyLDAtMS0wLjQ0OC0xLTFzMC40NDgtMSwxLTFoMi4wNWwwLDBoMy45NXYxYzAsMC41NTIsMC40NDgsMSwxLDFzMS0wLjQ0OCwxLTF2LTRjMC0wLjU1Mi0wLjQ0OC0xLTEtMXMtMSwwLjQ0OC0xLDF2MWgtMy45NWMwLjUxMy02LjcxMSw2LjEwOC0xMiwxMi45NS0xMnMxMi40MzcsNS4yODksMTIuOTUsMTJILTI1N3ogTS0yNjksMzkzYzAtMC41NTItMC40NDgtMS0xLTFzLTEsMC40NDgtMSwxdjhjMCwwLjU1MiwwLjQ0OCwxLDEsMXMxLTAuNDQ4LDEtMVYzOTN6IE0tMjY2LDM5MGMwLTAuNTUyLTAuNDQ4LTEtMS0xcy0xLDAuNDQ4LTEsMXYxNGMwLDAuNTUyLDAuNDQ4LDEsMSwxczEtMC40NDgsMS0xVjM5MHogTS0yNjMsMzk0YzAtMC41NTItMC40NDgtMS0xLTFzLTEsMC40NDgtMSwxdjZjMCwwLjU1MiwwLjQ0OCwxLDEsMXMxLTAuNDQ4LDEtMVYzOTR6IE0tMjYwLDM5MmMwLTAuNTUyLTAuNDQ4LTEtMS0xcy0xLDAuNDQ4LTEsMXYxMGMwLDAuNTUyLDAuNDQ4LDEsMSwxczEtMC40NDgsMS0xVjM5MnoiLz48L3N2Zz4=", 
  "ppt":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iI0YyOEEzMCIgZD0iTS0yNjQsNDAxYy0xLjI5MywwLTMsMC0zLDB2NmgtNHYtMTZoLTN2LTRjMCwwLDYuNTUxLDAsMTAsMGMzLjg2NiwwLDcsMy4xMzQsNyw3Uy0yNjAuMTM0LDQwMS0yNjQsNDAxeiBNLTI2NCwzOTFjLTAuNzk3LDAtMywwLTMsMHY2YzAsMCwyLjIwMywwLDMsMGMxLjY1NywwLDMtMS4zNDMsMy0zUy0yNjIuMzQzLDM5MS0yNjQsMzkxeiIvPjwvc3ZnPg==", 
  "word":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iIzQ0ODlBNyIgZD0iTS0yNTcsNDA3aC00bC00LTEzLjMzM0wtMjY5LDQwN2gtNGwtNi0yMGg0bDQsMTMuMzMzbDQtMTMuMzMzaDRsNCwxMy4zMzNsMi44LTkuMzMzaC0yLjh2LTRoOEwtMjU3LDQwN3oiLz48L3N2Zz4=", 
  "3d":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iIzY5NzU4QyIgZD0iTS0yNTMuNzU2LDQwNC41MzFsLTEwLjQ1Miw2LjI1Yy0wLjI0NCwwLjE0Ni0wLjUxOCwwLjIxOS0wLjc5MiwwLjIxOXMtMC41NDgtMC4wNzMtMC43OTItMC4yMTlsLTEwLjQ1Mi02LjI1Yy0wLjQ2OS0wLjI4LTAuNzU2LTAuNzg4LTAuNzU2LTEuMzM2di0xMi4zOWMwLTAuNTQ4LDAuMjg3LTEuMDU2LDAuNzU2LTEuMzM2bDEwLjQ1Mi02LjI1YzAuMjQ0LTAuMTQ2LDAuNTE4LTAuMjE5LDAuNzkyLTAuMjE5czAuNTQ4LDAuMDczLDAuNzkyLDAuMjE5bDEwLjQ1Miw2LjI1YzAuNDY5LDAuMjgsMC43NTYsMC43ODgsMC43NTYsMS4zMzZ2MTIuMzlDLTI1Myw0MDMuNzQzLTI1My4yODcsNDA0LjI1MS0yNTMuNzU2LDQwNC41MzF6IE0tMjczLDQwMC41MjlsMy45MS0yLjMzOGwxLjA5LDAuNjUydjEuMDI2bC00LjEyMywyLjQ2Nmw2LjEyMywzLjY2MXYtOC4zMzlsLTctNC4xODZWNDAwLjUyOXogTS0yNjQsMzg4LjAwNHY1LjA0bC0xLDAuNTk5bC0xLTAuNTk5di01LjA0bC02LjEyMywzLjY2MWw3LjEyMyw0LjI1OWw3LjEyMy00LjI1OUwtMjY0LDM4OC4wMDR6IE0tMjY0LDM5Ny42NTd2OC4zMzlsNi4xMjMtMy42NjFsLTQuMTIzLTIuNDY2di0xLjAyNmwxLjA5LTAuNjUybDMuOTEsMi4zMzh2LTcuMDU4TC0yNjQsMzk3LjY1N3oiLz48L3N2Zz4=", 
  "edit":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iI0JFQkVCRSIgZD0iTS0yNTUsNDA3aC00di00aDRWNDA3eiBNLTI2Myw0MDN2LTRoNHY0SC0yNjN6IE0tMjYzLDM5MWg0djRoLTRWMzkxeiBNLTI3MSwzOTV2LTRoNHY0SC0yNzF6IE0tMjY3LDQwM2gtNHYtNGg0VjQwM3ogTS0yNjcsMzk1aDR2NGgtNFYzOTV6IE0tMjYzLDQwN2gtNHYtNGg0VjQwN3ogTS0yNzUsNDA3di00aDR2NEgtMjc1eiBNLTI3NSwzOTl2LTRoNHY0SC0yNzV6IE0tMjc1LDM4N2g0djRoLTRWMzg3eiBNLTI2NywzODdoNHY0aC00VjM4N3ogTS0yNTUsMzg3djRoLTR2LTRILTI1NXogTS0yNTUsMzk1djRoLTR2LTRILTI1NXoiLz48L3N2Zz4=", 
  "excel":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iIzU3QTY3NCIgZD0iTS0yNTYsNDA3aC01bC00LjUtNi40MjlsLTEuNywyLjQyOWgyLjRsMi44LDRoLThoLTVsNy0xMGwtNy0xMGg1bDQuNSw2LjQyOUwtMjYxLDM4N2g1bC03LDEwTC0yNTYsNDA3eiBNLTI1NCw0MDNsLTEuOTY2LDIuNjIxTC0yNTcuOCw0MDNILTI1NHoiLz48L3N2Zz4=", 
  "font":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iIzg3ODhCRSIgZD0iTS0yNzAsMzkzdjJoMy4yMTRjLTEuNDgyLDQuNzUzLTMuMjYzLDEwLjQ1Ny0zLjI5NCwxMC41NjNjLTAuMTQ3LDAuNTAxLTAuNDk3LDAuODk5LTAuOTQyLDEuMTU0YzAuMDA3LTAuMDczLDAuMDIyLTAuMTQzLDAuMDIyLTAuMjE3YzAtMS4zODEtMS4xMTktMi41LTIuNS0yLjVzLTIuNSwxLjExOS0yLjUsMi41czEuMTE5LDIuNSwyLjUsMi41YzAuNzM5LDAsMi4yMTIsMCwzLjUsMGMyLjMwNiwwLDQuMjQ3LTEuNTYxLDQuODI1LTMuNjgzYzAuMDY1LTAuMjQxLDEuNzY2LTUuNjg3LDMuMjEyLTEwLjMxN0gtMjU4di0yaC0zLjMzOGMwLjc4Ny0yLjUyMywxLjM4Ni00LjQ0MiwxLjQtNC40OTZjMC4xMzUtMC41MywwLjQ5Ni0wLjk1MywwLjk2LTEuMjE4Yy0wLjAwNywwLjA3Mi0wLjAyMiwwLjE0MS0wLjAyMiwwLjIxNGMwLDEuMzgxLDEuMTE5LDIuNSwyLjUsMi41YzEuMzgxLDAsMi41LTEuMTE5LDIuNS0yLjVzLTEuMTE5LTIuNS0yLjUtMi41Yy0xLjEyLDAtMS45MDMsMC0zLjUsMGMtMi4zLDAtNC4yMzcsMS41NTMtNC44MjEsMy42NjhjLTAuMDIsMC4wNzQtMC4yMDEsMC44MDctMC42ODMsMi4yMTNjLTAuNTM2LDEuMjQ2LTEuNzczLDIuMTE5LTMuMjE1LDIuMTE5Qy0yNjksMzkzLTI3MCwzOTMtMjcwLDM5M3oiLz48L3N2Zz4=", 
  "keynote":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iIzU2QTBERCIgZD0iTS0yNTMsNDA5aC0yNGMtMS4xMDUsMC0yLTAuODk1LTItMnYtMjBjMC0xLjEwNSwwLjg5NS0yLDItMmgyNGMxLjEwNSwwLDIsMC44OTUsMiwydjIwQy0yNTEsNDA4LjEwNS0yNTEuODk1LDQwOS0yNTMsNDA5eiBNLTI1OCwzODhoLTE0djE4aDh2LTZoNlYzODh6IE0tMjYyLDQwMnY0bDQtNEgtMjYyeiBNLTI2OSwzOTZoOHYyaC04VjM5NnogTS0yNjksMzkyaDh2MmgtOFYzOTJ6IE0tMjY2LDQwMmgtM3YtMmgzVjQwMnoiLz48L3N2Zz4=", 
  "num":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iI0ZBQzI1RCIgZD0iTS0yNTguNSwzODZoLTEzYy0wLjgyOCwwLTEuNS0wLjY3Mi0xLjUtMS41czAuNjcyLTEuNSwxLjUtMS41aDEzYzAuODI4LDAsMS41LDAuNjcyLDEuNSwxLjVTLTI1Ny42NzIsMzg2LTI1OC41LDM4NnogTS0yNjAsMzg4bDQsMTRjLTIuOTU5LDEuNjgtNSwzLjk3Mi01LDhjMCwwLDAsMC4zMTYsMCwwLjVjMCwwLjgyOC0wLjY3MiwxLjUtMS41LDEuNXMtMS41LTAuNjcyLTEuNS0xLjVjMC0wLjQ2NiwwLTQuMzYzLDAtNy42ODRjMS4xNjMtMC40MTMsMi0xLjUxMiwyLTIuODE2YzAtMS42NTctMS4zNDMtMy0zLTNzLTMsMS4zNDMtMywzYzAsMS4zMDQsMC44MzcsMi40MDMsMiwyLjgxNmMwLDMuMzIxLDAsNy4yMTgsMCw3LjY4NGMwLDAuODI4LTAuNjcyLDEuNS0xLjUsMS41cy0xLjUtMC42NzItMS41LTEuNWMwLTAuMjA2LDAtMC41LDAtMC41YzAtNC4wMjgtMi4wNDEtNi4zMi01LThsNC0xNEgtMjYweiIvPjwvc3ZnPg==", 
  "svg":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iI0M1Qjc5RSIgZD0iTS0yNTQuNjcyLDM5My4yNDNjMS41NTMsMC41NSwyLjY3MiwyLjAxNiwyLjY3MiwzLjc1N2MwLDEuODYyLTEuMjc4LDMuNDEyLTMsMy44NTl2Ni40MThjMC41OTUsMC4zNDcsMSwwLjk4NSwxLDEuNzIzYzAsMS4xMDUtMC44OTUsMi0yLDJjLTEuMTA1LDAtMi0wLjg5NS0yLTJjMC0wLjczOCwwLjQwNS0xLjM3NiwxLTEuNzIzdi02LjQxOGMtMS43MjItMC40NDctMy0xLjk5Ny0zLTMuODU5YzAtMS4xNzYsMC41MTctMi4yMjMsMS4zMjUtMi45NTVjLTEuMTE2LTIuMzgzLTMuNTE5LTQuMDQ1LTYuMzI1LTQuMDQ1Yy0zLjg2NiwwLTcsMy4xMzQtNyw3czMuMTM0LDcsNyw3YzEuMTA0LDAsMiwwLjg5NSwyLDJzLTAuODk2LDItMiwyYy02LjA3NSwwLTExLTQuOTI1LTExLTExczQuOTI1LTExLDExLTExYzMuMTY3LDAsNS45OTYsMS4zNiw4LDMuNTA0di0yLjc4MWMtMC41OTUtMC4zNDctMS0wLjk4NS0xLTEuNzIzYzAtMS4xMDUsMC44OTUtMiwyLTJjMS4xMDUsMCwyLDAuODk1LDIsMmMwLDAuNzM4LTAuNDA1LDEuMzc2LTEsMS43MjN2NS43OTdDLTI1NC44OTIsMzkyLjc2MS0yNTQuNzY0LDM5Mi45OTMtMjU0LjY3MiwzOTMuMjQzeiIvPjwvc3ZnPg==", 
  "pages":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHdpZHRoPSI0MHB4IiBoZWlnaHQ9IjQwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zOmV2PSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL3htbC1ldmVudHMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSItMjg1IDM3NyA0MCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAtMjg1IDM3NyA0MCA0MCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZmlsbD0iI0ZBQzI1RCIgZD0iTS0yNTguNSwzODZoLTEzYy0wLjgyOCwwLTEuNS0wLjY3Mi0xLjUtMS41czAuNjcyLTEuNSwxLjUtMS41aDEzYzAuODI4LDAsMS41LDAuNjcyLDEuNSwxLjVTLTI1Ny42NzIsMzg2LTI1OC41LDM4NnogTS0yNjAsMzg4bDQsMTRjLTIuOTU5LDEuNjgtNSwzLjk3Mi01LDhjMCwwLDAsMC4zMTYsMCwwLjVjMCwwLjgyOC0wLjY3MiwxLjUtMS41LDEuNXMtMS41LTAuNjcyLTEuNS0xLjVjMC0wLjQ2NiwwLTQuMzYzLDAtNy42ODRjMS4xNjMtMC40MTMsMi0xLjUxMiwyLTIuODE2YzAtMS42NTctMS4zNDMtMy0zLTNzLTMsMS4zNDMtMywzYzAsMS4zMDQsMC44MzcsMi40MDMsMiwyLjgxNmMwLDMuMzIxLDAsNy4yMTgsMCw3LjY4NGMwLDAuODI4LTAuNjcyLDEuNS0xLjUsMS41cy0xLjUtMC42NzItMS41LTEuNWMwLTAuMjA2LDAtMC41LDAtMC41YzAtNC4wMjgtMi4wNDEtNi4zMi01LThsNC0xNEgtMjYweiIvPjwvc3ZnPg=="};
  util.attachment.getFileTypeFromMime = function(mime) {
    mime = mime ? mime.toLowerCase() : "";
    var fileType = mimeToFileType[mime];
    if (!fileType) {
      if (mime.indexOf("image/") > -1) {
        fileType = "image";
      } else {
        if (mime.indexOf("audio/") > -1) {
          fileType = "audio";
        } else {
          if (mime.indexOf("video/") > -1) {
            fileType = "video";
          }
        }
      }
    }
    return fileType;
  };
  util.attachment.isThumbnailableMimeType = function(mimeType) {
    if (!mimeType) {
      return false;
    }
    if (mimeType.indexOf("image/") === 0) {
      return true;
    }
    return mimeType.indexOf("video/") === 0;
  };
  util.attachment.getFileTypeDescription = function(mimeType) {
    switch(mimeType) {
      case "application/vnd.google-apps.document":
        return util.loc.t("Google Docs");
      case "application/vnd.google-apps.spreadsheet":
        return util.loc.t("Google Sheets");
      case "application/vnd.google-apps.presentation":
        return util.loc.t("Google Slides");
      case "application/pdf":
        return util.loc.t("PDF");
      default:
        return null;
    }
  };
})();
goog.provide("uno.util.resourcerender");
goog.require("goog.debug.Logger");
goog.require("goog.math");
goog.require("uno.defs");
goog.require("uno.util.attachment");
goog.require("uno.util.loc");
goog.require("uno.util.styles");
(function() {
  var resourcesLog = goog.debug.Logger.getLogger("resources");
  var util = uno.util;
  var State = uno.defs.resources.STATES;
  var Width = 130;
  var Height = 119;
  var Icons = {Default:initBase64Image(" "), 
  ThreeD:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAACLVJREFUeAHtW11sFFUUvnd2KbRVEQmtEiEqBBIRjQViTIzAi4khiE/EYASJhLC7pd0t7bYQhSka+kPLFuiPIRoDqEF8AkWfTAE1PAhFRR4k+BM0aAvyo3aBsjPXc7YzZWY7u9w7zGwh3knambn3/N1v7rkz55y7hMhDIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgGJgERAIiARkAhIBCQCEgFEgN4OMKxeu22Cpg+sZTp5IW2UQvYXFpJNrWr1+dvBvrRNI2mIqjKlL5lYxYj+FmFknM0WSi5SorxeUhR7W1WpbusbgZsRm1GRtYmndU3vIIw9mXPclB5XAkqkoyF2JCedz515B6pa7SpJ9iebGCHLCGGc+ikS7iwqLqptUUN9PmPiKJ7TUEdeoca9e/cGDh79PQQz6E1G2L1CzAYxJfQSofSNebMf7Fq8eLHmRoZbnrwAFa5teYYx2g4gPeHWUBsfpd8FwB3bG2Jf29p9vPEVqMp1baXXr2vN4Gav8LsZ72jT7rh71KhAfOumaC8vl1s6X4BS1e5gX/+xCHx9bAQ3u8etcTx84I5/w0NYX1I8q0NV56d4eNzQeA5UpLbtWca0dsbYTDcGueWhlJ6gNFDe0RQ97FZGLj7PgIquSzwwkNI3A0Av51Lodx8A9kFBUKlp2xT7w0tdtwwUulnvlZ4KWKhV+Gi8W9Q4MOAXhdKoxtg+K2+A0kU6Y22wvj1sbee6puQfeDuqpYVl27xyR4VLcRai8rrEvL5kz7dEZ63CIFFyFZ5+fUnx+Efbm9fsz1SBbdiHNBBoXc3sz3mPDwxsQtvQxpy0nJ2uZlR5fPtEjVxDcF7i1GMjA6WfsEAg2tUY+9nsCNW0wOS5cXRtrh6yLVSXeIRqGs6uhTcoBK4o2RMgo9e0N68+K8BlIx0yxtaa4yZct2Uq0fVDjJGJOciydf1ElEBlV1PsQCZBLqBM2lBtYgHRta1wP8Vs4z1TSs4SRZnb2Vh1mpfHSifuerreJgoSvMKvEKJsCE4qmOEEktWgXNfIW1o8/jGUNSgzF7W9L20z2G5v5b8L8pOalHQufLeYNzc9w4D2FQSUaFtj7NebEnMQqOpyXK82RusSuwY0eGiELeJgM0jQdneHMFDw+r+LRxUswqcVqlS0N8U+56EXpTGAf7G8NvG8zvRtYNfUm8ngtd1JjrjrOUnJaDPcYqVfIFnVGTpWirqiVQbPtfCM4hEK7lAIGZQvQvGWXcVFxXG/UiOYsulP9jfD+rPU+1jSPlJfZtSgCkghMbIMBnIqEm+twDSLXbX7O5SFMlE26vAbJLTUR6AMIBgZC1/YWw9+c6YH0y3Z4KFUWQFBNOTI6fnBa2dKlIGyUCaANNaZyvtWz4FSlOBcWMhPZJoK78nHoXjwJbpjWO24P7O/s7nqXRIonIZ/6esMAuRBXpSBsjK6IWKhJ1B3ZrtX954DhdF7SVFZGcRvMVhgIQWScTDITfVf/RFcJ4pxorW3qzF8Ef+sbUiDtMgDMwjyWvYDdaAu1OlX5gA1eg4UCsVAtKN5TRsk1aZBnLYb26wH5qjAdRK9/ceOh2q2ZJ0F2Ic0SOuY1wLZqAN1eRX8Wu20XtueqLXDi2sj87gU1pUdWVLB8JWtHwzVtH44epRSbaZGMGVz7breAn1LHO2AVDClrLyzqforx34fGn0FyrQXBwRvqlndx86EqZ7OemYUF9iSayltYTi+pR554HoDnIalbMDNLjGFrZ8/a1JnvosLeQEKB28MbDt8+3zkWK6C1AgUQmEWOR32clWXE4nPbXkDyhyH8fG5HAqgO+6kAqgvi7kJSq4zVn5Li6pmwzdTBBZ825suzYcldehDmpGuEqM9eZ9RVvCMPQWdsEnj41RqwFYBDgYKpm9vqDhHSJWVZcSu8zajMOwIxbesiqxteypztIOA2Fud2pAXZXgZDtm1Zr/LC1AYdnQf/e0YYXqXntKOhOOt72Q3ybkHeZAXZaCsXOGQs4Rba/XV9YYqxbq1UswoRPuvgdkrREyHXBLyDB5QmofvssPhmta8VYp9mVEYdoRrWiqhnH4KvqiHpUAcQxsThCzn4TwAOMhGHagrMxzKIsZ1s+dAYaUYykQ9ELhimnZ4OR1DmuIx04UtRp4s4RDqQp2oW1guJ4PnrqfrqUNOuqHc8z1ElhG3YUenGvkT5KbDIaKTDgDHlkEA15zJmLNuJ3tE2zyfUcMMoOQyRPeV8+ZMLnMLklUmykBZKBNm2GVrn5/XPgIFSwglOyEVjNH9Ni9jM5SFMlE26oBkH0wwfw/PXQ/NhYX3Cvxb0Nlc3e2n+UY49Cp8OuyEHP0BWBML/dLny4wyDN6BpSS/DDflGjp2+AkS6hKeUZBy/ZenPgY0UzWmfQbfOp4WQE2AoAD6EBZANV3jLoCi7Sa/6FkYKKh44FttAa8ieNKLYEDPQbaysbR4XLNR6eVlH0anqu+N6e2/GAeZdeKzKG37MJk8DeKupyjR9IYHHukGzeCA9Pre/r9+SG+0EOC1kiJvb/LCSch81ouCZGzSiFrliVwLA4W7QRQyeg4s1ntEFBm0U2A3yqfwJb0ft/Lw8iMt8iAvbFjj5huSD7aizW53sqAc+A50f+AmLV3Xcb/mDGEpuJGM0KaSovsa0R2dtv2gm/UlL6CL1UIFZoyoDliTTiqKUt7eGDsoyptJf0tAoTCMsf4PWxNvGSgTebnZ1USC8yy3T3MChWTojueSPeWQd8K30/AMgoCsm5Fi+gXeaBsmFJW1+1kE9cz1nAaEibuBVGqzUynciV6sDWNJ9n5BMFhzx/7EI3PAmLbNUinOJOW7H4FKsa8zyjpqLAhkrxRbKbNfg5sZleLJnV5mI7JrvNGTN6BMlfKHjSYSnGf5U1lOoJBM/vhaACwkdfo5f0ApaHAqggqKluQSAYmAREAiIBGQCEgEJAISAYmAREAiIBGQCEgEJAISAYmAREAiIBGQCHiMwH8M98f5whTdwwAAAABJRU5ErkJggg=="), 
  Audio:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAAB2FJREFUeAHtm1+ME0Ucx+e3bQ8CJj6onBLBaEJMVBINhou5865dPQ0Q8Q/RB33yQeU4FGPkRQRP0AeDDxiBA333QcUoeBLE7LXnXQSC0YRIYkw0IhHB8KAIoe11x9+vdMt0u9vO7M6WS5hNyk5nfr/ffOfD7Myvu3uMmcMQMAQMAUPAEDAEDAFDwBAwBAwBQ8AQMAQMAUPAEDAEDAFDwBAwBAwBQ0A/AdAfsn3EFycmbqjw6WXc5fdxBotQxG2c82vR85qa938A8A9n7Fdg/Bew4LsUpPe/39//d/voyVh0DNTaQmFxxZ1+lDFYwThfihAslSGhUJcBHGGMj6Ws9BfbBwaOqfjHtU0c1JDjLGHAt3DOlsUVK/oDsP2Mw8ZR2/5erE+qnBio2gzajIAeS0o8xUVgn+MM25T0DNMOaoRz68z4+IgL7HW8xLTHD4QOwC3O3pqXy42MALiBNjErtQ5k+PDh69zz5z/ijD8UU1ckd2DwtTV37tM7enrORgrQwkkbKNzJlpany59gXwtb9NeJphOZdOZJ3CFx4dd3aAE17Dg9FcYdlDVHn7RYkS6kGNg7bPtwrCiCs9IWLfjViy8VCosqwL7EipkCibTNIU2krS40ZiEWqHWHDnWX3coBXLSvj6lDvztqIm2kUUfwyKB2Hz2aKV24MIYZ9a06hOA2/61lpVbOTmfm04fKVBcnNmkjjaQ1ThzyTUcN8OO5c6/g7rYkqn+DH7C3u7P2Jt/Wvg9TjbHThfEt+FPntQZ7hS+kkbSiyzsKbk2mkRbzdZOTC0ul4nH8GTK3KaJiBc0ahJT1QapHobzsdN7JY+J6f71SsYCDPN/VNeuO9/r6Tii61s0jXXrFcnGbDkikAiC1NQwStVMb2VA56kFaSXNUf/JTBjWczw8yzh6P06no22VZR8Xvqx1nbGjcoV20fvht6g0qBdRc1a7iI9gqg6pwd1jwj13c1t9/qjEIX46L8AqxrtlGbJUvx9GuBGr11NQ8lLVcXtqMs1xeG4OyMCVQVrn4DOZMsbdaZZW6HFB7dQwR4imBcjl/VraPJPIi2b5b2amMQYwjnUdRSlAsFReLzqHlBPOi0D5lGzhbTGNRTRWkZ1SpVJKCRDPpxubksToM2uq7B3Ib42bcskzC7GTHIvpLg8KE5y7RMazcibworG/pesmxiPHkQTFXCpQ/56G8iD5ip34bsa0zZbmxiFqkQeFd3baXHj5iGhNznpcnJm7CpyaYTtDn8iHaXK7tXElmLH410ov5Ltu+2+/c7nvJde9tZxO1ndY5usxpdnYCvDQo1QHVfsyuV/WTsg/eVaVcoxolAqoKiW6PxPjFHzYgmkkBt2TCzLXVawVFaxJdbnhbZH0SkGjU7XZVbWR8gZpADeXzyzh3P8CfKjf7bNt+vThdbmsT18C/Y17aURs3i0h9AJwEsJ4fzWb3B/k37XpRIQUFT6KueeHWAImE4sSojj1EdBOoELurvroJFE0/XAhOXnVkapde2Lib1qjaNbrA77CmUFjgupXfcYpGus/uj3fFvtN7Clbqlp0DA3+oaGiaUWHOFBgJHQlrb1d/KUsXreAryuTFmmYbsVVPmcagCol6bppRreTg22+f4o36nlY2YW21LH2f146ZfsPtXqpPMpP3+qUxeGWVs/SMoqCWld6jEly05byynhJRsU4sUxvZiHVJlKOOIVR4kEh8Wes3BuxgUFu7OkpA/8o7m4NgUV31QWcCmXyDLtReHUNDpdwXpUuPQlqQ2uDyyqBceJ8VZxswa+9fk89Xf8xSa1gmT+tVY85Eaxo+KBOOtZOT86dLRaGmdZG0t7YIb420g+F7mXvwUfUT4WHjt9C7Bzuz2fqaFhQRgT+CO/HeoDZ/Hb5k9hm+77nKXy/7XenS84Km0+mNSDiRVwC9PnSuaaSVNHuxo5wjgcK32Y7jZbAlSoeyPrSm0bqlY00jraRZtu8gu0iXHgWqLsD58QP4VPfBoMC66ui2ineDjmLSmkazTfbuBOZq33Rncw/Tg404miKDok7pqSsUL/6AK+z8OCKS8sXB/clnzb5nV2/vmbh9RLr0vE6rAsBahYL+9epmyrmqCbXpgERjigWKAozmcodSYD2Aws7S95lwkBbSRNp06cGYeo7hSefOShmTUc7xycsVPABOpTJscEef/ZNOFbFnlCeGhEE604eLp7b/RS+27Jn6Jg26IVH/2maUN5iPOU+N5/OvMu6+iYv8LK8+yTMOosjAeiOXzb77FEAlib60g/JE1i7F3Xgp9np1iZwBpvBSeyGJWSTqTQyU18lax+mdBkZ3BVYiND394c03jLc3zdnW7bY95fWV5FmPcAmFQ5PO7VDmz2GiOMgBH8+rQkM4wPkxTEAP8gx8ONpn/yzRrTaTjoESFVdfDyyVbBx4P/7RIz4WA3rlcR7CozM9vKMEET/8DP7x4kkEO8G6uhxdOVG1D/OPIWAIGAKGgCFgCBgChoAhYAgYAoaAIWAIGAKGgCFgCBgChoAhYAgYAobADCDwP/D4qDcMN0OZAAAAAElFTkSuQmCC"), 
  Bitmap:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAAATFJREFUeAHt2EEOgkAMBVD0aBycq+kCF8yiMz90QUyeKyf9FXwppnHbvAgQIECAAAECBAgQIECAAAECBAgQIECAAAECBAgQIECAAAEC9wVe91vPzuM4PrPP2Pd9eo2n+2f3fq29rwfvawFQtc1QATVw1AdQtc1QATVw1AdQtc1QATVw1IfpjlO35ZV/2ZNW38hErYR+dVCgQoEwZqJAhQJhzESBCgXCWHuPenpP6l4/dNo8eqEUKFChQBgzUaBCgTBmokCFAmGsvUetrtPdc7r9q/tL6x69UAoUqFAgjJkoUKFAGDNRoEKBMNbeo7p7ztP9oZP/o0ClAmHOjzmoUCCMmShQoUAYM1EhlBgBAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAoCPwBdjuNEyslQIhAAAAAElFTkSuQmCC"), 
  Excel:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAABMxJREFUeAHtmj1MFEEUx3f2iJAISixsDIWVjdDZaCOhs9JCuTsKpDIh0QbBggYLYgS10MTCCgpuD+NHZ4fQEAtiA4SCyoSOivh5COw4j2Vh9/Z2vnZ2/HpXsLvz3sx788vM3J936zj4QQJIAAkgASSABJAAEkACSAAJIAEkgASQABJAAkgACSABJIAEkAASQAJIAAkgASSABJCAPgGi3zXoWfSGK5TSkmgc1yFlrzzpifx49lJluOQ7tMLzARshxKuWJssiPxW7q+LcyLel5fggIc5GI1u0jU3wedEb7Yi2qdxDXxhD1AdygZxEfqr2zKCmro1tua7b7xCHCoK3U/pzmq0+5VUMfaAvG7+dG4PlALlATlw/DWNBo0+iy8qrxU/nr19qY6guJozxhrNvVue+rL5e/BBv5j+tn/sxRB16i+/FrC55Ui1OvhD6aThkXlFhzNMnOkbZ6bASPqddfeKP972815lmr28HX+hT3558JitBDkmLiRZjoJ5dubPd1OT2sS24zU2MOs27u/7M7XdPm7l+zAg+4MtWKt+XxYTYkINoTF27MVCQwMyNhysuddnKEn1o5+bnDeEqCXyocPVBTIgtiprFrnywioLBwVv0RuYch3ZzfdnBW3DdnkrvxHwjv/LsSPee78+x1STIkcxXSxM9TBKIvkwahZFuM7qiICokTMixfnbL/+ZhAHzfn775dizxTQZtYBNDcrYgVt6QYF7GQcGg1dL4BhOYQi1DqdNRq31LaCNoAxuMxftADIjF8zFlEyzrbGF0VPvvVN+82eYKCrZQrfZ1WWJ1sC3U3AWJUrq9zC6J7RidRKC+W7vyEJbRONH7XEFBIJVDOUgs25dAdHIm73MHBcn2VocfOT4dMpK4Sx7PFifvGhlLYZBcDvP6+LKqvb5f8jlf9Z2Md9RiBZS0aj/KK3lnQX0ngx61WAEF4eRV+1Fy0Tsb6jsar/7eyhkVBpVW7WGHw6sd9X0YrsGNtRUFsaVVezxRa+o7Hjb+ZBUUhJZV7WGaNtV3GLPR1TqoRkn8DW1WzygAArVvGfUdgbev2m39TxeJG7u1uqKka9+xFB3tWnt8mGxPRmrmsilI176TA2rV2pPD6LdY23pQ+97d21sSlnXT5gKCs1C4kHclMy28la0nXftOyxLaFWrtvGF0bVZAyda+xZOQq7WLx1H3yH3ryZZZWI3pPSu3s3z+wzLLv1S4y3Xrqda+ZVV7Wq1dfUPJ98ht62WpfevU2uWnrOeZy4rK+uaJrTdkVJAZX1H6pZQw7aCkwnTXZZUfQHn+rGoxxd6XGggj6FyNK/MM6jvMf1+Fe6WJisobMhz/tZNtrVc/egs7YQCdq9EVlVl9hzM4UOGnWs+sb25tLDHJwH//IM2fkO9NhSam5h+shUPrXo2dUUbUdziLAxUOjypvyNT7u5QMmoAE4xoDZU59Q1rwCVS4fK097g/nkleemA7Gyv7XyNaTVd/K6R688cJgLai8IQP+Awv3m6e6x2rKMVM6ZAaloL5TUuA3hz+f12o7bTIFv9Df9M/tmbeerPrm40i3hir8T1bt6dmjBQkgASSABJAAEkACSAAJIAEkgASQABJAAkgACSABJIAEkAASQAJIAAkgASSABJAAEkACAYFfZEM/zS3SWYkAAAAASUVORK5CYII="), 
  Font:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAABUJJREFUeAHtmt9rHFUUx++dZNOS2kofpFYJkgdFUPAlqPhzNyr4A2urEPAvKPhQmpBmt0o1Umo36caWfesfoA8BQVP8QZUmm4Ko7GufRCGa0FYfEvsjjdnsXL9ncWSyzM6dnd2Ze8FzYZk79565c85nz7lz5s4VggsTYAJMgAkwASbABJgAE2ACTIAJMAEmwASYABNgAkyACTABJsAEmAATYAK2E5C2K0j6nT9fzayu3nxLSXVAKPEEmu7Fr5/6gou8CsOqjiPPTExkLwfLtNdqPaipqfmDrhBlodRAe6Y1pF3piBOFieGPYly77RKrQQHSB65Sk9s0bv/E7XGcbKee5bR/33SuAKSjXYBEyjquq451qrWVoCjclBAfRzDuOmQQmeEFYw2FS+h7rQNVLv+8wxXqnFIqdFpA52+Z3h2Y2CXBSrxYB+r2xgo92R7QWS6lMzk+/vQSgFW1shFkdGNYB0q66m2d0lLKm4OD93zSkOt1SjiGhZ9LaYJuTF2/VaAoX1JCvaBTWgj19cjII5skVxh/ftGR8n1Ug2A10oNOn3h0H6tAra3dykKnPaRYWHGk87m/P5/PnaIUQAp5AXPWVfpRndq6kUPRvXr9NzRdxyT+pk4HhF3Nde/6qlnuX6/pShbePDadW+NRFHbIvg8FKdnUtlAoDP3V1Jb4qTWgVldvjMLafTqLpVDbwk4n361+K0AVZy4/JqSgCTm0IOxUJrPzi1ChhDqNgzp9Zv5FVastKiV26WyETHVs7KkVnVwS/alP5rOzqmd5eWGwVhOP4tXiHVVXL0U1TDpmwo70C31NiGpAFLnTxUvgklw5XhhO1BbjoZccuu6OzKAi8mRQEUElGtdRdChOzV/EkopuQr9eyOfuQ3oQ9D4X5TYdyxj1qGKxejcsyOqskFLMmYRE+hkFJcTt1+BNGR0orE8ZSTL9ehkFpaR70K9McF3e6u8f+C64L71WY6BoyRcT5Ms6UxF23xw58uDfOrmk+1PPzD2D1tdXhrFIt9s7b3UETCMvwc36GPOoKGFHa099feLLZqVNnBsBRV9YsAJ5QGcwXoIro6O5NZ1cGv1GQJVKlScBi/YPhBZ8Drci7EhJI6DqSkR42uGN3YK0wPsnjYBSrj4twPxUxUeDZU9R08fUQZVK8w/D6Id0htvytPP0TB3U1la0sEPCbs38RLBSz6Oweqedn/BI/KWQf+aK92/acEzVo86eXdwPCI/rDEfqYJU3kb6pgtrcrL9BOZQOFPKn/zeoKGGHpODPfD77vQ5m2v2peVS5/MMeeFNOZyA+cF4wvfYUpGPHk/n09MKztPUP3tLY1Ya4CtyNu7Fx5xUo0BekhL9Nyh7ja09+fbx6Rx6FLYTvYZ9lBasAr2Mrzn76Ub3uugvF6UvvejehoxstG1/PZDLf+q+zpR4bVLFUeQ5edLLF5OwoV5wkbyNDZ2ev9EHuVZ3RCLmL+BJ8Rydnoj82KLHljreA5Nnx327cX5f+GEGjdt8T1hQ+9S627RgblDcnhRlEMjMzlQFRV6fC5Bp9Uizt2nn/nFbOkEDHk3m43mpfbcv9CcBCl1QQcpRcHbVhybeVPbE9ip5urQb1tTsIz1BIJIuxxrBSYF2S6bMjfmZOO23JE/yDxapL+SEgnYt1bYoXxfYo2jMJTzgBXeN9vZXyd+zmPXQ8n5tM0d7Yt4KtnZXtCSflUi3LOnquIc5+xIw0t3fv7s8OHx6qtZTmDibABJgAE2ACTIAJMAEmwASYABNgAkyACTABJsAEmAATYAJMgAkwASbABJhAmwT+AW/1cu7dVmbnAAAAAElFTkSuQmCC"), 
  Keynote:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAAAjBJREFUeAHt2z1OwzAUwHEHWti7IXXjAFyBUyAkGDgFK8ycAiQQEqfgChygWyW27nyGOFEWS857KYmdB/8sVZJX2+8X59Ud7BwHAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAghMXaDQDPDsfr38+Hq7ca44dmV5oPnOZGOK4tW58nm+u3/5cL5ca8cpQtVIn+8vVeMLbaM24orNfLZ3pMXakZJqZtJfQ/JZl4smN0mguS9C1a+bri2DUVUpUR4ylPWa1AXRIzcZqqujf3RvNlauTxeH4g/FkH2f3K7KIdsL22JGhSKRc6AiMOFloEKRyDlQEZjwMlChSOQcqAhMeBmoUCRyPto6KtKf++16J/X6rM2DGdVKCJ9ACUDtbaBaCeEzeY3KVWMEB/E2M0okagKAAkopoAxLXqNYRymfjNUwapTyyQGlhEpeo1hHKZ+M1TBePeWTA0oJlbxGxdZRYe2KxSnzGjyMGaUkBQoopYAyLHmNCmuRcpyu63und6vr79JdadvaJs78q5cCycOahkqFZBoqJZJZqNRIJqFyIJmDyoVkCionkocabR019H+1sddJHqPrML086Eps6HsyVL13ZOhuJ9Jej9xkqGqDzUTSGmEY+txEKL8LqdrmsRlhlJmbrDYN1bnphiFC+d1HfheSK9yj6zFVdd1niPI5VLn02VmVYZR0iQACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACWwj8AKJ6eHfVb7p4AAAAAElFTkSuQmCC"), 
  Numbers:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAAASNJREFUeAHt18sJwgAQBFAV+7IGKxIrsgYr0/MeBiYfFPHltsyEJM8VksPBQYAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBBYL3Bcf+p3z7w/r68ld3C7PDY962nJxf65C6r89UGBKgXKmo0CVQqUNRsFqhQoazYKVClQ1mxUCXUue7vXPv2ttvUBbFQpCApUKVDWbBSoUqCs2ShQpUBZs1GgSoGytvrN/NferEuPWPPXizQzADU94gQq0swA1PSIE6hIMwNQ0yNOoCLNDEBNjziBijQzADU94gQq0swA1PSIE6hIMwNQ0yNOoCLNDEBNjziBijQCAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgMB+Am8tnwxUtnfNXgAAAABJRU5ErkJggg=="), 
  Pages:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAABPxJREFUeAHtnDtvE0EQx3fPd1aCRAGhoQQFCqAGRAKi4vUZkkCEBC1UoUAI0VFBQcUzcVLAJ4CKIhFOQo+EAFGShkcBUohfy8wRm/PFd949zywgzUmR93Zn///ZX/buJsZGKTmEgBAQAkJACAgBISAEhIAQEAJCQAgIASEgBISAEBACQkAICAEkoKkxmDc3y42vH28pY6aMUrup9XvpwSLWlNaVcOfeG/rgzVqvmEH7wkEF0vMRkjFmJt3PeR7/QsATvNHmGodXQC4KO4lc01aQ0ZselO2i/rM4elBwr/hrDBi9yUHFN1Stb8c3WE/E0EuDJ3p7shQbISAEhMA/RYC8Mu+1OrNyYV+91nzXa6xoX1Qu7ddHZ98Xne86j/yp1yuBet2c7dU/SB+HZl4+XkBp1SIHxaGZB4r90jPVq8ON5ucvxqjhvERcx7RW62Fp14g+dmfddW6RePYd1Wx9OUkNCReKmqhdZNFF5rCDgqTIL7vEQjm1EzZKsYNqtehv5O0VcGq3PdqvrKBM9eIoGOEP1zG66cGl39FlBVVvNs51nJgaPjwwdVZQPh7hPjwQFFt5wFUWYNLJw1eZwLajuMqCJCRs+yoT2EDBGrw9un14sYHy+ej24cUCykNZgFdd8mAvE1hA1Rt1n5ddDIzbkwWU1oa9fkpuJ2xze5KXB77Kgq2geN9NIN9RrmUB1EEGtsMDpcOj0cj27fiDbeyLx9JEMs65ywTyzx7AOqzvT7Cd11QQTpTHnrxMrX8Vzlfrr6af6mZjweHDHuj9PKVFckq+o2wf1fFuKYUT0VZInYXFYxBju7NsvTsGDg1SUC5lAVxvD/MgtdeAMRjbPu/zylYmkIJye0SXHvVZdGLYPtYth4RFnyYpKLhErO9P0c7hN31y6wy7xLrk0DGwaJCBwrIA/kQ9aeH5O2S9McQSCzn8zsVa3SqQDJRrWdDY2DhglSEEucRylQlkoGA91pcdAjLN1jS+2hwusZt6TrnY5EAGyvXRDDXUZK06dbhfkhiDsf3ikuOuuSTnZrXJQAWBvg4f5vqaZZTuhyKypJvmRW1p+kh6rH2OYxiDse2+fq+YA+bSL851nAxUOF55Fg4PHYJErStjuJ/s0KpZrS1NVdKJYx+OYUx6LOscvTEHzCUrpmg/7Gr6o7Z0/hK86X8Xb6y26uUT81251BYnYSPZHVASrBsVXCkfn7tvN8M9imxHJa3jhIPgDPyGvyf7OdqxB3hxQsK8WUChcDQ2twjqp7XSP/Gc40Bto4NTsReHQUKTDRR6RGOVZfiNX074kTZRuzw+u0IqmiHGCgo9w+NzFRXohQz/4t1az8faxRWcZrKDwmwiFc7AnfqHU2Y5wagV6ZDlOy9Ztl5A6fHHn+Ady3tZSTj3g1as6Tyx+AQvoDC9sBQ5vK2SvyBKrXynP6PeQOljjz7AU2r5j3WxFlx2VdQqNrv4LG+g4hS1Wiye6uZMrZcG1igg4BUU/Nvb6wI5dk2h0OgStDzxCqrUCt9a5pUZRqGRKZ4z4BWU2hZ9y8nFbohCw86pK8ovqJHa4KAoNLoQ2J14BaX3zA78dx+Fhh2a7iivoNAaHu9r3SkM1pfW4jr3Dgoq9MqWxQzSt0WMp4Pjswe5meL3fuP/n6D91XuA1Ou7wLZxuWYyKASEgBAQAkJACAgBISAEhIAQEAJCQAgIASEgBISAEBACQOAXMLZ6WX8dk7EAAAAASUVORK5CYII="), 
  PDF:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAACTRJREFUeAHtW2tsHNUVvmfWu9nEoTxKKCS0Irg29pqqasFUCGgpjx/EjhUQ5mE7hlJiCaSioDY0prLkFlGFRGoLASTCQw5+CSyCi2NLtDwaUB/BkapS7a7tkCJKEqIiQpt412t7d27PWXvsO+O5u7Nr7938uCPZc+45556555tzn3OWMX1pBDQCGgGNgEZAI6AR0AhoBDQCGgGNgEZAI6AR0AhoBDQCGgGNgEZAI6AR0AgsPwKw/Ca9W+Strf7IxLFNjPFNwNmVnMFaqg2MH+fADiE1EFq9bgD27JnxbrUwmkUDKtJUdys3zV3oVlkW146AYWwL9ex/PYteQcXKgeIdHUb08KEdCNK2XDxDsHZVlV+5HTo6zFzqLZduyXIZ8monH5DINgGLdYl8hP6pvpRG1Fx327cUJzGybitGNzSW0uhc6tLAPTcm5VJtkS7ZIFuLBAVmKANqdnZzDNzAjho+1gi+4Fr6IxqnvKNZfC6bs5VFbXnFCscojssA4UJAvrKy9Ntff7H/pMDt+/THDW+emoz9g3F2scB3kGlb/Q5mQYvKIorWSaInhsEecYCUFhOPZKKuk3bacsoLUVYGlLWYtJzgLPgni3beM8lI12nLWb8QZWVA4Wo7JTrgM6aX8uyYaEsFvZTG5tQ+DvBPsUIyye8RyyINqYRURnoI+oeivgpaGVAGsFdtDnHWdvieTYu2Lx/fu+FCzth2m66jgGsppQM5PV4ZUEH/mufxeZ8u+MxXT8/M9OKWxjbzxqfhKQTq7AU9BwXsP0H/+V0ObsGLyoBa39mZMAxot3nE+VXRwyNPWrxIc20t47zBKkvuj5MtiaxgbGVAkQeV5TVdAPBX0Rtu8gejTXVtx1s3rmIme0aUOWlgcDBUcdXTTr6KstK9Hjl0pGXjNxIzqb8jeZ7NQWAjOO/X2HhiAdiMAf4rqnp+b5sURJVC0kojihwpe3nw3+CDFnxDOBQJVyaQUM1gsKtYIFErlQNFDw11Dw3hzPULor1cCOp4MLDmMS+6hdJR3vVER8J31z6FgfUTkeekKfKA+X5Y1Td4wClTWS5KRFkOhi6r2QrAMo85wF4sNkjUXtsaxnJA1T06/sG1OFJdLn8enFgZ8G+Ty9VJihZRvKMhgJvb53BEl3d/YA+t7xz4rzo45E8qGlCR8clHcXFZKW0asMHq3iHlWxVZe4oC1NjdGysRpDZZo3BRejoAwQdl8mLwlQPFOYcUM/fgZBaQOgzQVt6z7+hoU/014abaZqmeQoF8fChQI3C7ssU0CSj3i7Y4VRU11zIWLomMx3AFD2sDsOJbBJx7DTVcpRH1r/vrv2Zy/oTUNdymcL+xhT5yjo7Ft+OMGMIues6MmXiJIlFaT4FAKVCJePJJdPxcmV+46d1RvXcwPNZSt44z/qilhzPjzdHGugescjHuyoAKN228hXN2p8xJXHiO+b966eMkr9g7eBzB+bOoy4Hv/Ki5/psiTyWtBKgTmzeXgpl6VuYY9inODdhSvnv3FOngOMWDft+PELxT83U4K50yk52UuzDPU0goeegXyZO/xAi5ROYXnqc/X9099L4op1MGgxtbRR6OWddg/sHPbDxFhZwGSPd8Jr7a2VZaB60M8Ir1ncMnwi3134GZ1AiOOT6nnroyTGCQHsPt9XsYua9U9+x/O9dnewYqh3wmOrtpq+ob3sFfbfBFB+IHcca6IteGFVIfu/QBPGHaEurdf9jrc7J2PRoTEKSdmBxBWShl2QxjNH1ccn7Zb0kvOhB76EwDidqFk8oPMMIPhptrr6OylytrRM2B5HkHbzDf7Xgs8lr6yDeZiuC4UuqlIUXRAfgSlyTf8xJZGY9Z5rqbHSTKQMHcAPrsHere95nMwakZk2Y5OUjpTe9wvaz+cvIjzbddBKlpzBHl2/BvIYpoTQecPqNdn+150ohKD9ynj0bRwEJ3c89AWfSMcGNtA8a3/YOnqIUrcGBGtZc3KVZbKk3DyOj4yGO4O5hfzKZtGsZN2QZ4aUS55TPJMlBEB460NpydOB3HI96M1+58QcKX8By+hFbLOr5pz0fFtDVCsNqjYyPXiZEFJqeFcMaZMMNg7shnQkvZskyo8YlYHPdy/EKi3S507PPg6tJfucm88Nacs+qnNGFYurg+wyygVOfoffVnWbxMdwILx6VdNh3g37eVXQpSoPLJQaJjEXw782/b5Xl0nNletqf/f24yL7wLnu2fwBdxL4I1nx1Mi1kzkfyNl/qkw32BdNaspY/77XUWLbtLgXLLQQKWuF5mCDPlzjN5qovesEwHBR9W3lr6gkzulR/qHX4Pu87vRH2c8u+PNNZtEHkyesUqX1yUOVOSRJlFS4GyFMS7abKdBIjII5oyUE5PxoZwzbTeKRPLRonvYbijPyXy8qVXBS7A74JAk41wmS+4tU9QSJNTE3HnF+lPnDrOsnQwR5RpB19hq4B5lZRfGW3ekF4enLXCNxWbnLxlcoo/gW84Y/jianigsmvwHZu9JRQoUWN0c31LKpmkXIa0HxhVF+ELo2XJXVlMP2yXw0F7eXFJGlGzv0VZXAFH9IvNFOvlqcTxU/HYFyludmcDCd/8tN8fWPbNbGXXG4eYAb8WW4lg3Rlp3GDrlqI80ljbjpFv66KG4dsr6rjROGy4X1nXQu7VXLn4kJ2hvuGfuwqXyKT1XnTi2N/Q+e+KpnCwf4tx45lg6Wz2TCLGr8bZkb5K3yDqIf1Odd/wjQ7eoqI0ouhXTah9ZFGNHBnY5T7zG+emD+RyrOpJffaXV0Bd7aRYAYG7CYF5fTKWPEF/RKPcBhKdd9G5l1hPRkuBogZgIoV9+yKzIucnwYDby3t6Fg7g5Lp5S9KLVx9swhO/L70awSj/3MeMm+ncy0sdKVBUmX5zgmDZF2derM7poPH2qu6hv+RQJW9VOvgL+P01uJh8P6sRgHf9gcDVl/Xu/yCr7pyCdIyyDND+KNdfRGFjcQnA23Bcyhtk6/n53MNNdTfObks4HqfgjyUBz1A5O4aTyoEz5+AOWASMkq2h7jf+mI+TZ2qdrBElNtz1KBhPAjB6PsKXNobdtKuqZ/APYh1NawQ0AhoBjYBGQCOgEdAIaAQ0AhoBjYBGQCOgEdAIaAQ0AhoBjYBGQCOgEdAIaATkCPwfzUstowDgAMUAAAAASUVORK5CYII="), 
  PowerPoint:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAAAr9JREFUeAHt2T1v00AYwPG7uBkChKUTMLEhsdBKoC4IhMSOBBNio5+gUCY+AUVsbLAhJpDYkZBQlwpQw8LQiQmYKiEMdAjucUcqXVzFjx07tnPon+ns5178/BJfzmel+CCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAuUFdPmm6ZY/Hpwz6TMVj7T6aXv4qo36opTe7ETRq6N3Pgwq9lq6+fxCTU5pR3f0/f7dwYvJ4frOhgZ1IKG3urp7s7f+7nN9NOmeO+nDUI7MytAM38ePli41dcWBQjkes6gS9boprIChLJUxXfNHvdzbuHC67l9W0FAjHLNob8PnQBUSMCvxw6UbhaqWrDSzf72s8fPWV8fvfZx4Debx5WN7v+OziUpu275XjVET642Nu2P7OjN2PNNi3uCVBysLNT5wvLF8xc5Iz+ycdGL8/OFyFC0s17UoDWKO6q9vv7Gr81taK3H1v58k1w7jzeo4CCiX7AhLPZETNxflePloMFAuxUhFT6VUjVanpHiVWFBQvSP9TznJnsyJlw4HBZWbpZHnsNz2QoWgoNxyQcjFzvfqmxivEAwK6mBNlZnuaO8qM1wpEAzUaC2lVuVs9aYcLx8NAsovOOXVudsFLU8ht1yQw+1F048w+4UeYepalTuF1qGyHnHiX9+n+pbcFvFUDaasHMStl5+T3qp7H/0/gNK7bv88H7NajdZvvSqXr7Ue2uea6721+l8yBPyL0rsW6Wp/bfC2CnbRtoFC/Xtddb4pJIcZ2q3X2gvQ+YWas1fqrUNl7ZkXnTuaqhfoHNUUjx8HKG8hloASeXwQKG8hloASeXwQKG8hloASeXwQKG8hloASeXwQKG8hloASeQgigAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAKzEfgLx8ac8A2na54AAAAASUVORK5CYII="), 
  Vector:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAAB1xJREFUeAHtm1toHUUYgGd2z6Wtvmgt2FS8FKkUwSIkJOdUsakJTRSLWFu0tYlHn3ww1gf7Uos+FJH4YFXwwYdc2ohgrIgiSU3aVDQ5iQmGasEapAEvjeC1XjA5Z3fH/z+57dnsmd2d2Y3NcRYOmZ1/Lv//Zeaff2dnCVGXIqAIKAKKgCKgCCgCioAioAgoAoqAIqAIKAKKgCKgCCgCioAioAggAVpOGIYHuq6zZnKtjNBts8axM1oycbCm9pHvZe0sG1BzkM4yRq62Q6GU/AqwtsjC0uyNruR0YSQ5IKE9CA5lsraVDaj56eYGhCdzK++WVzagCCOr3Aws5PFkJSsVC8oGFDjb/mLTFu94ssVS/FSML45GyhijI/0d1cyi90J6I/RSAb6kglBWQRlNMML+oJT+DPnn4e85KP5BuqH5M642Ce1pkrO2gFfaVFyOThCUSV7LuuplezvrGDN3Q1SyE2BcG0h3Sr+ljJ3Qid5d3dicdas71nt8/QzLX7TLkjReUdmwf8qeJ5JeFlDDfe01pklaYQm6U0RJZx1K6GkSIwfS9ZkvnbLBnjZmz9va+FgoNkY69Ub739yYN3IvmQZ7wK68bBpG43Zi0PHB3rY3YjH9cHVd8y+ybXrVj8yZ4zTL5XNj4INChbRoENNhpXvCyJvnh062pRfzo0lFAip7sv1Ji1m94FivikbtolavAWd/KtvTHtE/ZLav0EEN9bYftSz2KkDSi8yJ8oaxVTAduwd7Olqi6iZUUDiSYKo9FZWyvHbBg4Mt1iu8MjKy0Jw5+iTLsl4OogwsR+OEau9phH5CY+SHK/XVFy8lianN5Nay6fzNMEpSjJL7wBelgrQbRdlQlk5c3dBx+/VJ0Ok7cRJ/tqpx/9d+jMr2HdvMTOMwxF8PYbDqp858mcsqPMAQwA8kiLInNZ3sranPDM8b4udvqr7pKyi3d7jv2OumYbwL6XV+6oVZRtpHYTDpJwSAYfCxHtOqgkKyG1tT3/RpIp6sgZE1Yc9fjrQ0KAgmYTTxL4SUWHdbfRiBYVXdvguxuJaG0TnE7zVcqRQodOCgzh08lXC66XF9V2VlZZ5XLogMgcPo3Eko/c6r3mB/e5VXGT9yKVAWsfZ4dYI+KYyR5OwH29QYaXLmO++pQVrxYdmZH/ReGBSuPpTB0s25cHWT8UmcpguiVGPmDIxYdO4lL9BzW47lv4HnwiOMvS0cBAuDKuwneWyVYAhQ0oIQBGxgIAb7WKV3Nuf6gGB0DcRih4Z6/+4EcEI2C1XC/nHTjWcrjKZxv3ESrx2ebHhm8kXQ5B5emWIZ25f9qAPqBL/EQc3uTJbuESLu0kJ5CQahFiGBH5eYxVrw1VZQDYRBQUcVvM7wsYQnl5aZxuMwnUQewZLmTD7w1rAwqMIeN8dafHbjiKVF4Hd2SDQSOGQQBoUvAniK4gMuTy4rg3/UDcJtMLY5aF1xUPBoz+tMjyfBn0d6TUu0ztXdrV1xUIRy32xcmv5dOshzU3ghj5JzC+mgCYG6wqDg8AN3ajGDbAiqf5DyoPjnQcrby4rUFQYFHXNBWSScV1N2A+1pmkwchddW/9jz/KSxDtb1U9ZeRhgUPDpcsDe0JM2s+5fkhZiBx3hgCy/Qjip2j3VEjgCJg9LYhzy7wVvePtpz/BZeGVlZOnnjc9BGV4B2uubqBKgyW1QYVHXdoyMwjH/k9Zgn+SM8uayM1tYa6YZME2y3vAC/0qsgyqAMlsU6Iv0Kg4KpB4OGvc/rFAo8iDugvDKyMtRja0Pm0Oo1V1yvafR5Z3uYhzIsM6uzs4S/e6lYp/DmhZl9vK5AuUncAo5iT8qt36jOHgiPKFQy1dDcD0Oa+0wH2xo3mXnzxNjYWNzNsJWSJwUKjdR1ctDLWJiCd+V++qJvpL9zrVfZy1UuDQp3MGF6cXcZ0XiEZRrWaNQ+KyrQ0qBQsXgs8Qy8QvrNS8nCNDRYdqinrTvq0MFLl6ByKWdu72zWsRdOsPjel8ZdUOcr9Vtr9/xlbzdoOipnHhooNKhw3KdwkiWoebbylE5RIv7FQVSgQpl682amdmReA38ld6KEsfWw1/QwHKI/K7JlO69L2H9DBYXKQfR7AIK8FvBZpoyyACuULw5kdLDXDR0UNo4jS6Nagx8Hb1fGmQ7jiwNnm6L3kYBCZTAYTcQTlX5CB1Hll7NeZKDQCDxQAVNxlx6jKa8I3s1odOpu+f9FXqirnpcBGEL4PZAv8vnYij+Q7wQIgWfJTzzAr/0pEh4MnercwHLWaXgG2FTcH52gCW17+u5mqddnIi8Qi/UQuAO/BU80ZHjuJ9CCS5Ucnh91QsJykFeQEc+TNy6tLmRF6qMWelmGBJCvK9UNT1aqjjO/bEDB19GcHU6OzEmkxH3ZgOKtkDxZCS5LsssGFH6Njiul08K51dNzz8xZz3lfNqDwFRR+jQ5g3oKYbQp/mA7jC3UnNHWvCCgCioAioAgoAoqAIqAIKAKKgCKgCCgCioAioAgoAoqAIqAI/J8J/AsPbG8i65MANQAAAABJRU5ErkJggg=="), 
  Video:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAAAg1JREFUeAHt2s1NAzEQhuEx2gpyQ6KHtEAPuVBJikgjcNkeaIEekLilgkgGZ9nLStF8Ew8RWb25RMnO2jOPf+SDzfgggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAALXCxTl1XE/PhU7HazYc631UXnnv8aUUr6s2nu1Yb877D7VPF2ohmR2+jCrG7XR+4grR7Nhq2I9eEWdZ9LqkFrVdTPV5glMz12otty0pu4wKlDb4JUX3ZN2hxd3OXt99jwf929VfT9Smz+j1F5XHufOqGX9yxlzaQQv/b9sL+v3Mq+53eX/1+bFjJpFnW+gHKD5MVCzhPMd3qOuXeNOHn/2OCtfZpQ4REABJQqIYeE9KutcIubXHZaVL0tPHAqggBIFxLDwHpV1LhHz6w7LypelJw4FUECJAmJYeI/KOpeI+XWHZeXL0hOHAiigRAExLLxHZZ1LxPy6w7LyZemJQwEUUKKAGBbeo7LOJWJ+3WFZ+bL0xKEACihRQAwL71HquWS5N4j5pIep+Xods/Q8od/n7oxqdx4j94iyRlDMvyvsfJ9TbMGfUT8XQ8W27i8sUJsL1W7PmrWLoWv7lONUm1aXCzXdmh22xcprZKpq3d8+qtXQaoncCL59lvSIAAIIIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAmsT+AYPinh9emc9LgAAAABJRU5ErkJggg=="), 
  Word:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAABWBJREFUeAHtmr9uHUUUxmdurgkKQUCBRUVHCDWCIobCUiIZCAUSssgr0EERt2mNlJZXiAUNUhIISiQXJIAiegK8QOQmSHEKh2sP5+x6rufOnj8ze3e7s1K0s2e+883MT7Obc0d2zi4jYASMgBEwAkbACBgBI2AEjIARMAJGwAgYASNgBIyAETACRsAIGAEjYASMgBEwAkbACPQn4LXUS9/c+DMEd57TTd2p83e2Nv/i+qX4xvZ3b8/c4SNJo/lf3L4RpHypz3v36O7VK+9Imtg3iQ3uHry/yfVhfOYPP5X6pb6S3BKNNIbUp60tzVVBTby/lSbkbR98b1AluSWafE6lz9raUh8V1Ctv+gfwfj5Jk9I27PsLn3x767U0VtLGHMzVtH39NV9cE65N08V+FdT3m5uHsEV/jAnde5gePHv6UTcuR9qcMJVV2NvPX/PFNeHaNF3sV0GhcOKC+J3yR/WvX01OjTYuTLtra8rzi0CdWXnxZ+f8LE+Oz8G7jWu7uwW7o81ALebEfO1e66/54VraNenKqCgC9cNXn/3rvPslJnXuIbz628O9DztxJtBoIYfp7oYr/bsGWQTW0qwpC0uPxbtg4vzNIxfWOTPouwx9u1x/Gj/WpiG1zfnf27rSqQUvbe9cDy58zZniWrg+Ll60ozA5uFNimeB8KC8TarRx5jU5ilZdSxwzuReDunv183+c92wFDtX7W1hpJ95kEzWoJTuF4GD+sIZmLcJYVFcxKEzWtmxJFV2ioSaKsZJcTaOtgRu7ChSQEt9t+Fjgd0q8SjScQUmuqlHWwI1dBerCu6u/wkT4Kj34NalKb6px0HCTQe+x/XEN3PhSvArUtfX1GVS0P/GGchWtVePoPbY/roGfP99TBQptJl55/YQqXauw0Xtsfx6F3FMN6sz09J0+VbpejUO1DN5j+8s4+N5qUCVV+u9/PP4gH7KJSdX4cbU8tn8+r9LnalBoDCeDYvF5SLx+VCydZOqZtlNNbFNeVCzq8a55plqq3QsUnHyIZQKcIXXKBCq2MKHUM20viNoHyouKLaQqngta4qEXKK1Khx885z6+vnMujte2w/w5xuf3rFoe238+bkWjFyj01yrc/2YnZ1Rpm5ob5UXF0tzUM22nmtjWvKJOuvcGFZx8lu780cmP5LRNzIbyomILqaln2l4QtQ+qF5GTh6AQ7nfhf/cPHj7eg28Dc17uZ6dfPruK7gdP9/fwSJcaCSvxtfffWM0LwbH9qblIsd47qqRKf77/bAP/cZBwYliJ55AwPrY/jlFz9QaFg2hVtHP4+iWvIDEzyUPqa62W8yemw4bI14FVZx1YRe8/P4DfTvRrBad9G7Bj4O2CF5S82mqc7ILg2P7cuFR8qR11XEXfp4wx1ny/5Gr8vnR2PbY/N28qvhQoNIT9Ihaf1KAxVpJbool++X2Z3NxraVArE/nnTD5g+lySW6JJPdP2MrmpD7Z7lwep0cXtHThLFyrvVDxv+7/vbX2hnrGjfGz/+ZSExtI7Cr37bPGanBptXGufnJhL3QcBBYVCj+9UTU6NNi6zT07M7d4HAbX23uviX7zkwzbVOOTkce55bH9u3DQ+CKimsvYOTj4LL9BS1TiXPbY/N24aHwRUa1iz1Wu0cbo1OTXa6C/fBwP1wtmXxLP0k2n4Was9iZS0xvbX5jAYqNtfXn4CxQZbpc8nAppGOw+UNcb212YxGCgcCP7eUjxLL9Vwkx7bnxsX44OCWpnKf5mHA5ZoUEddJbklGsrbYkbACBgBI2AEjIARMAJGwAgYASNgBIyAETACRsAIGAEjYASMgBEwAkbACBgBI2AEjIARGJPA/zq7H6e4qGkRAAAAAElFTkSuQmCC"), 
  Zip:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAEoAAABgCAYAAAC65+QhAAAAAXNSR0IArs4c6QAAAglJREFUeAHt20FKAzEUxvGkWuzaneAdvILX8BIDgvQQRRDmEl7DK3gHwZ1rpdSYzKoNZPqVFyYd+XflTJ/J8/eSR1zEOT4IIIAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAL1BXyNIfu+v/3dfm+C8/cuhBvLmI9P64OcXp7jsKd8vP/0Lrwtlqt113Ufp/zqWOxi7Evlu4S02/68h+AerEjKfEdjYqFSLimnlNvReDHADJVWUgS6FuebLizmNORWaUYz1LDdKiVTe5iauV2ak2vdk8b+AGNu+0ObV9T+YP/5Z6DE6gIlQtl7lDhRKSw/J5nPUaWJjO9ZUSIgUECJAmJY8x51rj0p92Pr5SKFZ6AKMPlroHKRwnPzHsU5qlCZub5m64mVA0qEat6jOEeJlZpLGFtPrBRQIlTzHsU5SqzUXMLYemKlgBKhmvcozlFipeYSxtYTKwWUCNW8R+V5nmvPYkXllSo8A1WAyV8DlYsUnpv3qPx/vUKezV+zosQSAAWUKCCGsaKAEgXEMFYUUKKAGMaKAkoUEMNYUUCJAmKYfUXF+3HiXNOHVczNDJUuEU4voM1YMzczVLpp6bz/0lKfMCrmNORWaUozVLqOerG8uvPevUaw9tswXZWNuaScal6VreTNMAgggAACCCCAAAIIIIAAAggggAACCCCAAAIIIIAAAgcCf/sDcwp6XbWsAAAAAElFTkSuQmCC"), 
  Error:initBase64Image("iVBORw0KGgoAAAANSUhEUgAAAE4AAAA0CAYAAAAkEw66AAAAAXNSR0IArs4c6QAACiZJREFUaAXtmn9sVtUZx98f/eFbCkhrsgYriIoiLIZg3ATnEtwSZol1f0wMUAstpbSYbWX+MacO6rIlbtMwJxvQFkpLkQ01RhtwM1Gmi8SxdpgxB2iM0HXQRehgLf39vu8+z+17r+fe3tve2/eW0m43Oe/59ZznPM/3Puc5zzn3DQaukqe2tvaavr6+xfF4/A5EmkPKJmUGg8H+WCzWTi6pjf4/p6enHysqKuoZT9GD4zm5zF1dXX17NBr9OqDcC0ARN/IImKRmAPzN2rVrP3Ezxm+acQPuwIED09vb2zdiQUuSUQoA3wmHw3vXr1//r2T4eB07LsDt2LFDluSjCDt9GIFjgHKB/hgpG/oUJ9pQKNQNeM+WlJQcdaLxu/2KA7dz585VLMmVVkUAKUpbEyC8nZKS8nFmZmb7ihUrpE17xEIvXry4kLF3Q3sXebreJzltccbWlZaWvqK2j1X5igJXVVWVjz9bryojCvM0ovSBDRs2XFL7nMr79u2bcfny5ZXwWgZNSKWDX0NZWdlv1baxKPsG3KFDh9JbW1vvwBJmI3wWYKST/4fUxjI6PjAwcBt931OVoO8cgD2PlXyotrst19TU3NLf3/8U9LIDGw9z/2Tjxo3vGw1jUEgauLq6uut7enpWIezdpDS3MgLY6RkzZvyA5djpdowdnVhfR0fHZua+Re/nhfREIpGKNWvW/FNv8zs3mbkX5ggaxl+VANqvsaSvegGNedrwYZuTBU3kXb169b+zsrIqAeszXX5kuaa7u7tIr49FPiqLa2homMZbfhKB5nsVCgW7SBX4s3Nexw5HTzw4B5/3HKCl6nTM83383d/1up+5Z4tjd0vr7Oz8IUKYQEPIAdIRdsRfsgyfwK89TtpGuZH2Vl1orHOb36AJb+K4T8ka9XkSeYGl7lvVMTZymoGgtZy3Os/SfxSQqmyCUMPpi0UA4E3EWn+0jPWtypJ96fz588uYZ0qC6Rc5yl3L8eyib5MkGHlaqnI8Ynf8mSoEFvUyu2I9wsbV9vEqE1yX8WKX6/Mj3wtY+Jt63a/c01Jlma1VJ0aoPyBU3dUCmsiGTKYwBBC/pMrsV9k1cJh8DsCpfq0Tf1bllyB+8Zk7d+7feJH9Oj+Ay9XLfuaugSPQvEedGOHeXLduXYfadjWUly5dOgBYcsbVHiwwSy/7mbveHLC22erEqampR9S6mzI+8j58ZKEsbTYTudF4226cWzq7sYm2dvIcKSN3hEggQszYnejzJXNlcUwcZrYb1BkB4B9qfaQyx6PZKPFd6OSm4zopS5t1nFs66zi1jpV1qXWC4Qy17kfZ0eJ27do1lRtZuWBcQghyE8oaxynaetgUTMKNJAzj5WbDeFFS5lnIuDPqWLd06hhrGR6mmxOAe4Ld9j3kfgu5XV0kWHla64YiegeTylHqIXzaHtqKqc8jGaAl6DxfWyP0kDNpMm26vA656SYZ+W8lyRGsGgBXUpYVlNRjAg7ApnP183OsodAGLHUiz/5i2rRpRwDKOE9KWdpUplJ2S2cdZ6nbLk30iqDXKvR8BpeQ1KZhACcXhTB9BuZzLULIJaFE3s3kB1leEuzustKMVBfnDO/HGL9fkpTtHLZbuuHmS0tL+ykyVjHPuwnZTeToOY9z7Y/FUEwdHirayQFGIZg8TS4+x3iY+GMqtfiF40bjBCscPnw45cSJE4vRJV8AU8UH1OPo9iS551OPBhzbfx67ZLnKlHDhDSaqhrERTKr9E62cMI5ScuM4JjoA6A50POhVn2BTU1MqqQaGxpqHWSPMxvRUwHxh/Ol83vZMyjnkveStzH2a+M64TfGq0Ej0bA7rmOebOh3zyvfaEq8GktLc3PxlGBmgwfACN7N7dcZ+5/X19VMID/JQQN686cpb5sL3Bej7EGVe5fLgKLnnZTSczLNmzWpoaWn5CjpfJ3QJ3RdTfHe4cda+EAPvVBs5f9bbOW2VZrTl3bt338BHll8ATiE8hoCm80WmBdA8hd+tFKD1dj/yvLy8Xvi8qPLi5SxS627KIQbdphDGcnJyTLcLSl9SRbmSIqB+DibaUcgNMwBc1NXV9Sxjv+CG3i0Nu+4HKi3zqBioXY7l4Pbt2/fTmykU+JfPWOvFjtSj7JD/hfBt4gWGDwGNF/cpSf4TItH+jeSq29BmTNA85tUPOYkbr6zM/UtGxmvX9/bmTonFMgju0sPxuFjiWdbuJ+QHAeO1YGWlo6+VI5cGmkyC0EOie2lP9unt7V0NDxNogHGYtB8wzun8mT/I8ryTXK68b1ba51D+Gul3ettocgCbiZJP40iLFnV2Wk8P8q3i1kS6H5rn41u21BLEbgHAs9b5UhAeOeNaWEJZy61Eydbhf6/Kg1Bnj90Xd5EFuiZirw9Onjz5bcr36ePou4vyqIEDtHzAaIDHVJ3nCHkYkEtIDzO2APBeV+nl5GAcelHwWrXTrzIuQP1DzDE70NS55E4tOzv7V4ClvmmVh0o+YhnFvwMAr0LoFjSV51QZq/FQWgW4C3pdgJMPvHrdrxzgxL8dA4gjzLHVDV929j45OkH7V8a9w24vvtjzg8L5KL6VJLqO7pGx8NB4JTiITyll639A54iQVXyLbNTrEzlH0Zksz5PoMBpLs1O9g01jnvi8EG/yTxaKb8kuaGmbmFXZCPwDTTCQZSs8A6Hi4uLjWNkZqcjDUsoidKggH5ONYnCWsf/F2nJRpshxpulcjEQiQ7ulTfqcHngKbwmA5Y97eyx097CEH5/QlheLPYhO1pBjUE0BpqIiENi0KRCYrdzeS1napM8ZvDDL/0HNYeLT5A99pq0ei1tCpM85vCo/2Us/y0u5UlXTLYhp0r6+QKCfS590Yu4CQkYBTJKUpU36hMb5WW4sR7m3OnXq1BYAW+hAL2HLJQAWC73qn4K2toKMaNQ5vNKBSksbBEo0SiUGFsAaCPfOGN5rqK7B4EcGcNIr4BF4llFcNpR6YrWUtLV9I2WY/w1r2gh4jzwyCJg0iKXt3Ts8aELH9xNTbCOBZ3l5+TYi+x/h+1qE5v+PPQK2zrOxsfFsYWHh7/Fxci8mnwHD5LKR4AACJiu1Zzv+rfO7unLThn6d+1ww61LlHlBbqgsWBAIt2Mwl8UwOTzB4ekKA4CD+sM3xzZsPQXC/LZGEHLJ7ykag+zQhlM1BfF4vFyVbtwYC3Y4f894wLVXbSSZuo/N3BAFHNgIBSN8IZDOQsrRJn9A4Pwcnr8VJAByLnUZ3W3ekxWlibVarEmsU0JyXapRj142T1uK0S8hgsNbRaAQYK2hCLG3OoMmOWiu8Jy1wGmBcQpJ3aGV/fjrkYlNYTWrg5BaDZVWAsskH7cIDXhrPyQ6cWAaKvg5wm5ICT0CDh8ZLmPJM2s1hUL3Pf7VLSG9X5/pguYOzvTrXCSZ1rlkLl5BYTg2KRl0oG9VoBy8uTd8bZOz/jMWpQGl3dYPXTssB52b6Zib6XX8e/C+MhWT+2DDH9wAAAABJRU5ErkJggg==")};
  uno.util.resourcerender.render = function(props, editor) {
    var canvas = init();
    var ctx = canvas.getContext("2d");
    var subtitle = util.attachment.getStringFromFilesize(props.filesize);
    var state = props.state || State.LOADED;
    if (state === State.LOADING) {
      drawLabels(ctx, props.filename, subtitle);
      drawLoadingIndicator(ctx, props.progress);
    } else {
      if (state === State.UNLOADED) {
        drawLabels(ctx, props.filename, subtitle, util.loc.t("Tap to Download"));
      } else {
        if (state === State.MOCK) {
          drawLabels(ctx, "Mock resource");
          drawImage(ctx, Icons.Error);
        } else {
          if (state === State.LOADED) {
            drawLabels(ctx, props.filename, subtitle);
            drawImage(ctx, getIcon(props));
          } else {
            drawLabels(ctx, util.loc.t("Download failed"));
            drawImage(ctx, Icons.Error);
          }
        }
      }
    }
    var img = findByRef(props.reference, editor.field);
    if (!img) {
      img = new Image;
      img.setAttribute("data-hash", props.hash);
      img.setAttribute("data-type", props.type);
      img.setAttribute("data-reference", props.reference);
      img.setAttribute("data-state", state);
      img.classList.add("en-media-rendered");
    }
    img.src = canvas.toDataURL();
    if (state === State.LOADING) {
      state += " (" + Math.max(Math.min(1, props.progress || 0), 0) * 100 + "%)";
    }
    var action = "Client reported resource " + state + ".";
    if (img.src.indexOf("data:image") === -1) {
      action += " Setting slug url to: " + img.src;
    }
    resourcesLog.info(JSON.stringify({client:"ce_" + editor.config.client, note_guid:editor.config.note.guid, resource_hash:props.hash, action:action}));
    return img;
  };
  function init() {
    var canvas = document.createElement("canvas");
    var ratio = util.styles.getDevicePixelRatio();
    canvas.width = Width * ratio;
    canvas.height = Height * ratio;
    canvas.style.width = Width + "px";
    canvas.style.height = Height + "px";
    var ctx = canvas.getContext("2d");
    ctx.scale(ratio, ratio);
    return canvas;
  }
  function findByRef(ref, node) {
    var selector = '.en-media[data-reference="' + ref + '"]';
    var el = node.querySelector(selector);
    return el;
  }
  function drawLabels(ctx, title, subtitle, cta) {
    var fontFamily = '-apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial';
    var maxWidth = Width - 20;
    var oneline = !(title && subtitle);
    var cx = Width / 2;
    var cyCTA = 40;
    var cyTitle = 73;
    var cySubtitle = 88;
    if (cta) {
      cyCTA = oneline ? 52 : 46;
      cyTitle = oneline ? 80 : 73;
      cySubtitle = oneline ? 80 : 88;
    } else {
      cyTitle = oneline ? 90 : 84;
      cySubtitle = oneline ? 90 : 99;
    }
    ctx.save();
    ctx.fillStyle = "#4475ff";
    ctx.textAlign = "center";
    if (cta) {
      ctx.font = "500 12px " + fontFamily;
      ctx.fillText(trimText(ctx, cta, maxWidth), cx, cyCTA);
    }
    ctx.fillStyle = "#666";
    if (title) {
      ctx.font = "500 11px " + fontFamily;
      ctx.fillText(trimText(ctx, title, maxWidth), cx, cyTitle);
    }
    if (subtitle) {
      ctx.font = "10px " + fontFamily;
      ctx.fillText(trimText(ctx, subtitle, maxWidth), cx, cySubtitle);
    }
    ctx.restore();
  }
  function drawLoadingIndicator(ctx, progress, offset) {
    var progressNorm = Math.max(Math.min(1, progress), 0);
    var cx = Width / 2;
    var cy = Height / 2 - 18;
    var radius = 14;
    ctx.fillStyle = "#a1a1a1";
    ctx.beginPath();
    ctx.arc(cx, cy, radius, 0, 2 * Math.PI, false);
    ctx.fill();
    ctx.fillStyle = "#dedede";
    ctx.beginPath();
    ctx.arc(cx, cy, radius, goog.math.toRadians(360 * progressNorm - 90), goog.math.toRadians(270), false);
    ctx.lineTo(cx, cy);
    ctx.closePath();
    ctx.fill();
    ctx.restore();
  }
  function drawImage(ctx, image, x, y) {
    var width = 37;
    var height = 48;
    var imageWidth = Math.round(image.naturalWidth / 2);
    var imageHeight = Math.round(image.naturalHeight / 2);
    if (x === undefined) {
      x = (Width - width - (imageWidth - width)) / 2;
    }
    if (y === undefined) {
      y = 20 + (height - imageHeight) / 2;
    }
    ctx.drawImage(image, x, y, imageWidth, imageHeight);
  }
  function trimText(ctx, text, maxWidth) {
    var trimmedText = text;
    var metrics = ctx.measureText(trimmedText);
    var len = text.length - 3;
    while (metrics.width > maxWidth && len > 0) {
      trimmedText = text.slice(0, len--) + "..." + text.slice(-3);
      metrics = ctx.measureText(trimmedText);
    }
    return trimmedText;
  }
  function getIcon(props) {
    var group = null;
    var mimeMatch = (props.mime || props.type || "").match(/\/[^/]+$/);
    var extMatch = (props.filename || "").match(/\.[^.]+$/);
    var value = (extMatch || [""])[0].substr(1).toLowerCase();
    switch(value) {
      case "3ds":
      case "ac":
      case "blend":
      case "dae":
      case "dxf":
      case "fbx":
      case "lwo":
      case "obj":
      case "skp":
        return Icons.ThreeD;
      case "m4a":
      case "mp3":
      case "wav":
        return Icons.Audio;
      case "psd":
      case "bmp":
        return Icons.Bitmap;
      case "xlsx":
      case "xls":
        return Icons.Excel;
      case "eot":
      case "otf":
      case "ttf":
      case "woff":
      case "woff2":
        return Icons.Font;
      case "key":
      case "keynote":
        return Icons.Keynote;
      case "numbers":
        return Icons.Numbers;
      case "pages":
        return Icons.Pages;
      case "pdf":
        return Icons.PDF;
      case "pptx":
      case "ppt":
        return Icons.PowerPoint;
      case "ai":
      case "ait":
      case "draw":
      case "svg":
      case "sketch":
        return Icons.Vector;
      case "webm":
      case "mkv":
      case "avi":
      case "mov":
      case "qt":
      case "wmv":
      case "mp4":
      case "m4v":
      case "mpg":
      case "mpeg":
        return Icons.Video;
      case "doc":
      case "docx":
        return Icons.Word;
      case "zip":
        return Icons.Zip;
      default:
        return Icons.Default;
    }
  }
  function initBase64Image(base64) {
    var img = new Image;
    img.src = "data:image/png;base64," + base64;
    return img;
  }
})();
goog.provide("uno.util.resource.generic");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.img");
goog.require("uno.util.resourcerender");
(function() {
  var generic = uno.util.resource.generic;
  var util = uno.util;
  generic.findResourcesInClientHtml = function(root, editor) {
    return [];
  };
  generic.findResourcesInClipboardHtml = function(root, editor) {
    return goog.array.filter(root.querySelectorAll('img:not(.en-todo):not(.en-crypt):not(.en-richlink):not([src^="data:"]),img[data-url]'), function(el) {
      return generic.dictFromClipboardElement(el, editor.context) != null;
    });
  };
  generic.convertMediaToSlug = function(enmedia, props, editor) {
    var slug;
    if (editor == null || editor.fakeEditor === true) {
      if (props.hash == null || props.type == null) {
        return null;
      }
      var dom = document.createElement("img");
      dom.setAttribute("class", "en-media");
      dom.setAttribute("data-hash", props.hash);
      dom.setAttribute("data-type", props.type);
      if (props.width != null && props.width !== "null") {
        dom.setAttribute("data-width", props.width);
      }
      if (props.height != null && props.height !== "null") {
        dom.setAttribute("data-height", props.height);
      }
      if (props.style != null && props.style !== "null") {
        dom.setAttribute("style", props.style);
      }
      return dom;
    }
    if (props.state && props.state === uno.defs.resources.STATES.LOADED && util.resource.isImage(props.type) || props.state == null && util.resource.isImage(props.type)) {
      slug = util.img.convertMediaToSlug(enmedia, props, editor);
    } else {
      slug = util.resourcerender.render(props, editor);
    }
    return slug;
  };
  generic.formatForExport = function(html) {
    return html;
  };
  generic.dictFromElement = function(el) {
    return {};
  };
  generic.dictFromClipboardElement = function(el, context) {
    var dict;
    if (util.dom.isImg(el) || util.dom.isObject(el)) {
      Object.keys(context.resources).some(function(key) {
        var res = context.resources[key];
        var src = el.getAttribute("src");
        var url = el.getAttribute("data-url");
        if (url && url === res.url || res.hash === src || res.url === src) {
          dict = res;
          return true;
        }
        return false;
      });
    }
    return dict;
  };
  generic.convertClientElementToSlug = function(el) {
    return el;
  };
  generic.convertSlugToClientElement = function(el) {
    var url = el.getAttribute("data-url");
    util.dom.removeDataAttributes(el);
    if (url) {
      el.setAttribute("data-url", url);
    }
    return el;
  };
  generic.convertSlugToClipboardElement = function(slug) {
    return slug;
  };
  generic.toggleObjectsInRange = function(range, dict) {
    return false;
  };
  generic.fixSlugInTableDimensions = function(table) {
    return false;
  };
  generic.applyPDFStyles = function(el) {
    return el;
  };
})();
goog.provide("uno.util.img.fixtures.generic");
(function() {
  var util = uno.util;
  var generic = util.img.fixtures.generic;
  generic.map = {"images/att_icon_drawings_40.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QICEQcDCqn3VgAAAyNJREFUaN7tmu9LE2EcwL+3uhuDnIMQemHdOURSktQVSlOEzXKSWHtl1AtfNAiCXpT044VRQS8qetE/IBRJUb4RX8RQX4Q4jAUTVDKYTufITVE5LtztNnbXi/EwKOY2n+25ze7z5nlxz33v+3z4Pvd8bwxAQ0ND4/+Fwg0QEG2m5tcsm+yCT7qW4WHqm3IcPnd0KD+pB/CdYYqVeMW7zmMXox7PiedPxl8stbeT1ZZGhxsAiYO38BLu2+3FFofQD1ZfOXXHao0MPet7VD8zQ0bXv2ALRBWn1gLUFoktkFTFZQOJ3Kp5OvLw/ewsqediCyw1aN9Jif3d1kZK5KETiCAlsmwFKoosJ5PZ5yGRkaHHN+/xhX9Hlq3AWCwSCYdzn68f5C7UfrBaVy/fDd/6GgoVKo+yFSiKXq/HAxCNbmyEQgCynEzmUpGmkTNfzv6ori6USOxG2u+32SwWRSGjLTOCEI8nEgA8nxpzxW73epeWqAN7KNsK/BujkWFoGsBkSo2kODQCEaRFHlVroQZDU1NLC0BFhc3W0wPAMBxXU5O+nkisrQUCAIIwNeV2A4ji/LzPl3t8JBKR79YuWYEmk9PZ3w9gNHZ39/ZmnqfX19XV1wNUVaVGQXC7x8cBeH5sbHQ09+cVWySxLYwqLpu4zCIcjr4+AIOhsbG5+SD3F2drExOItiouRmNXl8OBc39KYGVlYUQSE8gwLMtx+HFommXNZvw4hRKo2iGSiUBgYMDpzHxdlmVZlgHW1xcX/f7M82prW1stluLnS6wCE4lgcHUVP44kRaOxGKmss0NMIGpH8ONsb+/ukso6O8QEoj4OtSP5wvObmzs7AKIoCHt7JBXtD/F3IOrjJGllZXk5farSNMeZzamfqWQZIBZLbVVUcaUmTjWBCFFcWJibS4+IYHD/w6HUOHTfwqTRBGKiCcSk5BppUg1wodAqEBNNICb4f+04rbyC8/G42gvJmyPgg9uShBsGvwJdsKV0Tk+r7SNfqGsAylX8vLEF6t5Q15VfLhd1A3zKxORkqVYkyotqgAaAiQnqo+4cdcnlUjsvDQ0NjXLmD6E2U1wbu1pwAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAyVDE3OjA3OjAzLTAzOjAwGxDoJAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMlQxNzowNzowMy0wMzowMGpNUJgAAABMdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9hdHRfaWNvbl9kcmF3aW5nc180MC5zdmc7qb9bAAAAAElFTkSuQmCC", 
  "images/att_icon_forms_40.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QICEQcDCqn3VgAAAkhJREFUaN7tmk1IFGEYx/+jYZPjJQjpMGVIHTqkSATGugjZxT2I2MEVEjpsnpa61aLQFyTbsegUCB2ilD6OHlTIzwQD0Yg2IrqYpCwICzvDuLQznd4VDNmPd+Z9ndnndxvmnWee+fGfZ4ZhAIIgiOpF4S0w8ivS96mtqemviWf277Ex5Q6anSvhMFpwFfG6Oq8ab7vW+ePEx6Wl/kt3f56/19EhVtseNbwFCuJeYcj50NXltThGY1Z/qA6GQhOfn5xNPVpcFKPrf7gFFhInCdkiuQWKSlwxCiJXk9e/n15eFnVefoGHjMbMqe6jc+3tokQGTiBDlEjfCnQc2y5lHRP5puXx5W8X3Z+RvhWYTm9tmWbp608+PRM/9i4UevEg8Xb1xsaGW334VmAqtbKSyQDb25ubpgnYdj7vOMWPO9d5IXf8vq67JfKIbBGVYlmGkc8Da2uzszs7gGFYlmkC2axlGUaJRXp0HQDwsvI+fJvA/WiaqtbXAw0Nqqpp4s4bGIEM0SIDJ5AhSmRgBTK8Fhl4gQyvRPr2KVwpTCQAlPLaUwzhAoeHx8dbW/e2R0ej0fX1g/eXy/56B6Fp7iSxam5hr+D+Ip1IRCILC27cDHJIJicnw2GlYg+UQE6qdga6BSWQE5qBNAPlQjOQE0ogJzQDaQbKhQRywi/wC2bwPJeTfSFl0wNVGdzd5S3jwq8dzh/E5+dl+ygXJQo4vfx9cwusHVJu1t6KxZTXUPF+evrQJpL1lcZtDExN2QM1I8rXWEx2WwRBEH7mH7lv75z7XaiiAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAyVDE3OjA3OjAzLTAzOjAwGxDoJAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMlQxNzowNzowMy0wMzowMGpNUJgAAABJdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9hdHRfaWNvbl9mb3Jtc180MC5zdmfQaewzAAAAAElFTkSuQmCC", 
  "images/att_icon_gdocs_40.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QICEQcDCqn3VgAAAihJREFUaN7tmjFIG1EYx//v8KJRC6F0qR69QYqVji0SGq2IW4cOdlFXg2YS2kJpwaWLRSkdHCRLRuvQRcRJESWoEaGdVHRxESwuouBZk/TuOuhrQYRc/fLe5S7vN7/73seP//vucRygUCgU1QujFnjR+3nw15JpYtL5qL3NZFgbfrqZzk48xzIeRyKiGu9qfTSk/Vhbe/flZSzyrKNDrrZ/aOQKXNwwvrobPT2ixXGan9zd0toTiYk3cyeF9dVVKbZugCzwb+J8wm+R9ARKSlwpuMjx6fn7v1tyOVn70gVWGAZi37AXj8sSGTqBHFkiAyvQcRzHyzoucuzT7CsRMzKwAo+OTk9t2/t688G911p7IjF6Zzpn7R0clKuPwArc3NzfB4DDw+Nj275MpOuWfq4tbdq1LYZRLpE1fou4LZaVz7susLKyuwsAxeLFxdkZUCxa1vm5hwJPATQaBpZpfQQ2gdfR9bq6aBTQ9YaG+np5+4ZGIEe2yNAJ5MgSGVqBHNEiQy+QI0pkYN/Ct4WLBLxcekojXeDMTCpVKIir39+fTnv5tKHr0eilSBpVc4RFIT2BXhMSFFQCiVTtDCwXKoFE1AwkohJIJHAzsNISrBJIRM1AIiqBRJRAInSBWXRjW+TVWBAxbOB7Pk8tU45fOz6wgWzWbx//TR+bZX30vskC3VrNdKaSSaTYe/ZwcbFiE3nVlzuCHWYsLLAme8wZSCb9bkuhUCiCzB8kv8RReqfpewAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMi0wMlQxNzowNzowMy0wMzowMBsQ6CQAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDItMDJUMTc6MDc6MDMtMDM6MDBqTVCYAAAASXRFWHRzdmc6YmFzZS11cmkAZmlsZTovLy9Vc2Vycy9kbWFydGluZXovZ2l0L3Vuby9pbWFnZXMvYXR0X2ljb25fZ2RvY3NfNDAuc3Zncn/20gAAAABJRU5ErkJggg==", 
  "images/att_icon_gsheets_40.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QICEQcDCqn3VgAAAkJJREFUaN7tmE9IFFEcx79jq6Ss5EW0GFiyEqRLF0UZpYNXqUNRXaUlDfLgxVOdEiX2IGKQUl6CiL108k/oIVjcFuwSHowurjBIbnhZVhl215nXQZ5BKjvtb+Y9Z/d9bsM8fvPjw/f33swACoVCUb1o1AJN4x86HrdGIqGMZuHu/DyuYQT3+vowjsuI19X51fj9p5GZzpFkcvalkRq+1dsrVttfaqgFjsV9xAQO+/v9Fse5fqlxrnXbMIZfJHtmv6+tidF1ErLA48RJQrZIukBBiSsFF/nk91d9rjmVEvVcusBzRvv78FLL2+5uUSIrTiBHlMjACrRtxhyn9DoucvAg8e71jvd7ZGAFmmYut7fnfv3NN01d+jfDeLD5ORf7YZpe9RFYgcvLu7sbG0A6nc1mMoBtO46bRHYtXUnf+KnrXokMyRZRLtlsoWBZQDxumuvrAGBZxSLA2P5+oeCiwCS+ALpO7SOwCTxJfX1tLaBp4bDIl6oKEsgRK7ICBXLEiKxggRx/RQo/RLa2Bgampvyr39a2sDA6etodLvLoyvVhU4LAnsLlw0Uyxhi9mnSBZyXm36S6XeeehgYvRroK9kB/kZ5Atwnye+8sF+kC5Y2wN6gRJiI9gWqEiagRrnKkJzDoI6wSSER4As/+Vg0mKoFElEAidIHP8QsPvfgxJBb2CjEs5vPUOnSBeW0MnYmEbCH/i3YRjwB632SBh0WnHR3RKKZhYnF19dwmkvf1CUO4vbJiPwtdvXAnGpXdlkKhUASZPwFu9jieEVOZAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAyVDE3OjA3OjAzLTAzOjAwGxDoJAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMlQxNzowNzowMy0wMzowMGpNUJgAAABLdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9hdHRfaWNvbl9nc2hlZXRzXzQwLnN2Z4XZDF0AAAAASUVORK5CYII=", 
  "images/att_icon_gslides_40.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QICEQcDCqn3VgAAAmdJREFUaN7tmMFPE0EUh3/bZZfUAuEAmpQm3UQTo0kvGkhj4QJE9OLJREM4mV684En/DnowHghX45VrlxKDUAwHTNCDiSHQQL02FDbYrdvxsE4wCNh2pjPsOt9xM/PmvW/f7uwsoFAoFP8vGmuA40KhAiSTuIonwMICqigDY2O4Q3KAaXYqcf3TtW/TybU1817q+dvS6KhYbSdEmCNQcTfIK2BiotPiKNrwlfs3n2UybvHzm+nk6qoQW2fALpB2nCRki2QXKKjj/gUV+fP6l/GnH9bXRa3LLvCSQb5G528tp9OiRIZOIEWUyAALJMTzmhj1W6Rb3Hrw+Dv/d2RgBTYajlMqNT9eG469Ts1nMj/iHwsPH+3t8cojsAIJqVQWFwHPOzra3vavNNORemnQSt9NJHiJZP+QPl5aAggRIe0i6nXHAQDXPTxsZd7AwMwMoLXtIbAdeBrDiMUAwDR7e0WuGxqBFNEiQyeQIkpkaAVSOi2yS3RBjUZ//9QU4HmWlcv5pcXjLBFdt1wGdH1nZ3YWiEQODmz771FU5Mms1jab8xDegZ5nWXNzALs4imkODf15Qy6GijSMnh4eq0t4hP2C+dPdnUi0kgUfgcIf4dMYxsZGX1/78+v1kZFqVV7+od9EOo0SyIgSyIgSyIgSyIj0XVj2LsqKhA70Tw78qdX298VXI1wgPXLxE+mL0/XdXT+uWELzQ7VdotHJSfVDVSJKICPsAje1F4Dryi6kZYq4DdRqrGHYBerkPbCyIttHG7zjkTe7QEfrArJZFLEF2Pal7Uial42XQD6PPEkB2azstBQKhSLI/AJie9putJDt3wAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMi0wMlQxNzowNzowMy0wMzowMBsQ6CQAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDItMDJUMTc6MDc6MDMtMDM6MDBqTVCYAAAAS3RFWHRzdmc6YmFzZS11cmkAZmlsZTovLy9Vc2Vycy9kbWFydGluZXovZ2l0L3Vuby9pbWFnZXMvYXR0X2ljb25fZ3NsaWRlc180MC5zdmfYvJjpAAAAAElFTkSuQmCC", 
  "images/att_icon_maps_40.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QICEQcDCqn3VgAAA6lJREFUaN7tml9IU1Ecx79XuxukmZBFD5YF/iuFysy0JYJWL2FGlPSPXhwFRkGtv1BU0ENFSQ8iPqgUjSL1xRhBCyLSpUzZi9AEoZStOXKFOPfn3u3u9CCXUW5s8247W93Py2H3nPu7v/Phd8899zJARkZG5v+FkRrgq6c+d8fjggJhH15nVHR3MyNkDXpra8kEcw2jCkWiEl/1vC57v9tgWH//zpsH5r17k6stSIbUAKI4PMNDXG1oSLQ4EaUmv2njBZXKfuveoRtbhoaSo2spkgWKFUdrArRFShaYrIqLhCjyx+a72usvhoeTdV3JAlMN1rSBK3BWVydL5D8nUCRZItNWICGBgCBEHieKtN+63XJ5Lv5rZNoK9Hrt9pmZ6McrNZv2FL5Uqb4dvDRz7qPFEq880lagx2M0GgyA222zWSxAICAI0VRkrrb87bYv+fnxEil5Iz05WV+/cychydEWnvl5nvf5gLm5xTZaGhqMRrOZWbaHFbQnLqJU7t6tUgErVzY2HjsGsGxRUUlJsN/nm5ycmADc7oGBvj6A40ZHP38O9ufkKBQsG/wdq8i0FZidfebM2bNAVtaRIydOhB+nUJSXb98ebF2u/n6tFlhY0Gq7u4Pjki2S2hooVlwkceHIyjp69PRpQKmsrKypWdoviszN/VNovKEmULxV/4bjxsZGRgCHo6WluRlwONTq5maA500mozFUnKamUHFEEi2SmkCWLSwsLl563Ons7GxrAwTh58/ZWUAQHI7ZWWB+vqPjyZPQcUpLI18vUSIproGBQCAQjziExBJHFBmvfQO1CvT7LZapqVATbG29cgXIzMzLW7t2sV23DsjJOX9eo4k+TiRWr45PJVKrQK93cPDDB4BlS0rKyoLHFYqKiqoqIC+vq6u3N/o4tKBWgR7Pu3c6HSAINpvVGvv5gmC322yAx6PX63S0ZkFRICE+H88DTmdPT0dH7Oc7nV1d7e0AITzP87RmkQLvwhw3NjY8HGzjPT7RUBcoEqmipFZsokgZgZHWNKlrZqJIGYEi4Z6qtJ+24Ug5gX6/1To9Her48vZ7iYb615i/IcTlWlgAfD6zeXwcIIQQQgBC3G6Xi3Z2S0k5gSK/ft28efEi7Swik3K3cLohC5SI9L92lJJH2EXzXWCZZMKEVo6TGkZ6Barxg9R9+kTbR6wwxwFyWHrekgVmPGVOku9qNXMKJqJ//z5VK1LMi9mKrYBez7zKqGQOqNW085KRkZFJZ34Dzg3IpkPczfMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDJUMTc6MDc6MDMtMDM6MDAbEOgkAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAyVDE3OjA3OjAzLTAzOjAwak1QmAAAAEh0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2F0dF9pY29uX21hcHNfNDAuc3ZnIHRLhQAAAABJRU5ErkJggg==", 
  "images/att_src_icon_dropbox_28.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAQAAADYBBcfAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAFoAAABaAHAjuH0AAAAHdElNRQfhAgIRBwMKqfdWAAACTklEQVQ4y8XUTWtUZxjG8d+ZqbpogokiTkkYo2aGdCNibdOVjnUhVmjiyoWKiLjV+hH0Ayi2q0JDS+2mpUI1CWoQdFELdl90MiFIEmNUfEvaGjUzTxfzZMa86U6f5X3d/+e6zn3OuXnXJ1lYClld9mjTijF39LmQjL7lntASvgszYf4ph19D2xscQ7dzGsoGDZkwhUYZOTlpphxILi4KhuNOSxVd93RejiY75Kk4kXyzAAzdzofUdX8t8RCfKUgq9s66RjC0uqXh2pIYdCowpSMZh1SsntJQrGHrHZYFax2Sj9WbSjQ6+ZpjyBoup7/3FCsUbEbFVdN2W4bbBjzHSkely9qSsVnHbunBOJLtNlfD+9CqKHfYBZ4pkdZVj7qbUgw04CYeOOcPN/QYQVFfVEvwZR1sZ6I2hBtG/OY+eOJ3Iy6ZidoEbKyDGf6NUrODso7YKkG7w7IOWR3Vf6AFPlj4vtZghZ02mPZxvOxTl+uzrNQdx2mI4BW9XoBhfytjWm/EYtd43XFYPuNxFEf94hPLrdTuipw//VfLk6l21xz7ydXEl7Z4qGirdTYZtCkmIHb11cELynnNUXyh3yMFsMorAzWwSTszemtgMurHVGytniE/uK2oR/G16hfS9CRjtTERWtzS+OaP/HPbmdSR3KtHldy1T7mgc0ms0zYqDlSxuT/yMWekSq55Mg9qtkOOiq+Tb2drc1fHV37WWDGo5H5cHWvl5aSYtD/pWyqPsCacDa8WWVY/hY/mdi62Hlt12WN9XI/D+l2sTvL9nv8BmADVTZAM0RgAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDJUMTc6MDc6MDMtMDM6MDAbEOgkAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAyVDE3OjA3OjAzLTAzOjAwak1QmAAAAE90RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2F0dF9zcmNfaWNvbl9kcm9wYm94XzI4LnN2Z85N2HQAAAAASUVORK5CYII=", 
  "images/att_src_icon_evernote_28.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAQAAADYBBcfAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAFoAAABaAHAjuH0AAAAHdElNRQfhAgIRBwMKqfdWAAACHElEQVQ4y8WUv2/TQBSAv7NpBZJDmwFhSKhSUYdIIJggDAhSNqhEwoSATkisQP8E+ANAgBiQioSACYmhJRUTajcoW1mqxigC1Q2BSgWSwFBiH0Oci+0mYYO32Hfvfe/X3T341yK2bskR8kyQIgk4fKTIjFj9ix+ZkA9lU0bFlc9lqk9EWeAphkuJD1SpAzFMLCx0qDMpZruC8jq30VZY4Hskj2HGSYPHlLi3BZQFXkhtgXc9ijhGDuFxvh3VB2WSZYz5nhhAlhzUyYgKgObv3sJY6YvBIjbEuBmIKEcou/q0qi3OAU5Q4xUb/EIqdIir6C4p4cA2AAropQB2EQedOJeATd7w1tf8wCajk+dBO9UzYCu/h1gjqVaDZALp2gBnoR1xDKpKeZSBUG07Av9VgP2d5pjwUykbAcMKDbYH1g2ARLCrAfkaiuaGLpcA8DpgBQyl/OR/14E4QyGnhm/drrFM2mTDVy7hsQ+T1+xkL0dCqZstaxVxDiyl9FiiyDSbHGaRdeUQfKtiB5zBTROP1DpKhQEG6TzFYcagyUsFilUea+QioMNBrtDkvdo5jQ6PhKPaBDLBMrH+l/w4p6BGRnwOHIdY4wJujmxPLMtJ8JhsYeGHfI07aDbzfItAccaxwOOGuB86UYWe4xkxjxI2X/zRsZs0FhrUuCyKPROSu+Rd+bvLsHoi94Qtu43HJHkmGPXHY5k5Zlud/L/yB60vvrbSswzaAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAyVDE3OjA3OjAzLTAzOjAwGxDoJAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMlQxNzowNzowMy0wMzowMGpNUJgAAABQdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9hdHRfc3JjX2ljb25fZXZlcm5vdGVfMjguc3ZnEE07QgAAAABJRU5ErkJggg==", 
  "images/att_src_icon_google_28.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAQAAADYBBcfAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAFoAAABaAHAjuH0AAAAHdElNRQfhAgIRBwMKqfdWAAACHklEQVQ4y8XUu2tUURDH8c/daCFsIBYhK1nEqLsEhRSCJoXk0fnCRBsLgyAiWPn4E/QPUNRKEAS1EkQSYylGg4WvwkJCshIEo0YUH9kIQrJ7LHKzezcvO53mHn4z33Nmztwz/GuLlkpho177bZLFpHeGDETv/7JPaA7XwlxYbKVwJ2xa5cTQ55Z0ybi3phRRLyMnp46i/mhwWTCccVFqzLAfi/Jo0CNP2bnoyhIw9LkbUsOer1DELt2iskMLp8ZgyBqVfrQiBu26KWqNPsKaWL0gPZbAInu0IbjhS6w90yxX77yTkIobcKxkOLH7Ac/NItKdUB8qcTxkK6A+deOJK2mxzXYvwGYtFf2nAnV6q+BeCok0u7DTqBnQk7j6AuyrgluZqji3acIaWU9Bo+0V3xRsqYIZfsWuOrtB0RuvfQWd1sbeGWiuggnboQE8MSsY9ttva7Ul216utuOjfNq3GITPvuiIm1CJRXo+ugJOyGdi8LUuPLZHJpHH4/ibmY+upPqAXOx6adqEdTVY0at4lYOhKjiglLcezBkxorOm7hGzoMFW5tyvVEu47sS4e1a3w3Jci04lwWaj6lf/yTt0Ma01+pRoR/TBEaVu7Sti7Top65/Hah/yaZekCh75vghar0eOsrPR1QWtdnQcdFt92biCz/HoaJKXk2La0WhoxYRCY7gcZpcZVjfDhtrI5cZjVq/9WuLxOOGBwWjSf7c/JSjCkef4SfAAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDJUMTc6MDc6MDMtMDM6MDAbEOgkAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAyVDE3OjA3OjAzLTAzOjAwak1QmAAAAE50RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2F0dF9zcmNfaWNvbl9nb29nbGVfMjguc3ZnYkokAQAAAABJRU5ErkJggg==", 
  "images/checkbox_off.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwEAQAAACtm+1PAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAFoAAABaAHAjuH0AAAAHdElNRQfhAgIRBwMKqfdWAAABKElEQVRo3u3YsYrCQBDG8VljdaCgfcDm6thdZxnfxwXJA1gtxLyAT6CdWpxFGjs7SSPbCdpKMAEbEewOlZvDNDtXfL9OJqvzJ1ZLBAAgSf01HKx938uShHZhSB+NhtPNLmVJkzRVnSgy1trKAYO173vX7Za+222ni7/a5PltFATj3uHw27jGnfOyJBFfnojoq9XyFnHMjdkA2oWh9O4/dL/PjersoZf/vDFudx4OHz7EzSb3XO2N7/rXECANAdIQIA0B0hAgDQHSECANAdIQIA0B0hAgDQHSECCNvxu9lOXj/ejTXaVr+/OZG/FvYJKmgis/UdlqVTlAdaKINnkuvTzNTydaal05wFhrb6MgIJrNSBeF88V1Uaj5dKqW3a75PB6d/z4AwFvujM5H5k1c2IwAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDJUMTc6MDc6MDMtMDM6MDAbEOgkAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAyVDE3OjA3OjAzLTAzOjAwak1QmAAAAER0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2NoZWNrYm94X29mZi5zdmcAxvXwAAAAAElFTkSuQmCC", 
  "images/checkbox_on.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwEAYAAAAHkiXEAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QICEQcDCqn3VgAAA09JREFUeNrtm19IU1Ecx793OVHClaaPEgT1FvrUQ0JdEnXKZFcqIRQFXxSkhxRyQuQGPeiD86GE/oCgSYELt5ljCkpvog+C4ZMgQSj0IDadBMvpTi/7rTTWPHavd7s7n8fdnXvu+X7GOb972AEEAoFAIBAIshHptA3tXb5Be1dp6cFjdknaHhqS7mAfudXVuIISbBUU6D0wzfiCLZTs7eEbdnBxft40bfLFFIdjqsK+MFWxtsZ7O24BFPzhbTzDk5UVvGEjUltRkd656EYRxtEcCp0rlm6yhbIyv1vp9rs3Nk7a3MTbH/3isz544juaMV5YeNiEt2gZHORtzi0gMdUIjjLJiqWtmhreZtwCDD/Hn5bP6MSwxcLbjF+AQFWEAJ0RAo7jwgfcW1pibsnD7vf3a92dEEDIALC8zJ6aH0Tf19YGrinv/E29vYxJM8zqcGjVrRAgA8DyMvtkNkejVVWBgM0WCIRCdDkQUF75OwYGtBKRvQJk4F/BH0cKsJdSR36+2o+RfQJkgCd4G7xMgdMJG3xQ+vrUfpzsESAD6RQ8YXwBMpCOwRPGFSAD6Rw8obmARD0dr681H1G8n8hMNGo2V1ama/CEdgLq4UWD00n1dKQnajf7a2rYa8nNuhYXVe9PBv6s4+fmGhs9nt3dZF/XO3hCfQHx4KfbG8Z8rS4XfUyB/GzZf5j73GpVTYQMZMJUkwzVBUgv4IOSvF5WTYQMZHLwhOoC2GWMorWnp/6616LsJt9LIRGxW7kj+20cU5MMGCF4QrM14KQigut1V4Pr4XBKETJgpOAJ7aug/xUhA0YMnjiz9wASkQgoCSSC1ohMKSdPS86Z9xgPqP6r16KM5uV9XG0I+y78vcuYqoz8fbvMDJ7Q7U34pFNTMjI9eEL3rQheEUYJntBdAJFKhNGCJ85+DUhBYrFe9SoKIpHEBYMFT6SdgAQGDfw4aTMFZStCgM4IATrDL4D+Hy84igsKfKlfHI/DLyB+MEHv8aYbbAczsM7O8rbjFkAnQuhggt4D1xs2hvP4sb0da48xk9TdzdueWwAdxaETIXBJLub0eFCGYXSGw3oHojnxcbJHyENkYiJ2I3ZgyikvD67frZsMbm7q/XgCgUAgEAgEmcEvuKRTfu/rKrQAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDJUMTc6MDc6MDMtMDM6MDAbEOgkAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAyVDE3OjA3OjAzLTAzOjAwak1QmAAAAEN0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2NoZWNrYm94X29uLnN2Z9Ts0gYAAAAASUVORK5CYII=", 
  "images/en-attach-icon-3d.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAABkJJREFUaN7tWn9MU1cU/m6Ldcwl4lTG1OnEbbDhdBE18wcmzqlRJ46ZuOkoKGRgC7pSXlvQiIBO6C9+DGwZBgYUqovZMkEXXTaXSFQCwjYmajURZ9RhnYqZk6n03f0BF1kNKdpW1L3vn5f2vvOde77ed+855xUQIECAAAECBAwMyEBPoDcoJWStvzrI+NWqVaSYLsQ7mzf3jMWRAziYkVFk19mSP7RaAYAQSgd6zgMuoEyiDtKeCgrCTf6EWF9QgE9JCl6fP79Pg2B0EmttLSbSdfz1xETzPEOgqrW5eaDm/8gF5KScVF8xZMgti8gCqUpFL9Kp5HRqKrZiLmokkn4TVaIFoZ2d+J2ApJlMjhTy5t0laWnFxVptSsqNG0+VgJQSIp+uGp1TKpXS5yGl47VajIcDTQEBHnPyM6pJytWrpBUpdPeWLf6Xh6y5GVFQkI50pIPnnzgB4zdpjhtLJk8WaR1ieqawELGkFCNmz/aWv/twFPF4uaGBDOf9EJ+QYPrROIK72tDgaTciTxEpoEAu9fOTXVMvNobl54vyeDUNPHasv8LRFBxH4oULpBFWMiw62nmc3KFt1D88HKBalJw963JCM/AFzk2bRv8Rcfi8rk52jms3VFZUJNSnztv2w/Dhnorb7RUom5p8wLBg0SIsEJ1AZFkZruMS7P7+Lg2rEYj2jg76Hf2AlGq1vrccZ8lYnS53Ru4MZV1Hh0ymUhkM905Zs1mv5zhCko4mHc1529e341lxID2vVpPF5Bsao9EgHGfh5+vr0u8wjIK/3U7ewhGRKTratEK/W1m3f//Dxu/+CmwWrcCh8vJ+CzcR1fipulqcTo/Q10JCiiYbXki+lJHBhHNlzu5jdoyH8br03z1P+gtm8vLycnfD93FbwFjEYevIkX0LjCt4kefJFOTgvchIU4Jez3E7dwKwYZ/b3lH4icGiimpt7fq0bJl8nSrVYF25kjZBib2VlZiEkfhDdP9C6e8P7gIe2wP7RHcA9Ax0aMzJkU9XjTaWREUBXaezp9zIYzmpvmLpUp7Dxxis0/UpnIfhfQFjEEC2HD7M0hYailX0enm5TMKdNKYeOsROa2czGkHbqP/KlezqPM7sZBLupCGltpZKSACxV1eTbExE4ZgxPX69DPcfYRcwT9MnK9vDwu7LA2NJKZpmzxYd5K/QZ5qauk7JqiqRfdDyOwFJSdunZ1lU7+7axXji4jSa7OyhQ8XZ9LdB+zIzMY5X00C5HLEkBNd9fO7LA81D1vx1o6Dgsuxv1XNwOLwVn/dXILpqVlO9/mJybEWFY6yIdtYHB9MNOIeL+flohh2jeB5a8hnapFL+lbt7JfEtLbIAdb7h5ehodhVnO9J9dths2EhD6LL16xk343FMEr1/d+uECabL+jVcRH6+txNoBq+vQGf0lFrFAKBQyCTqIG282Yx8vkZ8srsWls2fjwgKoKysx3AjSQNwrxb+lhby2xMTi14a2Fr4kQvoDPMdnU0TbLNBAjGlCxf2dGOW03BcqKxk99GvSTXGREYW2XU2ZaPVCiD3cejGPJJHuDfYXib7Uh1kXJebK7vGdRjDOA7oetSL7Dob91FVlbNd7+8JoZTZMR7G+1QKyJoJxpKoKPF5nvhMP3UK9TScjlMoMI4sp5lZWQ9Myuy6eRivt9KkARNQ1qAy5vjV1rL0pacL02svozGhoQ9MzOwYj3Oa1O3X2/F5fw8sRRvdNGsWWiHGlLY2cg0W0qrRmMz6i8pGiwUPuZf9p5HaOmeOPJaT6hVLl/Jp5E+ywmQi2QDFrFneDs/7jzAr5V6FGqFKJUtnAM+25E0lBosqqqZGZEAVbqvVzK+3w3NfwO7uRp/jrJTrRBZ2WK2y7aogw5I9exJ3cFJ9xfjx7rpnPIyX+XFZyrma9yMT8Hv+DVSuXt3vCR1HOOaGhzvSyUxyuqVl7a/cZeOozZtZm8qVObuP2TEexuvSv1M7y93wPXZKsYbq7amDNjgWZmZCCSnscjlqUYpIsdg1Q1ejlNxBNE1VKFht2zPR7oYqlaCcZOXlAUSD2MBAl7RhiEGlw4EcWOBvMg0+dneb+EBaWh7ykETa2x8bAZ3xf2npCy+VngQBe0N4relhCC/WPYgn8a8dAgQIECBAgICBwr8VnItduBCehgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMPGM87MAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDItMDFUMTQ6MzM6NTItMDM6MDCA0UsPAAAASXRFWHRzdmc6YmFzZS11cmkAZmlsZTovLy9Vc2Vycy9kbWFydGluZXovZ2l0L3Vuby9pbWFnZXMvZW4tYXR0YWNoLWljb24tM2Quc3ZnojGHtgAAAABJRU5ErkJggg==", 
  "images/en-attach-icon-after_affects.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAA1VJREFUaN7tmF9IU1Ecx3/nrrmQWSmBU0duJcgcIhllkqBgKEhpDzoohw9CSj1EhNRSpCIjBy76Q6U9jGFbgpsvmS8+KZTLIkTBmSm5JETBWiiam+yeXryrVpfde3fvtofzeTmM+zvfc/jy2/eecwEIBAKBQCAQCAQCIdYgqYTduA/PYI0G3gYdeGZhgbXwuKwe6bTaYnQW6ZDXG29D+EJJJ00bAMrKxKtLTKQz8AX+inNKS0WrS1CkMzATfkAnh87iWpegiJ6BnLMvHIFZOP6yd3n2qFZLX0SpwU2TCW6iAcisqoJUKEKv09PBB+O4ZGUFTaBmVD00hCqDc1Sv2VxU3aDKfc9jfyxI0IFCM43fvLEax9xHQ2UlvkZdDr6amgIncoKzqQn0QMMDtRoywY0/yOXMb2zET3F5czNdIjsQNE9OjufYH868qahIPAOFZhrHeUzHUZ9wO/3I5cJWOAXflErO68xiK6hSUuh3qAX7Xa6xww6dZyg7O3EMFJppHOcxf1XexoWzYyQ1j6vQM5NJqIxoBoaybze0gV6j+adgC+7AtNcbGsPZmRfSYYPJOBawCjWizdbW5AH65LZVqYT7WAGFbW2seoVwF4bZ9WJmYMQMW4J9YBoZCY0CdVAHrML+jAy253uvyu202WIp6GpQFXRtbPg6fFb5eYuFdbkv0I3PZGXF38BIGXYOqdH86GhoFKiD+yAN2mUytudrVwIBdMvvd7vtdo8H49TVtPrtC1tbQvUisUs0AyNmGNUP8GfnBR0RdepE251kRN2BXLOPOd+FznnRZmGCIEIHhjKr5r+PGUPcdvB4MBagCwA2W5x9YiV6A5nMOggAgyLu7K8s/G0gOgvf4XYwyJZde+4lJeEbCoXeaTDonYGA1AZG/xKR6i7LootLYAAtLC2xTVuj/AgNtrRM1/X3T9clJYm+rzAE34UF33n5EnZHdquf+z36np7Q1U0kiouNxrw8xNuPKDowwrnvMzyG0zYbszG2kanjug71BPtkyZ2dkIsaYXl9XSwDhSLcQK7nvkjwPBcyX1GoY7gLKWpr422kcAN5n/sE1rGsUzRvvKQ7MTyMy+EQ/MzPRxUwga53dyMTGNCRxUXmZRM7KwkEAoFAIBAIBAIhVvwCu8u0NlezHZwAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDFUMTQ6MzM6NTItMDM6MDDxjPOzAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAwgNFLDwAAAFR0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2VuLWF0dGFjaC1pY29uLWFmdGVyX2FmZmVjdHMuc3ZnZxRiigAAAABJRU5ErkJggg==", 
  "images/en-attach-icon-animate.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAAkJJREFUaN7tljFI3GAUx9+LXcohUengIBKRjm46CNKknQ8X0dymLo4K0smhpYXrUIrF0qWF4t2kp4NwOjlIooLDzR1FBymd9CK43uvS7ywnueT78qWXk/dbwpGX9yWPP797AAzDMAzDMAzDMP8b1N3whgrggGVhQC7ZFxdhdWRiBf2RkX7cBg8uLzs9CFWMdNo6jt667KJ9gMb7RtCo2bauuqyjP4FfcBoLMZIVty7jaHNgXPe1IuvCet11bZtI+kPn4YgO7u7gFp5CrlZrDNMMjq2v95d3Pvs/9/dVv1tzAlUTlX4SqQyvMJ/L0R5M4kvHwQ38Bc+q1fq3uR92sVhU7attgKpO67gLXTyEw7W12w/uVwfyeen31/Yiqk7LiAtpC4BmVldln3uS9GDhPgpokIYsq/U+jsJvuLp3G53DIPxTJ37fmAVwzi0r6V7Y11ep+D4+cPv19eysA1NThmEYZJ+cPHiwBybh+fi47HmaEtgmQctUpW3Pa15V+yRkYGB314PT07D75MFHOOvtle2beIBRDmu8MUxjwvfFVbVPVkmewFgOE8lrk8CMuFAW5QE23dfiNIFwn3CauLY6UdB04d++nR5MXBL+iYQnRgykDq5rD90vvvE2YNG3VOr0gKJQTmBazuo2F6o7MC1ndZkLpQcY5b6kdJsLFR0YnhDcoO/0qVQy3+6YxxOLi2F1wbu54EVtc5NWcAlfLyy0Pye7LpROYNy9L6rPY9kL5R0otfdF8fj2QoZhGIZhGIZhmPT5Aw6pDHQgp7roAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABOdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi1hbmltYXRlLnN2Z76BYtsAAAAASUVORK5CYII=", 
  "images/en-attach-icon-audio.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAABN1JREFUaN7tmW1IW2cUx8+5xpfiCyw4hJam7bLCOq0MFHWagt5E6Xzph7H4IVAEV2yyKQPrdCq+sc6KjrTr6MzSTXRFobGlipLO1NxofWvpcJuQDW11jNoWW1u2OkGU3bMPM260s5qbe+O63d/HwPM/5/yfk3OfhwdARkZGRkZGRua5BLcqsNHhIhfFxMA4P8PPZGfDEKpgKD0dkiANv9i5E4xwmWzbt68tsMAbmHv3LlwDFx25fRtVWAmXHA5mgMIwrrf3zI9sNVvtdv9nDTS97CIXJSWRlhIpsbISEBroRHa2aAFehAXoGBnBfZCJlsrKZgMbyAYODkpdl2QG1oKLXKRQ3DtBKlIdP44/Qxu1lpVJXZAH0gOA3mp9ZJmff2gpKurszM3NzV1eFjuO6AYW2e037TcjIlbGQn4IbrDb4QGEgyElxS+u/VOBLfAltgwPK7qWapdqs7I+zczcm7n38WOx9BmxhPR6m81mCwpamd1WEhx54cJWG+eB8uFtytdoVtwhZSFl3d1/bnBwsFj6ohmoPBZpjbSazTBO78F4erq367GewiA8JYXnMY3nDxwQK681pqGQ3k1NXSkJ+T4ovLFRLFmfDTSZOI7j4uJwCi5Tj9EoVKdZqU3QJoyOWq1pmJ4+PCxWgU8RgZ8wbxYWGrOcrc7WhARf5Xw2kM/FM6RpaoJRGILRgADJCn8CwR37GtXRhwwDZgyAjvp6X/MQbGBBARfNRavVqKR9UJuaKnnhT+Bzxy7BJMSz7JHJwV8csXv2+N1AJgyyIMtggGZgQYub/pp7W7hks3E1b0Ui3xiQaDD43UDoghLC+HipC5facPqGunF0/TqkM1CFiVAXEyNW4WLhteEzYKPa/fuFxlMIXWgZSPtJG6JWwwCw/jJHUJ4WltU+a8RYfNMX7Rz4f2XDDjy66Apy9o2M4DH6GhTJyZsV3nDn/YTRyHFOJ5G36zxXwOZltp1tX3+WbtiBzAukx6943tsECgpcdOWKRmN80D/ZPynBzULiuPQ6roBtY+M37MC1HbBAO7T/9fvRTs7EmcrL0Ql6euvpAynDkIthhoagigGY9d0Q5qPfp1CFCFVw51l6XsfdTbtgd3m55QOtWqtuaPA2P8EzkM/nk/ikixeFGrLZDvmbIXdw9upVofmuW8cMHsJDnZ1C1ws28OyCLk+XNzUF56AJP+7v33RAkQzx+a/6K0xDRV+f1cq6Wff0tN8NXBNI4qP4qIoKMAEHAoa14LhCN2I1Tz4ckrGlpsbnPHwV+Mypa9W13rgBSuhH7vRpoTp+++iY4BJ2m81WKxvNRl+/7qucaOfAh8XzxfPFpaWetwmvE5F41oEF5sEyOMjHRLRFtJWXiyUr+jntcJQj1hEbGhr6m2KHYkdXFxyG96lEpxPdkM2yatxyaRAb3JyT09KoidRELiyIJS/6TeTcXMZExsTi4tIi2tGek0NF+C0EnjoF32ENVnl/nvQaT5xX0ADmkyeXAPWM7eBBsY3z4LebgvEl7j53PyWFOiCMzldXYytcg1czMnwW9ny8GmAXOB0OWuCD6J26us97dXm6vLExqev69zysK5liULIsdMAEbFOroZMm4FFU1NoCPcaCcm6OGsgNZ2/dwgG6B5kuV0AbtmN7T89WPazLyMjIyMjIyDyn/AEId12K0jpz2AAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMPGM87MAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDItMDFUMTQ6MzM6NTItMDM6MDCA0UsPAAAATHRFWHRzdmc6YmFzZS11cmkAZmlsZTovLy9Vc2Vycy9kbWFydGluZXovZ2l0L3Vuby9pbWFnZXMvZW4tYXR0YWNoLWljb24tYXVkaW8uc3ZnwuUY7QAAAABJRU5ErkJggg==", 
  "images/en-attach-icon-dream_weaver.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAAt1JREFUaN7tl19IU1Ecx7/HO6UCJQqhlIzWNiXowaeCCDRKjKReFlExqLWwXDcYRVrhZBNNIwi8zUI3SaQgFUvMeuihvRdmUBEb2h+miEjhPyL68+uhrsb04nbZvRflfF4O99zf+f3O+fK959wDcDgcDofD4XA4HI7esGQHBAKRiMtFlHCBC+wc7LOztIE8mIxE2FHkE+vvZy+FnelrJenss63jd0rGx40WQi2aC6iIhM3InZ7GdnYR651Od5dVCp7v7jZakGRJM6yyiE8YyczEWyrFjs7OwOGo6Gqy240WJFmME1DGDStaGYOHXDgSCjXtj4on67OzjZ5WophSrofbZgsG2dzWIPW+Dzkv5eQII8KgcN/hoGq6Sff8fvgxjI6MjLmBr7AaV7OyhBNUIKwRRTwFAK93qS0jvt5SpDqf5g4UDxWcars+OlpRYZVaY42NrJZ52HGvV3FAJczYVVam9bxShe6fMD03Nf2ItbcrBqzCHryzWNTmlyhKLhQVya3W69FdQHfXFnYXY2OKAfLhohIhjy6jvqZGbrVej/GHSIqQHUdVcGJ4vtXaiStGQCXHae3EZS9gvPPi32vtxGUvYKIO08qJy15AJeepjUsW3QW8/Tiy7syB3FzFgEJ8Q93UlN7zUovuAv5uZw9+fnc4FAOOYRThoSG1+VkD2mAOh+VW6/Wk/CoXzyJXuWKq9vlQhGF0LIynJ7jFbvT1YZu6er8+s2u44vPJz2nNFIVLu9+YlAu44K4ZA/AFINBuKgX+3oEXGRjGID5OTqab6CArlCQA/XiReF3ZcaLb2hDEvPOaN0WqXOZweMXsgQsIIIrTRKjDB+pwOsvL88tbWiYmkk0T77yl+lOFcQL+cxwe4Q3l2e1um60ytLGnJ9k0c85jVva/82Tkfq32RO0FFFgJemdmsA8PqXZggIrhYa/9ftNe+ppmtljUCieTqMO0diKHw+FwOBwOh8Ph6Mcf0DtKajHjm5cAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDFUMTQ6MzM6NTItMDM6MDDxjPOzAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAwgNFLDwAAAFN0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2VuLWF0dGFjaC1pY29uLWRyZWFtX3dlYXZlci5zdmdrnj5XAAAAAElFTkSuQmCC", 
  "images/en-attach-icon-editing.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAQAAAAm93DmAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAFoAAABaAHAjuH0AAAAHdElNRQfhAgEOITR0BZreAAAAQklEQVRIx2NgGAWjYBQQBozYBPf9h9BOjMTxkQETtV04+A1kxCdJStgNHS/TJwxH0yFJYDQdUg5G0+EoGAWjgD4AAAmEGiSYNnVwAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABOdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi1lZGl0aW5nLnN2Z5Hsl2oAAAAASUVORK5CYII=", 
  "images/en-attach-icon-evernote.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAA7lJREFUaN7tmF1IW2cYx/9P0mVaA0O7sUDNlGBlrZ6MVTraQSnGldlYtkJVOkvN0Y6D0E2mrC1DScPoMPVCWFkhlWVL2iEt/ZhQ3FqmiV13sY15oRmxLe3E6karYhxLNhdzzrubxQshyOqJb+zO7+7AeZ+PH8/7ng9AQ0NDQ0NDQ2NNQmoHLHUENzlOV1Whk31D8tmz9Bp+wfDGjWrnCYVsNp+PFuu3YoCJcLlGUEE+uFxp9raITu2ANMBaYPd40iUuFUygIMQTJ5IiVyuv6gKRixfpZH7+ajWwlKRIQQiYRbjd6c6nvsDMwQ/x+PF0i3ySBSZJq0jVHyKCEAiIImNp19JJ5eu2ms2hPeX0afPkZNrzpWDtTuBe7JXbu7uFr4Ps7dP8zty1O4GPydLXn5XCfwLnsA3FsRjrRyN77/Jl2RnfpLdu2GAwxI4aDDk5OEdn6JwoAvgCzZEI3sWf0M/P8y47yTpumQsxx5zRKN1XfqMLdjuL6X7VhYuKwjWVZm/r7OzifS9jCPD7AQBb/X5Irs9c0Om2XNrFJrosFv1mvCKPOp14i53CwqFDq90GvwnswRWKXryoHKR6zGVlUYIMytiDB8svdMEFRQnXlJO39d499qZyhvo8Hl5tcJtA+Xrcre8/dizcVmn2ds7Oou3x4ihu3Tbd+1NT+g9ZUB5Z/T44noFP58utBsNKo2S7E/3629PTvLrgJlD/Eozso5KS/7pO+CCwT4THs9k+EDlsKih4qtfYEInE47z64CaQipUote3cudx9ZWXXyiRp/frkdajD1utDU9PoVxW53ofj4zNfRoKmBkXh1Qc3gcoktbM7+/cvFZREEG7dqqvLzY2fNP60UGi3p4pjbM4u+sOenc2rD24PEdqDCuooLY0X5pT97Xz0SPg44Ha8MzjIRnGHioeHcWDBg7smE5pwg0UaG0uvBn4Uu8NhKJiG9+bNn6ttVb4fjhxRnlVa6HWLBaA3eLy9Z/yXCNXjearfvp0Z2Sn597w8fEcv6PL6+uR9M9bYJ1lZurvP1Rifqa2lCyzIEufPLxfvyfsSSYUVATQwlneUthTYhobwLQ3p7ksSphCFoacnXBOuLbmUSNAga2GHKyt5lZm5Akdgw+dE0zEcHLvicPy1Y753YdzhkKWZV2NdjY3WsV2m8brdu1GMDuyoruZVZsZvYbX5/2zhNYImcIVoAleI+gIjuM3a+f1iT4kFXXg4MaF2WPUFtrHvWUiSMkbkv+Joiq7huiTxLkdDQ0NDQ0NDI0P4BxlTbqdWQMDGAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABPdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi1ldmVybm90ZS5zdmdZOLbtAAAAAElFTkSuQmCC", 
  "images/en-attach-icon-excel.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAABHlJREFUaN7tmG1MW1Ucxp9zL7GoTDo0IxOpMidTcCDasBcCEgxGhZEtpMW2jLElRlFpaDeEDLagAxJeWhbJZDAFwkZLblEzthH1A3ElxrFgSMkgDmNQ2CRkOhkwBeXe4wd3/WC98tZeorm/j/c+93/O8+TknPO/gIKCgoKCgoKCgoKCgtwQXxfMmnDYCrUOBwqwkSYbDFI6OoMY2mQ0ct3GJ23TTudyx3l5q3PwUIvRSKPoFQy1t0uOU4NsTDocnMYo1J42mXztl/F1QcEcEM48l5eHVBShcWxMSke24l0S39Cg03FcUZFGs9T6Oh3HWb4MC6N7aCXurq+XFCaiEnuuX6cHAzr41/Pzfe3TbwG6XHp9VdWtW6SCXCSF2dm4C7PYx/Newu+QjKeCgxn3QhPfceaMTsdxOh3LStUtQxnKwDDEtDDFXmhrw1VkoD8kxEv4ETIwKQhMGz7AyZwcl0uvr9tx8+Z/JkCRjlHDppqjvb14Df1Ee/y4pDAZB6BLTCSlCy9p3iwokJJ9/fyWT2d/tVqJE0GYS0mR0tFq+hU4u9152bit9nRPj7/8+T1Akel96sK5j0tKcC/eRrHHI6UjPyGRXKuoyIrsuGo9EBsrPjfscnQVrY+Opn10M8KPHZMMrgkCLR4ausfyW1LQ/JEj/vb117zlGkgMQnAjmmf7+/EC+pAbGOglfIXkIWJ4WGhkT7FjO3eStoUb/A9uN8nFeoTGxHjpX0UN4ubnmV3oxY74eOdtY1DtpsFBuXz5fQWKOM8ZM6p+HhqiboTSD0tLJYWnaANGo6KYDL6ax8CAZHB3oPejlz5UUiJ3cCKyBSgSFTsStO7ZujpqwCwC/2WPOk+t4CMiJN9rSQlS3W6xntw+RGQP8M/TVBBoe4CaT8vJwRZ0QbuMU/IosSJ9akq4zFaxPXv3ivXk9iEi2x4ohT7bYSvUZmaS37GRJnd2LqZf7QXc18i+Ar0m4CGp9A2Vaq3nseL5r9XAS+4o/sZKOxh/sUZ74BI6CimW2cH4G9kDHPZEzs5ctFgW6yiQTuxgR0cl3y+xg/E3sgUoXqRJEiZJZnm5lE7sKIQu9i0WcXEr7WD+NwG+uLn7m/xulYrnMM6nOxySHcidjoJ9ELvJtNEo/pRgbqCGfcxkwifYhta5Oa/vGlGIAZUK79F45hmHIxcttAz/UN9P+P0akxXpDDz0tM2GONqMFKt12QXM+JzU22w0CHbhs4kJUokucq62dqV62kT6aXFrKxdssNse2L9/tf78tgL1F9qfOPh+UhJG6Y+IXsUelQw71Vss+IKeJTMez6IdjJT+Ns5CPzIyd+WXUDbBbPaVT5+vwN1ooQVQq1XbVeUBnYODeBiP4lJ4+KoLf49vsX18XAgXiviwtDSmjNWw82433qF2nFerF9MDOMkE8rzLlW22xQ0P+8qvz4//2Ims+xK1zc24BA0CEhJ8VliNEFwLDiaHyRhzeMMGWo3HSV9lJRGwDo/o9YvpObMpx2Y7ccLXfhUUFBQUFBQUFBQUFOTnD5IT87RPuiVFAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABMdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi1leGNlbC5zdmfxydgVAAAAAElFTkSuQmCC", 
  "images/en-attach-icon-flash_builder.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAAlBJREFUaN7t1k9oknEYB/Dvz+lJnBBh5GIucFOhQ4tVWBFdGjHWovCYsDmik8QO4YIxsBUxgmC5iKDVdumwYBHuTwwGHarLYIcIfZV5eGUMysFS7GLTp0t6sKR8/TP48XzOz/s8r1+e3+sPYIwxxhhjjLFmE1ofVNVoNBYjatSL2Wwul8MhSu/3r3nl9c2ia/ZA2XCANeIAa6RvVOP9+iY1G29gjaQJsPgvrT5WjsbPZLPJY8rZ2J2NjeSbyA/l28REwpKwJCwWS73nShNgyRVappdGIy3Rcwx2d9MJkRS7Y2OGvtzy3pfNTfW+MqQMeTz1GidfgBVQEEbsmkw4TwPi2vx8vYKU5iJd9Q8fxDq+ZjIGr35d99puP+zrDHWGUqlq+0izgcXAxbT4RB/a2gBcgn90VFyGGUdyufJ6msVJHGpt/RnNHyen3691rjQBFrU/dA47h7e3bTaX6lidnKQw3Lg6Pl7xgRW8oK3+fq3zpAuwXKG9cGrPPDdXsaCHpjBit2vtL/1FWv/IsGZYa2kpePJ36d5fClREoGj/tkq/gTSdv0EPvN6KBSnxDCuJhNb+0gWYvK3MKDNWq6pGbbHeQAAm3ML1YLDiA2YcFJ/DYa3zGnaEm614zSGUTuM7nAMojDS2/qwXFzCL9+m0/qLoo4FQCB/xFkvVz5UmwP+WhII4UeEVMuK7z2d1O252BXZ2tLaT7ghXIn5vHOmxKiIeT4fb9bQrsLBQa1/5NnAKHcKdzYon4gCdjsfRg16hW1wsHtVaN44xxhhjjDHG9t8vz+jmi31f438AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDFUMTQ6MzM6NTItMDM6MDDxjPOzAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAwgNFLDwAAAFR0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2VuLWF0dGFjaC1pY29uLWZsYXNoX2J1aWxkZXIuc3ZncTh8HwAAAABJRU5ErkJggg==", 
  "images/en-attach-icon-font.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAABBNJREFUaN7tmV9IW1ccx7+/28RSZxGprWVWbMaElHbV0BVj6SqaJvTF1I6ylTLdJBkrtezBqblRcQplSc320IeOUheHun/kpVqFYZLGWR0qtg91xclWJ+omjmxuDkXUJGcP475Yr2FbspPR+3kL93cO33zu+d3LORdQUFBQUFBQUFB4GiHeAf4uDofD0c9On2YXyYfS2lo6hp/ZeZ0O76AMmenpTww4iuPUsL6OcWhZ6r17ROgMV1ksoiiKRuPs7FMj0HnQeTCw0djI3sIlDDY3/9N52EV46brPV5ctBoq6TaZ/m0vgLSYajgOOA/3szJmo4vaiFnqvF3fgRcHamlwZvYcX2bN6fazyJbxASqVU9kl1tWzBDdzES+GwcJK+C2dVVMCMTrw8OChXzupwn+ZHRmKVL2EFujpcHd6j+/axSrxNt4qKZAvn2DRuDw3ZtDat8df5+fAtVSP7zGqVWhWv4wp+X16WVqjwOUyhK1ZrrHKqeIuSY+NR5LL6SEkJpaGBWQXZG80eCzkspatL+t0wXe02pM3MIBsATCYAKeiOX86EW4HXJq9NDv2yezfdYEfYrM0WrT6sFhpVJ7rjqGh7uL+Fm9CEnmPJyWrfrg9SJgsKhD6WwzJcLuzBBD7S6WQHfo+9SHr40N4mWopP5uXxys9NoMPhdAYCjMVrfrtdFIuLKe7/L+Fa+P8G9xaW8Hg8Ho9nx46pyz80p68tLMjuLERmQ9bMjAgRRc9rNERERPFbydFImBU4lTGVkf5mYaGsOIks+hFlXV28xUkkjEDkIQ/us2ejlUXu0wr7ht9bdzMJI5A0pMHNkhLZgkZcp6rFxY39q1phWX6n8V/DXaBjwjExYNbpWA1qUafRyBY+h09ZW29vE5pQRKEQ79wS3AXiEA6FuqO3Lsugj9GROK0rwV+ghdro69JS2esDGMOd1VW1VTCGAn19vONuhpvAq5r3LXd/y85GDoJYz82VLVyAmb71+2vKa8pN4ysrvPLKwU2g4A0PYPjcuWh1zESV2JN4rSsRs9MYaUWpkkMj1Ot2sxdQgFK9HrloxivDw5uP0oUTbElwm82sCmCVW0yYijR6NxJRZwofbiz19AAo5y1rK2K2E3Eedh4OdPr97DWUIdNg2HxdOp9TjQqX0FVeHg5FiHnn5jCDKahVW93IMrj8frtdzCz+0mjkLUqOmLUw82EUz+Tny12nCwD74tSp8B+R82y1vX0bcX8F66cKttjSwltQNGL3DGzHElq3OSo3w4ThnTsRRAtG5D/m0BQe43h9vc1r8xpGfT7egqIRsxaWnoHCV6Fp4Y3WVnqEegQLCzGOMXY1KemJARro4Q4GsYtexU8PHkTyMcDGWlrq99u0hpX+ft5iFBQUFBQUFBQUFLbjT7zJdhtwzFwbAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABLdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi1mb250LnN2Z50G1j0AAAAASUVORK5CYII=", 
  "images/en-attach-icon-gdocs.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QICEQcDCqn3VgAAAihJREFUaN7tmjFIG1EYx//v8KJRC6F0qR69QYqVji0SGq2IW4cOdlFXg2YS2kJpwaWLRSkdHCRLRuvQRcRJESWoEaGdVHRxESwuouBZk/TuOuhrQYRc/fLe5S7vN7/73seP//vucRygUCgU1QujFnjR+3nw15JpYtL5qL3NZFgbfrqZzk48xzIeRyKiGu9qfTSk/Vhbe/flZSzyrKNDrrZ/aOQKXNwwvrobPT2ixXGan9zd0toTiYk3cyeF9dVVKbZugCzwb+J8wm+R9ARKSlwpuMjx6fn7v1tyOVn70gVWGAZi37AXj8sSGTqBHFkiAyvQcRzHyzoucuzT7CsRMzKwAo+OTk9t2/t688G911p7IjF6Zzpn7R0clKuPwArc3NzfB4DDw+Nj275MpOuWfq4tbdq1LYZRLpE1fou4LZaVz7susLKyuwsAxeLFxdkZUCxa1vm5hwJPATQaBpZpfQQ2gdfR9bq6aBTQ9YaG+np5+4ZGIEe2yNAJ5MgSGVqBHNEiQy+QI0pkYN/Ct4WLBLxcekojXeDMTCpVKIir39+fTnv5tKHr0eilSBpVc4RFIT2BXhMSFFQCiVTtDCwXKoFE1AwkohJIJHAzsNISrBJIRM1AIiqBRJRAInSBWXRjW+TVWBAxbOB7Pk8tU45fOz6wgWzWbx//TR+bZX30vskC3VrNdKaSSaTYe/ZwcbFiE3nVlzuCHWYsLLAme8wZSCb9bkuhUCiCzB8kv8RReqfpewAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMi0wMlQxNzowNzowMy0wMzowMBsQ6CQAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDItMDJUMTc6MDc6MDMtMDM6MDBqTVCYAAAATHRFWHRzdmc6YmFzZS11cmkAZmlsZTovLy9Vc2Vycy9kbWFydGluZXovZ2l0L3Vuby9pbWFnZXMvZW4tYXR0YWNoLWljb24tZ2RvY3Muc3ZnB2JdzQAAAABJRU5ErkJggg==", 
  "images/en-attach-icon-generic.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAACidJREFUaN7tmXt8TGcax3/PmcnkOghaFSqT20i0rpmkaC2p6xLNolKCukcwCSIxEsIqRVyLKMalWyp8XNpE6bpU0hRRMknrGpMwM8lHrJYoIhfGzLN/NDl2M59+rIrF7vz+mc+c9znP+z7fc877e897ALvssssuu+yyy66XUvS8B/A46XTXIq9FurgAZYFVAyIi2J/UdGvgQMzjKvzati3CcRn9PDxwG99BcecO3NCeAvR6VlAf1mZk0Dj0ETw3bgw6oEz19DQY/m8A6pT65sZ1YWG4j6V0PiWF96ADxzVv/sQFjscybLFY8CeUUuDKlWWrZHs5LCkphLzIi6qqnnacLxxAna7gmHFSTAyv5VNQrVyJSeiPEEGwCUzHZYq8cQM/0nb2KC4mHUooWy7nvtyfE3x9f/e8naTG6cxMGurm5Xg0NFSl8tB6aCsqXnqAunoFJYaNPXvyIN5BkoMHbQBUUE8knDiB1tbzQh+NRuXeUt5iZHY2ERER86MLkO9c1LtpU14mXLC6xMXRJSzCm1Om8EbEYYxEIuY7AgsN2ro1KLFlK0XeyJEvLcDjNy9tvrRZLnesIqPT7gsX8A+M4HWvvy4G5NEhStuz515kSbRx6tChbtte69Wiib8/CiQPhSZTp9Ji1MfggAB254Yku3WL/i5sQ+sdO1QqP7OiX2rq6Z4FDU3jBgyg5pzInffssbkwPtxUyHrnnaCG/vU8R5048aTjlz5vgE4fC3LHMfPncwSP4Hf/BdxWmgJFUZHLdbO8PHv0aOFm0+MKS/fuVldKI5d9+xDGV3mfTMZhj3IxAGarBggNzcnSXzSlduoU1FU5QBERHZ0zTR9vHK/VAugPREXVnENdhOFcUfP/yQEKT3pCXenUpUubrySrVMjkI5ijVtdu573YxQPU6kqN02KnxRKJ9TbtgNOWLXgbVzlTJhMDc1AA06NHWNQFSLnp5Mk63WX/ot4dOtAwSUthzsaNNv3sZw0/6Nz5j9bxXweYyZmcyVKpUE6XhZZarc3cVP3IBl9T1vNO278fOy3hQtLCheJypUaNcRPpBoPjO/c9Be9GjZBPg6FITxfbg6CEggiwTLNM7dChSvEwvjK8sNBmQMVYBdfXXntpAMojPM55fRITAytGoW379mJD9TpO8obVVbg2ZUruN4XRRu7YkUt5KHo8euRqRKXCTnw8cWJ5X8l8YQ8RzeMOQMeOteOsCZQg7C0tdTJJfnJRvPqqzYCOYCTtKi9/4QHmTb94wFDp6cn3qRsuzJtXu5298T1tTEy0Ot1r+8sHN25YDfwDvafV2kz6cRiOpampKpXfGq8bhw9LnR32WtyTk3knEmBq0kQEHEqR1KugQFh09/DNqP37OY1HWaYOHGgzsKu4ytLTp194gJatkr3CqpQUJPBJnuXmJhaahOHIPXkyyFv5hef49esBeW6jwOnT8RZ/watbtxbjhtEQHLx1y9LUIZLbx8bmbivobFB36YJpnM5eY8eKHVXPiTSbK3B24kRAnivPrV8fndid3p4xo/a4SE9EDbdvf2EB6tpdGm1IeP99fAMNfxAaKjaYqTuNMZuxgKus7SdM0IUWDisuVii4HEexKSnJJlEqR7FCo5FbKg9XHv71V+thTqLeGzY8muuqtQnX0G3r1sDoljkK54wMjgRkkcuW4VWYWdO4sQhuIdKw9+JFwzS/8Z5f7Nr1wgE85VsYXRhdrx4CaBpVfPJJ7Xb2QgXPW75cpfI/5+Nz7hxe4a7WqNWr4YL56OHiIgaqUUzxx44FBiojvfps3lyRL23g4j9zJmLgjTcDAsQ4H2qLtaWlUhfh/MOY+PicNwujjUldu2IcPPDdhx+KcTWuPYsb0x21OjyciMhi+aN1PrN1oFDGMqnf4sUcC0f0b9as5jgtpR4wm0yyFpVjnCsXLNDpCleZDkREMFu7cat+/cQEJ9CcQh48sJYKKTQ+KupUan6WIcrXV0qSEEGTkFB73UKD+CKuxMa6taeVaH737u021pkYvn492uEeZI/uUCpCA9q9aZNqkn9/xaeZmU9dZ12Dy9EXNDT8FByMvtwUbhMm2ATMQLgQrVZX7JQWmc87OuID6zDuu2JF7TC6SOHwXLw4uNB3dYvE/HzpJskY4Zd163gLAkFOTmKgCrOgyMoKzFB6Kb7ctu32j5Ykh/dmz/4NnL+/mG8IFkHx88+yYffrk0ajqat66+xVrmZ9J6/vsUuhz8nho2gHx3btxI7SKQ1Dtm9XLVBqvE4NH54zuyDE2HrTJoTxeux7ZAKUTKtpcmFh2W6HFD7Qpo3rbvNuYMgQ8uK2MH32mdjhSpRDcf8+xSIHaNeO01iKNswwUHucPXMG0+AKk6OjmDeGsmh2RITqpDJSsX3Hjrqqu87uQHmuh1aBuDgbcNXu+fCytCGPmz5ddE8PjsXqMWPEBNVzk7U1jyTfiRNdm1WlyOq5utJZdqVeS5bU7o+cyImrFiwIDFRGKqDXo1LYidnr1tUGh3BaC8WhQ3UNrs4AnuR8NrJCwW+gBBlz5tgEPKF7Bs9tGey5+uhRUgvdzX4rViAMvqx95RURXLV7OpeZ51Z+uGRJTnaB2SQfNw5DOAXBISFivgok4duKCrTCTaF40qS6BldnAB1mCsdpcmIizmMYvJ2dxUIT8BX1+/77x7rnL3Cg5Js3SQs80MbF5a7RB5kq330XDXCFl48YIcbVrO8GUjqboqLKJM69nHu5u9NCGoUvk5Nrj4s24zY8P/roWe1E1xlAtqLzv7lnzfEjVg1fmDv3x05XYq/E+vgQIQSjExJsCl0G8M/Tp5cFyiJlkffucRYFY9D69bXv0Br3DByhzPZOOXZM0tesJXV0NP7Kc+Hn7i4mTKbW1PvsWcSULSxtaGtOLxxALKSe+MH2HdPxnPmcUHzmjOVz6+fCyD59bNxzNHXCloyMGvd063L/Bn07axZrOIbX+vmJ4H7HPbkvvU/f5eWJW/aLqBN9fO+edYF1nWXs2LEqlUqlUpnNzxrgU7uwrpn+jvGAwcBpuI5WXl5iQzofx3thYfQXevhAnZ2NKJTKLm3YwDPwZ8icnKyJwpaHFRMmUC8qcMyrX5+Uli+tJXl5tberHueeOp1+g35D48aAtIe0h9msUvn4+PjcufOswdWZdDH6gaa0pUtzcvR6o5FZ/I3XW4wpJSWi69oU/ts+XU50QR8jm0w253sVxBj54MHnXd/j9NR34GmP/DUl8kaNaJgw6cGis2dt9u1qOqp+A6n5z/H8LRwUCpuE1aYiybDkW1eqVB2Wt+rn7VxU9LxBPTOANcpzK0g2nQwIsHzKDXjb118jAN0Q7+PzHyfYBV8cuHbNOpb/Zi0PC3vL33+sj0ane96AHqc6/6gkfghfXqZ+EBAVxdexlnsPHkwldBpZSiWkfIj2ODjAi7ohSK/nrmgA+VdfWbUUaL6ekvLWZb81fmvu3n3eYOyyyy677LLLLrv+x/VP5iCYHXEHs4UAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDFUMTQ6MzM6NTItMDM6MDDxjPOzAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAwgNFLDwAAAE50RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2VuLWF0dGFjaC1pY29uLWdlbmVyaWMuc3Znf25HpQAAAABJRU5ErkJggg==", 
  "images/en-attach-icon-gsheets.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QICEQcDCqn3VgAAAkJJREFUaN7tmE9IFFEcx79jq6Ss5EW0GFiyEqRLF0UZpYNXqUNRXaUlDfLgxVOdEiX2IGKQUl6CiL108k/oIVjcFuwSHowurjBIbnhZVhl215nXQZ5BKjvtb+Y9Z/d9bsM8fvPjw/f33swACoVCUb1o1AJN4x86HrdGIqGMZuHu/DyuYQT3+vowjsuI19X51fj9p5GZzpFkcvalkRq+1dsrVttfaqgFjsV9xAQO+/v9Fse5fqlxrnXbMIZfJHtmv6+tidF1ErLA48RJQrZIukBBiSsFF/nk91d9rjmVEvVcusBzRvv78FLL2+5uUSIrTiBHlMjACrRtxhyn9DoucvAg8e71jvd7ZGAFmmYut7fnfv3NN01d+jfDeLD5ORf7YZpe9RFYgcvLu7sbG0A6nc1mMoBtO46bRHYtXUnf+KnrXokMyRZRLtlsoWBZQDxumuvrAGBZxSLA2P5+oeCiwCS+ALpO7SOwCTxJfX1tLaBp4bDIl6oKEsgRK7ICBXLEiKxggRx/RQo/RLa2Bgampvyr39a2sDA6etodLvLoyvVhU4LAnsLlw0Uyxhi9mnSBZyXm36S6XeeehgYvRroK9kB/kZ5Atwnye+8sF+kC5Y2wN6gRJiI9gWqEiagRrnKkJzDoI6wSSER4As/+Vg0mKoFElEAidIHP8QsPvfgxJBb2CjEs5vPUOnSBeW0MnYmEbCH/i3YRjwB632SBh0WnHR3RKKZhYnF19dwmkvf1CUO4vbJiPwtdvXAnGpXdlkKhUASZPwFu9jieEVOZAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAyVDE3OjA3OjAzLTAzOjAwGxDoJAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMlQxNzowNzowMy0wMzowMGpNUJgAAABOdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi1nc2hlZXRzLnN2Z1sV6wcAAAAASUVORK5CYII=", 
  "images/en-attach-icon-gslides.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QICEQcDCqn3VgAAAmdJREFUaN7tmMFPE0EUh3/bZZfUAuEAmpQm3UQTo0kvGkhj4QJE9OLJREM4mV684En/DnowHghX45VrlxKDUAwHTNCDiSHQQL02FDbYrdvxsE4wCNh2pjPsOt9xM/PmvW/f7uwsoFAoFP8vGmuA40KhAiSTuIonwMICqigDY2O4Q3KAaXYqcf3TtW/TybU1817q+dvS6KhYbSdEmCNQcTfIK2BiotPiKNrwlfs3n2UybvHzm+nk6qoQW2fALpB2nCRki2QXKKjj/gUV+fP6l/GnH9bXRa3LLvCSQb5G528tp9OiRIZOIEWUyAALJMTzmhj1W6Rb3Hrw+Dv/d2RgBTYajlMqNT9eG469Ts1nMj/iHwsPH+3t8cojsAIJqVQWFwHPOzra3vavNNORemnQSt9NJHiJZP+QPl5aAggRIe0i6nXHAQDXPTxsZd7AwMwMoLXtIbAdeBrDiMUAwDR7e0WuGxqBFNEiQyeQIkpkaAVSOi2yS3RBjUZ//9QU4HmWlcv5pcXjLBFdt1wGdH1nZ3YWiEQODmz771FU5Mms1jab8xDegZ5nWXNzALs4imkODf15Qy6GijSMnh4eq0t4hP2C+dPdnUi0kgUfgcIf4dMYxsZGX1/78+v1kZFqVV7+od9EOo0SyIgSyIgSyIgSyIj0XVj2LsqKhA70Tw78qdX298VXI1wgPXLxE+mL0/XdXT+uWELzQ7VdotHJSfVDVSJKICPsAje1F4Dryi6kZYq4DdRqrGHYBerkPbCyIttHG7zjkTe7QEfrArJZFLEF2Pal7Uial42XQD6PPEkB2azstBQKhSLI/AJie9putJDt3wAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMi0wMlQxNzowNzowMy0wMzowMBsQ6CQAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDItMDJUMTc6MDc6MDMtMDM6MDBqTVCYAAAATnRFWHRzdmc6YmFzZS11cmkAZmlsZTovLy9Vc2Vycy9kbWFydGluZXovZ2l0L3Vuby9pbWFnZXMvZW4tYXR0YWNoLWljb24tZ3NsaWRlcy5zdmc/q3XOAAAAAElFTkSuQmCC", 
  "images/en-attach-icon-illustrator.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAAaVJREFUaN7tlzFOw0AQRWcNHRVJQetcgYLScToK2kQU3AIJ4RMYIXEAOpcIt0iUOC5TwBHiNkVCRYmHAq9Bjs0ui3e9RvOaLfI9K3+Nvn8ACIIgCIIgCIIgTMNMX/iKl+CD6+YbFuTectmkcwYYOulotM+uIIEsk52/XgeB5yE2/T4chmGastbe2zHmXEE+de7fp77flq5rjBvI3vIDdjEet6XrGuMG4inb4KF4s2R1XWMsA2Wzr4pqFprC2AaqZprtWbhr6iKeaQgM4Pz3zwEAQBxFIv2//QqrZprtWajdQJ59cAILNnHdLcEDHOFTlpVnleK5co5laDdQlGHsDgfsOUn4qTqnK7QbKOpzuOes8Ho+56fqnK7Q/hH5nmF1ye3E+Wwn/tq8z5rzw5zHzryqRdsGymYf73dlz+tZFmrbwDKzbvGFrWoEhSE1tWMBE4m5ADOZWqMbbRuoK7Nsy0JtBurqb7b1wtYNFGbfX7EsC1s3UNj7zvAYbqKI/6VqOrlO9Z7eGijb+0Rz+tILWzdQlFHV3qeqsy0LCYIgCIIgCIIgzPEBODUacLLlyygAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDFUMTQ6MzM6NTItMDM6MDDxjPOzAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAwgNFLDwAAAFJ0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2VuLWF0dGFjaC1pY29uLWlsbHVzdHJhdG9yLnN2Z5fOOiMAAAAASUVORK5CYII=", 
  "images/en-attach-icon-image.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAABDRJREFUaN7tmW1IW2cUx//nRq2onVCLhZm4rozFVSuC0qqr26oRtOmGWEznIlUri45CGZ0gsxRxa2GUbogdolaX6YyCGVNWpYZIhy4v3dZSNOpa1M0l2tY2mwPFhWry7EPNPqyIL9ckZru/j7m5557zu+c893IfQEBAQEBAQEBA4P8I8Q3Q8YbRYflSLmd2MnC9DQ3sQ4SwqqgoXxe2KvvQSznT0yyUymBSqQriUySxkdevbzYcb4Eas+nc6Es2G36BnHWLxb72s276UY69NptSnWqKC4uO3myYAN6J/EucUpmaGhdHvG+Mp9BoTKaREcYgw2VMSSRQI5VPPP4C10p0m+CpG8v5ujB/RxDIE68LZHmkoOre3uVLpFj+Xixmv4tOusolEuThM9Rs/mnoKzy2Bq5KPRfsnC8rKxw6NJHw3swMzjz9uUP607RlorTUhaWz5LBafS1mvQgjzBOvdyCVORM4cWNjG37AcJZKJZJy0/Q5kSt/qYmMjY24AiDR11rWj/c7UIuzeD87myKcrdxlm81lX7pBDqsVV7APiVlZa51OH1ET9gwNcRWkoOrs7IWFoCCHIzQ0MJAUVB0RwfTUiueKilCJBsw/fOjpcry/Bm6WGCRANTgY8LGjmaLkcoXiCMVqFxZQiiRo3X9aXARQD21LSwczs5/ZwACLhsRpGBjwVFrbfw0sQRhlm0yOftdiQMmxY25x7QvGGktlQYHmgWly9OXZWY3dLB7Nu3u3Pc7YZIlMScmnFHqFpqY4iasI+enp/xmBq42g+3WGGDLw7enTeIx4hOh0ga1BT/7qOnq0pOLw7piS+fl2mXFu1FhczJw0SKKWFtzALPsmMhI61smqpFLMUgZd0unaag21Y+PJyW+bXr0QNz056al6vDfC6x9BoK+uDkAYKuvq3Ec0T8z9o7eVStaEA/jk6lX0sE5Ucc80AKvBAyTt3End3Air7OvrOGWwW7plsvwvDu8+kHPr1laX5fkOvEcKqjabNzqC7tPV7Dv2KwsORj97gRkuXkQ462RVItGa181BEasKD3f9xlnoeZ3OU+V5TmArwvH1nTuQLnc4z8vl7hFsKzKXjVgLC1cbQdZAXTSj13+lNb42FpyWVkxH6EVyOOgE9yP3ODMTt3EQtffvrzuPU9iBkF27/E/gSecfrtyMDKUyLS0+fm7O3XF0ED30QXMzelCOE8+OIKZwDvdCQ7lOimFvXrv2dASTkt6ZT1buvzA+zvaKYmguMxPp2EO5jx55LH9fC/xH3KfGd0eGjh9nmZTLdanVGx1B1iZ6i6vQ6zWamzeHhxMTC84cmojVjo2xCHrdqZDJ8CfOo95u97XITeP+7rfdvv95K98tfwr7i8itYvu/SG9z+Atc2eXydSEbZmVTiW8Y3gLd24N+I3JFHKcnKxWrVL5OR0BAQEBAQEBAwD/5GyeSAGFyRyxJAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABMdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi1pbWFnZS5zdmf04cYdAAAAAElFTkSuQmCC", 
  "images/en-attach-icon-indesign.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAAi1JREFUaN7t2D9oE2EYBvDnjfFAShYDR0kQwaYS3ZwUXEXBlCJCCw4VkykBSSbNUNohHawpDlKwEQkngYKVEpS2FqtuLgrtIOIizWCshmiCtEUleH2dTsRwtJA/3we+v/U77h4e3vv47gAhhBBCCCGE6Dbq1I1rtXjcspjd1v3+XC4apbY9v9vPc3jafcP/jRTYIimwRVJgi6TAFnlVB9hN5Wl8pVAxTeMNYB9OJvkzh5GJRGiZDuBbfz+/xBiO9vSoyqdtgbVaImFZQ0NkMuy3+TxXUUTO53NOXjwKwFSdUsNX2CkOdY7DmpvjKooo+3yqc7nRZgKdV/WviZtBBw6+7abNBP7Z49wm7jau43mjQctYoS/pNEe9n3aqwWCnvjD2SpsJ5B2U8XNgAABwv3mdIjSFd+PjB0/OlK7MZrMASqozAxpNIN1CkY709bmt289s2ztbKKjO+S9tCkQNKb7n/jOAXhuVxoJ+e6I2BXKKw1hdX3cNOmoHPQ9GRlTnbMqlOoCDfuARLS0uuq3zEl/D8Uym/iqRsE6k018Hrw7mbwYCqnNrU2DjAoU9D6enycRFHNraaroghSzOGAaHmJGcnCTrV8Bjbmzs9h+w07QpsPdc7uzl3mqVF/gjv4jFUEcCCovZK20KdPjP343FbszP4z2v8unhYezDYzzZ3FSdy412BTqcIo3S/jyHQiG6hO/4MDFBdzCGU2trdAxlymxvq84phBBCCCGEEN33G5C1y4sYjzPRAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABPdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi1pbmRlc2lnbi5zdmcZmMqAAAAAAElFTkSuQmCC", 
  "images/en-attach-icon-keynote.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAAWJJREFUaN7t2b9Kw1AUBvBzxRfQtX+ERiwIfQAn3UvHZDVTtk7O0kDnPkAn09FMgkNXB8EnUHBIB5PJZ5Bel97BQqAnN80x6ffbD7n34+OUcokAAAAA4BAp7oDrRuMkGQ7VGfXU3XxOX3SiZ62W9EUKC2mqRlmm3tVg/RoEj+7t0/npcrnrODtA7yNyVpdpSiHd6+d2W/r+pXmhK9VP0/jb7/d+ut1dx47YH2pacMYNvenPToc7dlzV+eLY9x1HsRtflOdFUZJove/v8BsIfyBASwjQUmU7MI/trqp6t25DAy2JN1C6QbbQQEviDcQOPHDiDZRukC000JJ4A/N24HYzq/pvy4UGWhJvYNEdmDfn0YNOdBiSpxa0mkz2ff7GNLDq4IzaBygVnFHbAKWDM/hvIv/017As3J1c5E1kqkZZJn3R0m0elbhj7ADN819jgtwEp6/1xXocBNLHAQAAAIB6+AUQ7pEMC5OXngAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMPGM87MAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDItMDFUMTQ6MzM6NTItMDM6MDCA0UsPAAAATnRFWHRzdmc6YmFzZS11cmkAZmlsZTovLy9Vc2Vycy9kbWFydGluZXovZ2l0L3Vuby9pbWFnZXMvZW4tYXR0YWNoLWljb24ta2V5bm90ZS5zdmfWvv9nAAAAAElFTkSuQmCC", 
  "images/en-attach-icon-link.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAABedJREFUaN7tmXtMU1ccx3+/3tuLmUMQhfmamiD8M6YLPnAbGgEfpDzcqBSjJqJkVZ6RTbdMwEdETdREtCCxc0CiIFSFQbUiimyAUxamg8Q4BNmwzkysIj620cc9+4dTCYSUttDKdr//NDnn3HN/59Nzzu97zgUQJEiQIEGCBAkalUJnB2CtNleVHqya7eXFdujnsB0pKbhZtJ80RkQQV6KBsd7e5oaLoQNOtrWR9/E9EKvVoo/hNJdx9KhCIpMtevX48f8OYOKLkpM1H0ml8ALy+Jn5+bgPNkOcq+uQO3gC4Sh//hwfkwKI2LBBcWV1YnBWaam9cYmcDcaSkteViK482LQJH0IZv+TMGavBUU2A80Q5bhzJwWry1tmzyUuLc65uiYqyN743FiAFRzLgEzyWmwsKiIEQNK8YkgLNoG1pQQkiWRAdzQaIE8XNU6bQX1oO02Ah+N+9a+64tx/iibGgzs+Xy4vkNWTiRFvjfOOWsCVwEIvZoG5oYOeJa0WHQ0Oz4FMMwmfPBusvPr6wsK5u/HhmBhuo97txAx7ADbjp62tucB/KIXLPnuyKmKKQVzt2WBvvGzMDhwpOr4RkPmzFCkvgqHJz165dtKirCx6Q63AzPX1Ag30wAfwiImyN2+kAkzWaVk2riwvPQyiOvXOH/UlcK/acOtVkMho5zsODTCbhoJ47Fzv10T2Jy5crlTLZsmXd3da+hw3gksTN9fUDKkphDsTPmjXqAFI7Qv54/tuYeRkZohL8G3QKhTHZoDXEtLYyp9kovbdWiw2ohcl5efw1LtVFvW1bskalqhvr6emsuPvL4Xugs+xIUlJxcXV1dDQAIoBKZa4ox1z87NatbK3s++B2f39rx+OwGThSdiShq3h3zQcrVw7WfAuUkRri7g7T8EPwz8zsX49j+BSIVattHdeIAxxpOyJagpd5eUFB6nWVqlLr4UGr5XKV6vJlNzdjo2Exn1pZOSD7xsIzmNnd3RPEV2KGQmHr+EZsCQ81qxqfspGmq5GRk5Y3b/uxWafbBbtgF/B8//7MdqSA3Wr4uqEB4iCL7PbxMf8RdxExJSHBMBPAlFVUxMlBIbpw6RIUkCSICAh4HRiUQDUh5ASuBl+pNOegTBYSW1Zm6ziHfQZaC45dZ1AzPXl5j+J9CkPq3NwG65faETyHR/iL27ebK1SQAwkXLpi2sh1G5tw5S+BwD3xHEuLj7QU37ABtBQcySIRjYWGiAyxv/Co42NJ7+IniHVBaU0PBGU+JI0wuGzeyHsYKJriiwhI4xakYfum048eHa9x2A6RZdagGmDlknMGapFIKjjZDL/iSiPbvp0t1sPd5Lmj6tX59VxcTYNKAe1ycs8CZ47b1QerjGD+DhvFraxuQVfuBowaYbvYGMekS69vboQDc4fc+S7c3WeBsbCBsWhrzhE3gTly7RquNDfpsw+zAQPgWU3Hn3r3990JHgbMbYNI3xVVX3TIzoQm7SGlaGi2nWVXsy2WK1i9cONiRi9oPUSc28ZKysgEz11o5GByVzUuYXmQO6LAN5xBperqls+qx8at3Bv1SXo6JJAT/WrWKGmSrA+m1IzSrOgocFWvrg31ugCv6lvdfcpZETxJyeVFTDamt5e4zL8nbKSlwCx/iO+Hh8IJcJPV9/Fs2tENnSwvuJi1Ycf58j57/GYMVCqVyjTLIW6dzFDi7AcLnUAhVhEAnuMK79geiVK5RBqFOl6w5dVTTeugQVnKTxmjLyw0GYyl3r73dZMIfjIEMI+4QHeYPTJ+OR8Zx/yTevq2USKIk2NPjaHBUtmfhRgiER/fu9S82b/JWip4ciBd3xiWnqornCSGksZFhWFavf/qU+4LR8WmdnaI76Eq2zp+vkEh8JD7OA2c3QPqxZkBF75nTkh2homfVoRpgR+9xlmRz1qPXSuQkCTNMamujh/zXIEeXHXE4QPM4ez/O0NuR0WpHbJXdJxGaRUe7HbFVw34bQ79ycX8yL3lr7EjvtRLNxs4GI0iQIEGCBAkS9B/Xv0R6xmS+OKmNAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABLdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi1saW5rLnN2Z42m/5wAAAAASUVORK5CYII=", 
  "images/en-attach-icon-maps.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QICEQcDCqn3VgAAA6lJREFUaN7tml9IU1Ecx79XuxukmZBFD5YF/iuFysy0JYJWL2FGlPSPXhwFRkGtv1BU0ENFSQ8iPqgUjSL1xRhBCyLSpUzZi9AEoZStOXKFOPfn3u3u9CCXUW5s8247W93Py2H3nPu7v/Phd8899zJARkZG5v+FkRrgq6c+d8fjggJhH15nVHR3MyNkDXpra8kEcw2jCkWiEl/1vC57v9tgWH//zpsH5r17k6stSIbUAKI4PMNDXG1oSLQ4EaUmv2njBZXKfuveoRtbhoaSo2spkgWKFUdrArRFShaYrIqLhCjyx+a72usvhoeTdV3JAlMN1rSBK3BWVydL5D8nUCRZItNWICGBgCBEHieKtN+63XJ5Lv5rZNoK9Hrt9pmZ6McrNZv2FL5Uqb4dvDRz7qPFEq880lagx2M0GgyA222zWSxAICAI0VRkrrb87bYv+fnxEil5Iz05WV+/cychydEWnvl5nvf5gLm5xTZaGhqMRrOZWbaHFbQnLqJU7t6tUgErVzY2HjsGsGxRUUlJsN/nm5ycmADc7oGBvj6A40ZHP38O9ufkKBQsG/wdq8i0FZidfebM2bNAVtaRIydOhB+nUJSXb98ebF2u/n6tFlhY0Gq7u4Pjki2S2hooVlwkceHIyjp69PRpQKmsrKypWdoviszN/VNovKEmULxV/4bjxsZGRgCHo6WluRlwONTq5maA500mozFUnKamUHFEEi2SmkCWLSwsLl563Ons7GxrAwTh58/ZWUAQHI7ZWWB+vqPjyZPQcUpLI18vUSIproGBQCAQjziExBJHFBmvfQO1CvT7LZapqVATbG29cgXIzMzLW7t2sV23DsjJOX9eo4k+TiRWr45PJVKrQK93cPDDB4BlS0rKyoLHFYqKiqoqIC+vq6u3N/o4tKBWgR7Pu3c6HSAINpvVGvv5gmC322yAx6PX63S0ZkFRICE+H88DTmdPT0dH7Oc7nV1d7e0AITzP87RmkQLvwhw3NjY8HGzjPT7RUBcoEqmipFZsokgZgZHWNKlrZqJIGYEi4Z6qtJ+24Ug5gX6/1To9Her48vZ7iYb615i/IcTlWlgAfD6zeXwcIIQQQgBC3G6Xi3Z2S0k5gSK/ft28efEi7Swik3K3cLohC5SI9L92lJJH2EXzXWCZZMKEVo6TGkZ6Barxg9R9+kTbR6wwxwFyWHrekgVmPGVOku9qNXMKJqJ//z5VK1LMi9mKrYBez7zKqGQOqNW085KRkZFJZ34Dzg3IpkPczfMAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDJUMTc6MDc6MDMtMDM6MDAbEOgkAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAyVDE3OjA3OjAzLTAzOjAwak1QmAAAAEt0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2VuLWF0dGFjaC1pY29uLW1hcHMuc3ZnG68OzQAAAABJRU5ErkJggg==", 
  "images/en-attach-icon-numbers.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoAgMAAADxkFD+AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACVBMVEUAAACBwVEAAADxS4cRAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAFoAAABaAHAjuH0AAAAHdElNRQfhAgEOITR0BZreAAAAGklEQVQY02NgGAAgGkIZUzSEDCaIQWMmHQEAf2wRpOlkzi4AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDFUMTQ6MzM6NTItMDM6MDDxjPOzAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAwgNFLDwAAAE50RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2VuLWF0dGFjaC1pY29uLW51bWJlcnMuc3Znu00KjgAAAABJRU5ErkJggg==", 
  "images/en-attach-icon-pages.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAA/NJREFUaN7tmm1oU2cUx/8nbyZanKwFKzrG2O7AKShDuw3am3RbXdNuig7HtjSusln24kCN2A41zg1rdemElFUqW9G2spZULQPHsDBo8kEZYaxOUSTCuk3bsha2pjNt3s6+NPlQF25r8tywcX9f8iHnnnP+/zzPvee5BNDQ0NDQ0NDIDyS6QPRF/23nl42NOIk9CLtceBQu/GgyCSs4hGY8HY1iG4ppwOMxXZbbOvr27xdVTryB/f47zkA4DCtu41RBgeh6afrxKy6Fw6ZquaZzdPFiUWV0woW48Qk1e73plSGaVJ2P+GXA6xVeT0Mjrwi/B85mumjg0hsTkkR3yWz44NatXOVNjibKuEiSzI+UU9eJUEgtPeLvgbMLvqALGCS7Pdd59e/r/6TDuc+rqEftgryE/0Zn7oXyw1jNv/2PDWS+vGLrVosFb2GYK2Q55wV2wk0/22zMwWBd3cKFaulSzcCEO1FhedNmwzq8R9sECFyDlbhosST2RAbuLRLwA2VANQOT1qQtaRW/xZLP89f0mHpbWTUDqZW+oFbxwugU+lGrnoHCxxhRY4sSao01wlegqLFFCbXGGuEGspnb+fvKSsXAmTMsnSc3xurr46t1T8Vsy5enPuk7In6ioWGuZ2q1xhphWzg1tsSCsYPmV8fHU0/JjI3MGGTcWFbWdejYsUxxsW8CgZrD9fVcyUyhpqaMDQziBqojEeM646dT5woLiZ773eeLRHKtU9gKTI8tCsalMLzCQXR3dCjHxUsNh86cUWwgPdbEdy9YYbWK0inMwPmPLYldiV2xmHKcoYAaE4k591HNRThYVSVKpzAD5zu2xFv16/VLa2sV43qwPh7Yvl1UH/NFmIH8Ayfp7IEDaCM3xsbHFeM3o42ko0dj3QGb075v3+zv0/c+mZvhOXJEsYGZuuk+BCF8DmT2n6hZuWxZbAQb8VNfHwpxh94pKVG6zmSS5c5OSvcXjfr9TiezYsFf4MZnV64YJWzi8i1biOTdXTeGh0XpEz7GpAQYixe8xHsrKmgturn9+vWc11lFLXjo2jWjpOs1fr5hg2jjUqh3lKNnQmdbJib4bZ0PXzkc+IvsKJ77wyAjY1iEhnic7eyiNQ4HUWlR+/FwWC1dqr8PNLlK/+h6d3CQWrmFay5cyDYffYwhnOvtNXnlZzt2XL2qth7VDUyRrKMPdT09PVnncfAQnvT58qUjfwYWxyd1jcFg1nm+1V9ESfZ5HpS8GWgGAIyMZJ2naeLkkpujo/nSkTcDicrpNKam7ns5EKLX+Pj09H0XZIgjqpJaqv4lXiXyZmCamf+wYACPo25yEq8nb9Jaj+eB4zQ0NDQ0NP4r/ANgmKYXDkKkbgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMPGM87MAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDItMDFUMTQ6MzM6NTItMDM6MDCA0UsPAAAATHRFWHRzdmc6YmFzZS11cmkAZmlsZTovLy9Vc2Vycy9kbWFydGluZXovZ2l0L3Vuby9pbWFnZXMvZW4tYXR0YWNoLWljb24tcGFnZXMuc3ZnYpXRawAAAABJRU5ErkJggg==", 
  "images/en-attach-icon-pdf.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAABc1JREFUaN7tmGtMFFcYht9vQERA1LilddGoiJHuoqb1hraRiwJyjZCwsoApRkWjorZYtdXCaihWixVCJPUK0bgoE0sQBMULiLcQNCtUQQW0XqhcqlSqIsjO6Q8LbdxuWEEcTeb5eeY737z77JzZsweQkJCQkJCQkHgvIbEDdFBRHxrrdzMoiN0gezZ/zRo8ZDOgUyjgChnW3rtHcXQev6Wns7r2dOvHyclKnud5vq1N7NyiC6z0DBvntz80VIhi37NmrRYKaHGUjOair1GOuJyc+qMPrj2bEhzsTkUoQnu7WPk5sW7cARvGwtm5mJiuxHXW/4hx2BAQYKeSZ1plRkSInV98gfFQs612dq+Ok4yNpqTgYGPzaAybhQFqtdj5RReIFYihvNu3Xx1my5AlyPv1QwXC4MeYwXUbVMBHLhc7vvgCVSwCjYWFBuOTkUqHoqONLW26iTNY+Py52PFFF0hl5M4laLUGT5ovpeKwi4vRiW2oR1pVldj5RReoiM+wza2tqkImzuLUyZOmzmOtmIcPLl0SO7/oAjugSIoE4uNNDj5dOAPk5oqd+50RiItsKFfy4IGp5UKxmR22TZsmdux3R+BjnBV8Zs82tZxusU+RsH17peccT7/9zs5ixRZdIGMaaMBxuI31OL14scnz9uE7yK2smC1nKYzn+fLysDA/v0GD3nZ+0QVWqK7vKV3v7882wwlODg4GBXdQCnbnDjRsCyJv3Hj1MtsIG1rr5GT2F5sn7MzOvs0i4QZLy7eVX/T/wtdC1CG+mUVF0MAc6a6uBgX38TvdWr7c7D6n1dsUFOiPCbnc6pISaFCE9AEDDOo1iGJeWVnkTru4E6mpGI71rG9bG1dHA4S79fXWf7at7D/y7t1hMTzP8y0t763AX1ko/OHmxlWQWvD9n420BhGQNzZSJI3Eo0mTyAHx1CqTCReYhgUsWAAXxOGI6Uv+P31tcEuvxxLIsLi8HKkYAXlmpsVH3FX2bWrq6JQDKfnVzc3vvMCKr9SXffILC9l8JFKKm5tYOTpFxOIJ++H6df1m1qq/7OU11vFgQcG8e/e6nNfbwV6+3B0cOCWKhRXh4VTIXMlxzhwMgYBlSqXY4gxhGqbheaXy4Jj8ySpVV9Xmb/r2lXPVC30cXV2FlZROi9eswS8sWwjy9oYZAima4zAEghhaKJsFQ5abi+04B/sTJ1gBNaAsOdmgsBpytHp4mNy3p8F0LBKzMXCghaq1sDVp715osJMKgoK63bA/luJZXR0ayR3+Oh2U7DyeXbmCGkqiEp1O6Cv8gdO1teTG4gT7+np9qEVw++G6OjPNixl9mqOiKJGymTwxESH/fGGvK9oLbhhfU6OozViUt8nRsdcElq2a+6FnmbW1+az2mX36l5T0fEm+3tIxxtWL6nM+jgEB1MDGIy0tDY4URZsGDza5gYIykLdhg5K0yING01V5t/eB5sntO/s8jI01Jo6m4BEeNTXRBIzDzWPHjPWhJUyLZQ0NFj/r1yNs6dLu5unAeWrG5/nVOTlcqPlkoXHsWApkE3EhPb3z19dYjo4lrnoRYh2SkGDq/br9BFbYq3f4flNdzQpQhLJRozovNGAEvHQ6pOIUc1i1CglQkTw7G224jFgbm38bvDy+YlvIFQmBgc6lWtu82t47HLi+J3RP4Hm5XDhAy/URHh7YgSGCmUxGG+EO6HRO+zJ25VcXF788eTQ8wH3zAi3V43xjnzxhl6HEJWvrzobROMJijh/HVXxJFgoFK0QNNg0bZtCgnH1CFxMSlOqDq482rVvXW+J6m24vYXaeKmFbXGwwnoJA2urtbVRcESzQlJmpCNWXWs2MjRVbQE/ptkDKYg+5bStW0ARcw8SnT7ucoMFPiDx0qGVK/771bRERRDzP88bfSe8LPd7GVFSFR/s4urhgkzCUZqSksOHYARdnZ3yGqXCtqeECMB1fJCV93JKxKO/s7t1if2AJCQkJCQkJCQkAwN+G5UkRnhwXSQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMPGM87MAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTctMDItMDFUMTQ6MzM6NTItMDM6MDCA0UsPAAAASnRFWHRzdmc6YmFzZS11cmkAZmlsZTovLy9Vc2Vycy9kbWFydGluZXovZ2l0L3Vuby9pbWFnZXMvZW4tYXR0YWNoLWljb24tcGRmLnN2Z1JhdqAAAAAASUVORK5CYII=", 
  "images/en-attach-icon-photoshop.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAA4xJREFUaN7t2F9MU1ccB/DvrzbuAcEs08SQrVdjtwd9EFPUGFFoGRozCZGVBJqACg8+DB8kmTUQIVQwII74BzWYdLqQlEaROAlZtmmvBsIDDWicmsDmw20ibigZKsYHkJ8v3j5UrpcW24vkfB7vPfecc7/3/GsBQRAEQRAEQRCERKNYHywqCgQUhTnqBx9gA3599QrfYR1dGB7GD7QXR7u7zbbJjsn9Z860/bf93urR0VGjg5mtxAeogY/iCtW8fIl6Osdfl5b6L9pJquroMDogPSajO6CiIyjg2uRkyucj2Hb5cuE+mZV6p9PofumZNwGG+eCAhYiGkE43vN6Cgp6kJz8vX250t7SY41Vxe7vDIUn03hJR6P3zi9CPqammm+YyLi8u5hXopVyPB0+4jrsWLw4XlLiJL6WkLPp2Kmey5cABXAGA6mqt9lw35LTQg7w8buVKrjl4EEPYiW3p6ViLIPKSkmLtr56Ej0B/Wc6YpWlkxOezH5ekxkb6FxncpR0M/cMSftu1S+t+4eHAV4rS0MBebuYl167BjGX4KTNztsHNleFTeDp7ykstbW1a97kMO5ButUZeV0ccKfgFcLuN6r/hAeqhEurHDLt9eKoaLG5r4GzRlKkfHSUlABSUz1Agk//H00eP0BdxfRPMsNhsGJi5Xh7jJdi8ZYv/j+yN0khfH+Ik4SNQ3URcLvmQorjdGDIVI7m2VvOB+9iLpV1d0bZD35s20GemuL/fvDlIvycLaZT1/DlAn5tzrNb2/XZKvfDsWbj9gUB+yCPLOIFy3pOVpVmP+svnIvbQeDCI17wOp5qb2zOyayxj0X+YSPNvDXQhgBAzjcMz7SstjQwu7F0QuvWpu7Ea9FnayoPXrxceDzQrtvr6hRPguxFHDzHBZqfT53acXLm5s1OruDqCeD3uIv/YsWiboztIQ2dlpeuFzEqn9jFJT+IDtGEcpyYmcJJ20zeDg5hAL7k8HnWq6gUXyX/IUSENVFVRK9kxkJvLLXSWKmU53I6O6Uk46WpFRayvE7c1MNaT/cdW1CpzaFVGBm6xzLd6eiLvq39i+K2O85ZLKSnR1j9/pnCccMObYVTH70Mafg6MVRSngMcfKkSNOI2/gkEA52Ppx4IfgXrYRWt42Sx2cw2f7AicsybqpcG6Ov+X9r8tv3d3x1rNwg9Q3Y2HkEu3+/vVETfX4ARBEARBEARBEIzzFtJFcqPCIPVgAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABQdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi1waG90b3Nob3Auc3ZnqlocOAAAAABJRU5ErkJggg==", 
  "images/en-attach-icon-ppt.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAAkdJREFUaN7t1z9oE1EcB/Dvu4QM0csSS22gInJokQ5pzSYVBxGEKlW6SRxOFyehpAkugTSoJEMRMzlUKKmDIQQh7SgORQSh6bWIyGGLWCxYIpheW6g0+XWKFOOpmL6kJ7/PeH/e7/e+vHd/AMYYY4wxxhhrNSFr4PX1dDoYJNq3RqOw4N/cpDJFEDJNVEUJt2ZmlENipfY8kzk8NXpjcXRtrTWx7elL1sD7HaDtBK7Di7uWhQQ9REDX1f7YB2Mgn5ddt05pVSFZ6Cm28EBVqVN8w5NcziqltODs8HCr6js+wB9URDEvBEaERd6JCat0/2hwtqNDdllpW9jOn7a2zxeNGoZo6GvrZOp939lAoFrBu1pXOExp0S1qY2O4ipdY9ngaBrpAV8ifTPrexHoWXsTjsubjmBXoNWM9869WV9UvsWsL+VRKRGmFlN8EcwxdIjQ4KLsvxwTY0PiA2PGIyUm782JbZNGvadL7aHcQ/0oE3ePf/S6X7QUWkqTJ/wpwbIDVws6I8iwctjtPR8gUuaUl2X242x3E32p4idxBN9USCQAfsfyLG16LbTpdLMru68C9hZue0Hkch1GpAMoJ1xlNU0uR0NxcuSyrnmO3cAMLafQRYYiKtbe6Lju4OsdsYTuivuKG6FJtStfVeCy72FsotKq+YwIUt8U9XNzYwCkaxznTpMe4TF+np9GpfHI/ymTUeCRr9MpfcT87cAHa/YkAAAwAwE2k9xz73N5+/59nYJtwgE3iAJvEATaJA2SMMcYYY4wxx9kFEeHOUD7gGgAAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDFUMTQ6MzM6NTItMDM6MDDxjPOzAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAwgNFLDwAAAEp0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2VuLWF0dGFjaC1pY29uLXBwdC5zdmfQBvLPAAAAAElFTkSuQmCC", 
  "images/en-attach-icon-premier.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAAsVJREFUaN7t111IU2EYB/D/W0MvnHZlF7twfdgHqRQ4KDE1IiPB2kUrCFJiXVjhXNLHiECnUigWOLekAvvAELJlyrSFCV2EQheBVJNaiZ1dGJgXihrkx54ucl44D1PHdiY8v5uN95xne/jzvO/ZAMYYY4wxxhiLNrHWQkmy2TweolUXduKIyJyeFg/RQG6vFzW0H4e7u2dL4p/PXbHbt49efLv3zuio0sGsVPQDlGukEpfgnZykHeIEWo1G7c0yd9oLp1PpgELZoHQDAVSFJuxMTEQufcPptjbpVmOB55TBoHRfocRMgItSYMYeIUQv5SCjufnXo8aC76bkZKXbkqOK1AdrtWZzWpoIOiJ81+ydX5s1Giql+3Nni4rEceoSw9XV5IID83FxgfvoCRJwMilp1kGXZwdMJgBu2Csq5L7P57F98gzr9VSJGlwvL0curMKl00GPXvqYkLDWfkOJ+gSm1Jv0u8+PjGi1Ze70+Lo6colC2iofDNxwkqawUO6yJDWMDzbV1pIa7/CnowN3cRDWvLyVBhcuxbewcIgLqmctLbI36NCE8dTUpcuBiQPEU8qzWJTqX/EAQ5JQj8/BT/vFraqwiJ2BK+b0n5t/U1yMUlhxYJnrvzGMnKGhoPUUqHE7MxMAMLNMXRY2++Ozs7Uj5jMZqf39kWo/6hMYeIhIUmPBl78WCxIxhpqqKtmCTXRDOFyuoHUz9mFGrZYri3RwARGbQLkf2gT/z/n/b4+JHwC54FiuXhyCFdaJCVX+XPbGo3Y7+gC8jHQcq6f8Fl7KBxsGifytoo2mjUZN1lXdrpKxMaXbkhMzDxGxMHGkEg/oscGwJassP/11e7vSfYUS/Qm0YQBxU1PinujBK68XOv978aGrK7BVY33ilor6P5Egfdi28BqTZ1woMbOF1ysOMEwcYJg4wDBxgIwxxhhjjDG27vwD838BsbHlHVwAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDFUMTQ6MzM6NTItMDM6MDDxjPOzAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAwgNFLDwAAAE50RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2VuLWF0dGFjaC1pY29uLXByZW1pZXIuc3ZnI/o/aQAAAABJRU5ErkJggg==", 
  "images/en-attach-icon-svg.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAABgtJREFUaN7tmWtMFFcUx/93FnalBTREEYVilEfFNtYiaXlqsSosEoRq1dpqxbWLghq1FbWC8V1EYwkVAeWh0UBFQF6ytFUQBVYjNj5aBXlYWFARghAw4sLO7YeyaiAjZZkVNPv7tLlz7pw9/zn3zLlzAR06dOjQoUOHDl4p7sjzixfMmVMcl2eV4FtXV/y17GaiQKEo8s9dHP+nWMyXH73BDlRrSOgOBjExCEQ99TE3hx3qqQ/AbCS2RB4b+5+RpeVA3TCDHafWCMYwOu3Zs57DNBqLkapU8uVm0DJQbpGniFtvYkKD2A7BA19f6kUC6VQfH5hjLWZNnIgv8BBxFhbkOrJJMqV0HmmESKFAET1Dr5aVIQj5yE1PF7nqjepks7MdHGbNCghobVXfn1TjAOMUEEBN4cfi3Lme4wCAgoHHQV6fYCkpKSkGBmycUWj7rg0bUIF4mAUHwx5t+MrYWOMAJGQ3Hra0IJs9Rqfs2CFsNW3tUkRFOTg4OAQEdHYWF8tkCQmUqu1dXMTi5csJb3FrXcAr1rkVR9dYWHRNIrmCDzIzsQm2ENrba82hIWrIKrlcObnrqDLSx0dYordbX7+xUX2ZbwG1VgOfC7eZ8RQoLl/WunBq2jGORjs5CcV6rP7jkhJtu+O9BqqXatckktvenJkJO3oIH5ubc06gKELMo0doRyqeRkYinp1Mbp49+6Rcv1zQUFFh1NwSMuwiywKG/k8Sra2pDa6zBxYtwgNmGckMDKTxNARmI0b0um8o9sLUxuaNE/B5jTNCBNa/IuO2A9h++jRNVhbQIInEdeTccsmmtjYA5T0Ky4IXP2/dQh1sILt1q4CeoYl0/35hrcG7sDp1CnU0jYbMnq1twXrCWy1Qv1XZTbSG+evePc6XQ7dwzr97evrXLFxICCGEvCjy/aW0tLQ0NlZf/1lE4+f6tunpWIVfcc/bm8uevq/cRRuNjV1Hzi3pfmADgrcaqG5HOIXrXqo0WbmLBkkkAxVOjfptq5pKZnTelUphg0+x/fFjLnuyTvg3+SQp6dKlnJwEywkTho6A6j6Oi+4ax9eT74nQlNkm3GdoiEJkIeUVD6Y7QxkikMNMLi8Oya041mBlNegCkmWkCOF2dlzX6RLGgMpzcvgWTg17UpVOp4aFYSxG47aJSd9/GK5YaWpK4pi9bMSePZr65S8Dj0GEmDFjOA3udLyDqOpqvoV77t8LHmiZObPfE5toICbOmKGpX/4y0I1OI1L+GtR++18PEb7pvfftC3oBGYjSvBbz10hbkT8oc/8+Z4Cr9MyZYM1rTZ+MJIdRlp/f73nHYYDj589r6pa/JTwHnvTB7dtc10kls5J2cLcXA/a/gv2RWbd1KwrwAzwaGvqcsA3TUfHwIbtUNQUeISGa+uUvA7/HarIkK4szwF+Qj+lr1hQ1ZTrH7zMy4ltAl91eNstGV1V1rRYIVO5OTriIaKw8caKXYfd4V5rAUZXm7Ozm5u29vFbz2sx/I+1EDzGh1dVYh8+QMXx4L8M7ZDVMUlOdJR6V/nMXLOCrH+RC219jeMtApzrP91b83NyMBjKF7A8P5zS0o4fQPH9+Sfxv1omZKSlXrHMrTkZq/jlrsOH9a4yyULQIew8ehCMJgEdpKadht5Cqf0iLcnhlZUlynl98VmioPC3PLyHP3r6AFtCoLw0NB1ugvuBdQHfiTvxJRwczrksk8PL1xWGYk+/q6rjsaSGaoBo1ilpSKWnauZM1o1Lcv3ZNWNKRZyBua9PWYdCQFVCNU513xbc36uuZQtU85kNHxz4zkotA1NOjFhZM+cuHQUMHrR8qqYVUMqIaMtbNjRzHBTp9yxZE4AJ8X5xhvKm8tlM59dJ2PiLeJ7EKC2PXqtxEsvHjEQFPKvP3h4wcoUszMlCLJOSXlRExosnG9nayEVfwVKEgtURCAqXS/+tP/lPe5gTL3ls7rnFNGbStl7YpviG7m+BeWYl2VGHJSzsgQ1jhRFWVy0di2+UF1tYD9fP2nguHo4NcFIl6DpNVSMJ8oZAvN2+tgFRIw9irUqm6C9C0FOjQoUOHDh06hir/AiiIlR7+WsuxAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi1zdmcuc3ZnEPfmHQAAAABJRU5ErkJggg==", 
  "images/en-attach-icon-unknown.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAQAAAB2Z6ylAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAFoAAABaAHAjuH0AAAAHdElNRQfhAgEOITR0BZreAAAEXElEQVRYw+2Xf0jTeRjHn9Vma2myXDfKQLEy7cf98UUikpE/Ku+usLOzo1RGgXkSVtCd6FEEWUwOEQJ/BLY7HNY/RhnMJLmUlNqhdIuC7CY1pZo3nM7v93mm+WP5uT/u/GxTOoTbjIO9YbC9v5/xvL7P9/Pe8xlAWGGFFdb/S0NFKhUJhYX0bVsb1jkciIyRIIqU2dOD7ZWVopiQ8MngaOWhQ1j29i0iYx999Xq9FFtVxZhSuaRwqDxzBv/48CEAxj48TN8/eUIKm23BNUNn51CRSrUkcFLSvn0BAGOPHuFMaipjMtncmvHudevoy+pq7PV659ZRlskUcriR7Kgo/O7NG19nbt1iTC73FGzfjnajkeDxY4o3myVLXh4AAOXn5ATczExqakgBqfrqVd6R04ODw82RkVJNVhaapqbm7z+y1tQAAODZa9e4d7apKWRw0u6UFP9HhoaDB93u6Oi59CIyho7ZWf/3YpMgiE2CwAHTX78OCRxjcjnmWq3+jxYAANPq6vyLi6Jajc67d7knFBaOZEdF8c+l4+MhAUTDuXO+oqI4kbh+PX6xa5f//pL0+/dLljVrsMvp5Gvzc3Ik/caN/kkPOtzY+bg4yifiRUdOnWJMocD658+5V3/zJgAA9ly/zj2FzcaYQoH20lLfzbW2Bh2Q4s1mXkBtsTC2bBkJ5eXcWzk66rFrtVSs0/E96Jid9RRkZJCg0eCoy8W7/POxY8GFs+bm8sfTMj3t+WXHDlFMSKDS8XH/fcZYRAT29fX5vMZGAAASGhv593978YKx5cuDBjfatno1Gt694wXaKyv/Ltrayr3fu7sZk8nIevGi77duZISsa9eSdc+egI5+np4e1O7h0fp63hH9wICzfdUqyZKXx0FMU1Nk3boVkzdvRsP799w/odcztmIFDr18yT1zQ0NQ4STLzp0BE+DogQPzE4qxly4xJpPhiQcPuNf88CFjMhnmXL7MvS6nUxTV6qDBMSaXY+HTp7x7FTduAACg3Wjknqa/nzGlEpuPH+cgtZOTJCQloX3LFqydnAxdMBaT0J8yM9EQE4P24WG+1njhAmMyGRo6O7n34/37QYUbY/HxWD4xsaiEZplMgQmNiKBvTp70nxpBP7CiuaGBF/21q2tBQkddLhI0Gk9BRoZ/R6lYp/PYtVrSut0cUFtWFlQ4AAD/wU8sLU2ybNq0MKFKJWn6++cnFEuuXPHN6mfPGFMogg/YMTMzV0QU1WrJUlLCi/7Q0fFvCaWKw4ex1+ulfCJpd0pK0OEAAOhru9032LOzSdBo8M7t27T33r2J/g0bPNpt2/zPfvMTSoJG43ZHR4cEDgCAYquqOGCdw0HFOt3cNbFJEOj04GDIEroYoSEmJuAA+s8UIf3AQMCJedTlGjsfF7fkgAAAVJGcTMKrVx/9K1nncIRqj8kWu3CoSKWKjC8ulhmPHIE/ExNhr0IBn9lsoGhpmc6urY35CvGTdC+ssMIK67/pL7RiGH8PMWDpAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABOdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi11bmtub3duLnN2Z6GswhUAAAAASUVORK5CYII=", 
  "images/en-attach-icon-video.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAAT1JREFUaN7t2L9qwlAUBvBzQ0fHbip9AJ+h0N1JpJCpm3mACgpdxEUw4J6sQlHxD3QoPoEP4CMUXZzr4ORxMYKD5B5PSAx8v/ne5OTkywlcIgAAAAAAgLQZ6YbFc7s9eqtWaU8DUwlD/uZPei0Ws36QuzHtTXe7daZmzRXPq036K3e2XNpud8T3C/jf2QVB7hsXMVTgTql0PPAvNcNQuv3p3hvaLq/Xfd91jTjpSZnPW63xmDl24Qf16K9cph/Z9eUNjGnQrYKtHyQht16cbb22xJ8wXFMnMO1kPVq9SKCSuoHRTMn6Z5FVvUigEmagEhKohBmohAQqYQYqIYFKmIFKSKBSajPwURKa9AyUN/B8gmt7Lpibn8yQvuhlsyEiX7JN/AlHR9+XRubduXFmxw1+97ysywEAAAAAAIh3ArpqtUPQiWzvAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABMdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi12aWRlby5zdmdWktNKAAAAAElFTkSuQmCC", 
  "images/en-attach-icon-word.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAA1NJREFUaN7tl19IU1Ecx7/nbimrhxgSmtRLOSeF9FBPOSlxzomKTy7HqIdECgrfaloJQzJZ0EtgD0HQH22hYIhTp60ynEFEgQSy6WsP/bNhhGF67+np7sHb8dw7u66H83kZ3Ht+n3t/v23n3i8gEAgEAoFAIBAIBNsNMVrgvngzP9KTSiFJu3GgtHTjeVosHyUJp/P5wyvulr6FBb3eqv5wcnDQ6bTcx4gsJ5OsdTy/2x0ORyKUGp5EJ37gUioVrw72+D+Wlektk4xeh7rofjI2OsoU9lu9Srix0ajX8pquybv5ddn6uZwnj3GN3RfzfowWkBZlkc5Go6zz1A8b6WtoMNzAHdIND78uaz+vrzTyqcTui4XhAdqbDw5ZhmZmUIDj5OrSkmbBGC3EnsrK6jM34g+eFhTwfPX1vb0DA3Y7mhFATUUF9wYM+nnQEBxwpNNr31aSe9tmZ00f4NCQz+fzyTK9ji6sTE1pFhxDG2wWizRobd7h8Hh4vtVVQqTyujqkkUKr1cq9AY4/Hg8G/X5C1E+AUhwOBFg6EiLnkJiYmEYIVWR93fQBZgrLyZwSZ+8Zygd6RHLr2KsmSDv0rDPJr/QrA+SQ8b0vM4dsC/Oq5ct0LhaDHU7c+8s39xntNOr1nkQIL6n2l6Uep28Qw3htraZe9Zrst7XSd/LXycltH+DYWGdnIJBOI4+cRk0isfE8CWERi3a7Ffn0E1wuzYV/2pJfApWV6jrNBc7iBd7PzGTrV4/z/Jk+tnuAmUYi+EUvbPJUfiI5SIX2qSntRIkyzH6a0gi9RfzRaLZ+KJIMG/uvq/q32v+WBygVy0XW8ZER5oISvKXfm5o0x9vJLnRt9jqivAKiUbP9W+3fcBJhoTehKB7LPukEIczEwUgEZvuzZcu/wEwDOhMKN3EwEoHZ/pwPUHdC4SQOViIw25/zAa5jlRQhkVDf7DULftNHeOZysRIHLxGY7c/5ADNv8oW4TRpiMc0CNWkwEgcvEZjtz/kAM0JOQmGhNxGY7Tfc778WUpcStM6Pj+MUhuFdW+MWGEwEZvtzPsB4vKPD51texjSZx10de43BRGC2P+cDVOElCJVsE4HZfr2YNkBugsiQXSIw2y8QCAQCgUAgEAgE/y9/AJdeW0KXQPvpAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABLdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi13b3JkLnN2ZznjsuoAAAAASUVORK5CYII=", 
  "images/en-attach-icon-zip.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoEAYAAADcbmQuAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH4QIBDiE0dAWa3gAAATpJREFUaN7t2TFKA0EYxfG3i3gCwSJJbyFYWHmGSEpBiO3aWLiwBLxCElyLFNkTCNZCIK32NoKVVdKIXQ7g2CQWA0LI9wWf7PsdYJh9/JlmAREREZF/KfE+sOwOFoNFu41uchkOqgpvOMZ1o7HpeXleFL1e8nPPshwO+/0Q1j7gAVc4nM9xi056l2X5STEtppOJ1/em3gPiPdkNz+OxdTg3ZxjhtdnEHo6+PqvK+/idrV14Q+bifvOIfZy3WgCAF7/P9S+wZvwLNIqL21qRTlSgEV2B7MXFVKARXYF6A2uGrkD24mIq0IiuQL2BNUNXIHtxMRVoRD/gqsi4TBb0A7KjewPZ37yYCjTSgEYa0EgDGmlAI/8BV/9h2ZziA/ezmfex/gMuf2DTDLkcLlykT7jJsr++joiIiAiJb63Fj8rw/YGYAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9lbi1hdHRhY2gtaWNvbi16aXAuc3ZnpS9YEgAAAABJRU5ErkJggg==", 
  "images/loading_progress.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYEAQAAAAa7ikwAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAFoAAABaAHAjuH0AAAAHdElNRQfhAgIRBwMKqfdWAAABrElEQVRIx+VUPW+CUBR9NO37AW/gB7g0TUjsZkPiRAedusgg/IB2beJfaJpG090OTrhAQtJJhzIgD1efAeLm3BCWjq2prwPBKsiXiUt7Rl7OPffcew8A/CvgK9vGgWUdTwBTijGlZTgn8Q+eCCHhZNkTESpaRFURUlVJUlUIcwVWC1EEiqKs2qY577BsXnG9y7LMnWkyzHAIQKuVK3B2MRqBpeuCCsdR3jCyRPQuy34/Ggbocxy4dV0AxuNClucdliW64xBCKdEdJxoXDiwLDyaTaCwachxNo1RDjqN3892miswUSYq/ay+yfHDxCJ6I0Pyz3fbE5PJUFcJwscWP4ShgNiOp2Tbt8/zOa4Dx5XW9nlXg+cO2mUGM94Tx/XvI21wRfVivE+xJfqiY8z08o1wYjwdPRGimSNK+JR+S+B3knSnhZDnKSVYYT9KKU94wQIXjwNJ14WuY0HnNtslb+Dctk/jEWLZTvE0khFJCfheYlvhMB6tFsxl1zkwFodrz/bRmqj3fZ6aCEDn5umk0CjiAMFxsspu4g23XaYkvhTSBLJyWUggwLhK+v4UfFhgQTvHqSuIAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTctMDItMDJUMTc6MDc6MDMtMDM6MDAbEOgkAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE3LTAyLTAyVDE3OjA3OjAzLTAzOjAwak1QmAAAAEh0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vVXNlcnMvZG1hcnRpbmV6L2dpdC91bm8vaW1hZ2VzL2xvYWRpbmdfcHJvZ3Jlc3Muc3ZnMH2+vAAAAABJRU5ErkJggg==", 
  "images/overflow_menu.svg":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAMEAQAAABd5xOiAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAFoAAABaAHAjuH0AAAAHdElNRQfhAgEOITR0BZreAAAAaUlEQVQI12PujW9rc8vYuNHNnJubsUf282eGfB4eBtXPn5kYUidNYpj45cv/j5MmMSADxj4LFZX/jn5+jPs3bWLsOXPnDsMBZWWGuNu3mRiq/v+HKWNh+uTp+e+lr+8/vk2bUAxgJs5SACVPNeDSTb9iAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTAyLTAxVDE0OjMzOjUyLTAzOjAw8YzzswAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0wMi0wMVQxNDozMzo1Mi0wMzowMIDRSw8AAABFdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL1VzZXJzL2RtYXJ0aW5lei9naXQvdW5vL2ltYWdlcy9vdmVyZmxvd19tZW51LnN2Z/dX7d8AAAAASUVORK5CYII=", 
  "images/attachment_play.png":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAyklEQVR42mNgGAWjYBSMglFAPuju7j4AxBe7urqsB4WDenp6/kPxPyCe0tnZyTuYHASiHwFDzHswOAgFAx21vK2tTXSwOOgf1FFvgHTsoAghtNDa2d7erjBYHARLW1+ADitoaGhgGvAQQgutE0CsM1gcBAutX0BHxQyKEEIKqZWDxkGgIgGYlkQG0kH0KzRJcBB9qhVCoQIMkWt0rXgJ5KSm3Nxc9gEvqWle1pDgIPqUxgQaaN/pXl8RCCFPoGMCR9vOo2AUjILhDAAx5rxAD1XOQAAAAABJRU5ErkJggg==", "images/attachment_open.png":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAQAAABLCVATAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAElSURBVEjH7ZEvSENRFMZ/T6YwtjJBDIIGTQNBsUwEowYxObMTNFmvYFi27EaHWSzaTBrEICIaxD0ZCIsGQWzCXjNYDL63++e8YRB5Xzznu7/znXMhU6Y/pMDe0hUOmTG27thSz/HSgGPIrgUD8+wkSy5QIU0vJzzBBecADFNn0GSQgo7U6fflllgQgXSJcQJQYax8omtUVQR8miclbqTneCWkRUvHR1xRJdDL9sjJY2+SN7jOWGGIS9aAERmoaPAcs06Jayps6zfKMlCvnthgjBumARiVrtarSfa5Zcpn839/kT2vx5koT+R4F8lBizQILb17mvLVmqyqWclSPtAEj7rN+4/Kg6r3A4IcKRL5v79PUNfh/UgDOqBjcb7Q+K30mf6dvgCbwjKQ6CfPoAAAAABJRU5ErkJggg=="};
})();
goog.provide("uno.util.img.fixtures.android");
goog.require("uno.util.img.fixtures.generic");
(function() {
  var util = uno.util;
  var generic = util.img.fixtures.generic;
  var fixtures = util.img.fixtures.android;
  fixtures.map = generic.map;
})();
goog.provide("uno.util.resource.android");
goog.require("uno.util.canvas");
goog.require("uno.util.dom");
goog.require("uno.util.resource.generic");
goog.require("uno.util.img");
goog.require("uno.util.img.fixtures.android");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.resource.android");
  var util = uno.util;
  var android = util.resource.android;
  var generic = util.resource.generic;
  var resourceFillStyle = "#8E8E93";
  var resourceFontStyle = '12px "Helvetica Neue", Helvetica, Arial, sans';
  var resourceHeight = 60;
  var resourceWidth = 320;
  var resourceTitleWidth = 185;
  android.findResourcesInClientHtml = function(root) {
    return [];
  };
  android.findResourcesInClipboardHtml = function(root) {
    return root.querySelectorAll('img:not(.en-todo):not(.en-crypt):not(.en-richlink):not([src^="data:"]),object.en-media,img[data-url]');
  };
  android.convertMediaToSlug = function(enmedia, props, editor, originalContent) {
    var slug;
    if (util.resource.isImage(props.type)) {
      slug = util.img.convertMediaToSlug(enmedia, props, editor);
    } else {
      slug = convertMediaToImage(enmedia, props, editor, originalContent);
    }
    return slug;
  };
  function convertMediaToImage(enmedia, props, editor, originalContent) {
    var img = util.resource.findByRef(props.reference, editor.field);
    if (img == null) {
      img = new Image;
      img.width = resourceWidth;
      img.height = resourceHeight;
      img.style.width = resourceWidth + "px";
      img.style.height = "auto";
      img.setAttribute("data-hash", props.hash);
      img.setAttribute("data-type", props.type);
    }
    var canvas = util.canvas.create(resourceWidth, resourceHeight);
    var ctx = canvas.getContext("2d");
    if (props.state === "unloaded") {
      renderUnloadedResource(ctx, img, props);
    } else {
      if (props.state === "loading") {
        renderLoadingResource(ctx, img, props);
      } else {
        if (props.state === "loaded" || !props.state) {
          var asyncRenderers = [renderMenuAsync(ctx, img, props), renderActionBtnAsync(ctx, img, props), renderThumbnailAsync(ctx, img, props)];
          Promise.all(asyncRenderers).then(function(results) {
            renderFilenameAndSize(ctx, img, props);
            var canvasData = canvas.toDataURL();
            var loadedImage = util.resource.findByRef(props.reference, editor.field);
            if (loadedImage && loadedImage.src === "") {
              loadedImage.src = canvasData;
              setUpHandlers(loadedImage, editor);
              util.resource.fixSlugInTableDimensions(loadedImage);
            } else {
              img.src = canvasData;
              setUpHandlers(img, editor);
              util.resource.fixSlugInTableDimensions(img);
            }
            if (!originalContent) {
              editor.dispatchChange();
            }
          });
        }
      }
    }
    return img;
  }
  function renderUnloadedResource(ctx, img, props) {
    ctx.save();
    ctx.fillStyle = resourceFillStyle;
    ctx.font = resourceFontStyle;
    ctx.textAlign = "center";
    if (props.title) {
      ctx.save();
      ctx.fillStyle = "#167EFB";
      ctx.font = '700 14px "Helvetica Neue", Helvetica, Arial, sans';
      ctx.textAlign = "center";
      ctx.fillText(props.title, resourceWidth / 2, resourceHeight * 0.25);
      ctx.restore();
    }
    if (props.filesize) {
      ctx.fillText(util.attachment.getStringFromFilesize(props.filesize), resourceWidth / 2, resourceHeight * 0.75 + 15);
    }
    ctx.restore();
    renderFilenameAndSize(ctx, img, props);
  }
  function renderLoadingResource(ctx, img, props) {
    ctx.save();
    ctx.fillStyle = resourceFillStyle;
    ctx.font = resourceFontStyle;
    ctx.textAlign = "center";
    if (props.downloaded != null) {
      ctx.fillText(props.downloaded, resourceWidth / 2, resourceHeight * 0.75 + 15);
    }
    var progress = Math.max(Math.min(1, props.progress), 0);
    var cx = resourceWidth / 2;
    var cy = resourceHeight * 0.25;
    var radius = 25;
    ctx.lineWidth = 3;
    ctx.strokeStyle = "#dedede";
    ctx.beginPath();
    ctx.arc(cx, cy, radius, 0, 2 * Math.PI, false);
    ctx.stroke();
    ctx.fillStyle = "#dedede";
    ctx.beginPath();
    ctx.arc(cx, cy, radius, util.canvas.rad(360 * progress - 90), util.canvas.rad(270), false);
    ctx.lineTo(cx, cy);
    ctx.closePath();
    ctx.fill();
    ctx.restore();
    renderFilenameAndSize(ctx, img, props);
  }
  var globalHandlerSetup = false;
  function setUpHandlers(img, editor) {
    if (globalHandlerSetup) {
      return;
    }
    setupGlobalHandler(editor);
    globalHandlerSetup = true;
  }
  function setupGlobalHandler(editor) {
    goog.events.listen(editor.field, "click", function(event) {
      var target = event.target;
      if (target.classList.contains("en-media-file") && target.hasAttribute("data-hash")) {
        event.preventDefault();
        event.stopPropagation();
        if (isOverMenu(event)) {
          EN.notifyAsync("showOptions", {href:target.getAttribute("data-href"), hash:target.getAttribute("data-hash"), reference:target.getAttribute("data-reference"), module:"resource"});
        } else {
          var evt = {type:"linkclick", target:target, data:{action:undefined, eventType:"tap", hash:util.resource.hashFor(target), href:util.resource.urlFor(target), mime:util.resource.mimeTypeFor(target), module:"resource", reference:util.resource.referenceFor(target)}};
          editor.dispatchEvent(evt);
        }
      }
    });
  }
  function renderFilenameAndSize(ctx, img, props) {
    ctx.save();
    ctx.fillStyle = resourceFillStyle;
    ctx.font = resourceFontStyle;
    ctx.textAlign = "left";
    var x = 70;
    var y = Math.floor(resourceHeight / 2) - 5;
    if (props.filename) {
      var filename = props.filename;
      var len = filename.length - 4;
      var metrics = ctx.measureText(filename);
      while (metrics.width > resourceTitleWidth && len > 0) {
        filename = props.filename.substring(0, len) + "...";
        len--;
        metrics = ctx.measureText(filename);
      }
      ctx.fillText(filename, x, y);
    }
    if (props.filesize) {
      y += 20;
      ctx.fillText(util.attachment.getStringFromFilesize(props.filesize), x, y);
    }
    ctx.restore();
  }
  function renderActionBtnAsync(ctx, img, props) {
    var fileType = util.attachment.getFileTypeFromMime(props.type);
    var btnSrc = "images/attachment_open.png";
    if (fileType === "audio" || fileType === "video") {
      btnSrc = "images/attachment_play.png";
    }
    return util.img.loadFromClientAsync(btnSrc, {fixtures:util.img.fixtures.android}).then(function(loadedImg) {
      var x = resourceWidth - loadedImg.width - 20;
      var y = Math.floor(resourceHeight / 2 - loadedImg.height / 2);
      ctx.drawImage(loadedImg, x, y);
    });
  }
  function renderMenuAsync(ctx, img, props) {
    return util.img.loadFromClientAsync("images/overflow_menu.svg", {fixtures:util.img.fixtures.android}).then(function(loadedImg) {
      var x = resourceWidth - loadedImg.width / 2 - 10;
      var y = Math.floor(resourceHeight / 2 - loadedImg.height / 2);
      ctx.drawImage(loadedImg, x, y);
    });
  }
  function renderThumbnailAsync(ctx, img, props) {
    var thumbSrc = util.attachment.getBase64IconFromMime(props.type);
    return util.img.loadAsync(thumbSrc).then(function(loadedImg) {
      var x = 10;
      var y = Math.floor(resourceHeight / 2) - loadedImg.height / 2;
      ctx.drawImage(loadedImg, x, y);
    });
  }
  function isOverMenu(event) {
    var target = event.target;
    var box = goog.style.getBounds(target);
    var overMenu = event.target === target && event.clientX > box.left + box.width - 22 && event.clientY <= box.top + 55;
    return overMenu;
  }
  android.dictFromElement = function(el) {
    return {};
  };
  android.dictFromClipboardElement = function(el, context) {
    var dict = generic.dictFromClipboardElement(el, context);
    if (dict) {
      return dict;
    }
    if (util.dom.isObject(el) || util.dom.isImg(el)) {
      var hash = el.getAttribute("hash");
      dict = context.resources[hash];
    }
    return dict;
  };
  android.formatForExport = function(html) {
    return html;
  };
  android.convertClientElementToSlug = function(el) {
    return el;
  };
  android.convertSlugToClientElement = function(el) {
    var hash = el.getAttribute("data-hash");
    el = generic.convertSlugToClientElement(el);
    var url = el.getAttribute("data-url");
    if (url) {
      el.src = url;
    }
    el.setAttribute("hash", hash);
    return el;
  };
  android.convertSlugToClipboardElement = function(slug) {
    return slug;
  };
  android.toggleObjectsInRange = function(range, clonedObjects) {
    return false;
  };
  android.fixSlugInTableDimensions = function(slug) {
    var parentTd = goog.dom.getAncestor(slug, util.dom.isTd);
    if (parentTd) {
      var parentTable = goog.dom.getAncestor(slug, util.dom.isEntable);
      var colIndex = util.table.colIndex(parentTd);
      util.table.fitColumnIfNeeded(parentTable, colIndex);
    }
  };
  android.applyPDFStyles = function(el) {
    return el;
  };
})();
goog.provide("uno.util.resource.ios");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.img");
goog.require("uno.util.resource.generic");
goog.require("uno.util.resourcerender");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.resource.ios");
  var util = uno.util;
  var ios = util.resource.ios;
  var generic = util.resource.generic;
  var resourceFillStyle = "#8E8E93";
  var resourceFontStyle = '12px "Helvetica Neue", Helvetica, Arial, sans';
  ios.findResourcesInClientHtml = function(root) {
    return [];
  };
  ios.findResourcesInClipboardHtml = function(root) {
    return root.querySelectorAll('img:not(.en-todo):not(.en-crypt):not(.en-richlink):not([src^="data:"]),img[data-url]');
  };
  ios.convertMediaToSlug = function(enmedia, props, editor) {
    var slug;
    if (util.resource.isImage(props.type)) {
      slug = util.img.convertMediaToSlug(enmedia, props, editor);
    } else {
      slug = util.resourcerender.render(props, editor);
    }
    return slug;
  };
  ios.decorateMedia = function(enmedia, props) {
    enmedia.setAttribute("data-url", props.url);
    goog.dom.append(enmedia, goog.dom.createDom("en-ux", {}, [goog.dom.createDom("span", {class:"en-resource-progress"}, goog.dom.createDom("span", {class:"en-resource-progress-fill"}, goog.dom.createDom("span", {class:"en-resource-progress-mask"}))), goog.dom.createDom("span", {class:"en-resource-icon"}, goog.dom.createDom("img", {src:props.thumbnailURL})), goog.dom.createDom("span", {class:"en-resource-title"}, props.title), goog.dom.createDom("span", {class:"en-resource-name"}, props.filename), 
    goog.dom.createDom("span", {class:"en-resource-value"}, props.state === uno.defs.resoures.STATES.LOADING ? props.downloaded : props.filesize)]));
    if (props.state) {
      goog.dom.classes.add(enmedia, props.state);
    }
    if (props.state === uno.defs.resoures.STATES.LOADING) {
      var value = Math.max(Math.min(1, props.progress), 0);
      var halfValue = value > 0.5 ? value - 0.5 : value;
      var progressFill = enmedia.querySelector(".en-resource-progress-fill");
      goog.style.setStyle(progressFill, "-webkit-transform", "rotate(" + 360 * value + "deg)");
      var progressMask = progressFill.children[0];
      goog.style.setStyle(progressMask, "-webkit-transform", "rotate(" + -180 * halfValue * 2 + "deg)");
      goog.style.setStyle(progressMask, "background", value * 2 <= 1 ? "#fff" : "#dedede");
    }
    if (props.overlayOpacity > 0) {
      goog.dom.classes.add(enmedia, "overlayed");
      var overlay = goog.dom.createDom("span", {class:"en-resource-overlay"});
      overlay.style.backgroundColor = "rgba(0, 0, 0, " + props.overlayOpacity + ")";
      enmedia.appendChild(overlay);
    }
    return enmedia;
  };
  ios.dictFromElement = function(el) {
    return {};
  };
  ios.dictFromClipboardElement = function(el, context) {
    var dict;
    if (util.dom.compareTagName(el, "img")) {
      dict = context.resources[el.getAttribute("src")];
    } else {
      log.severe("ios resource from clipboard is not an img");
      if (el) {
        log.info("ios.dictFromClipboardElement received " + el.tagName);
      }
    }
    return dict;
  };
  ios.formatForExport = function(html) {
    return html;
  };
  ios.convertClientElementToSlug = function(el) {
    return el;
  };
  ios.convertSlugToClientElement = function(el) {
    if (el && el.classList.contains("en-media-rendered")) {
      return null;
    }
    var url = el.getAttribute("data-url");
    util.dom.removeDataAttributes(el);
    el.setAttribute("src", url);
    return el;
  };
  ios.convertSlugToClipboardElement = function(el) {
    return el;
  };
  ios.toggleObjectsInRange = function(range, clonedObjects) {
    return false;
  };
  ios.fixSlugInTableDimensions = function(table) {
    return false;
  };
  ios.applyPDFStyles = function(el) {
    return el;
  };
})();
goog.provide("uno.util.resource.mac");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.resourcerender");
(function() {
  var util = uno.util;
  var mac = uno.util.resource.mac;
  var rxEmbedImplicitVoidTags = /<embed([^>]*[^/]\s*)>/g;
  var State = uno.defs.resources.STATES;
  mac.findResourcesInClientHtml = function(root) {
    return goog.array.filter(root.querySelectorAll('img[src^=evernotecid]:not(.en-todo):not(.en-crypt):not(.en-richlink):not([src^="data:"]),embed[id^="en-media"],img[data-url]'), function(el) {
      return el;
    });
  };
  mac.findResourcesInClipboardHtml = function(root) {
    return mac.findResourcesInClientHtml(root);
  };
  mac.convertMediaToSlug = function(enmedia, props, editor) {
    var slug;
    if (props.state === State.LOADING || props.state === State.MOCK) {
      slug = util.resourcerender.render(props, editor);
    } else {
      if (util.resource.isImage(props.type)) {
        slug = util.img.convertMediaToSlug(enmedia, props, editor);
        if (!props.elementId) {
          props.elementId = mac.getElementId(props);
        }
      } else {
        if (util.resource.isPdf(props.type)) {
          slug = convertPdfMediaToSlug(enmedia, props);
        } else {
          slug = convertFileMediaToSlug(enmedia, props);
        }
      }
    }
    if (props.elementId) {
      slug.id = props.elementId;
    }
    return slug;
  };
  mac.getElementId = function(props) {
    return props ? "en-media:" + props.type + ":" + props.hash + ":none:none" : null;
  };
  mac.dictFromElement = function(el) {
    var hash = el.getAttribute("data-hash");
    var mime = el.getAttribute("data-type");
    var url = el.getAttribute("data-url");
    var elementId = mac.getElementId({type:mime, hash:hash});
    var width = el.getAttribute("width");
    var idData = (el.getAttribute("id") || "").split(":");
    var dict;
    if (mime && hash && url && url.indexOf("evernotecid") > -1) {
      dict = {url:url, mime:mime || util.dom.compareTagName(el, "img") && "image/unknown", hash:hash, elementId:elementId};
    } else {
      if (idData.length > 2) {
        dict = {url:el.src, mime:idData[1] || util.dom.compareTagName(el, "img") && "image/unknown", hash:idData[2], elementId:el.getAttribute("id")};
      }
    }
    if (width && dict) {
      dict.width = width;
    }
    return dict;
  };
  mac.dictFromClipboardElement = function(el, context) {
    return mac.dictFromElement(el);
  };
  mac.formatForExport = function(html) {
    if (html == null) {
      return html;
    }
    return html.replace(rxEmbedImplicitVoidTags, "<embed $1 />");
  };
  function convertPdfMediaToSlug(enmedia, props) {
    var attr = {src:props.url, type:"evernote/x-pdf", id:"en-media:application/pdf:" + props.hash};
    ["style", "width", "height"].forEach(function(name) {
      if (props[name]) {
        attr[name] = props[name];
      }
    });
    return goog.dom.createDom("embed", attr);
  }
  function convertFileMediaToSlug(enmedia, props) {
    var attr = {src:props.url, type:"evernote/x-attachment", id:"en-media:evernote/x-attachment:" + props.hash};
    ["style", "width", "height", "id"].forEach(function(name) {
      if (props[name]) {
        attr[name] = props[name];
      }
    });
    return goog.dom.createDom("embed", attr);
  }
  mac.convertClientElementToSlug = function(el, props, editor) {
    if (util.resource.isImage(props.type)) {
      return util.img.convertClientElementToSlug(el, props, editor);
    }
    return el;
  };
  mac.convertSlugToClientElement = function(el) {
    util.dom.removeDataAttributes(el);
    return el;
  };
  mac.convertSlugToClipboardElement = function(slug) {
    return slug;
  };
  mac.toggleObjectsInRange = function(range, clonedObjects) {
    return false;
  };
  mac.fixSlugInTableDimensions = function(table) {
    return false;
  };
  mac.applyPDFStyles = function(el) {
    return el;
  };
})();
goog.provide("uno.util.resource.win");
goog.require("goog.array");
goog.require("uno.util.dom");
goog.require("uno.util.img");
(function() {
  var util = uno.util;
  var win = util.resource.win;
  win.findResourcesInClientHtml = function(root) {
    return goog.array.filter(root.querySelectorAll('img:not(.en-todo):not(.en-crypt):not(.en-richlink):not([src^="en-resource://database/pprotect:"]):not([src^="data:"]), object,img[data-url]'), function(el) {
      return util.dom.compareTagName(el, "object") || !/\/check/i.test(el.src);
    });
  };
  win.findResourcesInClipboardHtml = function(root) {
    return win.findResourcesInClientHtml(root);
  };
  win.convertMediaToSlug = function(enmedia, props, editor) {
    if (util.resource.isImage(props.type)) {
      return util.img.convertMediaToSlug(enmedia, props, editor);
    } else {
      if (util.resource.isPdf(enmedia) && !props.attachment) {
        var slug = goog.dom.createDom("object", {data:props.url, type:props.type}, goog.dom.createDom("param", {name:"filename", value:props.filename}));
        if (props.width != null) {
          slug.setAttribute("width", props.width);
        }
        if (props.style != null) {
          slug.setAttribute("style", props.style);
        }
        if (props.height != null) {
          slug.setAttribute("height", props.height);
        }
        return slug;
      } else {
        var img = new Image;
        goog.dom.classlist.addAll(img, ["en-media", "en-media-file"]);
        img.src = props.url;
        img.setAttribute("type", props.type);
        img.dataset.type = props.type;
        img.dataset.filename = props.filename;
        img.dataset.width = props.width;
        img.dataset.height = props.height;
        goog.dom.replaceNode(img, enmedia);
        return img;
      }
    }
  };
  win.dictFromElement = function(el) {
    var mime = el.getAttribute("type");
    var url = el.getAttribute("data");
    var style = el.getAttribute("style");
    var width = el.getAttribute("width");
    var height = el.getAttribute("height");
    var paramFilename = el.querySelector("param[name=filename]") || (el.getAttribute("data-filename") ? {value:el.getAttribute("data-filename")} : null);
    var paramUrl = el.querySelector("param[name=data]");
    if (paramFilename) {
      paramFilename = paramFilename.value;
    }
    if (!url && paramUrl) {
      url = paramUrl.value;
    }
    var dict;
    if (url && (url.indexOf("loadpdf") > -1 || url.indexOf("en-resource") > -1)) {
      dict = {url:url, mime:mime || util.dom.compareTagName(el, "img") && "image/unknown"};
    } else {
      dict = {url:el.src, mime:mime || util.dom.compareTagName(el, "img") && "image/unknown"};
    }
    if (style) {
      dict.style = style;
    }
    if (width) {
      dict.width = width;
    }
    if (height && dict.mime.indexOf("image/") < 0) {
      dict.height = height;
    }
    if (paramFilename) {
      dict.filename = paramFilename;
    }
    if (util.resource.isPdf(el) && el.nodeName === "IMG") {
      dict.attachment = true;
    }
    return dict;
  };
  win.dictFromClipboardElement = function(el, context) {
    var dict = win.dictFromElement(el);
    Object.keys(context.resources).some(function(key) {
      var res = context.resources[key];
      var src = el.getAttribute("src");
      if (res.url === src) {
        var temp = {};
        goog.object.extend(temp, dict, res);
        dict = temp;
        return true;
      }
      return false;
    });
    return dict;
  };
  win.formatForExport = function(html) {
    return html;
  };
  win.convertClientElementToSlug = function(el) {
    return el;
  };
  win.convertSlugToClientElement = function(el) {
    util.dom.removeDataAttributes(el);
    return el;
  };
  win.convertSlugToClipboardElement = function(slug) {
    return slug;
  };
  win.toggleObjectsInRange = function(range, clonedObjects) {
    clonedObjects = clonedObjects || [];
    var containerNode;
    if (range.isCollapsed()) {
      containerNode = range.getStartNode();
    } else {
      containerNode = range.getContainerElement();
    }
    if (util.dom.isTextNode(containerNode)) {
      return false;
    }
    var objects = containerNode.querySelectorAll("object");
    if (!!clonedObjects.length) {
      goog.array.forEach(objects, function(brokenObject) {
        var brokenObjectNodeAttrs = util.dom.attributes(brokenObject);
        goog.array.forEach(clonedObjects, function(clonedObject) {
          var clonedObjectAttrs = util.dom.attributes(clonedObject);
          if (brokenObjectNodeAttrs["data-reference"] === clonedObjectAttrs["data-reference"] && brokenObjectNodeAttrs["data-filename"] === clonedObjectAttrs["data-filename"] && brokenObjectNodeAttrs["data-url"] === clonedObjectAttrs["data-url"]) {
            brokenObject.parentNode.replaceChild(clonedObject, brokenObject);
          }
        });
      });
    } else {
      goog.array.forEach(objects, function(brokenObject) {
        clonedObjects.push(brokenObject.cloneNode(true));
      });
      return clonedObjects;
    }
    return false;
  };
  win.fixSlugInTableDimensions = function(table) {
    return false;
  };
  win.applyPDFStyles = function(el) {
    el.height = window.innerHeight;
    return el;
  };
})();
goog.provide("uno.util.resource");
goog.require("goog.asserts");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.events");
goog.require("goog.string");
goog.require("uno.util.dom");
goog.require("uno.util.resource.android");
goog.require("uno.util.resource.generic");
goog.require("uno.util.resource.ios");
goog.require("uno.util.resource.mac");
goog.require("uno.util.resource.win");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.resource");
  var util = uno.util;
  util.resource.counter = 0;
  var client = uno.util.resource.generic;
  util.resource.setClient = function(clientName) {
    client = uno.util.resource[clientName] || client;
  };
  util.resource.all = function(root) {
    return root.querySelectorAll(".en-media");
  };
  util.resource.findResourcesInClientHtml = function(root, editor) {
    return client.findResourcesInClientHtml(root, editor);
  };
  util.resource.findResourcesInClipboardHtml = function(root, editor) {
    return client.findResourcesInClipboardHtml(root, editor);
  };
  util.resource.findByRef = function(ref, node) {
    var selector = '.en-media[data-reference="' + ref + '"]';
    var el = node.querySelector(selector);
    return el;
  };
  util.resource.findByURL = function(url, node) {
    var selector = '.en-media[data-url="' + url + '"]';
    return node.querySelectorAll(selector);
  };
  util.resource.findByHash = function(hash, node) {
    var selector = '.en-media[data-hash="' + hash + '"]';
    return node.querySelectorAll(selector);
  };
  util.resource.createUid = function() {
    return "resource-" + util.resource.counter++;
  };
  util.resource.isResource = function(node) {
    return node && util.dom.matches(node, ".en-media");
  };
  util.resource.isImage = function(elOrMime) {
    var mime = (util.resource.parseMime(elOrMime) || "").toLowerCase();
    var isImage = mime.indexOf("image/") === 0;
    var isPsd = mime === "image/vnd.adobe.photoshop";
    var isTiff = mime === "image/tif" || mime === "image/tiff";
    var isXcf = mime === "image/x-xcf";
    var isInk = mime === "application/vnd.evernote.ink";
    return isInk || isImage && !isPsd && !isTiff && !isXcf;
  };
  util.resource.isPdf = function(elOrMime) {
    var mimes = ["application/pdf", "evernote/x-pdf"];
    var mime = util.resource.parseMime(elOrMime);
    return mime && mimes.indexOf(mime.toLowerCase()) != -1;
  };
  util.resource.isFileUI = function(el) {
    return goog.dom.classes.has(el, "en-media-file");
  };
  util.resource.createMediaFromDict = function(dict) {
    var enmedia = goog.dom.createElement("en-media");
    enmedia.setAttribute("type", dict.mime);
    enmedia.setAttribute("hash", dict.hash);
    if (dict.style) {
      enmedia.setAttribute("style", dict.style);
    }
    if (dict.width) {
      enmedia.setAttribute("width", dict.width);
    }
    if (dict.height) {
      enmedia.setAttribute("height", dict.height);
    }
    return enmedia;
  };
  util.resource.addMetaData = function(el, props) {
    if (props.reference != null) {
      el.setAttribute("data-reference", props.reference);
    }
    if (props.hash != null) {
      el.setAttribute("data-hash", props.hash);
    }
    if (props.type != null) {
      el.setAttribute("data-type", props.type);
    }
    if (props.filename != null) {
      el.setAttribute("data-filename", props.filename);
    }
    if (props.filesize != null) {
      el.setAttribute("data-filesize", props.filesize);
    }
    if (props.thumbnailURL != null) {
      el.setAttribute("data-thumbnail-url", props.thumbnailURL);
    }
    if (props.title != null) {
      el.setAttribute("data-title", props.title);
    }
    if (props.url != null) {
      el.setAttribute("data-url", props.url);
    }
    if (props.timestamp || !el.getAttribute("data-timestamp")) {
      props.timestamp = props.timestamp || Date.now();
      el.setAttribute("data-timestamp", props.timestamp);
    }
  };
  util.resource.convertClipboardElementToSlug = function(el, context, editor) {
    var enmedia;
    var slug;
    var dict = client.dictFromClipboardElement(el, context);
    if (!dict) {
      log.warning("Could not find resource dictionary for resource");
      return null;
    }
    enmedia = util.resource.createMediaFromDict(dict);
    slug = util.resource.convertMediaToSlug(enmedia, dict, editor);
    goog.dom.replaceNode(slug, el);
    return slug;
  };
  util.resource.convertClientElementToSlug = function(el, editor) {
    var dict = client.dictFromElement(el);
    var props = util.resource.propsFromDict(dict);
    props.reference = props.reference || el.getAttribute("data-reference") || util.resource.createUid();
    var slug = client.convertClientElementToSlug(el, props, editor);
    slug.setAttribute("data-yjs-hook", "en-resource");
    if (util.resource.isImage(dict.mime) && el.getAttribute("height") && el.getAttribute("width") && !editor.hasForeignSource()) {
      el.removeAttribute("height");
    }
    util.resource.addMetaData(slug, props);
    goog.dom.replaceNode(slug, el);
    addCssClasses(slug, props.type);
  };
  util.resource.convertSlugToClientElement = function(slug) {
    var el = client.convertSlugToClientElement(slug);
    if (!el) {
      goog.dom.removeNode(slug);
      return null;
    }
    el.removeAttribute("class");
    goog.dom.replaceNode(el, slug);
    return el;
  };
  util.resource.convertMediaToSlug = function(enmedia, dict, editor, originalContent) {
    var props = {};
    var enmlProps = util.resource.propsFromEnml(enmedia);
    Object.keys(enmlProps).forEach(function(key) {
      if (enmlProps[key] == null) {
        delete enmlProps[key];
      }
    });
    goog.object.extend(props, enmlProps, util.resource.propsFromDict(dict));
    props.reference = props.reference || enmedia.getAttribute("data-reference") || util.resource.createUid();
    var slug = client.convertMediaToSlug(enmedia, props, editor, originalContent);
    slug.setAttribute("data-yjs-hook", "en-resource");
    util.dom.copyAttributes(enmedia, slug, util.styles.rxEvernoteCustomDataAttr);
    util.resource.addMetaData(slug, props);
    if (props.style != null) {
      var style = slug.getAttribute("style") || "";
      slug.setAttribute("style", props.style + style);
    }
    if (props.hidden === true) {
      goog.style.setStyle(slug, "display", "none");
    }
    if (!util.dom.isFollowedByContent(slug)) {
      goog.dom.insertSiblingAfter(document.createElement("br"), slug);
    }
    goog.dom.replaceNode(slug, enmedia);
    addCssClasses(slug, props.type);
    return slug;
  };
  util.resource.convertSlugToMedia = function(slug) {
    var enmedia = goog.dom.createDom("en-media");
    if (!slug.getAttribute("data-hash") || !slug.getAttribute("data-type")) {
      return null;
    }
    enmedia.setAttribute("hash", slug.getAttribute("data-hash"));
    enmedia.setAttribute("type", slug.getAttribute("data-type"));
    if (slug.getAttribute("style") != null) {
      enmedia.setAttribute("style", slug.getAttribute("style"));
    }
    ["width", "height", "align", "alt", "longdesc", "title", "lang", "dir", "border", "hspace", "vspace", "usemap"].forEach(function(name) {
      if (slug.getAttribute(["data", goog.string.toSelectorCase(name)].join("-")) != null) {
        enmedia.setAttribute(name, slug.getAttribute(["data", goog.string.toSelectorCase(name)].join("-")));
      }
    });
    util.dom.copyAttributes(slug, enmedia, util.styles.rxEvernoteCustomDataAttr);
    goog.dom.replaceNode(enmedia, slug);
    return enmedia;
  };
  util.resource.dictFromElement = function(el) {
    if (!el) {
      return {};
    }
    return {filename:el.getAttribute("data-filename"), filesize:el.getAttribute("data-filesize"), hash:el.getAttribute("data-hash") || el.getAttribute("hash"), reference:el.getAttribute("data-reference"), thumbnailURL:el.getAttribute("data-thumbnail-url"), title:el.getAttribute("data-title"), mime:el.getAttribute("data-type") || el.getAttribute("type"), url:el.getAttribute("data-url"), timestamp:el.getAttribute("data-timestamp")};
  };
  util.resource.propsFromEnml = function(enmedia) {
    if (!enmedia) {
      return {};
    }
    return {hash:enmedia.getAttribute("hash"), type:enmedia.getAttribute("type"), width:enmedia.getAttribute("width"), height:enmedia.getAttribute("height"), style:enmedia.getAttribute("style"), align:enmedia.getAttribute("align"), alt:enmedia.getAttribute("alt"), longdesc:enmedia.getAttribute("longdesc"), title:enmedia.getAttribute("title"), lang:enmedia.getAttribute("lang"), dir:enmedia.getAttribute("dir"), border:enmedia.getAttribute("border"), hspace:enmedia.getAttribute("hspace"), vspace:enmedia.getAttribute("vspace"), 
    usemap:enmedia.getAttribute("usemap")};
  };
  util.resource.propsFromDict = function(dict) {
    if (!dict) {
      return {};
    }
    var props = {attachment:dict.attachment, contextURL:dict.contextURL, defaultActionURL:dict.defaultActionURL, downloaded:dict.downloaded, filename:dict.filename, filesize:dict.filesize, hash:dict.hash, height:dict.height, hidden:dict.hidden === true, elementId:dict.elementId, overlayImageURL:dict.overlayImageURL, overlayColor:dict.overlayColor, overlayOpacity:dict.overlayOpacity, progress:dict.progress, reference:dict.reference, state:dict.state, thumbnailURL:dict.thumbnailURL, timestamp:dict.timestamp, 
    title:dict.title, type:dict.mime ? dict.mime.toLowerCase() : "", url:dict.url, width:dict.width};
    Object.keys(props).forEach(function(key) {
      if (typeof props[key] === "undefined") {
        delete props[key];
      }
    });
    return props;
  };
  util.resource.applyProps = function(target, props) {
    target.setAttribute("hash", props.hash);
    target.setAttribute("type", props.type);
    ["reference", "width", "height", "align", "alt", "longdesc", "title", "lang", "dir", "border", "hspace", "vspace", "usemap"].forEach(function(name) {
      if (props[name]) {
        target.setAttribute(["data", goog.string.toSelectorCase(name)].join("-"), props[name]);
      }
    });
  };
  util.resource.referenceFor = function(el) {
    return el.getAttribute("data-reference");
  };
  util.resource.urlFor = function(el) {
    return el.getAttribute("data-url");
  };
  util.resource.mimeTypeFor = function(el) {
    return el.getAttribute("type") || el.getAttribute("data-type");
  };
  util.resource.parseMime = function(elOrMime) {
    var mime;
    if (elOrMime.getAttribute) {
      mime = util.resource.mimeTypeFor(elOrMime);
    } else {
      if (typeof elOrMime === "string") {
        mime = elOrMime;
      }
    }
    return mime;
  };
  util.resource.hashFor = function(el) {
    return el.getAttribute("hash") || el.getAttribute("data-hash");
  };
  util.resource.isDefaultContextButton = function(el) {
    return goog.dom.classes.has(el, "en-resource-context-default");
  };
  util.resource.isOverflowContextButton = function(el) {
    return goog.dom.classes.has(el, "en-resource-context-overflow");
  };
  util.resource.formatClientHtmlForExport = function(html) {
    return client.formatForExport(html);
  };
  util.resource.toDict = function(el, range) {
    return {hash:el.getAttribute("data-hash") || el.getAttribute("hash"), mime:el.getAttribute("data-type") || el.getAttribute("type"), url:el.getAttribute("data-url"), rect:goog.style.getBounds(el), reference:el.getAttribute("data-reference"), selected:!!(range && !range.isCollapsed() && range.containsNode(el)), filename:el.getAttribute("data-filename") || undefined, filesize:el.getAttribute("data-filesize") || undefined};
  };
  util.resource.toggleObjectsInRange = function(range, clonedObjects) {
    return client.toggleObjectsInRange(range, clonedObjects);
  };
  function addCssClasses(el, type) {
    goog.dom.classlist.add(el, "en-media");
    if (util.resource.isImage(type)) {
      goog.dom.classlist.add(el, "en-media-image");
    } else {
      goog.dom.classlist.add(el, "en-media-file");
      if (util.resource.isPdf(type)) {
        goog.dom.classlist.add(el, "en-media-pdf");
        client.applyPDFStyles(el);
      }
    }
  }
  util.resource.fixSlugInTableDimensions = function(slug) {
    return client.fixSlugInTableDimensions(slug);
  };
})();
goog.provide("uno.util.copy.resources");
goog.require("uno.util.resource");
(function() {
  var util = uno.util;
  util.copy.resources.copy = function(root) {
    return goog.array.map(util.resource.all(root), function(el) {
      return util.resource.toDict(el);
    });
  };
})();
goog.provide("uno.util.copy");
goog.require("goog.dom");
goog.require("uno.util.dom");
goog.require("uno.util.copy.plain");
goog.require("uno.util.copy.table");
goog.require("uno.util.copy.rich");
goog.require("uno.util.copy.resources");
goog.require("uno.util.styles");
(function() {
  var util = uno.util;
  var dom = util.dom;
  var copy = util.copy;
  util.copy.copy = function(editor, options, range) {
    range = range || editor.getRange();
    var pastableHtml = "";
    if (!editor.multirange.isEmpty() && !options.suppressMultirange) {
      pastableHtml = util.copy.table.getPastableHtml();
    } else {
      if (range && !range.isCollapsed()) {
        pastableHtml = util.copy.getPastableHtml(range);
      } else {
        return {plain:"", html:"", resources:[]};
      }
    }
    if (dom.isTextNode(range.getContainer()) || dom.isUnwrappedTextMarkup(pastableHtml)) {
      var style = util.styles.getCascadedStyle(range.getContainer());
      var metadata = util.styles.getCascadedMetadata(range.getContainer());
      var styledNode = goog.dom.createDom("span");
      styledNode.innerHTML = pastableHtml;
      if (Object.keys(style).length > 0) {
        styledNode.setAttribute("style", util.styles.getStyleString(style));
        pastableHtml = styledNode.outerHTML;
      }
      if (Object.keys(metadata).length > 0) {
        Object.keys(metadata).forEach(function(key) {
          util.styles.setMetadata(styledNode, key, metadata[key]);
        });
        pastableHtml = styledNode.outerHTML;
      }
    }
    var root = dom.nodeFromHtml("<div>" + pastableHtml + "</div>");
    var resourcesNode = dom.nodeFromHtml(pastableHtml);
    addContext(root.firstChild, range, editor);
    pastableHtml = editor.getClipboardContent(root);
    var richNode = dom.nodeFromHtml(pastableHtml);
    var plainNode = dom.nodeFromHtml(pastableHtml);
    return {resources:options.resources ? copy.resources.copy(resourcesNode) : [], html:options.html ? util.copy.rich.copy(richNode, options) : "", plain:options.plain ? util.copy.plain.copy(plainNode) : ""};
  };
  util.copy.getPastableHtml = function(range) {
    var html = range.getPastableHtml();
    if (html.indexOf("<en-table") !== 0) {
      return html;
    }
    var parts = html.split("</table>");
    if (parts[0].indexOf("colgroup") > -1) {
      return html;
    }
    var colgroup = goog.dom.getAncestor(range.getStartNode(), util.dom.isTable, true).querySelector("colgroup");
    var index = html.indexOf("<tbody>");
    if (index === -1 || !colgroup) {
      return html;
    }
    return html.substr(0, index) + colgroup.outerHTML + html.substr(index);
  };
  util.copy.copyOutside = function(range, formField, options) {
    var richText = "";
    var plainText = "";
    if (formField) {
      var start = formField.selectionStart;
      var end = formField.selectionEnd;
      if (start !== end) {
        plainText = formField.value.substr(Math.min(start, end), Math.max(start, end));
        richText = plainText;
      }
    } else {
      if (!range.isCollapsed()) {
        var html = util.copy.getPastableHtml(range);
        if (options.html) {
          richText = util.copy.rich.copy(dom.nodeFromHtml(html), options);
        }
        if (options.plain) {
          plainText = util.copy.plain.copy(dom.nodeFromHtml(html));
        }
      }
    }
    return {resources:[], html:options.html ? richText : "", plain:options.plain ? plainText : ""};
  };
  function addContext(root, range, editor) {
    if (!editor.multirange.isEmpty()) {
      return;
    }
    var href = getHrefForRange(range);
    var anchor;
    if (href) {
      anchor = goog.dom.createDom("a", {href:href}, root.childNodes);
      root.appendChild(anchor);
    }
    var styledNode = getStyleForRange(range);
    util.styles.mergeAttributes(styledNode, anchor || root);
  }
  function getHrefForRange(range) {
    var startAnchor = goog.dom.getAncestor(range.getStartNode(), util.link.isLink, true);
    var endAnchor = goog.dom.getAncestor(range.getEndNode(), util.link.isLink, true);
    return startAnchor && endAnchor && startAnchor === endAnchor && startAnchor.getAttribute("href");
  }
  function getStyleForRange(range) {
    var node = range.getContainer();
    var styledNode = goog.dom.createDom("div");
    if (node) {
      while (node && !dom.isEnnote(node) && !dom.isTd(node) && !dom.isLi(node) && !dom.isCodeBlock(node) && !dom.isRevealedCrypt(node) && !dom.isBlockquote(node)) {
        util.styles.mergeAttributes(node, styledNode);
        node = node.parentNode;
      }
    }
    return styledNode;
  }
})();
goog.provide("uno.util.crypto");
goog.require("goog.crypt");
goog.require("goog.crypt.Md5");
goog.require("goog.dom");
goog.require("goog.dom.classlist");
goog.require("goog.string");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.copy");
(function() {
  var util = uno.util;
  var CRYPT_CLASS = uno.defs.crypto.CRYPT_CLASS;
  var CRYPT_HIDDEN_CLASS = uno.defs.crypto.CRYPT_HIDDEN_CLASS;
  var CRYPT_VISIBLE_CLASS = uno.defs.crypto.CRYPT_VISIBLE_CLASS;
  util.crypto.all = function(root) {
    return root.querySelectorAll("." + CRYPT_CLASS);
  };
  util.crypto.for = function(node) {
    return goog.dom.getAncestor(node, util.crypto.isCrypt, true);
  };
  util.crypto.isCrypt = function(node) {
    return node && goog.dom.classlist.contains(node, CRYPT_CLASS);
  };
  util.crypto.isOpen = function(node) {
    return util.crypto.isCrypt(node) && goog.dom.classlist.contains(node, CRYPT_VISIBLE_CLASS);
  };
  util.crypto.createCryptoPlaceholder = function(cryptInfo) {
    var cryptNode = goog.dom.createDom("img", {id:cryptInfo.id, class:CRYPT_CLASS + " " + CRYPT_HIDDEN_CLASS, src:cryptInfo.src || uno.defs.image.TRANSPARENT_IMAGE_DATA_URL, "data-src":cryptInfo.src || "", "data-length":cryptInfo.length || "", "data-cipher":cryptInfo.cipher || "", "data-hint":cryptInfo.hint || "", "data-ciphertext":cryptInfo.cipherText || "", "data-hash":cryptInfo.plainText && util.crypto.hash(cryptInfo.plainText) || ""});
    return cryptNode;
  };
  util.crypto.getCryptInfoFromNode = function(node) {
    if (!node) {
      return null;
    }
    var cryptInfo = {id:node.getAttribute("id"), src:node.getAttribute("data-src"), length:node.getAttribute("data-length"), cipher:node.getAttribute("data-cipher"), hint:node.getAttribute("data-hint") || "", cipherText:node.getAttribute("data-ciphertext"), plainText:node.innerHTML, hash:node.getAttribute("data-hash"), boundingbox:goog.style.getBounds(node)};
    return cryptInfo;
  };
  util.crypto.getNodeFromCryptInfo = function(cryptInfo, options) {
    var selector = "#" + cryptInfo.id.replace(/([^a-z0-9_-])/gi, "\\$1");
    if (options && options.encryptedOnly) {
      selector += ":not(." + CRYPT_VISIBLE_CLASS + ")";
    }
    if (options && options.decryptedOnly) {
      selector += "." + CRYPT_VISIBLE_CLASS;
    }
    return document.querySelector(selector);
  };
  util.crypto.handleClick = function(node, readOnly, dispatchEvent) {
    var cryptNode = node && goog.dom.getAncestor(node, util.crypto.isCrypt, true);
    if (cryptNode && (cryptNode === node || readOnly)) {
      if (!util.crypto.isOpen(cryptNode)) {
        var range = goog.dom.Range.createFromNodeContents(cryptNode);
        if (range) {
          range.select();
        }
      }
      var cryptInfo = util.crypto.getCryptInfoFromNode(cryptNode);
      var hasClass = goog.dom.classlist.contains;
      if (hasClass(cryptNode, CRYPT_HIDDEN_CLASS)) {
        dispatchEvent({type:"decrypt", cryptInfo:cryptInfo});
      } else {
        if (readOnly && hasClass(cryptNode, CRYPT_VISIBLE_CLASS)) {
          dispatchEvent({type:"encrypt", cryptInfo:cryptInfo});
        }
      }
      return true;
    }
    return false;
  };
  util.crypto.isDirty = function(cryptNode) {
    var contentHash = cryptNode.getAttribute("data-hash");
    return util.crypto.isOpen(cryptNode) && contentHash !== util.crypto.hash(cryptNode.innerHTML || "");
  };
  util.crypto.getDirtyCrypto = function(root) {
    var cryptElements = util.crypto.all(root);
    var dirtyCrypto = [];
    goog.iter.forEach(cryptElements, function(cryptNode) {
      if (util.crypto.isDirty(cryptNode)) {
        cryptNode.setAttribute("data-ciphertext", "");
        cryptNode.setAttribute("data-hash", "");
        dirtyCrypto.push(util.crypto.getCryptInfoFromNode(cryptNode));
      }
    });
    return dirtyCrypto;
  };
  util.crypto.updateCryptNodes = function(cryptInfos) {
    cryptInfos.forEach(function(cryptInfo) {
      var cryptNode = util.crypto.getNodeFromCryptInfo(cryptInfo);
      cryptNode.setAttribute("data-ciphertext", cryptInfo.cipherText);
      if (cryptNode.innerHTML) {
        cryptNode.setAttribute("data-hash", util.crypto.hash(cryptNode.innerHTML));
      }
    });
  };
  util.crypto.hash = function(content) {
    var md5 = new goog.crypt.Md5;
    md5.update(content);
    return goog.crypt.byteArrayToHex(md5.digest());
  };
})();
goog.provide("uno.util.structure");
goog.require("goog.asserts");
goog.require("goog.dom");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.structure");
  var util = uno.util;
  var dom = util.dom;
  var structure = util.structure;
  var T = uno.defs.structuretypes;
  var rules = {NOTE:{CODE:1, CRYPTO:1, EMOTICON:1, HR:1, LIST:1, RESOURCE:1, TABLE:1, TEXT:1, TODO:1, CMD_CODE:1, CMD_CRYPTO:1, CMD_HR:1, CMD_INDENT:1, CMD_LIST:1, CMD_TODO:1, TYPE_LIST:1}, CODE:{TEXT:1, CMD_CODE:1}, CRYPTO:{TEXT:1}, TABLE:{CRYPTO:1, EMOTICON:1, LIST:1, RESOURCE:1, TEXT:1, TODO:1, CMD_CRYPTO:1, CMD_INDENT:1, CMD_LIST:1, CMD_TODO:1, TYPE_LIST:1}, LIST:{CRYPTO:1, EMOTICON:1, HR:1, LIST:1, RESOURCE:1, TEXT:1, TODO:1, CMD_CRYPTO:1, CMD_HR:1, CMD_INDENT:1, CMD_LIST:1, CMD_TODO:1}, HR:{CMD_HR:1}, 
  TEXT:{}, TODO:{CMD_INDENT:1, CMD_LIST:1, CMD_TODO:1}, RESOURCE:{}};
  structure.itemAllowed = function(item, container) {
    if (item instanceof HTMLElement) {
      var items = Object.keys(getTypes(item));
      if (items.length) {
        return structure.itemsAllowed(items, container);
      } else {
        item = T.TEXT;
      }
    }
    if (typeof container !== "string") {
      container = getContainerType(container);
    }
    var rule = rules[container];
    if (!rules.NOTE[item]) {
      log.severe("structure.itemAllowed: unknown item type " + item);
    }
    if (!rule) {
      log.severe("structure.itemAllowed: unknown container type " + container);
      return false;
    }
    return !!rule[item];
  };
  structure.itemsAllowed = function(items, container) {
    if (!items) {
      return true;
    }
    return !items.some(function(item) {
      return !structure.itemAllowed(item, container);
    });
  };
  structure.itemAllowedInRange = function(item, range, quickAndDirty) {
    var nodes = range.isCollapsed() || quickAndDirty ? [range.getContainer()] : goog.iter.toArray(range);
    var notAllowed = nodes.some(function(node) {
      return !structure.itemAllowed(item, node);
    });
    return !notAllowed;
  };
  structure.itemTypesInRange = function(range) {
    var nodes = goog.iter.toArray(range);
    var types = {};
    nodes.forEach(function(node) {
      var type = getEltType(node);
      if (type) {
        types[type] = 1;
      }
    });
    return Object.keys(types);
  };
  structure.isDroppableTarget = function(target, state) {
    var itemTypes = state.dragContentTypes;
    if (!itemTypes || !itemTypes.length) {
      return true;
    }
    var notAllowed = itemTypes.some(function(item) {
      return !structure.itemAllowed(item, target);
    });
    return !notAllowed;
  };
  function getEltType(elt, notNote) {
    if (dom.isLi(elt) || dom.isOl(elt) || dom.isUl(elt)) {
      return T.LIST;
    }
    if (dom.isTable(elt) || dom.isEntable(elt)) {
      return T.TABLE;
    }
    if (dom.isHr(elt)) {
      return T.HR;
    }
    if (dom.isCodeBlock(elt)) {
      return T.CODE;
    }
    if (dom.isRevealedCrypt(elt) || util.crypto.isCrypt(elt)) {
      return T.CRYPTO;
    }
    if (util.todo.isTodo(elt)) {
      return T.TODO;
    }
    if (util.resource.isResource(elt) || dom.isInlinedImage(elt)) {
      return T.RESOURCE;
    }
    if (!notNote && dom.isEnnote(elt)) {
      return T.NOTE;
    }
    return null;
  }
  var getTypes = structure.getTypes = function(elt) {
    var types = {};
    var type = getEltType(elt, true);
    if (!type) {
      goog.iter.forEach(elt.childNodes, function(child) {
        var ntypes = getTypes(child);
        Object.keys(ntypes).forEach(function(key) {
          types[key] = 1;
        });
      });
    } else {
      types[type] = 1;
    }
    return types;
  };
  function getContainerType(node) {
    return getEltType(goog.dom.getAncestor(node, getEltType, true)) || T.NOTE;
  }
})();
goog.provide("uno.commands.BasicTextFormatter");
goog.require("goog.debug.Logger");
goog.require("goog.editor.Command");
goog.require("goog.functions");
goog.require("goog.dom");
goog.require("goog.editor.range");
goog.require("uno.BasePlugin");
goog.require("uno.EditorMultiRange");
goog.require("uno.util.crypto");
goog.require("uno.util.dom");
goog.require("uno.util.structure");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.BasicTextFormatter");
  var WEBKIT_DEFAULT_FONT = "-webkit-standard";
  var ZERO_WIDTH_SPACE = uno.defs.unicode.ZERO_WIDTH_SPACE;
  var util = uno.util;
  var BasicTextFormatter = uno.commands.BasicTextFormatter = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(BasicTextFormatter, uno.BasePlugin);
  BasicTextFormatter.GOOG_COMMAND = {bold:goog.editor.Command.BOLD, fontname:goog.editor.Command.FONT_FACE, italic:goog.editor.Command.ITALIC, justifycenter:goog.editor.Command.JUSTIFY_CENTER, justifyfull:goog.editor.Command.JUSTIFY_FULL, justifyleft:goog.editor.Command.JUSTIFY_LEFT, justifyright:goog.editor.Command.JUSTIFY_RIGHT, subscript:goog.editor.Command.SUBSCRIPT, superscript:goog.editor.Command.SUPERSCRIPT};
  BasicTextFormatter.COMMANDS = Object.keys(BasicTextFormatter.GOOG_COMMAND);
  BasicTextFormatter.prototype.isSupportedCommand = function(command) {
    return BasicTextFormatter.COMMANDS.indexOf(command) > -1;
  };
  BasicTextFormatter.prototype.activeOnUneditableFields = goog.functions.TRUE;
  BasicTextFormatter.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  goog.editor.plugins.BasicTextFormatter.prototype.isSilentCommand = goog.functions.TRUE;
  BasicTextFormatter.prototype.registerFieldObject = function(fieldObject) {
    uno.BasePlugin.prototype.registerFieldObject.call(this, fieldObject);
    var plugin = fieldObject.plugins_.BTF;
    plugin.activeOnUneditableFields = goog.functions.TRUE;
  };
  BasicTextFormatter.prototype.execCommand = function(command, value) {
    var commands = BasicTextFormatter.GOOG_COMMAND;
    var editor = this.editor;
    var formatter = this;
    var styleOverride = {state:{}, value:{}, enabled:{}};
    var googleCommand = commands[command];
    var currentState = editor.context.style.state[command];
    editor.dispatchBeforeChange();
    var isJustifyCommand = ["justifycenter", "justifyfull", "justifyleft", "justifyright"].indexOf(command) > -1;
    function applyCommand(range) {
      editor.execCommand(googleCommand, value);
      fixFloatingUnwrappedBR(editor);
      removeTextSizeAdjust(editor);
      fixLeftoverZWS(editor);
      var newRange = editor.getRange();
      if (range && range.isCollapsed() && !newRange) {
        newRange = range;
        newRange.select();
      }
      if (newRange) {
        if (newRange.isCollapsed()) {
          if (isJustifyCommand) {
            editor.dispatchChange();
          }
        } else {
          editor.dispatchChange();
        }
      }
      if (isJustifyCommand) {
        styleOverride.state.justifyfull = false;
        styleOverride.state.justifycenter = false;
        styleOverride.state.justifyleft = false;
        styleOverride.state.justifyright = false;
        var justifyValue = formatter.queryCommandValue(command);
        styleOverride.value.justifyfull = justifyValue;
        styleOverride.value.justifycenter = justifyValue;
        styleOverride.value.justifyleft = justifyValue;
        styleOverride.value.justifyright = justifyValue;
      }
      if (isJustifyCommand && currentState) {
        styleOverride.state[command] = true;
      } else {
        if (goog.isDef(currentState)) {
          styleOverride.state[command] = !currentState;
        }
      }
      return {result:true, styleOverride:styleOverride};
    }
    if (isJustifyCommand) {
      return util.styles.withPendingStyles(editor, applyCommand);
    } else {
      var obj = applyCommand(editor.getRange());
      editor.dispatchStyleChange(obj.styleOverride);
      return true;
    }
  };
  BasicTextFormatter.prototype.queryCommandValue = function(command, options) {
    var result;
    var quickAndDirty = options && options.quickAndDirty;
    switch(command) {
      case "fontname":
        {
          result = this.editor.queryCommandValue(goog.editor.Command.FONT_FACE);
          if (result === WEBKIT_DEFAULT_FONT) {
            result = this.editor.config.defaults.richTextFont;
          }
          if (result) {
            result = result.replace(/,.*/, "").replace(/['"]/g, "");
          }
          break;
        }
      case "justifyleft":
      case "justifycenter":
      case "justifyright":
      case "justifyfull":
        {
          if (quickAndDirty) {
            result = "none";
          } else {
            if (this.editor.queryCommandValue(goog.editor.Command.JUSTIFY_LEFT) !== false) {
              result = "left";
            } else {
              if (this.editor.queryCommandValue(goog.editor.Command.JUSTIFY_CENTER) !== false) {
                result = "center";
              } else {
                if (this.editor.queryCommandValue(goog.editor.Command.JUSTIFY_RIGHT) !== false) {
                  result = "right";
                } else {
                  if (this.editor.queryCommandValue(goog.editor.Command.JUSTIFY_FULL) !== false) {
                    result = "justify";
                  } else {
                    result = "none";
                  }
                }
              }
            }
          }
          break;
        }
      default:
        result = this.editor.queryCommandValue(BasicTextFormatter.GOOG_COMMAND[command]);
    }
    return result;
  };
  BasicTextFormatter.prototype.queryCommandEnabled = function(command) {
    var range = this.editor.getRange();
    if (!range) {
      return false;
    }
    return true;
  };
  function fixFloatingUnwrappedBR(editor) {
    var tags = ["ol", "ul"];
    var range = editor.getRange();
    if (range && range.isCollapsed() && range.getStartNode().children) {
      var children = range.getStartNode().children;
      var offset = range.getStartOffset();
      if (offset <= 0 || children.length < 2 || offset >= children.length) {
        return;
      }
      if (tags.indexOf(util.dom.getTagName(children[offset - 1])) > -1 && util.dom.getTagName(children[offset]) === "br") {
        var newdiv = goog.dom.createDom("div");
        newdiv.appendChild(goog.dom.createDom("br"));
        goog.dom.replaceNode(newdiv, children[offset]);
        goog.dom.Range.createFromNodes(newdiv, 0, newdiv, 0).select();
      }
    }
  }
  function removeTextSizeAdjust(editor) {
    var elements = editor.field.querySelectorAll('*[style*="-webkit-text-size-adjust:"]');
    goog.iter.forEach(elements, function(element) {
      element.style.removeProperty("-webkit-text-size-adjust");
    });
  }
  function fixLeftoverZWS(editor) {
    var range = editor.getRange();
    if (!range.isCollapsed()) {
      return;
    }
    var container = range.getContainerElement();
    var firstChild = container.firstChild;
    if (util.dom.isTextNode(firstChild)) {
      var index = firstChild.data.indexOf(ZERO_WIDTH_SPACE);
      if (index > -1) {
        document.execCommand("inserttext", false, ZERO_WIDTH_SPACE);
        firstChild = container.firstChild;
        if (util.dom.isTextNode(firstChild)) {
          index = firstChild.data.indexOf(ZERO_WIDTH_SPACE);
          if (index > -1) {
            firstChild.deleteData(index, 1);
          }
        }
        editor.context.style.pendingNode = editor.getRange().getContainerElement();
      }
      container.normalize();
    }
  }
})();
goog.provide("uno.commands.Bounds");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Bounds");
  var Bounds = uno.commands.Bounds = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Bounds, uno.BasePlugin);
  Bounds.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Bounds.prototype.isSupportedCommand = function(command) {
    return command === "bounds";
  };
  Bounds.prototype.execCommand = function() {
    return false;
  };
  Bounds.prototype.queryCommandValue = function() {
    var result = goog.style.getBounds(this.editor.field);
    result.right = result.left + result.width;
    result.bottom = result.top + result.height;
    result.x = result.left;
    result.y = document.body.scrollHeight - result.bottom;
    return result;
  };
})();
goog.provide("uno.commands.Capitalize");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.range");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Capitalize");
  var util = uno.util;
  var Capitalize = uno.commands.Capitalize = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(Capitalize, uno.BasePlugin);
  Capitalize.prototype.isSupportedCommand = function(command) {
    return command === "capitalize";
  };
  Capitalize.prototype.execCommandInternal = function() {
    var range = this.editor.getRange();
    var savedRange = range.saveUsingDom();
    util.range.forEachWord(range, function(word, wordRange) {
      var container = wordRange.startContainer;
      var text = container.nodeValue;
      container.nodeValue = text.slice(0, wordRange.startOffset) + word[0].toLocaleUpperCase() + word.slice(1).toLocaleLowerCase() + text.slice(wordRange.endOffset);
    });
    savedRange.restore().select();
  };
})();
goog.provide("uno.commands.CaretLocation");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.CaretLocation");
  var util = uno.util;
  var CaretLocation = uno.commands.CaretLocation = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(CaretLocation, uno.BasePlugin);
  CaretLocation.prototype.isSupportedCommand = function(command) {
    return command === "caretlocation";
  };
  CaretLocation.prototype.activeOnUneditableFields = goog.functions.TRUE;
  CaretLocation.prototype.execCommand = function(command, coordinate) {
    if (coordinate) {
      this.editor.multirange.clear();
      var range = util.range.createFromPoints(coordinate.x, coordinate.y);
      if (range) {
        range.select();
        return true;
      }
    }
    return false;
  };
  CaretLocation.prototype.queryCommandValue = function() {
    return false;
  };
})();
goog.provide("uno.commands.Changes");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Changes");
  var Changes = uno.commands.Changes = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Changes, uno.BasePlugin);
  Changes.prototype.isSupportedCommand = function(command) {
    return command === "changes";
  };
  Changes.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Changes.prototype.execCommand = function() {
    return false;
  };
  Changes.prototype.queryCommandValue = function() {
    return this.editor.dirty || this.editor.isModified();
  };
})();
goog.provide("goog.dom.NodeIterator");
goog.require("goog.dom.TagIterator");
goog.dom.NodeIterator = function(opt_node, opt_reversed, opt_unconstrained, opt_depth) {
  goog.dom.TagIterator.call(this, opt_node, opt_reversed, opt_unconstrained, null, opt_depth);
};
goog.inherits(goog.dom.NodeIterator, goog.dom.TagIterator);
goog.dom.NodeIterator.prototype.next = function() {
  do {
    goog.dom.NodeIterator.superClass_.next.call(this);
  } while (this.isEndTag());
  return this.node;
};
goog.provide("uno.util.paragraph");
goog.require("goog.debug.Logger");
goog.require("goog.editor.node");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("uno.util.dom");
goog.require("uno.util.range");
(function() {
  var STRUCTTYPES = uno.defs.structuretypes;
  var ZWS = uno.defs.unicode.ZERO_WIDTH_SPACE;
  var log = goog.debug.Logger.getLogger("uno.util.paragraph");
  var util = uno.util;
  var dom = util.dom;
  util.paragraph.all = function(root) {
    var divs = root.querySelectorAll(["h1", "h2", "h3", "h4", "h5", "h6", 'div:not(.en-code):not([data-en-codeblock]):not([style*="-en-codeblock"]):not(.en-crypt)', "p"].join(","));
    return goog.array.filter(divs, util.paragraph.isParagraph);
  };
  util.paragraph.allInSelection = function(selection) {
    if (!selection) {
      return [];
    }
    var range = util.range.truncateTrailingOpenTag(selection.range);
    var startNode = range.getStartNode();
    var container = range.getContainer();
    var paragraphs = [];
    if (range.isCollapsed() || dom.isInlineNode(container)) {
      var p = util.paragraph.for(startNode);
      if (p) {
        paragraphs.push(p);
      }
    } else {
      if (util.paragraph.isParagraph(container)) {
        paragraphs.push(container);
      } else {
        goog.array.forEach(util.paragraph.all(container), function(paragraph) {
          if (range.containsNode(paragraph, true)) {
            paragraphs.push(paragraph);
          }
        });
      }
    }
    return paragraphs;
  };
  util.paragraph.create = function() {
    var div = document.createElement("div");
    div.appendChild(document.createElement("br"));
    return div;
  };
  util.paragraph.remove = function(paraNode) {
    goog.dom.removeNode(paraNode);
    return true;
  };
  util.paragraph.empty = function(paragraph, inlinenode, editor) {
    paragraph.removeAttribute("style");
    if (inlinenode) {
      var pendingStyle;
      if (inlinenode === true) {
        pendingStyle = util.styles.applyPendingStyles(goog.dom.createDom("br"), editor);
      } else {
        pendingStyle = document.createElement("span");
        pendingStyle.innerText = ZWS;
        pendingStyle.style.cssText = inlinenode;
      }
      paragraph.innerHTML = "";
      paragraph.appendChild(pendingStyle);
    } else {
      paragraph.innerHTML = "<br>";
    }
  };
  util.paragraph.isParagraph = function(node) {
    if (!dom.isBlockNode(node)) {
      return false;
    }
    if (goog.dom.getAncestor(node, util.dom.isEnadornments, true)) {
      return false;
    }
    return goog.array.every(node.childNodes, function(child) {
      return dom.isTextNode(child) || dom.isInlineNode(child);
    });
  };
  util.paragraph.for = function(node) {
    if (!node) {
      return null;
    }
    if (node.tagName && node.tagName.toLowerCase() === "en-note") {
      node = node.firstChild;
    }
    var paraNode = goog.dom.getAncestor(node, function(ancestor) {
      return util.dom.isBlockNode(ancestor);
    }, true);
    if (paraNode) {
      if (dom.isTable(paraNode)) {
        paraNode = goog.dom.getAncestor(paraNode, util.dom.isEntable);
      } else {
        if (paraNode.tagName.toLowerCase() === "en-note") {
          var savedRange;
          var range = goog.dom.Range.createFromWindow();
          if (range && (range.isCollapsed() || range.containsNode(node))) {
            savedRange = range.saveUsingCarets();
          }
          while (node.parentNode !== paraNode) {
            node = node.parentNode;
          }
          var sibs = util.dom.contiguousInlineSiblings(node);
          var blockWrapper = goog.dom.createDom("div");
          goog.dom.replaceNode(blockWrapper, node);
          sibs.forEach(function(sib) {
            blockWrapper.appendChild(sib);
          });
          if (savedRange) {
            savedRange.restore().select();
          }
          return blockWrapper;
        }
      }
    }
    return paraNode;
  };
  util.paragraph.insertBefore = function(paraNode) {
    var newParaNode = util.paragraph.create();
    goog.dom.insertSiblingBefore(newParaNode, paraNode);
    return newParaNode;
  };
  util.paragraph.insertAfter = function(paraNode) {
    var newParaNode = util.paragraph.create();
    goog.dom.insertSiblingAfter(newParaNode, paraNode);
    return newParaNode;
  };
  util.paragraph.startsWithTodo = function(paragraph) {
    var node = util.dom.getFirstParagraphItem(paragraph);
    return !!util.todo.isTodo(node);
  };
  util.paragraph.getLeadingTodo = function(paragraph) {
    var firstItem = util.dom.getFirstParagraphItem(paragraph);
    return util.todo.isTodo(firstItem) ? firstItem : null;
  };
  util.paragraph.onlyHasTodo = function(paragraph) {
    var todo;
    if ((todo = util.paragraph.getLeadingTodo(paragraph)) == null) {
      return false;
    }
    return !util.paragraph.hasVisibleContent(paragraph, {excluding:todo});
  };
  util.paragraph.prevParagraph = function(paragraph) {
    if (!paragraph || dom.isEnnote(paragraph)) {
      return null;
    }
    var previousSibling = paragraph.previousSibling;
    if (util.paragraph.isParagraph(previousSibling)) {
      return previousSibling;
    } else {
      if (dom.isBlockNode(previousSibling)) {
        var paragraphs = util.paragraph.all(previousSibling);
        if (paragraphs.length) {
          return paragraphs[paragraphs.length - 1];
        }
      }
    }
    return null;
  };
  util.paragraph.nextParagraph = function(paragraph) {
    if (!paragraph || dom.isEnnote(paragraph)) {
      return null;
    }
    var nextSibling = paragraph.nextSibling;
    if (util.paragraph.isParagraph(nextSibling)) {
      return nextSibling;
    } else {
      if (dom.isBlockNode(nextSibling)) {
        var paragraphs = util.paragraph.all(nextSibling);
        if (paragraphs.length) {
          return paragraphs[0];
        }
      }
    }
    return null;
  };
  util.paragraph.placeCursorAtStart = function(paraNode) {
    var range = goog.dom.Range.createCaret(paraNode, 0);
    range = util.range.normalize(range);
    range.select();
    return range;
  };
  util.paragraph.join = function(target, source) {
    if (target === source) {
      return target;
    }
    var sourceHasContent = !dom.isEmpty(source);
    if (sourceHasContent) {
      if (util.dom.isBr(target.lastChild)) {
        target.removeChild(target.lastChild);
      }
      goog.editor.node.transferChildren(target, source);
    }
    source.parentNode.removeChild(source);
    return target;
  };
  util.paragraph.hasVisibleContent = function(paraNode, opt) {
    if (!paraNode) {
      log.warning("hasVisibleContent paraNode is null");
      return false;
    }
    opt = opt || {};
    var contentTagSelector = "en-media,embed,img,object";
    var hasContentTags = goog.array.some(paraNode.querySelectorAll(contentTagSelector), function(el) {
      return el !== opt.excluding;
    });
    if (hasContentTags) {
      return true;
    }
    var hasTextContent = !goog.string.isEmptyOrWhitespace(util.string.trimZWS(paraNode.innerText));
    return hasTextContent;
  };
  util.paragraph.hasBr = function(paraNode) {
    return paraNode.querySelector("br") != null;
  };
  util.paragraph.appendBr = function(paraNode) {
    paraNode.appendChild(goog.dom.createElement("br"));
  };
  util.paragraph.addStyleToSelection = function(editor, stylename, value) {
    var selection = this.editor.getSelection();
    var paragraphs = util.paragraph.allInSelection(selection);
    paragraphs.forEach(function(paragraph) {
      if (typeof stylename === "function") {
        var newStyle = stylename(paragraph.style, paragraph);
        if (typeof newStyle === "string") {
          paragraph.style.cssText = newStyle;
        }
      } else {
        if (typeof value === "function") {
          paragraph.style[stylename] = value(paragraph.style[stylename] || "");
        } else {
          paragraph.style[stylename] = value;
        }
      }
    });
  };
  util.paragraph.segments = function(paraNode) {
    return Array.prototype.slice.call(paraNode.childNodes);
  };
  util.paragraph.segment = function(node) {
    if (!node || dom.isBlockNode(node)) {
      return null;
    }
    var segment = node;
    var paragraph = util.paragraph.for(node);
    while (segment && segment.parentNode !== paragraph) {
      segment = segment.parentNode;
    }
    return segment;
  };
  util.paragraph.splitParagraph = function(editor) {
    var selection = editor.getSelection();
    var newParagraph;
    if (!selection) {
      return false;
    }
    if (!selection.collapsed) {
      editor.execCommand("delete");
    }
    util.styles.withPendingStyles(editor, function(range) {
      range.select();
      selection = editor.getSelection().start;
      if (selection.isText) {
        if (selection.left && selection.right) {
          selection.target.splitText(selection.offset);
          newParagraph = goog.editor.node.splitDomTreeAt(selection.target, null, selection.paragraph);
        } else {
          var isPendingNode = dom.isPendingStyleNode(selection.el);
          var newParagraphStartNode = isPendingNode ? selection.el : selection.right ? selection.target : null;
          var splitNode = isPendingNode ? selection.el : selection.target;
          newParagraph = goog.editor.node.splitDomTreeAt(splitNode, newParagraphStartNode, selection.paragraph);
        }
      } else {
        if (dom.isEmpty(selection.paragraph)) {
          newParagraph = selection.paragraph.cloneNode(false);
        } else {
          newParagraph = goog.editor.node.splitDomTreeAt(selection.target || selection.prev, selection.target, selection.paragraph);
        }
      }
      if (newParagraph.textContent === ZWS) {
        newParagraph.textContent = "";
      }
      goog.array.forEach(newParagraph.children, function removeEmptyInlineWrappers(child) {
        if (dom.isInlineWrapper(child) && dom.isEmpty(child)) {
          newParagraph.removeChild(child);
        }
      });
      if (dom.isEmpty(newParagraph)) {
        util.paragraph.empty(newParagraph, true, editor);
      }
      if (dom.isEmpty(selection.paragraph)) {
        util.paragraph.empty(selection.paragraph, true, editor);
      }
      selection.paragraph.parentNode.insertBefore(newParagraph, selection.paragraph.nextSibling);
      if (dom.isHeader(newParagraph)) {
        newParagraph = dom.changeTagName(newParagraph, "div");
      }
      if (newParagraph.textContent === "" && newParagraph.hasAttribute("style")) {
        if (newParagraph.innerHTML === "") {
          newParagraph.innerHTML = "<br>";
        } else {
          newParagraph.textContent = ZWS;
        }
      }
      editor.selectStart(newParagraph);
      return {node:newParagraph};
    });
    return {newParagraph:newParagraph, oldParagraph:selection.paragraph};
  };
  util.paragraph.outdentSelection = function(editor) {
    var parentNode;
    util.paragraph.addStyleToSelection(editor, function(style, node) {
      if (!parentNode) {
        parentNode = node.parentNode;
      }
      if (node.parentNode === parentNode) {
        util.paragraph.outdentParagraph(node);
      }
      return null;
    });
    return true;
  };
  util.paragraph.indentSelection = function(editor) {
    var parentNode;
    util.paragraph.addStyleToSelection(editor, function(style, node) {
      if (!parentNode) {
        parentNode = node.parentNode;
      }
      if (node.parentNode === parentNode) {
        return util.paragraph.indentParagraph(node);
      }
      return null;
    });
    return true;
  };
  util.paragraph.indentParagraph = function(paragraph) {
    if (!paragraph) {
      return false;
    }
    var marginLeft = parseInt(paragraph.style.marginLeft, 10) || 0;
    paragraph.style.marginLeft = marginLeft + 40 + "px";
    return paragraph.style.cssText;
  };
  util.paragraph.outdentParagraph = function(paragraph) {
    if (!paragraph) {
      return false;
    }
    var node = dom.getAncestor(paragraph, function(ancestor) {
      return parseInt(ancestor.style.marginLeft, 10) || 0 >= 40;
    }, true) || paragraph;
    var marginLeft = parseInt(node.style.marginLeft, 10) || 0;
    node.style.marginLeft = marginLeft > 40 ? marginLeft - 40 + "px" : null;
    return node.style.cssText;
  };
  util.paragraph.wrap = function(node) {
    if (util.paragraph.isParagraph(node)) {
      return node;
    }
    var div = goog.dom.createDom("div");
    if (node.parentNode) {
      goog.dom.replaceNode(div, node);
    }
    div.appendChild(node);
    return div;
  };
  util.paragraph.getDraggableTarget = function(node) {
    return node;
  };
  util.paragraph.getDragContentTypes = function(state) {
    var types = [];
    if (state.dragStartedInNote) {
      var selection = state.editor.getSelection();
      if (selection && selection.range) {
        types = util.structure.itemTypesInRange(selection.range);
      }
    } else {
      var dt = state.dataTransfer;
      if (dt && dt.items && dt.items.length && dt.items[0].kind === "file" || dt && dt.files && dt.files.length) {
        types = [STRUCTTYPES.RESOURCE];
      } else {
        types = [STRUCTTYPES.TEXT];
      }
    }
    return types;
  };
  util.paragraph.prepareForDrag = function(state) {
    if (state.dragStartedInNote) {
      state.copiedContent = state.editor.queryCommandValue("copy", {suppressMultirange:true});
    }
  };
  util.paragraph.getDraggedNodes = function(state) {
    return [];
  };
})();
goog.provide("uno.util.list");
goog.require("goog.array");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.util.dom");
(function() {
  var util = uno.util;
  var dom = util.dom;
  var STRUCTTYPES = uno.defs.structuretypes;
  var DROPAREA = uno.defs.droparea;
  util.list.isList = function(node) {
    return dom.isUl(node) || dom.isOl(node);
  };
  util.list.for = function(node) {
    return goog.dom.getAncestor(node, util.list.isList, true);
  };
  util.list.itemFor = function(node) {
    return goog.dom.getAncestor(node, dom.isLi, true);
  };
  util.list.createListItem = function(paragraphs) {
    var listItem = document.createElement("li");
    if (paragraphs) {
      if (!Array.isArray(paragraphs)) {
        paragraphs = [paragraphs];
      }
      paragraphs.forEach(function(paragraph) {
        listItem.appendChild(paragraph);
      });
    }
    return listItem;
  };
  util.list.getParagraphs = function(node) {
    var paragraphs = [];
    if (dom.isUl(node) || dom.isOl(node)) {
      var lis = node.querySelectorAll("li");
      goog.array.forEach(lis, function(li) {
        paragraphs = paragraphs.concat(goog.array.toArray(li.childNodes));
      });
    }
    return paragraphs;
  };
  util.list.isCursorAtBeginningOfListItem = function(range) {
    if (!range.isCollapsed() || range.getFocusOffset() > 0) {
      return false;
    }
    var node = range.getFocusNode();
    return util.list.itemFor(node) && !dom.isPrecededByInlineContent(node);
  };
  util.list.isCursorInIndentedListItem = function(range) {
    var node = range.getFocusNode();
    var listItem = util.list.itemFor(node);
    var parentNode = listItem.parentNode;
    return util.list.isList(parentNode) && util.list.isList(listItem.parentNode.parentNode);
  };
  util.list.isCursorInFirstItemInList = function(range) {
    var node = range.getFocusNode();
    var listItem = util.list.itemFor(node);
    return listItem.parentNode.firstChild === listItem;
  };
  util.list.isCursorInLastItemInList = function(range) {
    var node = range.getFocusNode();
    var listItem = util.list.itemFor(node);
    return listItem.parentNode.lastChild === listItem;
  };
  util.list.deleteShouldOutdentListItem = function(range) {
    range = util.range.normalize(range);
    return util.list.isCursorAtBeginningOfListItem(range) && (util.list.isCursorInIndentedListItem(range) || util.list.isCursorInFirstItemInList(range) || util.list.isCursorInLastItemInList(range));
  };
  util.list.resetListItem = function(listItem) {
    if (!dom.isLi(listItem)) {
      return false;
    }
    while (listItem.firstChild) {
      goog.dom.removeNode(listItem.firstChild);
    }
    var paragraph = util.paragraph.create();
    listItem.appendChild(paragraph);
    return true;
  };
  util.list.normalizeListItem = function(listItem) {
    if (!listItem.firstChild) {
      return;
    }
    util.normalize.replaceBrsByParagraphs(listItem.querySelectorAll("br"));
    if (!util.dom.isDiv(listItem.firstChild)) {
      util.dom.unflattenElement(listItem);
    } else {
      var node = listItem.firstChild;
      var nodes = [];
      var div;
      while (node) {
        if (util.dom.isInlineNode(node)) {
          nodes.push(node);
        } else {
          if (nodes.length) {
            div = goog.dom.createDom("div", {}, nodes);
            nodes.length = 0;
            goog.dom.insertSiblingBefore(div, node);
          }
        }
        node = node.nextSibling;
      }
      if (nodes.length) {
        div = goog.dom.createDom("div", {}, nodes);
        listItem.appendChild(div);
      }
    }
  };
  util.list.normalize = function(root) {
    util.list.flattenInvisibleLists(root);
    util.list.flattenInvalidLists(root);
    util.list.moveBlocksOfLis(root);
    util.list.mergeSiblingUls(root);
    util.list.ensureValidLiWrapInUl(root);
  };
  util.list.flattenInvisibleLists = function(root) {
    var invisibleLists = goog.array.filter(root.querySelectorAll("ol, ul"), function(li) {
      var s = li.style;
      return s.listStyleType === "none" && (s.listStyleImage === "none" || s.listStyleImage === "initial");
    });
    goog.array.forEachRight(invisibleLists, function(invisibleList) {
      var isWithinList = goog.dom.getAncestor("ol, ul");
      if (!isWithinList) {
        goog.array.forEachRight(invisibleList.childNodes, function(child) {
          if (dom.isLi(child)) {
            dom.changeTagName(child, "div");
          }
        });
        goog.dom.flattenElement(invisibleList);
      }
    });
  };
  util.list.flattenInvalidLists = function(node) {
    goog.array.forEachRight(node.querySelectorAll("ol,ul"), function(list) {
      if (list.childNodes.length > 0 && !list.querySelector("li")) {
        goog.dom.flattenElement(list);
      }
    });
  };
  util.list.moveBlocksOfLis = function(root) {
    var blocks = root.querySelectorAll('ul, ol, table, [data-en-codeblock], [style*="-en-codeblock"], .en-code');
    goog.array.forEachRight(blocks, function(block) {
      if (dom.isLi(block.parentNode)) {
        var parentNode = block.parentNode;
        var lastNodeMoved = block.parentNode;
        var currentNode = block;
        while (currentNode) {
          var nextSibling = currentNode.nextSibling;
          if (dom.isDiv(currentNode)) {
            currentNode = dom.changeTagName(currentNode, "li");
          }
          goog.dom.insertSiblingAfter(currentNode, lastNodeMoved);
          lastNodeMoved = currentNode;
          currentNode = nextSibling;
        }
        if (!parentNode.firstChild) {
          goog.dom.removeNode(parentNode);
        }
      }
    });
  };
  util.list.mergeSiblingUls = function(node) {
    goog.array.forEachRight(node.querySelectorAll("ul"), function(list) {
      while (util.dom.isUl(list.previousSibling)) {
        var prevList = list.previousSibling;
        while (list.firstChild) {
          prevList.appendChild(list.firstChild);
        }
        list.remove();
        list = prevList;
      }
    });
  };
  util.list.ensureValidLiWrapInUl = function(node) {
    goog.array.forEachRight(node.querySelectorAll("li"), function(li) {
      if (!util.dom.isUl(li.parentNode) && !util.dom.isOl(li.parentNode)) {
        var ul = goog.dom.createDom("ul", null);
        var childNodes = li.parentNode ? goog.array.toArray(li.parentNode.childNodes) : [li];
        goog.dom.replaceNode(ul, li);
        goog.array.forEach(childNodes, function(child) {
          ul.appendChild(child);
        });
      }
    });
  };
  function getNormalizedParagraphsInSelection(selection, checkTableCells) {
    var paragraphs = util.paragraph.allInSelection(selection);
    var changed = false;
    paragraphs.forEach(function(p) {
      if (dom.isLi(p)) {
        util.list.normalizeListItem(p);
        changed = true;
      }
      if (checkTableCells && dom.isTd(p)) {
        util.table.normalizeTd(p);
        changed = true;
      }
    });
    if (changed) {
      paragraphs = util.paragraph.allInSelection(selection);
    }
    return paragraphs;
  }
  util.list.indentSelection = function(editor) {
    var selection = editor.getSelection();
    if (!selection) {
      return false;
    }
    util.range.truncateTrailingOpenTag(selection.range).select();
    editor.saveSelection(false);
    var paragraphs = getNormalizedParagraphsInSelection(selection);
    var skipNext;
    paragraphs.forEach(function(paragraph, index) {
      var listItem = paragraph.parentNode;
      var list = listItem && listItem.parentNode;
      var previousSibling = listItem.previousSibling;
      var nextSibling = listItem.nextSibling;
      if (!dom.isLi(listItem)) {
        util.paragraph.indentParagraph(paragraph);
      } else {
        if (!skipNext) {
          if (util.list.isList(nextSibling)) {
            goog.dom.insertSiblingBefore(listItem, nextSibling.firstChild);
          } else {
            var previousList;
            if (util.list.isList(previousSibling)) {
              previousList = previousSibling;
            } else {
              previousList = document.createElement(list.tagName);
              goog.dom.insertSiblingBefore(previousList, listItem);
            }
            previousList.appendChild(listItem);
          }
          if (dom.isLi(listItem) && util.list.isList(nextSibling) && previousSibling && nextSibling.tagName === previousSibling.tagName) {
            goog.dom.append(previousSibling, nextSibling.childNodes);
            goog.dom.removeNode(nextSibling);
          }
        }
        skipNext = paragraph.nextSibling === paragraphs[index + 1];
      }
    });
    editor.restoreSelection();
    return !!paragraphs.length;
  };
  util.list.outdentSelection = function(editor) {
    var selection = editor.getSelection();
    if (!selection) {
      return false;
    }
    util.range.truncateTrailingOpenTag(selection.range).select();
    editor.saveSelection(false);
    var paragraphs = getNormalizedParagraphsInSelection(selection);
    var skipNext;
    paragraphs.forEach(function(paragraph, index) {
      var listItem = paragraph.parentNode;
      var list = listItem && listItem.parentNode;
      var slicedList;
      if (!dom.isLi(listItem)) {
        util.paragraph.outdentParagraph(paragraph);
      } else {
        if (!skipNext) {
          var siblings = dom.getNextSiblings(listItem);
          if (siblings.length) {
            var newList = list.cloneNode();
            goog.dom.append(newList, siblings);
            goog.dom.insertSiblingAfter(newList, list);
          }
          goog.dom.insertSiblingAfter(listItem, list);
          if (!util.list.isList(listItem.parentNode)) {
            goog.dom.flattenElement(listItem);
          }
          if (dom.isEmpty(list)) {
            goog.dom.removeNode(list);
          }
        }
        skipNext = paragraph.nextSibling === paragraphs[index + 1];
      }
    });
    editor.restoreSelection();
    return true;
  };
  util.list.isSelectionInList = function(selection, tagName) {
    var paragraphs = getNormalizedParagraphsInSelection(selection);
    return paragraphs.length > 0 && paragraphs.every(function(paragraph) {
      var parent = paragraph.parentNode;
      return (tagName === "ol" || tagName === "all") && dom.isLi(parent) && dom.isOl(parent.parentNode) || (tagName === "ul" || tagName === "all") && dom.isLi(parent) && dom.isUl(parent.parentNode);
    });
  };
  util.list.toggleListsInSelection = function(editor, isInList, tagName) {
    editor.saveSelection(false);
    var selection = editor.getSelection();
    var isCorrectListType = tagName === "ol" ? dom.isOl : dom.isUl;
    var paragraphs = getNormalizedParagraphsInSelection(selection, true);
    var topListItem = paragraphs[0].parentNode;
    var topList = topListItem && topListItem.parentNode;
    paragraphs.forEach(function(paragraph) {
      var listItem = paragraph.parentNode;
      var list = listItem && listItem.parentNode;
      if (isInList && isCorrectListType(listItem.parentNode)) {
        if (topList === listItem.parentNode) {
          if (listItem.previousSibling) {
            var slicedList = goog.editor.node.splitDomTreeAt(listItem.previousSibling, null, topList);
            goog.dom.insertSiblingAfter(slicedList, topList);
            list = slicedList;
            topList = list;
          }
          goog.dom.flattenElement(listItem);
          list.parentNode.insertBefore(paragraph, list);
          if (!list.childNodes.length) {
            list.parentNode.removeChild(list);
          }
        }
      } else {
        if (dom.isLi(listItem) && !isCorrectListType(listItem.parentNode)) {
          list = dom.changeTagName(listItem.parentNode, tagName);
        } else {
          if (!dom.isLi(listItem)) {
            var prev = paragraph.previousSibling;
            if (!isCorrectListType(prev)) {
              prev = document.createElement(tagName);
              paragraph.parentNode.insertBefore(prev, paragraph);
            }
            var li = util.list.createListItem(paragraph);
            prev.appendChild(li);
          }
        }
      }
      if (list && util.list.isList(list) && list.previousSibling && list.tagName === list.previousSibling.tagName) {
        goog.dom.append(list.previousSibling, list.childNodes);
        list.parentNode.removeChild(list);
        list = list.previousSibling;
      }
    });
    editor.restoreSelection();
    return true;
  };
  util.list.splitListItem = function(editor) {
    var selection = editor.getSelection();
    var listItem = selection.start.paragraph.parentNode;
    var list = listItem && listItem.parentNode;
    if (!listItem) {
      return false;
    }
    if (dom.isSeeminglyEmpty(selection.start.paragraph)) {
      util.list.outdentSelection(editor);
    } else {
      var paragraphs = util.paragraph.splitParagraph(editor);
      var newParagraph = paragraphs.newParagraph;
      var oldParagraph = paragraphs.oldParagraph;
      var newListItem = util.list.createListItem(newParagraph);
      goog.dom.insertSiblingAfter(newListItem, listItem);
      goog.dom.append(newListItem, dom.getNextSiblings(oldParagraph));
      editor.select(newParagraph);
    }
    return true;
  };
  util.list.getDraggableTarget = function(node) {
    if (!node || dom.isTextNode(node)) {
      return false;
    }
    var li = goog.dom.getAncestor(node, dom.isLi, true);
    return li;
  };
  util.list.getHintRect = function(state) {
    var nodes = util.list.getDraggedNodes(state);
    var rect;
    var currentDisplayStyle;
    if (nodes.length === 1) {
      currentDisplayStyle = nodes[0].style.display;
      nodes[0].style.display = "inline-block";
      rect = nodes[0].getBoundingClientRect();
      nodes[0].style.display = currentDisplayStyle || null;
      return rect;
    } else {
      var width = 0;
      var height = 0;
      var left = 0;
      var top = 0;
      nodes.forEach(function(node, i) {
        currentDisplayStyle = node.style.display;
        node.style.display = "inline-block";
        rect = node.getBoundingClientRect();
        node.style.display = currentDisplayStyle || null;
        var offset = i > 0 ? rect.left - left : 0;
        if (rect.width + offset > width) {
          width = rect.width + offset;
        }
        if (i === 0) {
          top = rect.top;
          left = rect.left;
        }
        if (i === nodes.length - 1) {
          height = rect.top - top + rect.height;
        }
      });
      return {width:width, height:height, top:top, left:left};
    }
  };
  util.list.getDragContentTypes = function(state) {
    return [STRUCTTYPES.LIST];
  };
  util.list.getDraggedNodes = function(state) {
    var draggedNodes = [];
    var listItem = util.list.itemFor(state.target);
    var list = util.list.for(state.target);
    if (listItem) {
      draggedNodes.push(listItem);
      while (listItem && listItem.nextSibling && (dom.isUl(listItem.nextSibling) || dom.isOl(listItem.nextSibling))) {
        var lis = goog.array.toArray(listItem.nextSibling.querySelectorAll("li"));
        draggedNodes = draggedNodes.concat(lis);
        listItem = listItem.nextSibling;
      }
    } else {
      draggedNodes.push(list);
    }
    return draggedNodes;
  };
  function getTruncatedListItem(list, listItem, levelOfIdentation) {
    var indentation = "";
    if (levelOfIdentation) {
      indentation = levelOfIdentation === 2 ? "        " : "    ";
    }
    var numberOfSlicableChar = 20 - indentation.length;
    var listItemIndex = dom.index(listItem);
    var text = listItem.textContent;
    var bulletType = util.dom.isUl(list) ? "\u2022    " : listItemIndex + 1 + ".  ";
    return indentation + bulletType + text.slice(0, numberOfSlicableChar) + (text.length > numberOfSlicableChar ? "..." : "");
  }
  util.list.getGhostImage = function(node) {
    var listItem = util.list.itemFor(node);
    var originalListItem = listItem;
    var list = util.list.for(node);
    var draggedItems = [];
    var processedItems = 0;
    draggedItems.push(listItem);
    while (processedItems < 8 && listItem.nextSibling && (dom.isUl(listItem.nextSibling) || dom.isOl(listItem.nextSibling))) {
      draggedItems.push(listItem.nextSibling);
      listItem = listItem.nextSibling;
      processedItems++;
    }
    var ghost = goog.dom.createDom("div");
    if (draggedItems.length > 1) {
      goog.dom.classlist.add(ghost, "en-dragdrop-list-ghost");
      ghost.appendChild(goog.dom.createDom("div", null, getTruncatedListItem(list, originalListItem)));
      draggedItems.shift();
      draggedItems.forEach(function(listwrapper) {
        Array.prototype.slice.call(listwrapper.childNodes, 0, 3).forEach(function(item) {
          var ghostitem;
          if (dom.isUl(item) || dom.isOl(item)) {
            ghostitem = goog.dom.createDom("div", null, getTruncatedListItem(item, item.firstChild, 2));
          } else {
            ghostitem = goog.dom.createDom("div", null, getTruncatedListItem(list, item, 1));
          }
          ghost.appendChild(ghostitem);
        });
      });
    } else {
      goog.dom.classlist.add(ghost, "en-dragdrop-listitem-ghost");
      ghost.innerHTML = getTruncatedListItem(list, listItem);
    }
    return ghost;
  };
  util.list.getValidDraggedItems = function(target) {
    var draggedItems = [];
    var listItem = util.list.itemFor(target);
    if (!listItem) {
      return [];
    }
    draggedItems.push(listItem);
    while (listItem.nextSibling && util.list.isList(listItem.nextSibling)) {
      draggedItems.push(listItem.nextSibling);
      listItem = listItem.nextSibling;
    }
    return draggedItems;
  };
})();
goog.provide("uno.commands.CodeBlock");
goog.require("goog.debug.Logger");
goog.require("goog.dom.NodeIterator");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
goog.require("uno.util.paragraph");
goog.require("uno.util.table");
goog.require("uno.util.list");
goog.require("uno.util.crypto");
goog.require("uno.defs");
goog.require("uno.util.structure");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.CodeBlock");
  var util = uno.util;
  var CodeBlock = uno.commands.CodeBlock = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(CodeBlock, uno.BasePlugin);
  CodeBlock.prototype.isSupportedCommand = function(command) {
    return command === "codeblock";
  };
  CodeBlock.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  CodeBlock.prototype.execCommandInternal = function() {
    var range = this.editor.getRange();
    if (!range) {
      return false;
    }
    if (this.queryCommandValue("codeblock")) {
      this.findAndRemoveCodeBlock(range);
      return true;
    }
    var copiedText = range.isCollapsed() ? null : this.editor.queryCommandValue("cut");
    var insertParagraphIfRequired = function(editor, updateRange) {
      var result = false;
      var currentRange = editor.getRange();
      if (!util.dom.isEmpty(util.paragraph.for(currentRange.getStartNode())) || editor.field.childNodes && currentRange.getStartNode() === editor.field.childNodes[0]) {
        editor.execCommand("insertparagraph");
        result = true;
      }
      if (updateRange) {
        currentRange.select();
      }
      return result;
    };
    insertParagraphIfRequired(this.editor, true);
    insertParagraphIfRequired(this.editor, false);
    var innerBr = goog.dom.createDom("br");
    var innerDiv = goog.dom.createDom("div", {}, innerBr);
    var codeBlockElement = goog.dom.createDom("div", {class:"en-code"}, innerDiv);
    range = this.editor.getRange();
    var currentNode = range.getStartNode();
    if (util.dom.isEnnote(currentNode)) {
      currentNode = currentNode.childNodes[range.getStartOffset()] || currentNode.lastChild;
    }
    if (currentNode) {
      goog.dom.replaceNode(codeBlockElement, currentNode);
    } else {
      this.editor.field.appendChild(codeBlockElement);
    }
    var newRange = goog.editor.range.placeCursorNextTo(innerBr);
    if (copiedText && copiedText.plain && copiedText.plain.length > 0) {
      goog.editor.range.placeCursorNextTo(innerBr);
      this.editor.execCommand("inserttext", copiedText.plain);
      newRange = goog.editor.range.placeCursorNextTo(codeBlockElement);
    }
    newRange.select();
    return true;
  };
  CodeBlock.prototype.queryCommandValue = function(command, options) {
    var quickAndDirty = options && options.quickAndDirty;
    var range = this.editor.getRange();
    if (!range) {
      return false;
    }
    var containerNode = range.getContainerElement();
    return this.isParentNodeCodeBlock(containerNode) || !quickAndDirty && this.isChildNodeCodeBlock([containerNode], range);
  };
  CodeBlock.prototype.isChildNodeCodeBlock = function(nodes, range) {
    return Array.prototype.some.call(nodes, function(node) {
      if (util.dom.isElementNode(node)) {
        if (range.containsNode(node, true) && util.dom.isCodeBlock(node)) {
          return true;
        }
        return this.isChildNodeCodeBlock(node.childNodes, range);
      }
      return false;
    }.bind(this));
  };
  CodeBlock.prototype.isParentNodeCodeBlock = function(node) {
    return goog.dom.getAncestor(node, function(ancestor) {
      return util.dom.isCodeBlock(ancestor);
    }, true);
  };
  CodeBlock.prototype.findAndRemoveCodeBlock = function(range) {
    var containerNode = range.getContainerElement();
    if (util.dom.isCodeBlock(containerNode)) {
      this.unwrapCodeBlock(containerNode);
      return true;
    }
    var block = goog.dom.getAncestor(containerNode, function(ancestor) {
      return util.dom.isCodeBlock(ancestor);
    }, true);
    if (block) {
      this.unwrapCodeBlock(block);
      return true;
    }
    var ci = new goog.dom.NodeIterator(containerNode, true, false);
    var currentChild;
    var foundBlocks = [];
    try {
      while (currentChild = ci.next()) {
        if (range.containsNode(currentChild, true) && util.dom.isCodeBlock(currentChild)) {
          foundBlocks.push(currentChild);
        }
      }
    } catch (err) {
      log.fine(err.stack || err);
    }
    var _this = this;
    foundBlocks.forEach(function(foundBlock) {
      _this.unwrapCodeBlock(foundBlock);
    });
    return true;
  };
  CodeBlock.prototype.unwrapCodeBlock = function(node) {
    var lastChild;
    while (node.firstChild) {
      lastChild = node.firstChild;
      node.parentElement.insertBefore(lastChild, node);
    }
    if (lastChild) {
      var cursorTarget = lastChild.childNodes ? lastChild.childNodes[0] : lastChild;
      goog.editor.range.placeCursorNextTo(cursorTarget);
    }
    node.remove();
    return true;
  };
  CodeBlock.prototype.queryCommandEnabled = function(command) {
    var range = this.editor.getRange();
    if (range) {
      if (!util.structure.itemAllowedInRange(uno.defs.structuretypes.CMD_CODE, range)) {
        return false;
      }
    }
    return true;
  };
})();
goog.provide("uno.util.menu");
goog.require("goog.debug.Logger");
goog.require("uno.util.react");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.menu");
  var util = uno.util;
  util.menu.presentImageContextMenu = function(targetImage, editor, point) {
    var openAction;
    switch(editor.config.client) {
      case "win":
      case "mac":
        openAction = function() {
          editor.dispatchEvent({type:"imagedoubleclick", tagname:targetImage.tagName, src:util.resource.urlFor(targetImage), reference:util.resource.referenceFor(targetImage)});
        };
        break;
      case "web":
        openAction = function() {
          editor.dispatchEvent({type:"linkclick", target:targetImage, data:{action:"open", eventType:"tap", hash:util.resource.hashFor(targetImage), href:util.resource.urlFor(targetImage), mime:util.resource.mimeTypeFor(targetImage), module:"resource", reference:util.resource.referenceFor(targetImage)}});
        };
        break;
      case "ios":
      case "android":
      default:
        break;
    }
    util.react.showMenu({xPosition:point.x, yPosition:point.y, items:[{type:"item", label:"Full Screen", enabled:editor.config.images.preview, action:function() {
      util.preview.requestOpen(editor, targetImage);
    }}, {type:"item", label:"Annotate", enabled:editor.config.images.annotate, action:function() {
      editor.dispatchEvent({type:"annotate", module:"ui-img-buttons", src:util.resource.urlFor(targetImage)});
    }}, {type:"divider"}, {type:"item", label:"Open", enabled:!!openAction, action:openAction}, {type:"item", label:"Reset Image Size", enabled:!util.img.isNaturalSize(targetImage), action:function() {
      util.img.restoreNaturalSize(targetImage, editor);
    }}]});
  };
  function createExecCallback(editor, range, command, arg) {
    return function(val) {
      if (range) {
        range.select();
      }
      return editor.execCommand(command, val || arg, undefined, true);
    };
  }
  util.menu.presentTableContextMenu = function(target, editor) {
    if (!target) {
      return;
    }
    var range = editor.getRange();
    var cell = util.table.getActiveCell();
    var cells = !util.table.selection.isActive() && cell ? [cell] : util.table.selection.getCells();
    var valign = cell.style.verticalAlign;
    var targetDims = target.getBoundingClientRect();
    util.react.showMenu({xPosition:targetDims.right + 1, yPosition:targetDims.top - 6, items:[{type:"colorpicker", label:"Cell Background", value:cell.style.backgroundColor || "#ffffff", action:createExecCallback(editor, range, "tablecellcolor")}, {type:"divider"}, {type:"item", label:"Match Note Width", action:createExecCallback(editor, range, "tablefitnote")}, {type:"item", label:"Distribute Columns Evenly", enabled:util.table.selection.getColumnIndexes().length > 1, action:createExecCallback(editor, 
    range, "tableequalcol")}, {type:"submenu", label:"Cell Alignment", items:[{type:"item", label:"Align content to top", value:!valign || valign === "top", action:createExecCallback(editor, range, "tableverticalalign", "top")}, {type:"item", label:"Align content to center", value:valign === "middle", action:createExecCallback(editor, range, "tableverticalalign", "middle")}, {type:"item", label:"Align content to bottom", value:valign === "bottom", action:createExecCallback(editor, range, "tableverticalalign", 
    "bottom")}]}, {type:"divider"}, {type:"item", label:"Merge Cells", enabled:util.table.mergeable(cells), action:createExecCallback(editor, range, "mergecells", true)}, {type:"item", label:"Unmerge Cells", enabled:util.table.unmergeable(cells), action:createExecCallback(editor, range, "mergecells", false)}, {type:"divider"}, {type:"item", label:"Delete Selected Column(s)", action:createExecCallback(editor, range, "deletetablecol")}, {type:"item", label:"Delete Selected Row(s)", action:createExecCallback(editor, 
    range, "deletetablerow")}, {type:"item", label:"Delete Table", action:createExecCallback(editor, range, "deletetable")}]});
  };
  util.menu.presentCommentMenu = function(point, handlers) {
    util.react.showMenu({xPosition:point.x, yPosition:point.y - 12, items:[{type:"item", label:"Edit", action:handlers.edit}, {type:"item", label:"Delete", action:handlers.remove}]});
  };
})();
goog.provide("uno.commands.Comment");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.events");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.commenting");
goog.require("uno.util.dom");
goog.require("uno.util.menu");
(function() {
  var util = uno.util;
  var log = goog.debug.Logger.getLogger("uno.commands.Comment");
  var Comment = uno.commands.Comment = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Comment, uno.BasePlugin);
  Comment.prototype.isSupportedCommand = function(command) {
    return command === "comment";
  };
  Comment.prototype.execCommand = function(command, value) {
    var options = value || {};
    var action = options.action || "init";
    var id = options.id;
    var threadId = options.threadId;
    var editor = this.editor;
    var state = editor.context.commenting;
    var commentMap = editor.realtime.y.share.comments;
    var retVal = false;
    if (action === "init") {
      this.editor.context.commenting.skipSelection = true;
      retVal = util.commenting.init(editor);
    }
    if (action === "insert") {
      retVal = util.commenting.insert(state, commentMap, options);
    } else {
      if (action === "edit") {
        retVal = util.commenting.edit(state, commentMap, options);
      } else {
        if (action === "remove") {
          retVal = util.commenting.remove(state, commentMap, {id:id, editor:editor});
        } else {
          if (action === "resolve") {
            retVal = util.commenting.resolve(state, commentMap, {threadId:threadId, editor:editor});
          } else {
            if (action === "reopen") {
              retVal = util.commenting.reopen(state, commentMap, {threadId:threadId, editor:editor});
            } else {
              if (action === "highlight") {
                retVal = util.commenting.highlight(editor, threadId);
              } else {
                if (action === "canceledit") {
                  retVal = util.commenting.setEditing(editor, id, false);
                } else {
                  if (action === "menu") {
                    uno.util.menu.presentCommentMenu({x:options.x, y:options.y}, {edit:function() {
                      util.commenting.setEditing(editor, id, true);
                    }, remove:function() {
                      util.commenting.remove(state, commentMap, {id:id, editor:editor});
                      util.commenting.updateMarkers(state, editor.field);
                      util.commenting.changeColumnPaddingIfNeeded(state, editor.field);
                    }});
                    retVal = true;
                  } else {
                    if (action === "collapse") {
                      retVal = util.commenting.highlight(editor, null, true);
                    } else {
                      if (action === "openarchive") {
                        this.editor.openFullSize("archive");
                        retVal = true;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    if (retVal && ["collapse", "highlight", "reopen", "remove", "resolve", "insert", "init"].indexOf(action) > -1) {
      util.commenting.updateMarkers(state, editor.field);
      util.commenting.changeColumnPaddingIfNeeded(state, editor.field);
    }
    return retVal;
  };
  Comment.prototype.queryCommandEnabled = function(command, options) {
    var state = this.editor.context.commenting;
    var action = (options || {}).action;
    if (this.editor.readOnly) {
      return false;
    }
    var readOnlyActions = ["collapse", "highlight", "openarchive"];
    if (!state.ui.user && !readOnlyActions.includes(action)) {
      return false;
    }
    var actions = ["insert", "edit", "remove", "resolve", "reopen", "canceledit", "menu", "collapse", "highlight", "openarchive"];
    if (actions.includes(action)) {
      return true;
    }
    var range = this.editor.getRange();
    if (!range || range.isCollapsed() || !goog.dom.getAncestor(range.getContainer(), uno.util.dom.isEnnote, true)) {
      return false;
    }
    var threads = state.ui.threads || [];
    if (threads.find(function(t) {
      return t.active && t.comments.length === 0;
    })) {
      return false;
    }
    return true;
  };
})();
goog.provide("uno.commands.Connection");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Connection");
  var Connection = uno.commands.Connection = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Connection, uno.BasePlugin);
  Connection.prototype.isSupportedCommand = function(command) {
    return command === "connection";
  };
  Connection.prototype.execCommand = function() {
    return false;
  };
  Connection.prototype.queryCommandValue = function() {
    return {connected:this.editor.context.realtime.connected};
  };
  Connection.prototype.queryCommandEnabled = goog.functions.TRUE;
})();
goog.provide("uno.commands.Content");
goog.require("goog.array");
goog.require("goog.functions");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
goog.require("uno.util.crypto");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Content");
  var util = uno.util;
  var Content = uno.commands.Content = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Content, uno.BasePlugin);
  Content.prototype.isSupportedCommand = function(command) {
    return command === "content";
  };
  Content.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Content.prototype.execCommand = function(command, value) {
    var editor = this.editor;
    value = {type:value.type || uno.defs.format.ENML, content:goog.isString(value.content) ? value.content : value, resources:value.resources || {}, allowUndo:value.allowUndo || false, editableOnly:value.editableOnly || false};
    if (this.editor.readOnly && value.editableOnly) {
      return false;
    }
    if (value.type === "html") {
      value.type = uno.defs.format.CLIENT_HTML;
    }
    var content = value.content;
    editor.context.format = value.type;
    if (editor.context.format === uno.defs.format.CLIENT_HTML) {
      if (content && content.indexOf('<div id="en-note">') !== -1) {
        content = content.replace('<div id="en-note">', "").replace(/<\/div>\s*$/, "");
      } else {
        if (content && content.indexOf('<div id="en-note"/>') !== -1) {
          content = editor.config.defaults.html;
        }
      }
    }
    goog.object.extend(editor.context.resources, value.resources);
    editor.setHtml(false, content, true);
    if (value.allowUndo) {
      editor.dispatchChange();
    } else {
      editor.plugins_.UndoRedo.refreshCurrentState(editor);
    }
    this.waitForImages();
    editor.updateEmpty();
    return true;
  };
  Content.prototype.queryCommandValue = function(command, opt) {
    var editor = this.editor;
    var value;
    var initialFormat = editor.context.format;
    opt = opt || {};
    opt.resetChangesState = opt.resetChangesState !== false;
    if (opt.type === "html") {
      editor.context.format = uno.defs.format.CLIENT_HTML;
    } else {
      if (opt.type === "plain") {
        editor.context.format = uno.defs.format.CLIPBOARD;
      } else {
        if (opt.type) {
          editor.context.format = opt.type;
        } else {
          editor.context.format = uno.defs.format.ENML;
        }
      }
    }
    if (opt.cryptInfo) {
      util.crypto.updateCryptNodes(opt.cryptInfo);
    } else {
      var cryptInfo = util.crypto.getDirtyCrypto(editor.field);
      if (cryptInfo.length) {
        return {success:false, cryptInfo:cryptInfo};
      }
    }
    if (opt.type === "plain") {
      var range = goog.dom.Range.createFromNodeContents(this.editor.field);
      var result = util.copy.copy(this.editor, {plain:true}, range);
      value = result.plain;
    } else {
      value = editor.getCleanContents();
    }
    if (editor.context.format === uno.defs.format.CLIENT_HTML) {
      value = '<div id="en-note">' + value + "</div>";
    }
    if (opt.resetChangesState) {
      editor.dirty = false;
    }
    editor.context.format = initialFormat;
    return {success:value != null, value:value, syncMetadata:this.editor.realtime ? this.editor.realtime.syncMetadata : null};
  };
  Content.prototype.waitForImages = function() {
    var me = this;
    var completeImageCount = 0;
    var images = this.editor.field.querySelectorAll("img.en-media");
    if (images.length === 0) {
      return setTimeout(function() {
        if (me.editor) {
          me.dispatchContentLoaded();
        }
      }, 0);
    }
    var onImageComplete = function() {
      if (++completeImageCount === images.length) {
        return setTimeout(function() {
          if (me.editor) {
            me.dispatchContentLoaded();
          }
        }, 0);
      }
    };
    goog.array.forEach(images, function waitForImageComplete(img) {
      if (img.getAttribute("src") && !img.naturalWidth && !img.naturalHeight) {
        goog.events.listen(img, "load", onImageComplete);
        goog.events.listen(img, "error", onImageComplete);
      } else {
        onImageComplete();
      }
    });
  };
  Content.prototype.dispatchContentLoaded = function() {
    this.dispatchEvent("contentloaded");
  };
})();
goog.provide("uno.util.todo.generic");
(function() {
  var util = uno.util;
  var generic = util.todo.generic;
  generic.tryToInsertTodo = function(editor) {
    editor.execCommand("insertparagraph");
    editor.execCommand("inserttodo");
    return true;
  };
  generic.findTodosInClientHtml = function() {
    return [];
  };
})();
goog.provide("uno.util.todo.mac");
goog.require("goog.dom");
goog.require("goog.dom.classes");
goog.require("uno.util.todo.generic");
(function() {
  var mac = uno.util.todo.mac;
  var util = uno.util;
  mac.tryToInsertTodo = function(editor) {
    return util.todo.generic.tryToInsertTodo(editor);
  };
  mac.findTodosInClientHtml = function(frag) {
    return frag.querySelectorAll("img.en-todo");
  };
  mac.convertClientElementToTodo = function(el) {
    var checked = goog.dom.classes.has(el, "en-todo-checked");
    var entodo = util.todo.create(checked);
    goog.dom.replaceNode(entodo, el);
  };
  mac.convertTodoToClientElement = function(todo) {
    var img = goog.dom.createDom("img", {class:"en-todo"});
    if (util.todo.isChecked(todo)) {
      goog.dom.classes.add(img, "en-todo-checked");
    }
    goog.dom.replaceNode(img, todo);
  };
})();
goog.provide("uno.util.todo.ios");
(function() {
  var ios = uno.util.todo.ios;
  var util = uno.util;
  ios.tryToInsertTodo = function(editor) {
    return false;
  };
  ios.findTodosInClientHtml = function() {
    return [];
  };
  ios.convertTodoToClientElement = function() {
  };
  ios.convertClientElementToTodo = function(el) {
    var todo = util.todo.create(!!el.checked);
    goog.dom.replaceNode(todo, el);
  };
})();
goog.provide("uno.util.todo.win");
goog.require("goog.dom");
goog.require("uno.util.todo.generic");
(function() {
  var util = uno.util;
  var win = uno.util.todo.win;
  win.tryToInsertTodo = function(editor) {
    return util.todo.generic.tryToInsertTodo(editor);
  };
  win.findTodosInClientHtml = function(frag) {
    return frag.querySelectorAll("img[src^=en-resource\\:\\/\\/database\\/check]");
  };
  win.convertClientElementToTodo = function(el) {
    var src = el.getAttribute("src");
    var matches = /database\/check(\d+):(\d+)/.exec(src);
    var X = parseInt(matches[1], 10);
    var checked = X === 1 || X === 3;
    var entodo = util.todo.create(checked);
    goog.dom.replaceNode(entodo, el);
  };
  win.convertTodoToClientElement = function(todo) {
    var src = "en-resource://database/check";
    src += util.todo.isChecked(todo) ? "1" : "0";
    src += ":0";
    var img = goog.dom.createDom("img", {src:src});
    goog.dom.replaceNode(img, todo);
  };
})();
goog.provide("uno.util.todo");
goog.require("goog.debug.Logger");
goog.require("goog.dom.classes");
goog.require("uno.util.todo.generic");
goog.require("uno.util.todo.mac");
goog.require("uno.util.todo.ios");
goog.require("uno.util.todo.win");
goog.require("uno.defs");
goog.require("uno.util.dom");
(function() {
  var util = uno.util;
  var defs = uno.defs;
  var client = uno.util.todo.generic;
  var STRUCTTYPES = defs.structuretypes;
  util.todo.setClient = function(clientName) {
    client = uno.util.todo[clientName] || client;
  };
  util.todo.all = function(root) {
    return root.querySelectorAll(".en-todo");
  };
  util.todo.allEnmlTodos = function(root) {
    return root.querySelectorAll("en-todo");
  };
  util.todo.allClipboardTodos = function(root) {
    return root.querySelectorAll("[data-en-todo]");
  };
  util.todo.isTodo = function(el) {
    return el && goog.dom.classes.has(el, "en-todo");
  };
  util.todo.create = function(checked) {
    var todo = new Image;
    todo.src = defs.image.TRANSPARENT_IMAGE_DATA_URL;
    goog.dom.classes.add(todo, "en-todo");
    if (checked) {
      util.todo.toggle(todo);
    }
    return todo;
  };
  util.todo.tryToInsertTodo = function(editor) {
    return client.tryToInsertTodo(editor);
  };
  util.todo.isChecked = function(todo) {
    return todo.getAttribute("checked") === "true";
  };
  util.todo.setChecked = function(todo, checked) {
    todo.setAttribute("checked", checked);
  };
  util.todo.toggle = function(todo) {
    todo.setAttribute("checked", !util.todo.isChecked(todo));
  };
  util.todo.remove = function(todo) {
    if (!todo || !todo.parentNode) {
      return;
    }
    var textNode = goog.editor.node.getNextSibling(todo);
    if (textNode && textNode.nodeType === Node.TEXT_NODE) {
      var text = textNode.textContent;
      var updated = goog.string.trimLeft(text);
      if (updated !== text) {
        if (updated.length === 0) {
          goog.dom.removeNode(textNode);
        } else {
          textNode.textContent = updated;
        }
      }
    }
    var parentTableCell = util.dom.getAncestor(todo, util.dom.isTd);
    goog.dom.removeNode(todo);
    if (parentTableCell && util.dom.isEmpty(parentTableCell)) {
      parentTableCell.innerHTML = defs.table.CELL_HTML;
    }
  };
  util.todo.findTodosInClientHtml = function(root) {
    return client.findTodosInClientHtml(root);
  };
  util.todo.convertClientElementToTodo = function(el) {
    client.convertClientElementToTodo(el);
  };
  util.todo.convertTodoToClientElement = function(todo) {
    client.convertTodoToClientElement(todo);
  };
  util.todo.convertTodoInClipboard = function(todo) {
    return util.todo.create(todo.textContent === "[x]");
  };
  util.todo.convertTodoToClipboardElement = function(fragment) {
    var todo = goog.dom.createDom("span");
    util.styles.setStyle(todo, "-en-todo", true);
    var value = document.createTextNode("[]");
    if (util.todo.isChecked(fragment)) {
      value = document.createTextNode("[x]");
    }
    todo.appendChild(value);
    return todo;
  };
  util.todo.decorate = function(entodo) {
    var checked = util.todo.isChecked(entodo);
    goog.dom.replaceNode(util.todo.create(checked), entodo);
  };
  util.todo.undecorate = function(todo) {
    var entodo = goog.dom.createDom("en-todo");
    entodo.setAttribute("checked", util.todo.isChecked(todo));
    goog.dom.replaceNode(entodo, todo);
  };
  util.todo.addTodoToParagraph = function(node) {
    var todo = util.todo.create();
    node.insertBefore(todo, node.firstChild);
    return node;
  };
  util.todo.getDraggableTarget = function(node) {
    var paragraph = goog.dom.getAncestor(node, util.dom.isBlockNode, true);
    if (util.todo.isTodo(node) && util.dom.isDiv(paragraph)) {
      return paragraph;
    }
    return null;
  };
  util.todo.getDragContentTypes = function(node) {
    return [STRUCTTYPES.TODO];
  };
  util.todo.getGhostImage = function(node) {
    var ghost = node.cloneNode(true);
    var todo = ghost.querySelector(".en-todo");
    ghost.innerText = ghost.textContent;
    goog.dom.insertChildAt(ghost, todo, 0);
    goog.dom.classlist.add(ghost, "en-dragdrop-todoitem-ghost");
    return ghost;
  };
  util.todo.getHintRect = function(state) {
    var currentDisplayStyle = state.target.style.display;
    state.target.style.display = "inline-block";
    var rect = state.target.getBoundingClientRect();
    state.target.style.display = currentDisplayStyle || null;
    return rect;
  };
  util.todo.getDraggedNodes = function(state) {
    return [state.target];
  };
})();
goog.provide("uno.commands.ControlTodos");
goog.require("goog.array");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.todo");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.ControlTodos");
  var util = uno.util;
  var ControlTodos = uno.commands.ControlTodos = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(ControlTodos, uno.BasePlugin);
  ControlTodos.prototype.isSupportedCommand = function(command) {
    return command === "controltodos";
  };
  ControlTodos.prototype.execCommandInternal = function(command, state) {
    var range = this.editor.getRange();
    var todos = util.todo.all(this.editor.field);
    if (!range.isCollapsed()) {
      todos = goog.array.filter(todos, function(node) {
        return range.containsNode(node, true);
      });
    }
    goog.array.forEach(todos, function(entodo) {
      if (state === "on") {
        util.todo.setChecked(entodo, true);
      } else {
        if (state === "off") {
          util.todo.setChecked(entodo, false);
        } else {
          util.todo.toggle(entodo);
        }
      }
    });
  };
})();
goog.provide("uno.commands.Copy");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
goog.require("uno.util.copy");
goog.require("uno.util.objects");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Copy");
  var defs = uno.defs;
  var util = uno.util;
  var Copy = uno.commands.Copy = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Copy, uno.BasePlugin);
  Copy.prototype.isSupportedCommand = function(command) {
    return command === "copy";
  };
  Copy.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Copy.prototype.execCommand = function() {
    return false;
  };
  Copy.prototype.queryCommandValue = function(command, opt) {
    var options = getOptions(opt);
    var range = this.editor.getRange();
    if (range && !goog.dom.getAncestor(range.getContainer(), uno.util.dom.isEnnote, true)) {
      return util.copy.copyOutside(range, this.editor.getFormField(), options);
    }
    this.editor.context.format = defs.format.CLIPBOARD;
    return util.copy.copy(this.editor, options, range);
  };
  function getOptions(options) {
    return util.objects.mergeOptions(options, {html:true, resources:true, plain:true});
  }
})();
goog.provide("uno.commands.Count");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("goog.string");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Count");
  var Count = uno.commands.Count = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Count, uno.BasePlugin);
  Count.prototype.isSupportedCommand = function(command) {
    return command === "count";
  };
  Count.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Count.prototype.queryCommandValue = function() {
    var text = goog.string.canonicalizeNewlines(this.editor.field.innerText).trim();
    var lines = text.split("\n");
    var words = goog.string.collapseWhitespace(text).split(" ");
    var paragraphs = text.split(/\n{2,}/);
    return {words:words.length, charsWithoutSpaces:words.join("").length, charsWithSpaces:lines.join("").length, paragraphs:paragraphs.length, lines:lines.length};
  };
})();
goog.provide("goog.dom.InputType");
goog.dom.InputType = {BUTTON:"button", CHECKBOX:"checkbox", COLOR:"color", DATE:"date", DATETIME:"datetime", DATETIME_LOCAL:"datetime-local", EMAIL:"email", FILE:"file", HIDDEN:"hidden", IMAGE:"image", MENU:"menu", MONTH:"month", NUMBER:"number", PASSWORD:"password", RADIO:"radio", RANGE:"range", RESET:"reset", SEARCH:"search", SELECT_MULTIPLE:"select-multiple", SELECT_ONE:"select-one", SUBMIT:"submit", TEL:"tel", TEXT:"text", TEXTAREA:"textarea", TIME:"time", URL:"url", WEEK:"week"};
goog.provide("goog.dom.selection");
goog.require("goog.dom.InputType");
goog.require("goog.string");
goog.require("goog.userAgent");
goog.dom.selection.setStart = function(textfield, pos) {
  if (goog.dom.selection.useSelectionProperties_(textfield)) {
    textfield.selectionStart = pos;
  } else {
    if (goog.dom.selection.isLegacyIe_()) {
      var tmp = goog.dom.selection.getRangeIe_(textfield);
      var range = tmp[0];
      var selectionRange = tmp[1];
      if (range.inRange(selectionRange)) {
        pos = goog.dom.selection.canonicalizePositionIe_(textfield, pos);
        range.collapse(true);
        range.move("character", pos);
        range.select();
      }
    }
  }
};
goog.dom.selection.getStart = function(textfield) {
  return goog.dom.selection.getEndPoints_(textfield, true)[0];
};
goog.dom.selection.getEndPointsTextareaIe_ = function(range, selRange, getOnlyStart) {
  var selectionRange = selRange.duplicate();
  var beforeSelectionText = range.text;
  var untrimmedBeforeSelectionText = beforeSelectionText;
  var selectionText = selectionRange.text;
  var untrimmedSelectionText = selectionText;
  var isRangeEndTrimmed = false;
  while (!isRangeEndTrimmed) {
    if (range.compareEndPoints("StartToEnd", range) == 0) {
      isRangeEndTrimmed = true;
    } else {
      range.moveEnd("character", -1);
      if (range.text == beforeSelectionText) {
        untrimmedBeforeSelectionText += "\r\n";
      } else {
        isRangeEndTrimmed = true;
      }
    }
  }
  if (getOnlyStart) {
    return [untrimmedBeforeSelectionText.length, -1];
  }
  var isSelectionRangeEndTrimmed = false;
  while (!isSelectionRangeEndTrimmed) {
    if (selectionRange.compareEndPoints("StartToEnd", selectionRange) == 0) {
      isSelectionRangeEndTrimmed = true;
    } else {
      selectionRange.moveEnd("character", -1);
      if (selectionRange.text == selectionText) {
        untrimmedSelectionText += "\r\n";
      } else {
        isSelectionRangeEndTrimmed = true;
      }
    }
  }
  return [untrimmedBeforeSelectionText.length, untrimmedBeforeSelectionText.length + untrimmedSelectionText.length];
};
goog.dom.selection.getEndPoints = function(textfield) {
  return goog.dom.selection.getEndPoints_(textfield, false);
};
goog.dom.selection.getEndPoints_ = function(textfield, getOnlyStart) {
  textfield = textfield;
  var startPos = 0;
  var endPos = 0;
  if (goog.dom.selection.useSelectionProperties_(textfield)) {
    startPos = textfield.selectionStart;
    endPos = getOnlyStart ? -1 : textfield.selectionEnd;
  } else {
    if (goog.dom.selection.isLegacyIe_()) {
      var tmp = goog.dom.selection.getRangeIe_(textfield);
      var range = tmp[0];
      var selectionRange = tmp[1];
      if (range.inRange(selectionRange)) {
        range.setEndPoint("EndToStart", selectionRange);
        if (textfield.type == goog.dom.InputType.TEXTAREA) {
          return goog.dom.selection.getEndPointsTextareaIe_(range, selectionRange, getOnlyStart);
        }
        startPos = range.text.length;
        if (!getOnlyStart) {
          endPos = range.text.length + selectionRange.text.length;
        } else {
          endPos = -1;
        }
      }
    }
  }
  return [startPos, endPos];
};
goog.dom.selection.setEnd = function(textfield, pos) {
  if (goog.dom.selection.useSelectionProperties_(textfield)) {
    textfield.selectionEnd = pos;
  } else {
    if (goog.dom.selection.isLegacyIe_()) {
      var tmp = goog.dom.selection.getRangeIe_(textfield);
      var range = tmp[0];
      var selectionRange = tmp[1];
      if (range.inRange(selectionRange)) {
        pos = goog.dom.selection.canonicalizePositionIe_(textfield, pos);
        var startCursorPos = goog.dom.selection.canonicalizePositionIe_(textfield, goog.dom.selection.getStart(textfield));
        selectionRange.collapse(true);
        selectionRange.moveEnd("character", pos - startCursorPos);
        selectionRange.select();
      }
    }
  }
};
goog.dom.selection.getEnd = function(textfield) {
  return goog.dom.selection.getEndPoints_(textfield, false)[1];
};
goog.dom.selection.setCursorPosition = function(textfield, pos) {
  if (goog.dom.selection.useSelectionProperties_(textfield)) {
    textfield.selectionStart = pos;
    textfield.selectionEnd = pos;
  } else {
    if (goog.dom.selection.isLegacyIe_()) {
      pos = goog.dom.selection.canonicalizePositionIe_(textfield, pos);
      var sel = textfield.createTextRange();
      sel.collapse(true);
      sel.move("character", pos);
      sel.select();
    }
  }
};
goog.dom.selection.setText = function(textfield, text) {
  textfield = textfield;
  if (goog.dom.selection.useSelectionProperties_(textfield)) {
    var value = textfield.value;
    var oldSelectionStart = textfield.selectionStart;
    var before = value.substr(0, oldSelectionStart);
    var after = value.substr(textfield.selectionEnd);
    textfield.value = before + text + after;
    textfield.selectionStart = oldSelectionStart;
    textfield.selectionEnd = oldSelectionStart + text.length;
  } else {
    if (goog.dom.selection.isLegacyIe_()) {
      var tmp = goog.dom.selection.getRangeIe_(textfield);
      var range = tmp[0];
      var selectionRange = tmp[1];
      if (!range.inRange(selectionRange)) {
        return;
      }
      var range2 = selectionRange.duplicate();
      selectionRange.text = text;
      selectionRange.setEndPoint("StartToStart", range2);
      selectionRange.select();
    } else {
      throw Error("Cannot set the selection end");
    }
  }
};
goog.dom.selection.getText = function(textfield) {
  textfield = textfield;
  if (goog.dom.selection.useSelectionProperties_(textfield)) {
    var s = textfield.value;
    return s.substring(textfield.selectionStart, textfield.selectionEnd);
  }
  if (goog.dom.selection.isLegacyIe_()) {
    var tmp = goog.dom.selection.getRangeIe_(textfield);
    var range = tmp[0];
    var selectionRange = tmp[1];
    if (!range.inRange(selectionRange)) {
      return "";
    } else {
      if (textfield.type == goog.dom.InputType.TEXTAREA) {
        return goog.dom.selection.getSelectionRangeText_(selectionRange);
      }
    }
    return selectionRange.text;
  }
  throw Error("Cannot get the selection text");
};
goog.dom.selection.getSelectionRangeText_ = function(selRange) {
  var selectionRange = selRange.duplicate();
  var selectionText = selectionRange.text;
  var untrimmedSelectionText = selectionText;
  var isSelectionRangeEndTrimmed = false;
  while (!isSelectionRangeEndTrimmed) {
    if (selectionRange.compareEndPoints("StartToEnd", selectionRange) == 0) {
      isSelectionRangeEndTrimmed = true;
    } else {
      selectionRange.moveEnd("character", -1);
      if (selectionRange.text == selectionText) {
        untrimmedSelectionText += "\r\n";
      } else {
        isSelectionRangeEndTrimmed = true;
      }
    }
  }
  return untrimmedSelectionText;
};
goog.dom.selection.getRangeIe_ = function(el) {
  var doc = el.ownerDocument || el.document;
  var selectionRange = doc.selection.createRange();
  var range;
  if (el.type == goog.dom.InputType.TEXTAREA) {
    range = doc.body.createTextRange();
    range.moveToElementText(el);
  } else {
    range = el.createTextRange();
  }
  return [range, selectionRange];
};
goog.dom.selection.canonicalizePositionIe_ = function(textfield, pos) {
  textfield = textfield;
  if (textfield.type == goog.dom.InputType.TEXTAREA) {
    var value = textfield.value.substring(0, pos);
    pos = goog.string.canonicalizeNewlines(value).length;
  }
  return pos;
};
goog.dom.selection.useSelectionProperties_ = function(el) {
  try {
    return typeof el.selectionStart == "number";
  } catch (e) {
    return false;
  }
};
goog.dom.selection.isLegacyIe_ = function() {
  return goog.userAgent.IE && !goog.userAgent.isVersionOrHigher("9");
};
goog.provide("uno.util.richlink");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.dom.classlist");
goog.require("goog.dom.selection");
goog.require("goog.string");
goog.require("uno.defs");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.richlink");
  var defs = uno.defs;
  var util = uno.util;
  util.richlink.counter = 0;
  util.richlink.DISPLAY_TYPE = {NONE:"en_rl_none", MINIMAL:"en_rl_minimal", TEXT:"en_rl_text", SMALL:"en_rl_small"};
  util.richlink.isRichLink = function(node) {
    return node && util.dom.matches(node, ".en-richlink");
  };
  util.richlink.componentElementFor = function(el) {
    return goog.dom.getAncestorByTagNameAndClass(el, null, "en-richlink");
  };
  util.richlink.all = function(root) {
    return root.querySelectorAll(".en-richlink");
  };
  util.richlink.allPlain = function(root) {
    return root.querySelectorAll("a:not(.en-richlink)");
  };
  util.richlink.allPending = function(root) {
    return root.querySelectorAll("a.en-richlink-pending");
  };
  util.richlink.allUndecorated = function(root) {
    return Array.prototype.filter.call(util.richlink.allPlain(root), function(link) {
      return link.rev === util.richlink.DISPLAY_TYPE.NONE || link.rev === util.richlink.DISPLAY_TYPE.MINIMAL || link.rev === util.richlink.DISPLAY_TYPE.TEXT || link.rev === util.richlink.DISPLAY_TYPE.SMALL;
    });
  };
  util.richlink.canDecorate = function(el, editor) {
    return !!util.richlink.getProvider(el, editor);
  };
  util.richlink.getProvider = function(el, editor) {
    var provider;
    editor.richlinkProviders.some(function(p) {
      if (p.canDecorate(el.href)) {
        provider = p;
        return true;
      }
    });
    return provider;
  };
  util.richlink.decorate = function(el, editor) {
    if (!editor.config.richlinks.enabled) {
      return;
    }
    if (!el.href || util.richlink.hasNonDecoratableChildren(el)) {
      return;
    }
    if (el.rev === "" && el.text !== el.href) {
      return;
    }
    var provider = util.richlink.getProvider(el, editor);
    if (provider) {
      el.setAttribute("data-provider", provider.name);
      el.setAttribute("data-title", el.innerText);
      el.setAttribute("data-href", el.href);
      util.richlink.setDisplayType(el, util.richlink.getDisplayType(el));
      provider.decorate(el, editor);
    }
  };
  util.richlink.undecorate = function(el, editor) {
    editor.richlinkProviders.some(function(provider) {
      if (provider.name === el.getAttribute("data-provider")) {
        var anchor = provider.undecorate(el);
        anchor.href = el.getAttribute("data-href");
        anchor.removeAttribute("class");
        anchor.innerText = anchor.getAttribute("data-title");
        Object.keys(anchor.dataset).forEach(function(key) {
          anchor.removeAttribute(["data", goog.string.toSelectorCase(key)].join("-"));
        });
        return true;
      }
    });
  };
  util.richlink.setPending = function(el, pending) {
    if (el) {
      if (pending) {
        goog.dom.classlist.add(el, "en-richlink-pending");
      } else {
        goog.dom.classlist.remove(el, "en-richlink-pending");
      }
    }
  };
  util.richlink.setDisplayType = function(el, displayType) {
    el.setAttribute("rev", displayType || util.richlink.DISPLAY_TYPE.SMALL);
  };
  util.richlink.getDisplayType = function(el) {
    var parent;
    var displayType;
    if (!el) {
      displayType = util.richlink.DISPLAY_TYPE.SMALL;
    } else {
      if (el.hasAttribute("rev")) {
        displayType = el.getAttribute("rev");
      } else {
        if ((parent = util.dom.parent(el, "ul, ol, il, dl, td", null)) !== null) {
          displayType = util.richlink.DISPLAY_TYPE.MINIMAL;
        } else {
          if (util.dom.hasTextNextToIt(el)) {
            displayType = util.richlink.DISPLAY_TYPE.MINIMAL;
          } else {
            if (util.dom.hasTodoNextToIt(el)) {
              displayType = util.richlink.DISPLAY_TYPE.MINIMAL;
            } else {
              displayType = util.richlink.DISPLAY_TYPE.SMALL;
            }
          }
        }
      }
    }
    return displayType;
  };
  util.richlink.hasNonDecoratableChildren = function(node) {
    if (!node || !node.childNodes || node.childNodes.length == 0) {
      return false;
    }
    for (var index = 0; index < node.children.length; index++) {
      if (node.children[index].nodeName && (node.children[index].nodeName.toLowerCase() == "img" || uno.defs.blockElements[node.children[index].nodeName.toLowerCase()] && node.children[index].nodeName.toLowerCase() != "p")) {
        return true;
      }
      if (util.richlink.hasNonDecoratableChildren(node.children[index])) {
        return true;
      }
    }
    return false;
  };
  util.richlink.handleClick = function(el, target, editor) {
    var result = false;
    editor.richlinkProviders.some(function(provider) {
      if (provider.name === el.getAttribute("data-provider")) {
        result = provider.handleClick(el, target, editor);
      }
    });
    return result;
  };
  util.richlink.handleMouseMove = function(el, target, editor) {
    var result = false;
    editor.richlinkProviders.some(function(provider) {
      if (provider.name === el.getAttribute("data-provider")) {
        result = provider.handleMouseMove(el, target, editor);
      }
    });
    return result;
  };
  util.richlink.handleMouseOut = function(el, target, editor) {
    var result = false;
    editor.richlinkProviders.some(function(provider) {
      if (provider.name === el.getAttribute("data-provider")) {
        result = provider.handleMouseOut(el, target, editor);
      }
    });
    return result;
  };
})();
goog.provide("uno.commands.CreateLink");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.editor.plugins.BasicTextFormatter");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
goog.require("uno.util.richlink");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.CreateLink");
  var util = uno.util;
  var CreateLink = uno.commands.CreateLink = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(CreateLink, uno.BasePlugin);
  CreateLink.prototype.isSupportedCommand = function(command) {
    return command === "createlink";
  };
  CreateLink.prototype.activeOnUneditableFields = goog.functions.TRUE;
  CreateLink.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  CreateLink.prototype.execCommandInternal = function(command, value) {
    var container;
    var editor = this.editor;
    var url = goog.isObject(value) ? value.url : value;
    var title = goog.isObject(value) ? value.title || value.url : value;
    var range = editor.getRange();
    var origRangeCollapsed = range.isCollapsed();
    var dom = goog.dom;
    var node;
    if (range == null) {
      return;
    }
    if (url == null) {
      return;
    }
    if (range.isCollapsed()) {
      node = dom.createTextNode(title);
      range.replaceContentsWithNode(node);
      range = goog.dom.Range.createFromNodes(node, 0, node, title.length);
      range.select();
    }
    var googLink = editor.plugins_.BTF.createLink_(range, url);
    range = editor.getRange();
    container = range.getContainerElement();
    if (util.dom.compareTagName(container, "a")) {
      container.setAttribute("href", url);
      util.richlink.decorate(container, editor);
    }
    goog.array.forEachRight(googLink.getExtraAnchors(), function(a) {
      a.setAttribute("href", url);
      util.richlink.decorate(a, editor);
    });
    if (origRangeCollapsed) {
      goog.editor.range.placeCursorNextTo(editor.getRange().getStartNode());
    }
    editor.updateEmpty();
  };
  CreateLink.prototype.queryCommandValue = function() {
    var anchor;
    var range = this.editor.getRange();
    if (range && (range.isCollapsed() || range.getContainer() === range.getStartNode())) {
      anchor = goog.dom.getAncestorByTagNameAndClass(range.getStartNode(), "a");
      if (anchor && anchor.hasAttribute("href")) {
        return anchor.getAttribute("href");
      }
    }
    return null;
  };
  CreateLink.prototype.queryCommandEnabled = function(command) {
    return !!this.editor.getRange();
  };
})();
goog.provide("uno.commands.CreateTemplate");
goog.require("goog.debug.Logger");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.CreateTemplate");
  var util = uno.util;
  var CreateTemplate = uno.commands.CreateTemplate = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(CreateTemplate, uno.BasePlugin);
  CreateTemplate.prototype.isSupportedCommand = function(command) {
    return command === "createtemplate";
  };
  CreateTemplate.prototype.activeOnUneditableFields = goog.functions.TRUE;
  CreateTemplate.prototype.activeOnRangeOutsideOfEditor = goog.functions.TRUE;
  CreateTemplate.prototype.execCommand = function(command, value) {
    value = value || {};
    var theEditor = this.editor;
    EN.query("platform-version-for", "formDialog").then(function(version) {
      if (version === "1") {
        var initialTitle = value.title || theEditor.config && theEditor.config.note && theEditor.config.note.title || uno.util.loc.t("New Template");
        var formElements = [];
        formElements.push({type:"textInput", id:"title", label:util.loc.t("Title"), isRequired:true, initialValue:initialTitle});
        if (util.resource.all(theEditor.field).length > 0) {
          formElements.push({type:"warningText", content:util.loc.t("template-dialogs-create-warning")});
        }
        EN.run("platform-use", {type:"formDialog", payload:{isModal:true, titleText:theEditor.config.client === "ios" ? util.loc.t("Save as Template") : util.loc.t("Save as template"), titleIcon:"template", formElements:formElements, submitText:util.loc.t("Save"), cancelText:util.loc.t("Cancel")}, callback:function(data) {
          data = data || {};
          if (data.result === "submitted") {
            var titleResult = data.values && data.values.title && data.values.title.value;
            if (typeof titleResult === "string") {
              titleResult = titleResult.trim();
            }
            util.templates.createFromNote(theEditor, titleResult);
          }
        }});
      } else {
        var opt = {title:value.title, access:value.access};
        util.templates.showTemplateDialog(theEditor, "create", opt);
      }
    });
    return true;
  };
  CreateTemplate.prototype.queryCommandValue = function() {
    return this.checkTemplateCreationConditions();
  };
  CreateTemplate.prototype.queryCommandEnabled = function(command) {
    var conditions = this.checkTemplateCreationConditions();
    return conditions.featureEnabled && conditions.hasNoteGuid && conditions.hasValidContent;
  };
  CreateTemplate.prototype.checkTemplateCreationConditions = function() {
    return {featureEnabled:!!EN.isEnabled("templatemanager"), hasNoteGuid:!!this.editor.config.note.guid, hasValidContent:!util.dom.isEmpty(this.editor.field, {ignoreAttachments:true}) && (!this.editor.config.note.contentClass || this.editor.config.note.contentClass === "evernote.realtime") && util.crypto.all(this.editor.field).length === 0};
  };
})();
goog.provide("uno.commands.Crypt");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.dom.classlist");
goog.require("goog.editor.range");
goog.require("goog.functions");
goog.require("goog.object");
goog.require("goog.string");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
goog.require("uno.util.crypto");
goog.require("uno.util.dom");
goog.require("uno.util.list");
goog.require("uno.util.copy");
goog.require("uno.util.structure");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Crypt");
  var util = uno.util;
  var Crypt = uno.commands.Crypt = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Crypt, uno.BasePlugin);
  var CRYPT_CLASS = uno.defs.crypto.CRYPT_CLASS;
  var CRYPT_HIDDEN_CLASS = uno.defs.crypto.CRYPT_HIDDEN_CLASS;
  var CRYPT_VISIBLE_CLASS = uno.defs.crypto.CRYPT_VISIBLE_CLASS;
  Crypt.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Crypt.prototype.isSupportedCommand = function(command) {
    return command === "crypt";
  };
  Crypt.prototype.queryCommandEnabled = function(command, value) {
    if (this.editor.config.realtime.enabled) {
      log.info("crypt command disabled by realtime editing");
      return false;
    }
    if (value) {
      var action = value.open || value.close || value.revert;
      if (action && (action.id == null || this.editor.field.querySelector("#" + action.id))) {
        return true;
      }
      if (value.decrypt && this.editor.field.querySelector("#" + value.decrypt.cryptInfo.id)) {
        return true;
      }
    }
    var range = this.editor.getRange();
    if (!util.range.isInNote(this.editor, range)) {
      return false;
    }
    if (!util.structure.itemAllowedInRange(uno.defs.structuretypes.CMD_CRYPTO, range)) {
      return false;
    }
    var selection = getSelectedContents(this.editor);
    return !!(range && !range.isCollapsed() && !getCryptNodeFromRange(range) && selection && isValidHtml(selection.html));
  };
  Crypt.prototype.queryCommandValue = function(command, value) {
    var range = this.editor.getRange();
    if (range) {
      var cryptNode = getCryptNodeFromRange(range);
      var hasClass = goog.dom.classlist.contains;
      if (cryptNode) {
        if (value === "open") {
          return hasClass(cryptNode, CRYPT_VISIBLE_CLASS);
        } else {
          if (value === "closed") {
            return hasClass(cryptNode, CRYPT_HIDDEN_CLASS) || !hasClass(cryptNode, CRYPT_VISIBLE_CLASS);
          } else {
            if (value === "selected") {
              var cryptInfo = util.crypto.getCryptInfoFromNode(cryptNode);
              cryptInfo.open = !!hasClass(cryptNode, CRYPT_VISIBLE_CLASS);
              return cryptInfo;
            }
          }
        }
        return true;
      }
    }
    return false;
  };
  Crypt.prototype.execCommand = function(command, options) {
    var editor = this.editor;
    var range = editor.getRange();
    var result;
    if (!options) {
      result = requestEncryption(null, editor);
    } else {
      if (options.encrypt) {
        result = encrypt(options.encrypt, range, editor);
      } else {
        if (options.decrypt) {
          result = decrypt(options.decrypt, range, editor);
        } else {
          if (options.revert) {
            result = revert(options.revert, range, editor);
          } else {
            if (options.open) {
              result = open(options.open, range, editor);
            } else {
              if (options.close) {
                result = close(options.close, range, editor);
              } else {
                result = false;
              }
            }
          }
        }
      }
    }
    return result;
  };
  function isValidHtml(html) {
    var frag = util.dom.fragFromString(html);
    return frag.querySelectorAll("img,object,embed,table,tr,td,th,tbody,thead,ul,ol,hr").length === 0;
  }
  function getSelectedContents(editor) {
    return util.copy.copy(editor, {html:true, addMarker:false});
  }
  function requestEncryption(options, editor) {
    var selection = getSelectedContents(editor);
    if (!selection.html) {
      return false;
    }
    var cryptInfo = {id:"crypt-" + editor.context.crypt.incrementUniqueId(), length:"", cipher:"", hint:"", cipherText:"", plainText:selection.html, src:options && options.src || ""};
    editor.dispatchEvent({type:"encrypt", cryptInfo:cryptInfo});
    return cryptInfo;
  }
  function hide(options, range, editor) {
    if (!range || range.isCollapsed()) {
      return false;
    }
    var selection = getSelectedContents(editor);
    if (!selection.html) {
      return false;
    }
    var encryptedNode = util.crypto.createCryptoPlaceholder({id:options.cryptInfo.id, src:options.cryptInfo.src, plainText:options.cryptInfo.plainText});
    editor.execCommand("delete");
    editor.getRange().insertNode(encryptedNode, true);
    return encryptedNode;
  }
  function encrypt(options, range, editor) {
    if (!options) {
      return false;
    }
    if (!options.cryptInfo) {
      return options.src ? requestEncryption(options, editor) : false;
    }
    if (!options.cipherText) {
      return false;
    }
    var cryptNode = hide(options, range, editor);
    if (cryptNode) {
      cryptNode.setAttribute("data-ciphertext", options.cipherText);
      cryptNode.setAttribute("data-cipher", options.cipher);
      cryptNode.setAttribute("data-length", options.length);
      cryptNode.setAttribute("data-hint", options.hint);
      editor.dispatchChange();
      return true;
    }
    return false;
  }
  function decrypt(options, range, editor) {
    var cryptInfo = options && options.cryptInfo;
    var encryptedOnly = cryptInfo.revert ? {} : {encryptedOnly:true};
    var cryptNode = util.crypto.getNodeFromCryptInfo(cryptInfo, encryptedOnly);
    if (!cryptNode || !options.plainText) {
      return false;
    }
    var result = openCrypt(cryptNode, options.plainText, cryptInfo.revert, editor);
    return result;
  }
  function revert(options, range, editor) {
    var cryptInfo = {};
    var cryptNode = getCryptNode(options, range);
    if (cryptNode) {
      if (util.crypto.isOpen(cryptNode)) {
        openCrypt(cryptNode, cryptNode.innerHTML, true, editor);
      } else {
        goog.object.extend(cryptInfo, options, util.crypto.getCryptInfoFromNode(cryptNode), {revert:true});
        if (options.plainText) {
          cryptInfo.plainText = options.plainText;
        }
        editor.dispatchEvent({type:"decrypt", cryptInfo:cryptInfo});
      }
      return true;
    }
    return false;
  }
  function open(options, range, editor) {
    var cryptInfo = {};
    var cryptNode = getCryptNode(options, range);
    if (cryptNode) {
      goog.object.extend(cryptInfo, options, util.crypto.getCryptInfoFromNode(cryptNode));
      editor.dispatchEvent({type:"decrypt", cryptInfo:cryptInfo});
      return true;
    }
    return false;
  }
  function getCryptNode(options, range) {
    var cryptNode;
    if (options.id) {
      cryptNode = util.crypto.getNodeFromCryptInfo(options);
    } else {
      if (range) {
        var container = range.getContainerElement();
        cryptNode = util.crypto.isCrypt(container) ? container : container.querySelector("." + CRYPT_CLASS);
        if (cryptNode) {
          options.id = cryptNode.id;
        }
      }
    }
    return cryptNode;
  }
  function close(options, range, editor) {
    if (options.all) {
      var cryptNodes = editor.field.querySelectorAll("." + CRYPT_VISIBLE_CLASS);
      if (!cryptNodes.length) {
        return false;
      }
      goog.array.forEach(cryptNodes, function(cryptNode) {
        closeCrypt(cryptNode, options, editor);
      });
      return true;
    }
    if (options.id) {
      var cryptNode = util.crypto.getNodeFromCryptInfo(options, {decryptedOnly:true});
      if (cryptNode) {
        return closeCrypt(cryptNode, options, editor);
      }
    }
    return false;
  }
  function openCrypt(cryptNode, plainText, openPermanently, editor) {
    var placeholder = null;
    var cryptInfo = util.crypto.getCryptInfoFromNode(cryptNode);
    if (!plainText) {
      return false;
    }
    if (openPermanently) {
      placeholder = document.createElement("span");
      placeholder.innerHTML = plainText;
      editor.dispatchChange();
    } else {
      var attrs = {class:CRYPT_CLASS + " " + CRYPT_VISIBLE_CLASS, id:cryptInfo.id, "data-src":cryptInfo.src || "", "data-length":cryptInfo.length, "data-cipher":cryptInfo.cipher, "data-hint":cryptInfo.hint, "data-ciphertext":cryptInfo.cipherText};
      placeholder = goog.dom.createDom("blockquote", attrs);
      placeholder.innerHTML = plainText;
      placeholder.setAttribute("data-hash", util.crypto.hash(placeholder.innerHTML));
      placeholder.setAttribute("contentEditable", !editor.config.crypt.readOnly);
    }
    return !!replaceNodeAndKeepSelection(cryptNode, placeholder, openPermanently);
  }
  function closeCrypt(cryptNode, options, editor) {
    var cryptInfo = {};
    goog.object.extend(cryptInfo, options, util.crypto.getCryptInfoFromNode(cryptNode));
    if (util.crypto.isDirty(cryptNode)) {
      goog.object.extend(cryptInfo, {plainText:cryptNode.innerHTML});
      editor.dispatchEvent({type:"encrypt", cryptInfo:cryptInfo});
      return true;
    }
    var placeholder = util.crypto.createCryptoPlaceholder(cryptInfo);
    return !!replaceNodeAndKeepSelection(cryptNode, placeholder);
  }
  function getCryptNodeFromRange(range) {
    if (!range) {
      return null;
    }
    var container = document.createElement("div");
    container.innerHTML = range.getValidHtml();
    return container.querySelector("." + CRYPT_CLASS);
  }
  function replaceNodeAndKeepSelection(oldNode, newNode, flatten) {
    goog.dom.replaceNode(newNode, oldNode);
    var range = goog.editor.range.placeCursorNextTo(newNode);
    range.select();
    if (flatten) {
      goog.dom.flattenElement(newNode);
    }
    return range;
  }
})();
goog.provide("uno.commands.Cut");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Cut");
  var Cut = uno.commands.Cut = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Cut, uno.BasePlugin);
  Cut.prototype.isSupportedCommand = function(command) {
    return command === "cut";
  };
  Cut.prototype.execCommandInternal = function(command, opt) {
    return !!this.queryCommandValue(command, opt);
  };
  Cut.prototype.queryCommandValue = function() {
    var result = this.editor.queryCommandValue("copy");
    this.editor.execCommand("delete", "selection", undefined, true);
    return result;
  };
})();
goog.provide("uno.commands.Delete");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.iter");
goog.require("uno.BasePlugin");
goog.require("uno.EditorMultiRange");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.styles");
goog.require("uno.util.table");
goog.require("uno.util.list");
(function() {
  var util = uno.util;
  var log = goog.debug.Logger.getLogger("uno.commands.Delete");
  var ZERO_WIDTH_SPACE = uno.defs.unicode.ZERO_WIDTH_SPACE;
  var Delete = uno.commands.Delete = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(Delete, uno.BasePlugin);
  Delete.WORD = "word";
  Delete.SELECTION = "selection";
  Delete.prototype.isSupportedCommand = function(command) {
    return command === "delete";
  };
  Delete.prototype.queryCommandValue = function(command) {
    return document.queryCommandValue(command);
  };
  Delete.prototype.execCommand = function(command, value, options) {
    if (options && options.smart === false) {
      clearBaseAndExtent();
    }
    var forward = options ? options.forward : false;
    var native = options ? options.native : false;
    var formField = this.editor.getFormField();
    if (formField) {
      return deleteSelection(forward);
    }
    var range = this.editor.getRange();
    if (!range) {
      return false;
    }
    var focusNode = range.getFocusNode();
    var focusOffset = range.getFocusOffset();
    if (value === Delete.SELECTION && range.isCollapsed()) {
      return false;
    }
    if (value === Delete.WORD) {
      var wordRange = getWordRange(range, focusOffset, forward);
      selectRange(wordRange);
      range = this.editor.getRange();
      value = 1;
    }
    this.editor.dispatchBeforeChange();
    util.styles.createPendingStyles(this.editor);
    var result;
    var count = parseInt(value, 10);
    count = isNaN(count) ? 1 : count;
    for (var i = 0; i < count; i++) {
      if (isCursorAfterCodeBlock(focusNode, focusOffset) && range.isCollapsed()) {
        result = moveCursorToEndOfCodeBlock(focusNode, this.editor);
      } else {
        if (isCursorAtBeginningOfCodeBlock(focusNode, focusOffset) && range.isCollapsed()) {
          result = moveFirstLineOutOfCodeBlock(focusNode, this.editor);
        } else {
          if (this.editor.multirange.isInvoking()) {
            result = emptyCell(focusNode);
          } else {
            if (shouldEmptyCell(range, forward)) {
              result = emptyCell(focusNode, true);
            } else {
              if (!forward && isTableSelectedBeforeCursor(range) || forward && isTableSelectedAfterCursor(range)) {
                result = true;
              } else {
                if (assistedTableDelete(this.editor, range, forward)) {
                  result = true;
                } else {
                  if (util.list.deleteShouldOutdentListItem(range) && !forward) {
                    result = util.list.outdentSelection(this.editor);
                  } else {
                    if (isLastIndentation(focusNode, focusOffset) && range.isCollapsed() && !forward) {
                      result = deleteIndentation(focusNode);
                    } else {
                      if (isAfterResource(focusNode, focusOffset, forward)) {
                        result = removeResource(focusNode, range.isCollapsed());
                      } else {
                        if (isEditorDefaultEmpty(this.editor)) {
                          result = true;
                        } else {
                          if (range.isCollapsed() && !util.paragraph.hasVisibleContent(util.paragraph.for(focusNode))) {
                            var paragraph = util.paragraph.for(focusNode);
                            var cursorDestination = forward ? util.dom.startContent(util.paragraph.nextParagraph(paragraph)) : util.dom.endContent(util.paragraph.prevParagraph(paragraph));
                            if (cursorDestination) {
                              result = util.paragraph.remove(paragraph);
                              goog.editor.range.placeCursorNextTo(cursorDestination, forward);
                            }
                            util.styles.clearPendingStyles(this.editor);
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      if (typeof result !== "undefined") {
        if (result === true) {
          this.editor.dispatchChange();
        }
        return result;
      } else {
        if (native) {
          return false;
        }
      }
      deleteSelection(forward);
    }
    this.editor.dispatchChange();
    return true;
  };
  function isEditorDefaultEmpty(editor) {
    return editor.field.innerHTML === editor.config.defaults.html;
  }
  function clearBaseAndExtent() {
    var sel = window.getSelection();
    if (!sel || sel.setBaseAndExtent === undefined || sel.baseNode === undefined) {
      return;
    }
    var clear = sel.type === "Range" && (sel.anchorNode !== sel.baseNode || sel.anchorOffset !== sel.baseOffset || sel.extentNode !== sel.focusNode || sel.extentOffset !== sel.focusOffset);
    if (clear) {
      sel.setBaseAndExtent(sel.anchorNode, sel.anchorOffset, sel.focusNode, sel.focusOffset);
    }
  }
  function deleteSelection(forward) {
    var commandName = forward ? "forwarddelete" : "delete";
    return document.execCommand(commandName);
  }
  function selectRange(range) {
    var currentSelection = window.getSelection();
    currentSelection.removeAllRanges();
    currentSelection.addRange(range.getBrowserRangeObject());
  }
  function getWordRange(currentRange, offset, forward) {
    var wordRange = currentRange;
    var wordNode = currentRange.getContainer();
    if (offset && wordNode && wordNode.nodeType === Node.TEXT_NODE) {
      var found = false;
      var index = 0;
      wordNode.nodeValue.split(" ").forEach(function(word, i, arr) {
        var oldIndex = index;
        index += word.length;
        if (i < arr.length - 1) {
          index++;
        }
        if (!found) {
          if (forward && (offset === oldIndex || offset === oldIndex - 1)) {
            found = true;
          } else {
            if (!forward && (offset === index || offset === index - 1)) {
              found = true;
            } else {
              if (offset > oldIndex && offset < index) {
                found = true;
              }
            }
          }
          if (found) {
            wordRange = goog.dom.Range.createFromNodes(wordNode, oldIndex, wordNode, index);
          }
        }
      });
    }
    return wordRange;
  }
  function isTableSelectedBeforeCursor(range) {
    if (!range.isCollapsed() || range.getFocusOffset() > 0 || isCursorAtBeginningOfLI(range)) {
      return false;
    }
    var tableForNode = util.table.for(range.getFocusNode());
    var tableForPrevious = util.table.for(util.paragraph.prevParagraph(util.paragraph.for(range.getFocusNode())));
    if (!tableForPrevious || tableForNode) {
      return false;
    }
    var enTable = goog.dom.getAncestor(tableForPrevious, util.dom.isEntable);
    if (enTable) {
      goog.dom.Range.createFromNodes(enTable, 0, enTable, enTable.childNodes.length).select();
      enTable.classList.add("selected");
      return true;
    }
    return false;
  }
  function isTableSelectedAfterCursor(range) {
    if (!range.isCollapsed()) {
      return false;
    }
    var tableForNode = util.table.for(range.getFocusNode());
    var tableForNext = util.table.for(util.paragraph.nextParagraph(util.paragraph.for(range.getFocusNode())));
    if (!tableForNext || tableForNode) {
      return false;
    }
    var enTable = goog.dom.getAncestor(tableForNext, util.dom.isEntable);
    if (enTable) {
      goog.dom.Range.createFromNodes(enTable, 0, enTable, enTable.childNodes.length).select();
      enTable.classList.add("selected");
      return true;
    }
    return false;
  }
  function assistedTableDelete(editor, range, forward) {
    if (range.isCollapsed()) {
      return false;
    }
    var startAncestor = goog.dom.getAncestor(range.getStartNode(), util.dom.isEntable, true);
    var endAncestor = goog.dom.getAncestor(range.getEndNode(), util.dom.isEntable, true);
    var tableParent = null;
    var tableIndex = 0;
    var deleted = false;
    if (endAncestor && endAncestor !== startAncestor && endAncestor.classList.contains("selected")) {
      tableIndex = util.dom.index(endAncestor);
      tableParent = endAncestor.parentElement;
      endAncestor.remove();
      deleted = true;
    }
    if (startAncestor && startAncestor.classList.contains("selected")) {
      tableIndex = util.dom.index(startAncestor);
      tableParent = startAncestor.parentElement;
      startAncestor.remove();
      deleted = true;
    }
    if (deleted && !range.isCollapsed()) {
      util.range.normalize(editor.getRange()).select();
      deleteSelection(forward);
    }
    return deleted;
  }
  function shouldEmptyCell(range, forward) {
    var startNode = range.getStartNode();
    var endNode = range.getEndNode();
    var cell = goog.dom.getAncestor(startNode, util.dom.isTd, true);
    var endAncestor = goog.dom.getAncestor(endNode, util.dom.isTd, true);
    if (!cell || cell !== endAncestor) {
      return false;
    }
    if (util.dom.isEmptyContent(cell)) {
      return true;
    }
    var startOffset = range.getStartOffset();
    var endOffset = range.getEndOffset();
    var leaves = goog.array.filter(util.dom.getNodeLeaves(cell), function(node) {
      return !util.dom.isBr(node);
    });
    if (range.isCollapsed() && leaves.length === 1) {
      if (util.dom.isTextNode(leaves[0]) && leaves[0] === startNode && startNode.length === 1 && (startOffset === 1 && !forward || startOffset === 0 && forward)) {
        return true;
      }
      if (leaves[0].parentNode === startNode && (startOffset === 1 && !forward || startOffset === 0 && forward) && !util.list.itemFor(startNode)) {
        return true;
      }
    }
    if (!range.isCollapsed() && goog.array.every(leaves, range.containsNode, range)) {
      return true;
    }
    return false;
  }
  function isLastIndentation(node, offset) {
    if (offset) {
      return false;
    }
    if (util.dom.isElementNode(node) && (util.dom.isLi(node) || util.dom.isBlockquote(node))) {
      return true;
    } else {
      if (util.dom.isTextNode(node) && (util.dom.isLi(node.parentNode) || util.dom.isBlockquote(node.parentNode))) {
        return true;
      }
    }
    return false;
  }
  function getParagraphBeforeNode(node) {
    var previousParagraph = null;
    var currentParagraph = util.paragraph.for(node);
    if (!currentParagraph) {
      return false;
    }
    while (!previousParagraph) {
      previousParagraph = util.paragraph.prevParagraph(currentParagraph);
      if (previousParagraph && !util.dom.isEnnote(previousParagraph)) {
        break;
      } else {
        if (util.dom.isEnnote(previousParagraph) || util.dom.isEnnote(currentParagraph)) {
          break;
        } else {
          currentParagraph = currentParagraph.parentNode;
        }
      }
    }
    return previousParagraph;
  }
  function isCursorAtBeginningOfLI(range) {
    if (!range.isCollapsed() || range.getFocusOffset() > 0) {
      return false;
    }
    var node = range.getFocusNode();
    while (node && !util.dom.isEnnote(node)) {
      if (!node.previousSibling && util.dom.isLi(node)) {
        return true;
      }
      node = node.parentNode;
    }
    return false;
  }
  function isCursorAtBeginningOfCodeBlock(node, offset) {
    var block = goog.dom.getAncestor(node, function(ancestor) {
      return util.dom.isCodeBlock(ancestor);
    }, true);
    if (block && util.dom.isEmpty(block)) {
      return true;
    }
    if (offset === 0 && block && block.childNodes && block.childNodes[0] === util.paragraph.for(node)) {
      return true;
    }
    return false;
  }
  function moveFirstLineOutOfCodeBlock(node) {
    var block = goog.dom.getAncestor(node, function(ancestor) {
      return util.dom.isCodeBlock(ancestor);
    }, true);
    var textLine = block.childNodes[0].textContent;
    if (textLine.length === 0) {
      textLine = goog.dom.createDom("br");
    }
    block.childNodes[0].remove();
    var newLine = goog.dom.createDom("div", {}, textLine);
    block.parentElement.insertBefore(newLine, block);
    goog.editor.range.selectNodeStart(newLine);
    if (!block.childNodes || block.childNodes.length === 0) {
      block.remove();
    }
    return true;
  }
  function getCodeBlockBeforeNode(node) {
    var previousParagraph = getParagraphBeforeNode(node);
    if (previousParagraph && util.dom.isCodeBlock(previousParagraph)) {
      var block = previousParagraph;
      while (block.childNodes && block.childNodes.length > 0) {
        block = block.childNodes[block.childNodes.length - 1];
      }
      return block;
    }
    return false;
  }
  function moveCursorToEndOfCodeBlock(node, editor) {
    var newText = node.textContent;
    var block = getCodeBlockBeforeNode(node);
    if (block) {
      goog.editor.range.placeCursorNextTo(block);
      var range = editor.getRange();
      range.insertNode(goog.dom.createTextNode(newText));
      node.remove();
      return true;
    }
    return false;
  }
  function isCursorAfterCodeBlock(node, offset) {
    if (offset > 0) {
      return false;
    }
    return getCodeBlockBeforeNode(node);
  }
  function isAfterResource(node, offset, forward) {
    if (node.nodeType === Node.TEXT_NODE) {
      if (forward && (node.length === offset || node.textContent === ZERO_WIDTH_SPACE)) {
        node = node.nextSibling;
      } else {
        if (offset === 0 || node.textContent === ZERO_WIDTH_SPACE) {
          node = node.previousSibling;
        }
      }
    }
    if (util.dom.isEnmedia(node)) {
      return true;
    }
    return false;
  }
  function emptyCell(focusNode, placeCursor) {
    var cell = goog.dom.getAncestor(focusNode, util.dom.isTd, true);
    if (cell) {
      cell.innerHTML = "<div><br></div>";
      if (placeCursor) {
        goog.editor.range.placeCursorNextTo(cell.firstChild);
      }
      return true;
    }
    return false;
  }
  function removeResource(node, isCursorCollapsed, forward) {
    var enMedia = node;
    if (node.nodeType === Node.TEXT_NODE) {
      var sibling = forward ? node.nextSibling : node.previousSibling;
      if (sibling && sibling.tagName && sibling.tagName.toLowerCase() === "en-media") {
        enMedia = sibling;
      }
    }
    var previousSibling = enMedia.previousSibling;
    var nextSibling = enMedia.nextSibling;
    var startNode = enMedia.parentNode;
    var startOffset = util.dom.index(enMedia);
    if (previousSibling && previousSibling.textContent === ZERO_WIDTH_SPACE) {
      startNode = previousSibling;
      startOffset = 0;
    }
    var endNode = enMedia.parentNode;
    var endOffset = util.dom.index(enMedia) + 1;
    if (nextSibling && nextSibling.textContent === ZERO_WIDTH_SPACE) {
      endNode = nextSibling;
      endOffset = 1;
    }
    var range = goog.dom.Range.createFromNodes(startNode, startOffset, endNode, endOffset);
    if (isCursorCollapsed) {
      range.select();
    } else {
      deleteSelection(forward);
    }
    return true;
  }
  function deleteIndentation(element, forward) {
    var node = element.nodeType === Node.TEXT_NODE ? element.parentNode : element;
    var parent = node.parentNode;
    if (util.dom.isBlockquote(parent) || util.dom.isUl(parent) || util.dom.isOl(parent)) {
      var tagName = node.tagName.toLowerCase();
      var lis = parent.querySelectorAll(tagName);
      if (lis.length && lis[0] === node) {
        var grandParent = parent.parentNode;
        var line;
        var isParentAList = tagName === "li" && util.dom.isUl(grandParent) || util.dom.isOl(grandParent);
        var isParentABlockquote = tagName === "blockquote" && util.dom.isBlockquote(grandParent);
        if (grandParent && isParentAList || isParentABlockquote) {
          line = node;
        } else {
          line = document.createElement("div");
          line.innerHTML = node.innerHTML || "<br>";
        }
        if (lis.length === 0) {
          goog.dom.replaceNode(line, parent);
        } else {
          goog.dom.removeNode(node);
          grandParent.insertBefore(line, parent);
        }
        var range = goog.dom.Range.createFromNodes(line, 0, line, 0);
        range.select();
        return true;
      }
    }
    return deleteSelection(forward);
  }
})();
goog.provide("uno.commands.DeleteNote");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.DeleteNote");
  var DeleteNote = uno.commands.DeleteNote = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(DeleteNote, uno.BasePlugin);
  DeleteNote.prototype.isSupportedCommand = function(command) {
    return command === "deletenote";
  };
  DeleteNote.prototype.execCommand = function() {
    var y = this.editor.realtime.y;
    y.when("connectorReady").then(function() {
      y.connector.sendDeleteNoteMessage();
    });
    return true;
  };
  DeleteNote.prototype.queryCommandEnabled = goog.functions.TRUE;
})();
goog.provide("uno.commands.DeleteTable");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.editor.plugins.TableEditor");
goog.require("uno.BasePlugin");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.DeleteTable");
  var util = uno.util;
  var DeleteTable = uno.commands.DeleteTable = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(DeleteTable, uno.BasePlugin);
  DeleteTable.prototype.isSupportedCommand = function(command) {
    return command === "deletetable";
  };
  DeleteTable.prototype.execCommandInternal = function() {
    var table = goog.dom.getAncestor(this.editor.getRange().getStartNode(), util.dom.isTable);
    return util.table.delete(goog.dom.getAncestor(table, util.dom.isEntable) || table);
  };
  DeleteTable.prototype.queryCommandEnabled = function() {
    return !!util.table.cellForStructureChange(this.editor.getRange());
  };
})();
goog.provide("uno.commands.DeleteTableCol");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.DeleteTableCol");
  var util = uno.util;
  var DeleteTableCol = uno.commands.DeleteTableCol = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(DeleteTableCol, uno.BasePlugin);
  DeleteTableCol.prototype.isSupportedCommand = function(command) {
    return command === "deletetablecol";
  };
  DeleteTableCol.prototype.execCommandInternal = function() {
    var indexes = [];
    var enTable = util.table.getActive();
    var table = null;
    if (util.table.selection.isActive(enTable)) {
      indexes = util.table.selection.getColumnIndexes();
      util.table.selection.clear();
    } else {
      if (enTable) {
        var info = util.table.infoForCell(util.table.getActiveCell());
        if (info) {
          for (var c = info.startColIndex; c <= info.endColIndex; c++) {
            indexes.push(c);
          }
        }
      } else {
        var cell = util.table.cellForStructureChange(this.editor.getRange());
        var info = util.table.infoForCell(cell);
        if (info) {
          table = goog.dom.getAncestor(cell, util.dom.isTable);
          indexes.push(info.startColIndex);
        }
      }
    }
    return util.table.deleteColumns(enTable || table, indexes);
  };
  DeleteTableCol.prototype.queryCommandEnabled = function() {
    return !!util.table.cellForStructureChange(this.editor.getRange());
  };
})();
goog.provide("uno.commands.DeleteTableRow");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.DeleteTableRow");
  var util = uno.util;
  var DeleteTableRow = uno.commands.DeleteTableRow = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(DeleteTableRow, uno.BasePlugin);
  DeleteTableRow.prototype.isSupportedCommand = function(command) {
    return command === "deletetablerow";
  };
  DeleteTableRow.prototype.execCommandInternal = function() {
    var indexes = [];
    var enTable = util.table.getActive();
    var table = null;
    if (util.table.selection.isActive(enTable)) {
      indexes = util.table.selection.getRowIndexes();
      util.table.selection.clear();
    } else {
      if (enTable) {
        var info = util.table.infoForCell(util.table.getActiveCell());
        if (info) {
          for (var r = info.startRowIndex; r <= info.endRowIndex; r++) {
            indexes.push(r);
          }
        }
      } else {
        var cell = util.table.cellForStructureChange(this.editor.getRange());
        var info = util.table.infoForCell(cell);
        if (info) {
          table = goog.dom.getAncestor(cell, util.dom.isTable);
          indexes.push(info.startRowIndex);
        }
      }
    }
    return util.table.deleteRows(enTable || table, indexes);
  };
  DeleteTableRow.prototype.queryCommandEnabled = function() {
    return !!util.table.cellForStructureChange(this.editor.getRange());
  };
})();
goog.provide("uno.commands.Editable");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Editable");
  var Editable = uno.commands.Editable = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Editable, uno.BasePlugin);
  Editable.prototype.isSupportedCommand = function(command) {
    return command === "editable";
  };
  Editable.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Editable.prototype.execCommand = function(command, makeEditable) {
    if (makeEditable === "true") {
      makeEditable = true;
    } else {
      if (makeEditable === "false") {
        makeEditable = false;
      }
    }
    if (this.editor.readOnly && makeEditable) {
      return false;
    }
    if (makeEditable === this.editor.inEditMode()) {
      return true;
    }
    if (makeEditable) {
      this.editor.showVirtualKeyboardOnFocus = false;
      this.editor.enterEditMode({range:this.editor.saveRange(), focus:false});
      this.editor.showVirtualKeyboardOnFocus = true;
    } else {
      this.editor.leaveEditMode();
    }
    return true;
  };
  Editable.prototype.queryCommandValue = function() {
    return this.editor.inEditMode();
  };
})();
goog.provide("uno.commands.searchapi");
(function() {
  var searchapi = uno.commands.searchapi;
  var DIACRITIC_CHARS = {a:"a\u24d0\uff41\u1e9a\u00e0\u00e1\u00e2\u1ea7\u1ea5\u1eab\u1ea9\u00e3\u0101\u0103\u1eb1\u1eaf\u1eb5\u1eb3\u0227\u01e1\u00e4\u01df\u1ea3\u00e5\u01fb\u01ce\u0201\u0203\u1ea1\u1ead\u1eb7\u1e01\u0105\u2c65\u0250", b:"b\u24d1\uff42\u1e03\u1e05\u1e07\u0180\u0183\u0253", c:"c\u24d2\uff43\u0107\u0109\u010b\u010d\u00e7\u1e09\u0188\u023c\ua73f\u2184", d:"d\u24d3\uff44\u1e0b\u010f\u1e0d\u1e11\u1e13\u1e0f\u0111\u018c\u0256\u0257\ua77a", e:"e\u24d4\uff45\u00e8\u00e9\u00ea\u1ec1\u1ebf\u1ec5\u1ec3\u1ebd\u0113\u1e15\u1e17\u0115\u0117\u00eb\u1ebb\u011b\u0205\u0207\u1eb9\u1ec7\u0229\u1e1d\u0119\u1e19\u1e1b\u0247\u025b\u01dd", 
  f:"f\u24d5\uff46\u1e1f\u0192\ua77c", g:"g\u24d6\uff47\u01f5\u011d\u1e21\u011f\u0121\u01e7\u0123\u01e5\u0260\ua7a1\u1d79\ua77f", h:"h\u24d7\uff48\u0125\u1e23\u1e27\u021f\u1e25\u1e29\u1e2b\u1e96\u0127\u2c68\u2c76\u0265", i:"i\u24d8\uff49\u00ec\u00ed\u00ee\u0129\u012b\u012d\u00ef\u1e2f\u1ec9\u01d0\u0209\u020b\u1ecb\u012f\u1e2d\u0268\u0131", j:"j\u24d9\uff4a\u0135\u01f0\u0249", k:"k\u24da\uff4b\u1e31\u01e9\u1e33\u0137\u1e35\u0199\u2c6a\ua741\ua743\ua745\ua7a3", l:"l\u24db\uff4c\u0140\u013a\u013e\u1e37\u1e39\u013c\u1e3d\u1e3b\u017f\u0142\u019a\u026b\u2c61\ua749\ua781\ua747", 
  m:"m\u24dc\uff4d\u1e3f\u1e41\u1e43\u0271\u026f", n:"n\u24dd\uff4e\u01f9\u0144\u00f1\u1e45\u0148\u1e47\u0146\u1e4b\u1e49\u019e\u0272\u0149\ua791\ua7a5", o:"o\u24de\uff4f\u00f2\u00f3\u00f4\u1ed3\u1ed1\u1ed7\u1ed5\u00f5\u1e4d\u022d\u1e4f\u014d\u1e51\u1e53\u014f\u022f\u0231\u00f6\u022b\u1ecf\u0151\u01d2\u020d\u020f\u01a1\u1edd\u1edb\u1ee1\u1edf\u1ee3\u1ecd\u1ed9\u01eb\u01ed\u00f8\u01ff\u0254\ua74b\ua74d\u0275", p:"p\u24df\uff50\u1e55\u1e57\u01a5\u1d7d\ua751\ua753\ua755", q:"q\u24e0\uff51\u024b\ua757\ua759", 
  r:"r\u24e1\uff52\u0155\u1e59\u0159\u0211\u0213\u1e5b\u1e5d\u0157\u1e5f\u024d\u027d\ua75b\ua7a7\ua783", s:"s\u24e2\uff53\u00df\u015b\u1e65\u015d\u1e61\u0161\u1e67\u1e63\u1e69\u0219\u015f\u023f\ua7a9\ua785\u1e9b", t:"t\u24e3\uff54\u1e6b\u1e97\u0165\u1e6d\u021b\u0163\u1e71\u1e6f\u0167\u01ad\u0288\u2c66\ua787", u:"u\u24e4\uff55\u00f9\u00fa\u00fb\u0169\u1e79\u016b\u1e7b\u016d\u00fc\u01dc\u01d8\u01d6\u01da\u1ee7\u016f\u0171\u01d4\u0215\u0217\u01b0\u1eeb\u1ee9\u1eef\u1eed\u1ef1\u1ee5\u1e73\u0173\u1e77\u1e75\u0289", 
  v:"v\u24e5\uff56\u1e7d\u1e7f\u028b\ua75f\u028c", w:"w\u24e6\uff57\u1e81\u1e83\u0175\u1e87\u1e85\u1e98\u1e89\u2c73", x:"x\u24e7\uff58\u1e8b\u1e8d", y:"y\u24e8\uff59\u1ef3\u00fd\u0177\u1ef9\u0233\u1e8f\u00ff\u1ef7\u1e99\u1ef5\u01b4\u024f\u1eff", z:"z\u24e9\uff5a\u017a\u1e91\u017c\u017e\u1e93\u1e95\u01b6\u0225\u0240\u2c6c\ua763"};
  var DIACRITICMAP = {};
  for (var s in DIACRITIC_CHARS) {
    if (DIACRITIC_CHARS.hasOwnProperty(s)) {
      var characters = DIACRITIC_CHARS[s];
      DIACRITICMAP[s] = "[" + s + characters + "]";
      for (var i = 0; i < characters.length; i++) {
        var letter = characters[i];
        if (!DIACRITICMAP[letter]) {
          DIACRITICMAP[letter] = DIACRITICMAP[s];
        }
      }
    }
  }
  var UNICODE_CJK_RANGES = "\u1100-\u11ff\u2e80-\u312f\u3130-\u31bf\u31f0-\u9fff\ua960-\ua97f\uac00-\ud7ff\uf900-\ufaff\ufe30-\ufe4f\uff61-\uffdc";
  var UNICODE_LETTER_CATEGORY_RANGES = "A-Za-z\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0-\u08b4\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16f1-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2183\u2184\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005\u3006\u3031-\u3035\u303b\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fd5\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6e5\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ad\ua7b0-\ua7b7\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab65\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
  var UNICODE_MARK_CATEGORY_RANGES = "\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0c00-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d01-\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f\u109a-\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u192b\u1930-\u193b\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f\u1ab0-\u1abe\u1b00-\u1b04\u1b34-\u1b44\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1be6-\u1bf3\u1c24-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1cf8\u1cf9\u1dc0-\u1df5\u1dfc-\u1dff\u20d0-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9e5\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f";
  var UNICODE_DECIMAL_DIGIT_CATEGORY_RANGES = "0-9\u0660-\u0669\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0de6-\u0def\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u1090-\u1099\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1a80-\u1a89\u1a90-\u1a99\u1b50-\u1b59\u1bb0-\u1bb9\u1c40-\u1c49\u1c50-\u1c59\ua620-\ua629\ua8d0-\ua8d9\ua900-\ua909\ua9d0-\ua9d9\ua9f0-\ua9f9\uaa50-\uaa59\uabf0-\uabf9\uff10-\uff19";
  var UNICODE_ALPHANUM_RANGES = UNICODE_LETTER_CATEGORY_RANGES + UNICODE_MARK_CATEGORY_RANGES + UNICODE_DECIMAL_DIGIT_CATEGORY_RANGES;
  var UNDERSCORE_RANGES = "_\uff3f";
  var EN_CJK_ALPHANUM_CHARSET = "(?=[" + UNICODE_LETTER_CATEGORY_RANGES + UNICODE_MARK_CATEGORY_RANGES + UNICODE_DECIMAL_DIGIT_CATEGORY_RANGES + "])[" + UNICODE_CJK_RANGES + "]";
  var EN_CJK_ALPHANUM_REGEX = RegExp(EN_CJK_ALPHANUM_CHARSET);
  var EN_WORD_BOUNDARY_CHARSET = "(?:[^" + UNICODE_LETTER_CATEGORY_RANGES + UNICODE_MARK_CATEGORY_RANGES + UNICODE_DECIMAL_DIGIT_CATEGORY_RANGES + "]|[" + UNICODE_CJK_RANGES + "])";
  var STARTSWITH_EN_WORD_BOUNDARY_REGEX = RegExp("^" + EN_WORD_BOUNDARY_CHARSET);
  var ENDSWITH_EN_WORD_BOUNDARY_REGEX = RegExp(EN_WORD_BOUNDARY_CHARSET + "$");
  var EN_WORD_DELIMITER_CHARSET = "[^" + UNICODE_ALPHANUM_RANGES + UNDERSCORE_RANGES + "]";
  var EN_WORD_DELIMITER_REGEX = RegExp(EN_WORD_DELIMITER_CHARSET);
  var ONE_OR_MORE_EN_WORD_DELIMITER_PATTERN = EN_WORD_DELIMITER_CHARSET + "+";
  var ZERO_OR_MORE_EN_WORD_DELIMITER_PATTERN = EN_WORD_DELIMITER_CHARSET + "*";
  var EN_STOPWORDS = ["a", "an", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"];
  var EN_STOPWORDS_REGEX = RegExp("^(" + EN_STOPWORDS.join("|") + ")$", "i");
  searchapi.getNoteSearchRegex = function(rawSearchTerm, caseSensitive) {
    var searchTerm = rawSearchTerm.trim();
    var prefixMatch = /\*$/.test(searchTerm);
    searchTerm = prefixMatch ? searchTerm.substring(0, searchTerm.length - 1) : searchTerm;
    if (searchTerm.length <= 0) {
      return null;
    }
    if (EN_STOPWORDS_REGEX.test(searchTerm)) {
      return null;
    }
    var pattern = searchTerm;
    var newValue = [];
    var prevCharDelimeter = false;
    var prevCharCJK = false;
    for (var s = 0; s < pattern.length; s++) {
      var character = pattern[s];
      if (isCharCJKAlphanum(character)) {
        if (prevCharCJK) {
          newValue.push(ZERO_OR_MORE_EN_WORD_DELIMITER_PATTERN);
        }
        newValue.push(character);
        prevCharDelimeter = false;
        prevCharCJK = true;
      } else {
        if (isCharWordDelimiter(character)) {
          if (!prevCharDelimeter) {
            newValue.push(ONE_OR_MORE_EN_WORD_DELIMITER_PATTERN);
          }
          prevCharDelimeter = true;
          prevCharCJK = false;
        } else {
          if (prevCharCJK) {
            newValue.push(ZERO_OR_MORE_EN_WORD_DELIMITER_PATTERN);
          }
          var item = DIACRITICMAP[character.toLowerCase()];
          if (item) {
            newValue.push(item);
          } else {
            newValue.push(character);
          }
          prevCharDelimeter = false;
          prevCharCJK = false;
        }
      }
    }
    pattern = newValue.join("");
    pattern = pattern.replace(/\s/g, "\\s");
    pattern = "(" + pattern + ")";
    var groupIdxForHighlight = 1;
    if (!startsWithWordBoundary(searchTerm)) {
      pattern = "(^|" + EN_WORD_BOUNDARY_CHARSET + ")" + pattern;
      groupIdxForHighlight++;
    }
    if (!prefixMatch && !endsWithWordBoundary(searchTerm)) {
      pattern = pattern + "(?:" + EN_WORD_BOUNDARY_CHARSET + "|$)";
    }
    return {regex:new RegExp(pattern, caseSensitive ? "g" : "gi"), getTextRange:function(m) {
      var startIdx = m.index;
      var endIdx = startIdx;
      for (var idx = 1; idx <= groupIdxForHighlight; idx++) {
        startIdx = endIdx;
        endIdx = startIdx + m[idx].length;
      }
      return {start:startIdx, end:endIdx};
    }};
  };
  searchapi.getFindInNoteRegex = function(searchTerm, caseSensitive) {
    var pattern = [searchTerm].map(function(word) {
      if (word instanceof RegExp) {
        return word.source;
      }
      return word.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&").replace(/\s/g, "\\s");
    });
    return {regex:new RegExp(pattern, caseSensitive ? "g" : "gi"), getTextRange:function(m, regex) {
      return {start:m.index, end:regex.lastIndex};
    }};
  };
  var isCharCJKAlphanum = function(character) {
    return EN_CJK_ALPHANUM_REGEX.test(character);
  };
  var isCharWordDelimiter = function(character) {
    return EN_WORD_DELIMITER_REGEX.test(character);
  };
  var startsWithWordBoundary = function(sentence) {
    return STARTSWITH_EN_WORD_BOUNDARY_REGEX.test(sentence);
  };
  var endsWithWordBoundary = function(sentence) {
    return ENDSWITH_EN_WORD_BOUNDARY_REGEX.test(sentence);
  };
})();
goog.provide("uno.commands.Find");
goog.require("uno.commands.searchapi");
goog.require("goog.functions");
goog.require("goog.object");
goog.require("goog.debug.Logger");
goog.require("goog.iter");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
goog.require("uno.util.range");
goog.require("uno.util.zoomscale");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Find");
  var util = uno.util;
  var Find = uno.commands.Find = function() {
    uno.BasePlugin.call(this, log.getName());
    this.current = {hasMore:false, matches:[], index:-1, term:null, regex:null};
  };
  goog.inherits(Find, uno.BasePlugin);
  Find.NEXT = "next";
  Find.PREV = "prev";
  Find.FIRST = "first";
  Find.LAST = "last";
  Find.ALL = "all";
  Find.CLEAR = "clear";
  Find.prototype.isSupportedCommand = function(command) {
    return command === "find";
  };
  Find.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Find.prototype.queryCommandValue = function(command, rawOptions) {
    this.options = Object.assign({caseSensitive:false}, mergeOptions(this.editor.config.find, rawOptions || this.options));
    var options = this.options;
    var current = this.current;
    var result = {limit:options.limit, hasMore:current.hasMore, count:current.matches.length, items:current.matches, index:current.index};
    if (options.value) {
      if (typeof options.value === "string" && options.value.length && options.limit) {
        var getNoteSearchRegex = uno.commands.searchapi.getNoteSearchRegex;
        var getFindInNoteRegex = uno.commands.searchapi.getFindInNoteRegex;
        var searchApi = options.noteSearchMatching ? getNoteSearchRegex(options.value, options.caseSensitive) : getFindInNoteRegex(options.value, options.caseSensitive);
        var searchElements = document.querySelectorAll(options.selector);
        var matches = [];
        var regexResult;
        Array.prototype.forEach.call(searchElements, function(searchElement) {
          var searchRange = goog.dom.Range.createFromNodeContents(searchElement);
          var textNodes = textNodesFor(searchRange);
          var rawText = searchRange.getText();
          var offset = 0;
          var boundingBoxes;
          while ((regexResult = searchApi.regex.exec(rawText)) && regexResult && matches.length < options.limit) {
            var textRange = searchApi.getTextRange(regexResult, searchApi.regex);
            searchApi.regex.lastIndex = textRange.end;
            var boundingNodes = getBoundingNodes(textNodes, textRange.start, textRange.end, offset);
            boundingBoxes = getBoundingBoxesFromRange(boundingNodes, options.includeRangeInfo);
            offset = boundingNodes.offset;
            if (boundingBoxes) {
              var scrollTop = util.dom.scrollTop(document.body);
              if (util.dom.isBoundingBoxOnScreen(boundingBoxes[0].top - scrollTop, boundingBoxes[0].bottom - scrollTop)) {
                current.index = matches.length;
              }
              matches.push(boundingBoxes);
            }
          }
        });
        current.hasMore = !!regexResult;
        current.matches = matches;
        current.term = options.value;
        current.regex = searchApi.regex;
        current.index = current.index > -1 ? current.index : 0;
      }
      result = {limit:options.limit, hasMore:current.hasMore, count:current.matches.length, items:current.matches, index:current.index};
    }
    if (options.excludeMatches) {
      delete result.items;
    }
    return result;
  };
  function mergeOptions(configOptions, options) {
    var parsedOptions = {};
    var defaultOptions = {limit:100, excludeMatches:false, selector:"en-note", noteSearchMatching:false, includeRangeInfo:false};
    goog.object.extend(parsedOptions, defaultOptions || {});
    goog.object.extend(parsedOptions, configOptions || {});
    goog.object.extend(parsedOptions, options || {});
    parsedOptions.limit = isNaN(parsedOptions.limit) || parsedOptions.limit < 0 ? 100 : parseInt(parsedOptions.limit, 10);
    parsedOptions.selector = parsedOptions.selector && typeof parsedOptions.selector === "string" ? parsedOptions.selector : "en-note";
    return parsedOptions;
  }
  function textNodesFor(range) {
    var textNodesArray = [];
    var startIndex = 0;
    goog.iter.forEach(range, function(node, notUsed, element) {
      if (node.nodeType === Node.TEXT_NODE) {
        var text = node.nodeValue;
        var endIndex = startIndex + text.length;
        textNodesArray[startIndex] = {wordOffsetInTextNode:0, node:node, text:text, startIndex:startIndex, endIndex:endIndex};
        startIndex = endIndex;
      }
    });
    return textNodesArray;
  }
  function getBoundingNodes(textNodes, start, end, offset) {
    if (!textNodes) {
      return {offset:0};
    }
    offset = offset || 0;
    var nodes = textNodes.slice(offset);
    var startNode = null;
    var endNode = null;
    for (var i in nodes) {
      var node = nodes[parseInt(i)];
      if (node.startIndex <= start) {
        startNode = node;
      }
      if (node.endIndex >= end) {
        endNode = node;
      }
      if (startNode && endNode) {
        break;
      }
    }
    if (startNode && endNode) {
      return {offset:startNode.startIndex, startNode:startNode.node, startIndex:startNode.startIndex, startOffset:start - startNode.startIndex, endNode:endNode.node, endIndex:endNode.endIndex, endOffset:end - endNode.startIndex, string:[startNode.text, endNode.text].join(" "), length:end - start};
    }
  }
  function getBoundingBoxesFromRange(boundingNodes, includeRangeInfo) {
    if (!boundingNodes || !boundingNodes.startNode || !boundingNodes.endNode) {
      return;
    }
    var elementRange = goog.dom.Range.createFromNodes(boundingNodes.startNode, boundingNodes.startOffset, boundingNodes.endNode, boundingNodes.endOffset);
    var boundingBoxes = util.range.getBoundingBoxesFromRange(elementRange.getBrowserRangeObject());
    if (boundingBoxes && boundingBoxes.length) {
      var adjustedScroll = util.dom.scrollTop(document.body);
      boundingBoxes = boundingBoxes.map(function(boundingBox) {
        if (boundingBox) {
          boundingBox = util.zoomscale.normalizeRect(boundingBox);
          boundingBox.top = adjustedScroll + boundingBox.top;
          boundingBox.string = boundingNodes.string;
          boundingBox.length = boundingNodes.length;
          boundingBox.from = boundingNodes.startIndex;
          boundingBox.to = boundingNodes.endIndex;
        }
        if (includeRangeInfo) {
          boundingBox.rangeInfo = boundingNodes;
        }
        return boundingBox;
      });
    }
    return boundingBoxes;
  }
})();
goog.provide("uno.commands.Focus");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.range");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Focus");
  var util = uno.util;
  var Focus = uno.commands.Focus = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Focus, uno.BasePlugin);
  Focus.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Focus.prototype.isSupportedCommand = function(command) {
    return command === "focus";
  };
  Focus.prototype.execCommand = function(command, value) {
    if (this.editor.readOnly) {
      return false;
    }
    var opt = {force:false, pos:"top", scroll:false};
    goog.object.extend(opt, value || {});
    this.editor.enterEditMode({range:true, focus:false});
    this.editor.focus();
    if (opt.force) {
      if (opt.pos === "top") {
        this.editor.placeCursorAtStart();
      } else {
        if (opt.pos === "bottom") {
          this.editor.placeCursorAtEnd();
        }
      }
    }
    if (opt.scroll) {
      util.range.scrollSelectionIntoView(this.editor);
    }
    if (opt.selection) {
      this.editor.execCommand("selection", JSON.parse(opt.selection));
    }
    return true;
  };
  Focus.prototype.queryCommandValue = function() {
    return this.editor.isFocused();
  };
})();
goog.provide("uno.commands.FontSize");
goog.require("goog.array");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.editor.Command");
goog.require("goog.functions");
goog.require("goog.style");
goog.require("uno.BasePlugin");
goog.require("uno.util.font");
goog.require("uno.defs");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.FontSize");
  var util = uno.util;
  var ZERO_WIDTH_SPACE = uno.defs.unicode.ZERO_WIDTH_SPACE;
  var FontSize = uno.commands.FontSize = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(FontSize, uno.BasePlugin);
  FontSize.prototype.isSupportedCommand = function(command) {
    return command === "fontsize";
  };
  FontSize.prototype.activeOnUneditableFields = goog.functions.TRUE;
  FontSize.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  FontSize.prototype.execCommand = function(command, size) {
    var range = this.editor.getRange();
    if (!range) {
      return false;
    }
    var sizeValue = util.font.prepareSize(size);
    if (range.isCollapsed()) {
      this.setFontSizeCollapsed(sizeValue, range);
    } else {
      this.editor.dispatchBeforeChange();
      this.setFontSizeExpanded(sizeValue, range);
      this.editor.dispatchChange();
      this.editor.dispatchStyleChange();
    }
    return true;
  };
  FontSize.prototype.queryCommandValue = function() {
    var range = this.editor.getRange();
    if (!range) {
      return "";
    }
    var startNode = range.getStartNode();
    var startEl = startNode.nodeType === goog.dom.NodeType.TEXT ? goog.dom.getParentElement(startNode) : startNode;
    var countSupSubs = util.dom.ancestors(startEl).concat(startEl).filter(function(elt) {
      return util.dom.isSub(elt) || util.dom.isSup(elt) || elt && elt.style && elt.style.fontSize === "smaller" && (elt.style.verticalAlign === "sub" || elt.style.verticalAlign === "super");
    }).length;
    var firstAddedEl;
    for (var i = 0; i < countSupSubs; i++) {
      var el = goog.dom.createDom("span", {style:"font-size: larger"});
      if (!firstAddedEl) {
        firstAddedEl = el;
      }
      startEl.appendChild(el);
      startEl = el;
    }
    var size = util.font.getSize(startEl);
    if (firstAddedEl) {
      goog.dom.removeNode(firstAddedEl);
    }
    return size.toString();
  };
  FontSize.prototype.setFontSizeCollapsed = function(size, range) {
    var node = range.getStartNode();
    var container = range.getContainerElement();
    var fontEl;
    var lineEmpty = util.dom.isEmpty(range.getStartNode());
    if (container.tagName === "FONT" && node.textContent.split(ZERO_WIDTH_SPACE).join("").length === 0) {
      fontEl = container;
    } else {
      this.editor.execCommand(goog.editor.Command.FONT_SIZE, 1);
      document.execCommand("inserttext", false, ZERO_WIDTH_SPACE);
      range = this.editor.getRange();
      if (lineEmpty) {
        var br = goog.dom.createDom("br");
        range.insertNode(br);
        range = this.editor.getRange();
      }
      fontEl = range.getContainerElement();
    }
    util.font.normalize(fontEl, size);
  };
  FontSize.prototype.setFontSizeExpanded = function(size, range) {
    var fontEls;
    this.editor.execCommand(goog.editor.Command.FONT_SIZE, 1);
    range = this.editor.getRange();
    fontEls = document.querySelectorAll("font[size]");
    goog.array.forEach(fontEls, function(fontEl) {
      if (range.containsNode(fontEl, true)) {
        util.font.normalizeFontSize(fontEl, size);
      }
    });
  };
})();
goog.provide("uno.commands.ForeColor");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.EditorMultiRange");
goog.require("uno.util.font");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.ForeColor");
  var util = uno.util;
  var ForeColor = uno.commands.ForeColor = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(ForeColor, uno.BasePlugin);
  ForeColor.prototype.activeOnUneditableFields = goog.functions.TRUE;
  ForeColor.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  ForeColor.prototype.isSupportedCommand = function(command) {
    return command === "forecolor";
  };
  ForeColor.prototype.execCommand = function(command, color) {
    var range = this.editor.getRange();
    if (!range) {
      return false;
    }
    var isCollapsed = range.isCollapsed();
    if (!isCollapsed) {
      this.editor.dispatchBeforeChange();
    }
    this.editor.execCommand(goog.editor.Command.FONT_COLOR, color);
    var container = range.getContainerElement();
    var fontAnchors = container.querySelectorAll("font a");
    for (var i = 0; i < fontAnchors.length; i++) {
      goog.style.setStyle(fontAnchors[i], "color", color);
    }
    if (!isCollapsed) {
      this.editor.dispatchChange();
    }
    this.editor.dispatchStyleChange();
    return true;
  };
  ForeColor.prototype.queryCommandValue = function() {
    var range = this.editor.getRange();
    if (!range) {
      return "";
    }
    var startNode = range.getStartNode();
    var startEl = startNode.nodeType === goog.dom.NodeType.TEXT ? goog.dom.getParentElement(startNode) : startNode;
    var a = util.dom.getAncestor(startEl, util.dom.isA, true);
    if (a && util.font.getColor(a) === util.font.getColor(startEl) && !a.style.color) {
      startEl = a.parentElement;
    }
    var color = util.font.getColor(startEl) || "rgb(0, 0, 0)";
    return color.toString();
  };
})();
goog.provide("uno.commands.ForwardDelete");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.ForwardDelete");
  var ForwardDelete = uno.commands.ForwardDelete = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(ForwardDelete, uno.BasePlugin);
  ForwardDelete.prototype.isSupportedCommand = function(command) {
    return command === "forwarddelete";
  };
  ForwardDelete.prototype.queryCommandValue = function(command) {
    return document.queryCommandValue(command);
  };
  ForwardDelete.prototype.execCommand = function(command, value) {
    this.editor.execCommand("delete", value, {forward:true}, true);
  };
})();
goog.provide("uno.commands.Highlight");
goog.require("goog.debug.Logger");
goog.require("goog.editor.Command");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
(function() {
  var util = uno.util;
  var log = goog.debug.Logger.getLogger("uno.commands.Highlight");
  var highlightBackgroundColor = uno.defs.highlight.COLOR;
  var highlightPlaceholder = "rgb(255, 255, 255)";
  var Highlight = uno.commands.Highlight = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(Highlight, uno.BasePlugin);
  Highlight.prototype.isSupportedCommand = function(command) {
    return command === "highlight";
  };
  Highlight.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  Highlight.prototype.execCommand = function() {
    var multirange = this.editor.multirange;
    var range = this.editor.getRange();
    if (!range) {
      return false;
    }
    var highlighted = this.editor.queryCommandValue("highlight");
    this.editor.dispatchBeforeChange();
    document.execCommand("backColor", null, highlighted ? highlightPlaceholder : highlightBackgroundColor);
    cleanupHighlight([range.getContainerElement()], range);
    if (!multirange.isInvoking() || multirange.isLastInvokedRange()) {
      this.editor.dispatchStyleChange({state:{highlight:!highlighted}, value:{}, enabled:{}});
    }
    this.editor.dispatchChange();
    return true;
  };
  Highlight.prototype.queryCommandValue = function(command, options) {
    var quickAndDirty = options && options.quickAndDirty;
    var range = this.editor.getRange();
    var state = document.queryCommandValue("backColor");
    if (!range) {
      return false;
    }
    var startNode = range.getStartNode();
    var endNode = range.getEndNode();
    if (range && range.isCollapsed()) {
      if (startNode.nodeType === Node.TEXT_NODE) {
        return highlightBackgroundColor === state;
      }
    }
    if (highlightBackgroundColor === state) {
      return true;
    }
    var container = range.getContainerElement();
    var nodes = [];
    if (container === startNode && container === endNode) {
      nodes.push(container);
    } else {
      if (quickAndDirty && container === this.editor.field) {
        return false;
      }
      Array.prototype.forEach.call(container.childNodes || [], function(node) {
        if (range.containsNode(node, true) || node.contains(startNode) || node.contains(endNode)) {
          nodes.push(node);
        }
      });
    }
    return isHighlighted(range, nodes);
  };
  Highlight.prototype.queryCommandEnabled = goog.functions.TRUE;
  function cleanupHighlight(nodes, range) {
    Array.prototype.forEach.call(nodes || [], function(node) {
      if (range.containsNode(node, true)) {
        if (util.dom.isElementNode(node)) {
          if (node.style.backgroundColor === highlightPlaceholder) {
            node.style.backgroundColor = "";
          }
          if (node.childNodes) {
            cleanupHighlight(node.childNodes, range);
          }
        }
      }
    });
  }
  function isHighlighted(range, nodes) {
    if (!nodes) {
      return false;
    }
    var filteredNodes = Array.prototype.filter.call(nodes, function(node) {
      return range.containsNode(node, true);
    });
    if (filteredNodes.length === 0) {
      return false;
    }
    return Array.prototype.every.call(filteredNodes, function(node) {
      if (util.dom.isElementNode(node)) {
        var style = window.getComputedStyle(node);
        if (style.backgroundColor === highlightBackgroundColor) {
          return true;
        }
        if (["rgba(0, 0, 0, 0)", "rgb(255, 255, 255)"].indexOf(style.backgroundColor) > -1) {
          return isHighlighted(range, node.childNodes);
        }
      }
      return false;
    });
  }
})();
goog.provide("uno.util.hr");
goog.require("goog.dom");
goog.require("uno.util.paragraph");
goog.require("uno.util.dom");
(function() {
  var util = uno.util;
  util.hr.insertHrAtRange = function(editor) {
    var range = editor.getRange();
    if (range) {
      var hr = goog.dom.createDom("hr");
      var paragraph = util.paragraph.for(range.getStartNode());
      var nextParagraph = paragraph.nextSibling;
      if (util.dom.isEmptyContent(paragraph)) {
        if (!nextParagraph) {
          nextParagraph = util.paragraph.create();
          goog.dom.insertSiblingAfter(nextParagraph, paragraph);
        }
        goog.dom.replaceNode(hr, paragraph);
      } else {
        var paragraphs = util.paragraph.splitParagraph(editor);
        goog.dom.insertSiblingAfter(hr, paragraphs.oldParagraph);
        nextParagraph = paragraphs.newParagraph;
      }
      editor.selectStart(nextParagraph);
      return true;
    }
    return false;
  };
})();
goog.provide("uno.commands.InsertHorizontalRule");
goog.require("goog.debug.Logger");
goog.require("uno.util.hr");
goog.require("uno.util.structure");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.InsertHorizontalRule");
  var util = uno.util;
  var InsertHorizontalRule = uno.commands.InsertHorizontalRule = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(InsertHorizontalRule, uno.BasePlugin);
  InsertHorizontalRule.prototype.isSupportedCommand = function(command) {
    return command === "inserthorizontalrule";
  };
  InsertHorizontalRule.prototype.activeOnUneditableFields = goog.functions.TRUE;
  InsertHorizontalRule.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  InsertHorizontalRule.prototype.execCommandInternal = function() {
    return util.hr.insertHrAtRange(this.editor);
  };
  InsertHorizontalRule.prototype.queryCommandValue = function() {
    return this.editor.queryCommandValue(goog.editor.Command.HORIZONTAL_RULE);
  };
  InsertHorizontalRule.prototype.queryCommandEnabled = function(command, options) {
    var quickAndDirty = options && options.quickAndDirty;
    var range = this.editor.getRange();
    if (range) {
      if (!util.structure.itemAllowedInRange(uno.defs.structuretypes.CMD_HR, range, quickAndDirty)) {
        return false;
      }
    }
    return true;
  };
})();
goog.provide("uno.commands.InsertHtml");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.InsertHtml");
  var InsertHtml = uno.commands.InsertHtml = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(InsertHtml, uno.BasePlugin);
  InsertHtml.prototype.isSupportedCommand = function(command) {
    return command === "inserthtml";
  };
  InsertHtml.prototype.execCommandInternal = function(command, html) {
    return this.editor.execCommand("paste", {type:"html", value:html});
  };
})();
goog.provide("uno.commands.InsertText");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.InsertText");
  var InsertText = uno.commands.InsertText = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(InsertText, uno.BasePlugin);
  InsertText.prototype.isSupportedCommand = function(command) {
    return command === "inserttext";
  };
  InsertText.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  InsertText.prototype.execCommandInternal = function(command, plainText) {
    return this.editor.execCommand("paste", {type:"plain", value:plainText});
  };
})();
goog.provide("uno.commands.InsertParagraph");
goog.require("goog.debug.Logger");
goog.require("goog.object");
goog.require("uno.BasePlugin");
goog.require("uno.util.todo");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.InsertParagraph");
  var util = uno.util;
  var InsertParagraph = uno.commands.InsertParagraph = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(InsertParagraph, uno.BasePlugin);
  InsertParagraph.prototype.isSupportedCommand = function(command) {
    return command === "insertparagraph";
  };
  InsertParagraph.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  InsertParagraph.prototype.execCommandInternal = function(command, options) {
    options = options || {};
    var editor = this.editor;
    var range = editor.getRange();
    if (!range) {
      return false;
    }
    if (!range.isCollapsed()) {
      editor.execCommand("delete");
    }
    range = editor.getRange();
    var p = util.paragraph.for(range.getStartNode());
    range = editor.getRange();
    var node = range.getStartNode();
    var offset = range.getStartOffset();
    var isTextNode = util.dom.isTextNode(node);
    if (isTextNode && offset > 0 && offset < node.length) {
      node.splitText(offset);
    }
    return util.styles.withPendingStyles(editor, function(range_) {
      var savedRange = range_.saveUsingCarets();
      if (!goog.dom.contains(p, savedRange.getCaret(true))) {
        savedRange.removeCarets();
        return false;
      }
      var newp = goog.editor.node.splitDomTreeAt(savedRange.getCaret(true), savedRange.getCaret(true), p);
      if (!p.childNodes.length || !util.dom.isBr(goog.dom.getLastElementChild(p))) {
        p.appendChild(document.createElement("br"));
      }
      goog.dom.insertSiblingAfter(newp, p);
      newp.normalize();
      range = util.range.normalize(savedRange.restore());
      var f = newp;
      while (f && f.firstChild) {
        f = f.firstChild;
      }
      if (!util.dom.isBr(f) && !util.dom.isTextNode(f)) {
        f.appendChild(document.createElement("br"));
      }
      range.select();
      if (options.cursorPosition === "new" && newp.children.length > 0) {
        goog.dom.Range.createCaret(newp, 0).select();
        return {result:true, node:newp};
      } else {
        if (options.cursorPosition === "original" && node) {
          goog.dom.Range.createCaret(node, isTextNode ? node.length : node.children.length).select();
          return {result:true, node:node};
        }
      }
      return {result:true, node:newp.firstChild};
    }, {delayClearStyles:true});
  };
})();
goog.provide("uno.commands.InsertTable");
goog.require("goog.debug.Logger");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.editor.range");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
goog.require("uno.util.table");
goog.require("uno.util.list");
goog.require("uno.util.paragraph");
goog.require("uno.util.crypto");
goog.require("uno.util.structure");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.InsertTable");
  var util = uno.util;
  var InsertTable = uno.commands.InsertTable = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(InsertTable, uno.BasePlugin);
  InsertTable.prototype.isSupportedCommand = function(command) {
    return command === "inserttable";
  };
  InsertTable.prototype.activeOnUneditableFields = goog.functions.TRUE;
  InsertTable.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  InsertTable.prototype.execCommandInternal = function(command, options) {
    var enTable = util.table.create(options);
    var editor = this.editor;
    var range = editor.getRange();
    if (!range.isCollapsed()) {
      editor.execCommand("delete");
      range = editor.getRange();
    }
    if (!util.dom.isEmpty(util.paragraph.for(range.getStartNode()))) {
      editor.execCommand("insertparagraph", {cursorPosition:"original"});
      range = editor.getRange();
      if (!util.dom.isEmpty(util.paragraph.for(range.getStartNode()))) {
        editor.execCommand("insertparagraph", {cursorPosition:"new"});
      }
    }
    util.styles.withPendingStyles(editor, function(range_) {
      range_.insertNode(enTable);
      util.table.normalizeDOMPlacement(enTable);
      util.table.cellsForNode(enTable).forEach(function(cell) {
        util.paragraph.empty(cell.firstChild, true, editor);
      });
      var targetBr = enTable.querySelector("td br");
      goog.editor.range.placeCursorNextTo(targetBr, true);
    });
    return true;
  };
  InsertTable.prototype.queryCommandEnabled = function() {
    var range = this.editor.getRange();
    if (range == null) {
      return false;
    }
    if (!util.structure.itemAllowedInRange(uno.defs.structuretypes.TABLE, range)) {
      return false;
    }
    return true;
  };
})();
goog.provide("uno.commands.InsertTableCol");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
goog.require("uno.util.table");
goog.require("uno.util.table.selection");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.InsertTableCol");
  var util = uno.util;
  var InsertTableCol = uno.commands.InsertTableCol = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(InsertTableCol, uno.BasePlugin);
  InsertTableCol.prototype.isSupportedCommand = function(command) {
    return command === "inserttablecol";
  };
  InsertTableCol.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  InsertTableCol.prototype.execCommandInternal = function(command, value) {
    var enTable = util.table.getActive();
    var cell = util.table.getActiveCell();
    var retVal = false;
    var index = -1;
    if (enTable && cell) {
      index = util.table.colIndex(cell, value === "after");
      retVal = util.table.insertColumns(enTable, index);
      if (retVal && util.table.selection.isActive(enTable)) {
        util.table.selection.create(enTable, this.editor.multirange);
      }
    } else {
      cell = util.table.cellForStructureChange(this.editor.getRange());
      if (cell) {
        var table = goog.dom.getAncestor(this.editor.getRange().getStartNode(), util.dom.isTable);
        index = util.table.colIndex(cell, value === "after");
        retVal = util.table.insertColumns(table, index);
      }
    }
    return retVal;
  };
  InsertTableCol.prototype.queryCommandEnabled = function() {
    return !!util.table.cellForStructureChange(this.editor.getRange());
  };
})();
goog.provide("uno.commands.InsertTableRow");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
goog.require("uno.util.table");
goog.require("uno.util.table.selection");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.InsertTableRow");
  var util = uno.util;
  var InsertTableRow = uno.commands.InsertTableRow = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(InsertTableRow, uno.BasePlugin);
  InsertTableRow.prototype.isSupportedCommand = function(command) {
    return command === "inserttablerow";
  };
  InsertTableRow.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  InsertTableRow.prototype.execCommandInternal = function(command, value) {
    var enTable = util.table.getActive();
    var cell = util.table.getActiveCell();
    var retVal = false;
    var index = -1;
    if (enTable && cell) {
      index = util.table.rowIndex(cell, value === "after");
      retVal = util.table.insertRows(enTable, index);
      if (retVal && util.table.selection.isActive(enTable)) {
        util.table.selection.create(enTable, this.editor.multirange);
      }
    } else {
      cell = util.table.cellForStructureChange(this.editor.getRange());
      if (cell) {
        var table = goog.dom.getAncestor(this.editor.getRange().getStartNode(), util.dom.isTable);
        index = util.table.rowIndex(cell, value === "after");
        retVal = util.table.insertRows(table, index);
      }
    }
    return retVal;
  };
  InsertTableRow.prototype.queryCommandEnabled = function() {
    return !!util.table.cellForStructureChange(this.editor.getRange());
  };
})();
goog.provide("uno.util.fullsize");
goog.require("uno.util.img");
(function() {
  var util = uno.util;
  util.fullsize.preserve = function(editor, bounds) {
    document.body.classList.add("fullsize");
    editor.execCommand("active", false);
    var field = editor.field;
    field.style.position = "fixed";
    field.style.overflow = "hidden";
    field.style.top = bounds.top + "px";
    field.style.left = bounds.left + "px";
    field.style.width = bounds.width + "px";
    field.style.height = bounds.height + "px";
    util.img.layoutResizer();
    field.scrollTop = editor.context.fullsize.scrollY;
  };
  util.fullsize.restore = function(editor) {
    var field = editor.field;
    field.style.position = "";
    field.style.overflow = "";
    field.style.top = "";
    field.style.left = "";
    field.style.width = "";
    field.style.height = "";
    document.scrollingElement.scrollTop = editor.context.fullsize.scrollY;
    util.img.layoutResizer();
    setTimeout(function() {
      document.body.classList.remove("fullsize");
      editor.execCommand("active", true);
      editor.execCommand("focus", true);
    }, 10);
  };
})();
goog.provide("uno.util.preview");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("uno.util.dom");
goog.require("uno.util.img");
goog.require("uno.util.react");
goog.require("uno.util.table");
(function() {
  var util = uno.util;
  util.preview.fullsizeOpened = function(editor, opt) {
    var field = editor.field;
    var items = getItems(field);
    var node = editor.context.preview.initialNode || findImageByHash(opt.hash, field);
    if (!editor || !node || !items.length) {
      return false;
    }
    editor.context.preview = {initialIndex:items.indexOf(node), items:items, animated:true, translucent:true, scrollYOffset:editor.context.fullsize.scrollY, onClose:function() {
      editor.closeFullSize("preview");
    }, onChange:function(img) {
      handleOnChange(img, editor);
    }, isVisibleInView:function(img) {
      return util.dom.isVisibleInView(img);
    }};
    util.react.renderPreview(editor.context.preview);
    return true;
  };
  util.preview.fullsizeClosed = function(editor) {
    editor.context.preview = null;
    util.react.renderPreview(null);
  };
  util.preview.requestOpen = function(editor, node) {
    if (!node) {
      return;
    }
    editor.context.preview = {initialNode:node};
    editor.openFullSize("preview");
  };
  function getItems(root) {
    var items = [].slice.call(root.querySelectorAll("img.en-media-image"));
    var diversity = true;
    if (items.length > 1) {
      var src = items[0].getAttribute("src");
      diversity = !goog.array.every(items, function(node) {
        return node.getAttribute("src") === src;
      });
    }
    return diversity ? items : [items[0]];
  }
  function findImageByHash(hash, root) {
    if (!hash) {
      return null;
    }
    var nodes = util.resource.findByHash(hash, root);
    if (nodes.length > 0 && util.resource.isImage(nodes[0])) {
      return nodes[0];
    }
    return null;
  }
  function handleOnChange(img, editor) {
    util.img.setSelected(img, editor);
    var field = editor.field;
    var ib = img.getBoundingClientRect();
    var nb = field.getBoundingClientRect();
    var offset = 10;
    var scrollY = null;
    ib = {top:ib.top - offset, bottom:ib.bottom + offset, height:ib.height + offset * 2};
    var direction = null;
    var isTaller = ib.height > nb.height;
    if (ib.top < nb.top && ib.bottom < nb.bottom) {
      direction = "top";
    } else {
      if (ib.top > nb.top && ib.bottom > nb.bottom) {
        direction = "bottom";
      }
    }
    if (direction === "top" && !isTaller || direction === "bottom" && isTaller) {
      scrollY = field.scrollTop - (nb.top - ib.top);
      field.scrollTop = scrollY;
    } else {
      if (direction === "bottom" && !isTaller || direction === "top" && isTaller) {
        scrollY = field.scrollTop - (nb.bottom - ib.bottom);
        field.scrollTop = scrollY;
      }
    }
    util.table.scrollCellIntoView(goog.dom.getAncestor(img, util.dom.isTd));
  }
})();
goog.provide("uno.commands.FullSize");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.fullsize");
goog.require("uno.util.preview");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.FullSize");
  var util = uno.util;
  var FullSize = uno.commands.FullSize = function() {
    uno.BasePlugin.call(this, log.getName());
    this.utilOwners = {preview:util.preview, archive:util.commenting};
  };
  goog.inherits(FullSize, uno.BasePlugin);
  FullSize.prototype.activeOnUneditableFields = goog.functions.TRUE;
  FullSize.prototype.isSupportedCommand = function(command) {
    return command === "fullsize";
  };
  FullSize.prototype.execCommand = function(command, value) {
    var state = this.editor.context.fullsize || {};
    var options = value || {};
    var action = options.action;
    var utilOwner = this.utilOwners[state.owner];
    if (!utilOwner) {
      log.warning("Fullsize is missing request owner.");
    } else {
      if (action === "open" && state.enabled) {
        log.warning("Fullsize is already opened, blocking redundat command.");
      } else {
        if (action === "close" && !state.enabled) {
          log.warning("Fullsize should be closed, blocking wrong command.");
        } else {
          if (action === "open") {
            util.fullsize.preserve(this.editor, options.bounds);
            if (utilOwner.fullsizeOpened(this.editor, options)) {
              this.editor.context.fullsize.pending = false;
              this.editor.context.fullsize.enabled = true;
              return true;
            }
            util.fullsize.restore(this.editor);
            this.editor.context.fullsize = {enabled:false};
          } else {
            if (action === "close") {
              utilOwner.fullsizeClosed(this.editor);
              util.fullsize.restore(this.editor);
              this.editor.context.fullsize = {enabled:false};
              return true;
            }
          }
        }
      }
    }
    return false;
  };
  FullSize.prototype.queryCommandEnabled = function(command, value) {
    var options = value || {};
    var state = this.editor.context.fullsize || {};
    var action = options.action;
    return action === "open" && !state.enabled && options.bounds && state.pending && this.utilOwners[state.owner] || action === "close" && state.enabled && state.pending;
  };
  FullSize.prototype.queryCommandValue = function() {
    return !!(this.editor.context.fullsize || {}).enabled;
  };
})();
goog.provide("uno.commands.List");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.EditorMultiRange");
goog.require("uno.util.list");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.List");
  var util = uno.util;
  var dom = util.dom;
  var List = uno.commands.List = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(List, uno.BasePlugin);
  List.prototype.isSupportedCommand = function(command) {
    return ["insertorderedlist", "insertunorderedlist"].indexOf(command) > -1;
  };
  List.prototype.activeOnUneditableFields = goog.functions.TRUE;
  List.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  List.prototype.execCommand = function(command) {
    var selection = this.editor.getSelection();
    if (!selection) {
      return false;
    }
    var isInList = /^(ol|ul)$/.test(this.queryCommandValue(command));
    var tagName = command === "insertorderedlist" ? "ol" : "ul";
    var editor = this.editor;
    if (selection.collapsed) {
      return util.styles.withPendingStyles(editor, function() {
        editor.dispatchBeforeChange();
        util.list.toggleListsInSelection(editor, isInList, tagName);
        editor.dispatchChange();
        return {result:true};
      });
    } else {
      editor.dispatchBeforeChange();
      util.list.toggleListsInSelection(editor, isInList, tagName);
      editor.dispatchChange();
      util.range.normalize(editor.getRange()).select();
      return true;
    }
  };
  List.prototype.queryCommandValue = function(command, options) {
    var quickAndDirty = options && options.quickAndDirty;
    var selection = this.editor.getSelection();
    if (!selection) {
      return "none";
    }
    if (quickAndDirty && selection.range.getContainer() === this.editor.field) {
      return "none";
    }
    if (util.list.isSelectionInList(selection, "ol")) {
      return "ol";
    } else {
      if (util.list.isSelectionInList(selection, "ul")) {
        return "ul";
      } else {
        return "none";
      }
    }
  };
  List.prototype.queryCommandEnabled = function(command) {
    var selection = this.editor.getSelection();
    if (!selection) {
      return false;
    }
    return util.structure.itemAllowedInRange(uno.defs.structuretypes.CMD_LIST, selection.range);
  };
})();
goog.provide("uno.commands.MergeCells");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.table");
goog.require("uno.util.table.selection");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.MergeCells");
  var util = uno.util;
  var MergeCells = uno.commands.MergeCells = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(MergeCells, uno.BasePlugin);
  MergeCells.prototype.isSupportedCommand = function(command) {
    return command === "mergecells";
  };
  MergeCells.prototype.execCommandInternal = function(command, value) {
    var cell = util.table.getActiveCell();
    var cells = !util.table.selection.isActive() && cell ? [cell] : util.table.selection.getCells();
    var selected = util.table.selection.isActive();
    var enTable = util.table.getActive();
    var mergedCell, splitCells;
    if ((value === true || value === undefined) && util.table.mergeable(cells)) {
      util.table.selection.clear();
      mergedCell = util.table.mergeCells(cells);
      util.table.selection.create(enTable, this.editor.multirange, mergedCell);
    } else {
      if (!value && util.table.unmergeable(cells)) {
        util.table.selection.clear();
        splitCells = util.table.splitCells(cells);
        if (selected) {
          util.table.selection.create(enTable, this.editor.multirange, splitCells[0], splitCells[splitCells.length - 1]);
        }
      }
    }
    if (mergedCell || splitCells) {
      this.editor.dispatchStyleChange();
      return true;
    }
    return false;
  };
  MergeCells.prototype.queryCommandEnabled = function() {
    var selected = util.table.selection.isActive() || util.table.selection.isPending();
    var cell = util.table.getActiveCell();
    var cells = !selected && cell ? [cell] : util.table.selection.getCells();
    return util.table.unmergeable(cells) || util.table.mergeable(cells);
  };
  MergeCells.prototype.queryCommandValue = function() {
    var selected = util.table.selection.isActive() || util.table.selection.isPending();
    var cell = util.table.getActiveCell();
    var cells = !selected && cell ? [cell] : util.table.selection.getCells();
    return util.table.unmergeable(cells) && !util.table.mergeable(cells);
  };
})();
goog.provide("uno.commands.MigrateTable");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.BasePlugin");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.MigrateTable");
  var util = uno.util;
  var MigrateTable = uno.commands.MigrateTable = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(MigrateTable, uno.BasePlugin);
  MigrateTable.prototype.isSupportedCommand = function(command) {
    return command === "migratetable";
  };
  MigrateTable.prototype.execCommandInternal = function(command, value) {
    var range = this.editor.getRange();
    if (!range) {
      return false;
    }
    var table = null;
    var node = range.getStartNode();
    while (node && node.parentNode) {
      if (util.dom.isTable(node)) {
        table = node;
      }
      node = node.parentNode;
    }
    if (!table) {
      return false;
    }
    if (!range.isCollapsed()) {
      var startTd = goog.dom.getAncestor(range.getStartNode(), util.dom.isTd);
      var endTd = goog.dom.getAncestor(range.getEndNode(), util.dom.isTd);
      if (startTd !== endTd) {
        range.collapse(true);
      }
    }
    var savedRange = range.saveUsingCarets();
    if (!util.table.migrateToEnTable(table)) {
      return false;
    }
    savedRange.restore();
    return true;
  };
  MigrateTable.prototype.queryCommandEnabled = function() {
    var range = this.editor.getRange();
    if (!range) {
      return false;
    }
    var table = null;
    var td = null;
    var enTable = goog.dom.getAncestor(range.getStartNode(), function(node) {
      if (util.dom.isTable(node)) {
        table = node;
      }
      if (util.dom.isTd(node)) {
        td = node;
      }
      return util.dom.isEntable(node);
    }, true);
    return !enTable && table && td;
  };
})();
goog.provide("uno.commands.SetNoteGuid");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.SetNoteGuid");
  var SetNoteGuid = uno.commands.SetNoteGuid = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(SetNoteGuid, uno.BasePlugin);
  SetNoteGuid.prototype.isSupportedCommand = function(command) {
    return command === "setnoteguid";
  };
  SetNoteGuid.prototype.execCommand = function(command, value) {
    var guid = value && value.guid;
    this.editor.config.note.guid = guid;
    if (EN.isEnabled("templatemanager")) {
      EN.run("template-updatenote", {guid:guid});
    }
    return true;
  };
  SetNoteGuid.prototype.queryCommandValue = function() {
    return this.editor.config.note.guid;
  };
  SetNoteGuid.prototype.queryCommandEnabled = function() {
    return !this.editor.config.note.guid;
  };
})();
goog.provide("uno.commands.SyncMetadata");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.SyncMetadata");
  var SyncMetadata = uno.commands.SyncMetadata = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(SyncMetadata, uno.BasePlugin);
  SyncMetadata.prototype.isSupportedCommand = function(command) {
    return command === "syncmetadata";
  };
  SyncMetadata.prototype.queryCommandValue = function() {
    var y = this.editor.realtime.y;
    if (!y.connector) {
      return null;
    }
    return y.connector.syncMetadata;
  };
  SyncMetadata.prototype.queryCommandEnabled = function() {
    return this.editor.config.realtime.enabled;
  };
})();
goog.provide("uno.commands.Shutdown");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Shutdown");
  var SHUTDOWN_TIMEOUT = 2000;
  var Shutdown = uno.commands.Shutdown = function() {
    this.isShuttingDown = false;
    this.isShutdownComplete = false;
    this.isSaved = true;
    this.isForceShutdown = false;
    this.timeoutTimerID = 0;
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Shutdown, uno.BasePlugin);
  Shutdown.prototype.isSupportedCommand = function(command) {
    return command === "shutdown";
  };
  Shutdown.prototype.registerFieldObject = function(fieldObject) {
    uno.BasePlugin.prototype.registerFieldObject.call(this, fieldObject);
    this.editor.listen("realtimeNoteSavedNotification", this.tryShutdown.bind(this));
  };
  Shutdown.prototype.execCommand = function() {
    log.info("Beginning shutdown protocol! NOTE LOCKED");
    this.editor.execCommand("active", false);
    if (this.editor.config.realtime.enabled) {
      this.isShuttingDown = true;
      this.tryShutdown();
      this.timeoutTimerID = setTimeout(function() {
        this.isForceShutdown = true;
        this.tryShutdown();
      }.bind(this), SHUTDOWN_TIMEOUT);
    } else {
      this.editor.dispatchEvent({type:"shutdownComplete", code:"success", syncMetadata:this.editor.realtime ? this.editor.realtime.syncMetadata : null});
    }
    return true;
  };
  Shutdown.prototype.queryCommandEnabled = goog.functions.TRUE;
  Shutdown.prototype.tryShutdown = function() {
    if (this.isShutdownComplete) {
      return;
    }
    if (!this.isForceShutdown) {
      if (!this.isShuttingDown) {
        return;
      }
      if (!this.editor.context.realtime.saved) {
        return;
      }
    }
    this.editor.dispatchEvent({type:"shutdownComplete", code:this.isForceShutdown ? "timeout" : "success", syncMetadata:this.editor.realtime ? this.editor.realtime.syncMetadata : null});
    this.isShuttingDown = false;
    this.isShutdownComplete = true;
    clearTimeout(this.timeoutTimerID);
  };
})();
goog.provide("uno.commands.TableAlign");
goog.require("goog.debug.Logger");
goog.require("goog.style");
goog.require("uno.BasePlugin");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.TableAlign");
  var util = uno.util;
  var TableAlign = uno.commands.TableAlign = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(TableAlign, uno.BasePlugin);
  TableAlign.prototype.isSupportedCommand = function(command) {
    return command === "tablealign";
  };
  TableAlign.prototype.execCommand = function(command, direction) {
    if (["left", "center", "right"].indexOf(direction) < 0) {
      log.warning("Saw unexpected alignment value", direction);
      direction = "left";
    }
    var table = util.table.getActive();
    if (!table) {
      return false;
    }
    this.editor.dispatchBeforeChange();
    util.table.setAlignment(table, direction);
    this.editor.dispatchChange();
    return true;
  };
  TableAlign.prototype.queryCommandValue = function() {
    var table = util.table.getActive();
    if (!table) {
      return "";
    }
    return util.table.getAlignment(table);
  };
  TableAlign.prototype.queryCommandEnabled = function() {
    return !!util.table.getActive();
  };
})();
goog.provide("uno.commands.TableBorderColor");
goog.require("goog.array");
goog.require("goog.debug.Logger");
goog.require("goog.style");
goog.require("uno.BasePlugin");
goog.require("uno.EditorMultiRange");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.TableBorderColor");
  var util = uno.util;
  var TableBorderColor = uno.commands.TableBorderColor = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(TableBorderColor, uno.BasePlugin);
  TableBorderColor.prototype.isSupportedCommand = function(command) {
    return command === "tablebordercolor";
  };
  TableBorderColor.prototype.execCommand = function(command, color) {
    color = color || "";
    var enTable = util.table.getActive();
    if (!enTable) {
      return false;
    }
    this.editor.dispatchBeforeChange();
    enTable.style.borderColor = color;
    goog.array.forEach(enTable.querySelectorAll("td"), function(cell) {
      cell.style.borderColor = color;
    });
    this.editor.dispatchChange();
    return true;
  };
  TableBorderColor.prototype.queryCommandValue = function() {
    var enTable = util.table.getActive();
    if (enTable) {
      var td = enTable.querySelector("td");
      return td ? goog.style.getComputedStyle(td, "borderColor") : "";
    }
    return "";
  };
  TableBorderColor.prototype.queryCommandEnabled = function() {
    return !!util.table.getActive();
  };
})();
goog.provide("uno.commands.TableBorderWidth");
goog.require("goog.array");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.style");
goog.require("uno.BasePlugin");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.TableBorderWidth");
  var util = uno.util;
  var TableBorderWidth = uno.commands.TableBorderWidth = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(TableBorderWidth, uno.BasePlugin);
  TableBorderWidth.prototype.isSupportedCommand = function(command) {
    return command === "tableborderwidth";
  };
  TableBorderWidth.prototype.execCommand = function(command, value) {
    var borderWidth = parseInt(value, 10);
    if (isNaN(borderWidth) || borderWidth < 0) {
      log.warning("Invalid value given to tableborderwidth: " + value);
      return false;
    }
    var enTable = util.table.getActive();
    if (!enTable) {
      return false;
    }
    this.editor.dispatchBeforeChange();
    var val = borderWidth + "px";
    enTable.style.borderWidth = val;
    goog.array.forEach(enTable.querySelectorAll("td"), function(cell) {
      cell.style.borderWidth = val;
    });
    this.editor.dispatchChange();
    return true;
  };
  TableBorderWidth.prototype.queryCommandValue = function() {
    var enTable = util.table.getActive();
    if (enTable) {
      var td = enTable.querySelector("td");
      var val = parseInt(td ? goog.style.getComputedStyle(td, "borderWidth") : "", 10);
      if (!isNaN(val)) {
        return "" + val;
      }
    }
    return "0";
  };
  TableBorderWidth.prototype.queryCommandEnabled = function() {
    return !!util.table.getActive();
  };
})();
goog.provide("uno.commands.TableCellColor");
goog.require("goog.color");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.EditorMultiRange");
goog.require("uno.defs");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.TableCellColor");
  var util = uno.util;
  var TableCellColor = uno.commands.TableCellColor = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(TableCellColor, uno.BasePlugin);
  TableCellColor.prototype.isSupportedCommand = function(command) {
    return command === "tablecellcolor";
  };
  TableCellColor.prototype.execCommandInternal = function(command, value) {
    var hexValue = goog.color.parse(value).hex;
    var isTransparent = hexValue === "#ffffff";
    var range = this.editor.getRange();
    var cells = util.table.cellsForRange(range);
    var colorPalette = ["#ffffff", "#eaeaea", "#d4d4d4", "#ddd1f3", "#f0d1f6", "#fbcfd6", "#fedec1", "#ffe697", "#cdedd8", "#cdeef0", "#cde6f9", "#ccd7ea", "#3f3f3f", "#737373", "#979797", "#8b65e0", "#c064d1", "#fc5356", "#fd7b39", "#ffc200", "#00a82d", "#57bfc4", "#0081c2", "#426bb3"];
    cells.forEach(function(cell) {
      var textColor = colorPalette.indexOf(hexValue) >= 12 ? "white" : "black";
      goog.dom.Range.createFromNodeContents(cell).select();
      this.editor.execCommand("forecolor", textColor);
      range.select();
      cell.style.background = "";
      if (isTransparent) {
        cell.style.backgroundColor = "";
        cell.style.borderColor = uno.defs.table.BORDER_COLOR;
      } else {
        cell.style.borderColor = util.table.darkenBorderColor(hexValue);
        cell.style.backgroundColor = hexValue;
      }
      this.editor.dispatchChange();
    }, this);
    return true;
  };
  TableCellColor.prototype.queryCommandValue = function() {
    var cells = util.table.cellsForRange(this.editor.getRange());
    if (!cells.length) {
      return "";
    }
    var style = cells[0].style;
    var color;
    if (style.backgroundColor) {
      try {
        color = goog.color.hexToRgbStyle(goog.color.parse(style.backgroundColor).hex);
      } catch (ex) {
        color = null;
        log.fine(ex.stack || ex);
      }
      return color != null ? color : "";
    }
    return "";
  };
  TableCellColor.prototype.queryCommandEnabled = function() {
    return !this.editor.multirange.isEmpty() || util.table.cellsForRange(this.editor.getRange()).length > 0;
  };
})();
goog.provide("uno.commands.TableEqualCol");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.TableEqualCol");
  var util = uno.util;
  var TableEqualCol = uno.commands.TableEqualCol = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(TableEqualCol, uno.BasePlugin);
  TableEqualCol.prototype.isSupportedCommand = function(command) {
    return command === "tableequalcol";
  };
  TableEqualCol.prototype.execCommandInternal = function(command) {
    var indexes = util.table.selection.getColumnIndexes();
    if (indexes.length < 2) {
      return false;
    }
    util.table.equalizeColumns(util.table.getActive(), indexes);
    return true;
  };
  TableEqualCol.prototype.queryCommandEnabled = function() {
    return !this.editor.multirange.isEmpty() || util.table.selection.getColumnIndexes() > 1;
  };
})();
goog.provide("uno.commands.TableFitNote");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.TableFitNote");
  var util = uno.util;
  var TableFitNote = uno.commands.TableFitNote = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(TableFitNote, uno.BasePlugin);
  TableFitNote.prototype.isSupportedCommand = function(command) {
    return command === "tablefitnote";
  };
  TableFitNote.prototype.execCommandInternal = function(command) {
    return util.table.fitNote(util.table.getActive());
  };
  TableFitNote.prototype.queryCommandEnabled = function() {
    return !!util.table.getActive();
  };
})();
goog.provide("uno.commands.TableVerticalAlign");
goog.require("goog.array");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.BasePlugin");
goog.require("uno.EditorMultiRange");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.TableVerticalAlign");
  var util = uno.util;
  var TableVerticalAlign = uno.commands.TableVerticalAlign = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(TableVerticalAlign, uno.BasePlugin);
  TableVerticalAlign.prototype.isSupportedCommand = function(command) {
    return command === "tableverticalalign";
  };
  TableVerticalAlign.prototype.execCommandInternal = function(command, align) {
    if (["", "middle", "top", "bottom"].indexOf(align) < 0) {
      log.warning("Saw unexpected vertical-align value", align);
      align = "";
    }
    if (align === "top") {
      align = "";
    }
    util.table.cellsForRange(this.editor.getRange()).forEach(function(cell) {
      cell.style.verticalAlign = align;
    });
    return true;
  };
  TableVerticalAlign.prototype.queryCommandEnabled = function() {
    return !this.editor.multirange.isEmpty() || util.table.cellsForRange(this.editor.getRange()).length > 0;
  };
})();
goog.provide("uno.util.codeblock");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.paragraph");
(function() {
  var util = uno.util;
  util.codeblock.create = function(paragraphs) {
    if (!paragraphs) {
      paragraphs = [];
    }
    if (paragraphs.length === 0) {
      paragraphs.push(util.paragraph.create());
    }
    var codeblock = goog.dom.createDom("div", {class:"en-code"}, paragraphs);
    return codeblock;
  };
  util.codeblock.all = function(root) {
    return root.querySelectorAll(".en-code");
  };
  util.codeblock.for = function(node) {
    return goog.dom.getAncestor(node, util.dom.isCodeBlock, true);
  };
  util.codeblock.updateEmpty = function(node) {
    if (!node) {
      return false;
    }
    var block = goog.dom.getAncestor(node, function(ancestor) {
      return util.dom.isCodeBlock(ancestor);
    }, true);
    if (block && block.childNodes.length && !util.dom.isDiv(block.childNodes[0]) && !util.list.for(block.childNodes[0])) {
      var innerContent = block.childNodes[0].cloneNode(true);
      var innerDiv = goog.dom.createDom("div", {}, innerContent);
      for (var i = 1; i < block.childNodes.length; i++) {
        innerDiv.appendChild(block.childNodes[i].cloneNode(true));
        block.childNodes[i].remove();
      }
      goog.dom.replaceNode(innerDiv, block.childNodes[0]);
      goog.editor.range.placeCursorNextTo(innerContent);
      return true;
    }
    return false;
  };
  util.codeblock.updateTopSpace = function(editor) {
    var firstChild = editor.field.childNodes[0];
    if (util.dom.isCodeBlock(firstChild)) {
      var innerDiv = goog.dom.createDom("div", {}, goog.dom.createDom("br"));
      editor.field.insertBefore(innerDiv, firstChild);
    }
  };
})();
goog.provide("uno.commands.Indent");
goog.require("goog.debug.Logger");
goog.require("goog.editor.Command");
goog.require("uno.util.dom");
goog.require("uno.util.codeblock");
goog.require("uno.util.crypto");
goog.require("uno.util.structure");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Indent");
  var util = uno.util;
  var Indent = uno.commands.Indent = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Indent, uno.BasePlugin);
  Indent.prototype.isSupportedCommand = function(command) {
    return command === "indent";
  };
  Indent.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  Indent.prototype.execCommandInternal = function(command) {
    var editor = this.editor;
    var range = editor.getRange();
    if (!range) {
      return false;
    }
    return util.styles.withPendingStyles(editor, function() {
      return {result:util.list.indentSelection(editor)};
    });
  };
  Indent.prototype.queryCommandValue = function() {
    return this.editor.queryCommandValue(goog.editor.Command.INDENT);
  };
  Indent.prototype.queryCommandEnabled = function() {
    var selection = this.editor.getSelection();
    if (!selection) {
      return false;
    }
    if (!util.structure.itemAllowedInRange(uno.defs.structuretypes.CMD_INDENT, selection.range)) {
      return false;
    }
    return true;
  };
})();
goog.provide("uno.commands.InsertTodo");
goog.require("goog.debug.Logger");
goog.require("goog.editor.node");
goog.require("goog.editor.range");
goog.require("uno.BasePlugin");
goog.require("goog.string");
goog.require("uno.util.dom");
goog.require("uno.util.todo");
goog.require("uno.util.crypto");
goog.require("uno.util.structure");
goog.require("uno.util.paragraph");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.InsertTodo");
  var util = uno.util;
  var ZERO_WIDTH_SPACE = uno.defs.unicode.ZERO_WIDTH_SPACE;
  var InsertTodo = uno.commands.InsertTodo = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(InsertTodo, uno.BasePlugin);
  InsertTodo.prototype.isSupportedCommand = function(command) {
    return command === "inserttodo";
  };
  InsertTodo.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  InsertTodo.prototype.execCommandInternal = function(command, value) {
    var editor = this.editor;
    var toggle = value === "toggle";
    var range = editor.getRange();
    var startNode = range.getStartNode();
    var node;
    if (toggle) {
      node = startNode;
      while (node = goog.dom.getPreviousElementSibling(node)) {
        if (util.todo.isTodo(node)) {
          util.todo.toggle(node);
          return true;
        }
      }
    } else {
      if (range.isCollapsed()) {
        var todo = util.todo.create();
        util.styles.withPendingStyles(editor, function(range_) {
          node = todo;
          range_.insertNode(node);
          if (util.dom.isBr(node.nextSibling)) {
            goog.dom.removeNode(node.nextSibling);
          }
          if (util.dom.isBr(node.previousSibling)) {
            goog.dom.removeNode(node.previousSibling);
          }
          if (node.previousSibling && node.previousSibling.textContent === ZERO_WIDTH_SPACE) {
            goog.dom.removeNode(node.previousSibling);
          }
          if (node.parentNode) {
            node.parentNode.normalize();
          }
          return {node:node};
        });
        goog.editor.range.placeCursorNextTo(todo);
      } else {
        var container = range.getContainer();
        if (!util.dom.isBlockNode(container)) {
          container = util.paragraph.for(container);
        }
        if (container === range.getAnchorNode()) {
          container = null;
        }
        var existing = goog.array.toArray(util.todo.all(editor.field)).filter(function(n) {
          return range.containsNode(n, true);
        });
        if (existing.length > 0) {
          existing.forEach(util.todo.remove);
        } else {
          var nodes = goog.array.toArray(editor.field.querySelectorAll("div,li"));
          nodes = nodes.filter(function(node) {
            return range.containsNode(node, true) && (!container || container.contains(node)) && goog.array.every(node.childNodes, util.dom.isInlineNode) && (!goog.string.isEmpty(node.textContent) || !!node.querySelector("img"));
          });
          if (nodes.length > 0) {
            nodes.forEach(function(node) {
              var entodo = util.todo.create();
              if (node.childNodes.length === 0) {
                node.appendChild(entodo);
              } else {
                var leftMostLeaf = goog.editor.node.getLeftMostLeaf(node);
                goog.dom.insertSiblingBefore(entodo, leftMostLeaf);
              }
            });
            goog.dom.Range.createFromNodes(nodes[0], 0, range.getEndNode(), range.getEndOffset()).select();
          }
        }
      }
    }
  };
  InsertTodo.prototype.queryCommandEnabled = function() {
    var range = this.editor.getRange();
    if (!range) {
      return false;
    }
    if (!util.structure.itemAllowedInRange(uno.defs.structuretypes.CMD_TODO, range)) {
      return false;
    }
    return true;
  };
})();
goog.provide("uno.commands.InsertDrawing");
goog.require("goog.debug.Logger");
goog.require("goog.editor.node");
goog.require("goog.editor.range");
goog.require("uno.BasePlugin");
goog.require("goog.string");
goog.require("uno.util.dom");
goog.require("uno.util.todo");
goog.require("uno.util.crypto");
goog.require("uno.util.structure");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.InsertDrawing");
  var util = uno.util;
  var ZERO_WIDTH_SPACE = uno.defs.unicode.ZERO_WIDTH_SPACE;
  var InsertDrawing = uno.commands.InsertDrawing = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(InsertDrawing, uno.BasePlugin);
  InsertDrawing.prototype.isSupportedCommand = function(command) {
    return command === "insertdrawing";
  };
  InsertDrawing.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  InsertDrawing.prototype.execCommandInternal = function(command, value) {
    var enDrawing = document.createElement("magic-drawing");
    enDrawing.setAttribute("data-yjs-hook", "magic-drawing");
    var range = this.editor.getRange();
    if (!range.isCollapsed()) {
      this.editor.execCommand("delete");
      range = this.editor.getRange();
    }
    if (!util.dom.isEmpty(util.paragraph.for(range.getStartNode()))) {
      this.editor.execCommand("insertparagraph", {cursorPosition:"original"});
      range = this.editor.getRange();
      if (!util.dom.isEmpty(util.paragraph.for(range.getStartNode()))) {
        this.editor.execCommand("insertparagraph", {cursorPosition:"new"});
      }
    }
    range = this.editor.getRange();
    range.insertNode(enDrawing);
    util.table.normalizeDOMPlacement(enDrawing);
    return true;
  };
  InsertDrawing.prototype.queryCommandEnabled = function() {
    var range = this.editor.getRange();
    if (range == null) {
      return false;
    }
    if (!util.structure.itemAllowedInRange(uno.defs.structuretypes.TABLE, range)) {
      return false;
    }
    return true;
  };
})();
goog.provide("uno.commands.Lowercase");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.range");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Lowercase");
  var util = uno.util;
  var Lowercase = uno.commands.Lowercase = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(Lowercase, uno.BasePlugin);
  Lowercase.prototype.isSupportedCommand = function(command) {
    return command === "lowercase";
  };
  Lowercase.prototype.execCommandInternal = function() {
    var range = this.editor.getRange();
    var savedRange = range.saveUsingDom();
    util.range.forEachWord(range, function(word, wordRange) {
      var container = wordRange.startContainer;
      var text = container.nodeValue;
      container.nodeValue = text.slice(0, wordRange.startOffset) + word.toLocaleLowerCase() + text.slice(wordRange.endOffset);
    });
    savedRange.restore().select();
    return true;
  };
})();
goog.provide("uno.commands.Margin");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.range");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Margin");
  var Margin = uno.commands.Margin = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Margin, uno.BasePlugin);
  Margin.prototype.isSupportedCommand = function(command) {
    return command === "margin";
  };
  Margin.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Margin.prototype.execCommand = function(command, value) {
    if (value == null) {
      return false;
    }
    if (this.editor == null || this.editor.field == null) {
      return false;
    }
    var field = this.editor.field;
    var note = value.note;
    if (note) {
      if (this.editor.config.client === "android") {
        var offsetDiv = document.querySelector("#offset");
        if (!offsetDiv) {
          offsetDiv = document.createElement("div");
          offsetDiv.id = "offset";
          field.parentNode.insertBefore(offsetDiv, field);
        }
        offsetDiv.style.height = toCssValue(note.top, "px");
      } else {
        field.style.paddingTop = toCssValue(note.top, "px");
        field.style.paddingBottom = toCssValue(note.bottom, "px");
        field.style.paddingLeft = toCssValue(note.left, "px");
        field.style.paddingRight = toCssValue(note.right, "px");
      }
    }
    if (value.scroll) {
      this.editor.config.margin.scroll = {top:value.scroll.top || 0, left:value.scroll.left || 0, bottom:value.scroll.bottom || 0, right:value.scroll.right || 0};
    }
    if (value.offset) {
      this.editor.config.margin.offset = {height:value.offset.height || 0, width:value.offset.width || 0};
    }
    this.editor.updateEmpty();
    return true;
  };
  function toCssValue(value, unit) {
    var result;
    switch(typeof value) {
      case "number":
        result = value + unit;
        break;
      case "string":
        if (value.indexOf(unit) > -1) {
          result = value;
        } else {
          result = value + unit;
        }
        break;
      case "undefined":
        result = null;
        break;
      default:
        result = value;
    }
    return result;
  }
})();
goog.provide("uno.commands.Outdent");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.EditorMultiRange");
goog.require("uno.util.list");
goog.require("uno.util.paragraph");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Outdent");
  var util = uno.util;
  var Outdent = uno.commands.Outdent = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Outdent, uno.BasePlugin);
  Outdent.prototype.isSupportedCommand = function(command) {
    return command === "outdent";
  };
  Outdent.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Outdent.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  Outdent.prototype.execCommandInternal = function(command) {
    var editor = this.editor;
    var selection = this.editor.getSelection();
    if (!selection) {
      return false;
    }
    return util.list.outdentSelection(editor);
  };
  Outdent.prototype.queryCommandValue = function() {
    return this.editor.queryCommandValue(goog.editor.Command.OUTDENT);
  };
  Outdent.prototype.queryCommandEnabled = function(command) {
    var selection = this.editor.getSelection();
    if (!selection) {
      return false;
    }
    if (!util.structure.itemAllowedInRange(uno.defs.structuretypes.CMD_INDENT, selection.range)) {
      return false;
    }
    return true;
  };
})();
goog.provide("uno.util.paste.plain");
(function() {
  var util = uno.util;
  util.paste.plain.getContent = function(content) {
    return content.split("\n").map(function(line) {
      var value = goog.string.htmlEscape(line).replace(/\r/, "").replace(/\t/gi, uno.defs.tab.CHARACTER_SEQUENCE).replace(/[ \t]{2,}/gi, function(match) {
        var nbsp = String.fromCharCode(160);
        var result = "";
        for (var i = 0; i < match.length; i++) {
          result += nbsp;
        }
        return result;
      });
      if (!value) {
        value = "<br>";
      }
      return "<div>" + value + "</div>";
    }).join("");
  };
})();
goog.provide("uno.util.paste");
goog.require("goog.editor.range");
goog.require("goog.editor.node");
goog.require("goog.dom.Range");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("uno.util.paragraph");
goog.require("uno.util.dom");
goog.require("uno.util.font");
goog.require("uno.util.list");
goog.require("uno.util.range");
goog.require("uno.util.table");
goog.require("uno.util.copy.plain");
goog.require("uno.util.paste.plain");
(function() {
  var util = uno.util;
  var dom = util.dom;
  var copy = util.copy;
  var paste = util.paste;
  var MIME = util.paste.MIME = {TEXT_HTML:"text/html", TEXT_PLAIN:"text/plain", TEXT_XML:"text/xml", TEXT_RICHTEXT:"text/richtext"};
  util.paste.paste = function(clipboardContent, range, options) {
    options = options || {};
    var pasteTarget = util.paste.getTarget(range);
    if (!pasteTarget) {
      return false;
    } else {
      if (dom.parent(pasteTarget, "en-search")) {
        pasteTarget.querySelector("input[type=text]").value = clipboardContent.textContent ? clipboardContent.textContent : clipboardContent || "";
        return false;
      }
    }
    var paragraphs = [];
    var pastingInLi = goog.dom.getAncestor(pasteTarget, dom.isLi, true);
    var pastingInTable = goog.dom.getAncestor(pasteTarget, dom.isTable, true);
    var pastingInCodeBlock = goog.dom.getAncestor(pasteTarget, dom.isCodeBlock, true);
    var pastingInCrypt = goog.dom.getAncestor(pasteTarget, dom.isRevealedCrypt, true);
    var pastingInTodo = util.paragraph.startsWithTodo(pasteTarget);
    options.cursorPosition = getCursorPosition(range);
    options.alignment = pasteTarget.style.textAlign;
    if (!options.editor.context.pastingInPartialTypebehind) {
      setStyles(clipboardContent, options);
    }
    if (pastingInTable && (clipboardContent.childNodes.length > 1 || !dom.isEntable(clipboardContent.firstChild))) {
      var tables = clipboardContent.querySelectorAll("en-table");
      goog.array.forEach(tables, plainifyTable);
    }
    var p = clipboardContent;
    if (p.childNodes.length === 1 && dom.isBlockNode(p.firstChild) && !util.list.isList(p.firstChild) && !dom.isHeader(p.firstChild) && goog.array.every(p.firstChild.childNodes, dom.isBlockNode)) {
      p = p.firstChild;
      do {
        if (p.getAttribute("style") && p.getAttribute("style").length) {
          Array.prototype.forEach.call(p.children, function(child) {
            util.styles.transferStyles(pastParagraphTransferStyles, p, child);
          });
        }
        var nextP = p.childNodes.length === 1 && dom.isBlockNode(p.firstChild) && !util.list.isList(p.firstChild) && !dom.isHeader(p.firstChild) && goog.array.every(p.firstChild.childNodes, dom.isBlockNode) ? p.firstChild : null;
        goog.dom.flattenElement(p);
        p = nextP;
      } while (p);
    }
    var nodeArray = Array.prototype.slice.call(clipboardContent.childNodes);
    goog.array.forEach(nodeArray, function(child, index) {
      if (pastingInLi && util.list.isList(child)) {
        var childArray = Array.prototype.slice.call(child.childNodes);
        goog.array.forEach(childArray, function(li) {
          paragraphs.push(dom.isLi(li) && !dom.isDiv(li.firstChild) ? dom.unflattenElement(li) : li);
        });
      } else {
        if (pastingInCodeBlock || pastingInCrypt) {
          if (dom.isCodeBlock(child)) {
            paragraphs = paragraphs.concat(plainifyCodeBlock(child));
          } else {
            if (dom.isRevealedCrypt(child)) {
              paragraphs = paragraphs.concat(plainifyCrypt(child));
            } else {
              paragraphs.push(plainifyParagraph(child, false));
            }
          }
        } else {
          if (options.alignment) {
            child.style.textAlign = options.alignment;
          }
          if (pastingInTodo) {
            if (options.cursorPosition.beginningOfLine && util.paragraph.startsWithTodo(child)) {
              pasteTarget.parentNode.insertBefore(child, pasteTarget);
            } else {
              if (child.innerHTML.replace(/&nbsp;/g, "") !== "") {
                if (index === 0) {
                  var todo = util.paragraph.getLeadingTodo(child);
                  if (todo) {
                    goog.dom.removeNode(todo);
                  }
                } else {
                  if (!util.paragraph.startsWithTodo(child)) {
                    util.todo.addTodoToParagraph(child);
                  }
                }
                paragraphs.push(child);
              }
            }
          } else {
            paragraphs.push(child);
          }
        }
      }
    });
    if (pastingInTodo && !paragraphs.length) {
      return goog.editor.range.placeCursorNextTo(pasteTarget.previousSibling);
    }
    if (pastingInTable && paragraphs.length === 1 && dom.isEntable(paragraphs[0])) {
      var table = paragraphs[0].querySelector("table");
      return mergeTables(pasteTarget, table, range);
    }
    if (!util.structure.itemsAllowed(paragraphs, pasteTarget)) {
      var empty = true;
      paragraphs = paragraphs.map(function(p) {
        if (!util.structure.itemAllowed(p, pasteTarget)) {
          var plainP = plainifyParagraph(p, true);
          empty &= plainP.textContent.trim() === "";
          return plainP;
        } else {
          empty &= dom.isEmpty(p);
        }
        return p;
      });
      if (empty) {
        return false;
      }
    }
    return mergeContent(pasteTarget, paragraphs, range, options);
  };
  util.paste.getTarget = function(range) {
    if (!range) {
      return false;
    }
    var node = util.range.boundary(range.getStartNode(), range.getStartOffset()) || range.getStartNode();
    if (dom.isEnnote(node)) {
      return false;
    }
    var paragraph = goog.dom.getAncestor(node, dom.isBlockNode, true);
    if (dom.isEnnote(paragraph) || dom.isHr(paragraph)) {
      var siblings = dom.contiguousInlineSiblings(node);
      paragraph = goog.dom.createDom("div");
      goog.dom.insertSiblingBefore(paragraph, node);
      siblings.forEach(function(sibling) {
        paragraph.appendChild(sibling);
      });
    }
    return paragraph;
  };
  util.paste.normalizeOptions = function(input, context) {
    var opt = {values:[], matchStyle:input.matchStyle || input.mode === "plain" || false, unstyled:false, fromDrag:input.fromDrag || false, select:false, enclipboard:false, pasteValue:"", resources:[]};
    var strInput = !!(typeof input === "string" && input);
    var oldInput = !!(typeof input === "object" && input.value);
    var newInput = !!(typeof input === "object" && input.values instanceof Array && input.values.find(function(payload) {
      return !!payload.value && (payload.type === MIME.TEXT_HTML || payload.type === MIME.TEXT_PLAIN);
    }));
    if (!strInput && !oldInput && !newInput) {
      return opt;
    }
    if (strInput) {
      opt.values.push({type:MIME.TEXT_HTML, value:input});
      opt.pasteValue = input;
    } else {
      if (newInput) {
        for (var i = input.values.length - 1; i >= 0; i--) {
          var obj = input.values[i];
          if (obj.type && obj.value) {
            opt.values.push(obj);
            if (obj.type === MIME.TEXT_HTML) {
              opt.pasteValue = obj.value;
            }
          }
        }
        if (input.resources instanceof Array) {
          opt.resources = input.resources;
        }
        if (!opt.pasteValue) {
          var plainValue = util.paste.getValueType(opt, MIME.TEXT_PLAIN);
          if (plainValue) {
            opt.pasteValue = util.paste.plain.getContent(plainValue);
          }
        }
      } else {
        if (oldInput) {
          opt.values.push({type:input.type === "plain" ? MIME.TEXT_PLAIN : MIME.TEXT_HTML, value:input.value});
          if (input.resources instanceof Array) {
            opt.resources = input.resources;
          }
          opt.pasteValue = input.type === "plain" ? util.paste.plain.getContent(input.value) : input.value;
        }
      }
    }
    var clipboardRegex = /-en-clipboard:\s*true;/g;
    var enclipboard = clipboardRegex.test(opt.pasteValue);
    opt.pasteValue = "<div>" + opt.pasteValue.replace(clipboardRegex, "") + "</div>";
    context.format = uno.defs.format.CLIPBOARD;
    context.copyPaste.externalContent = !enclipboard;
    if (input.fromDrag) {
      opt.matchStyle = false;
    }
    (input.resources || []).forEach(function(res) {
      context.resources[res.id || res.reference] = res;
    });
    return opt;
  };
  util.paste.adjustOptionsFromContent = function(opt, content) {
    if (!opt.fromDrag && !hasStyles(dom.nodeFromHtml(content))) {
      opt.unstyled = true;
    }
    return opt;
  };
  util.paste.getValueType = function(options, type) {
    var obj = options.values.find(function(payload) {
      return payload.type === type;
    });
    return obj ? obj.value : "";
  };
  util.paste.pasteOutside = function(formField, options) {
    if (formField) {
      var value = util.paste.getValueType(options, MIME.TEXT_PLAIN);
      if (!value) {
        var htmlValue = util.paste.getValueType(options, MIME.TEXT_HTML);
        if (htmlValue) {
          value = htmlValue.replace(/<br\/?>/gi, "\n");
        }
      }
      if (value) {
        value = value.replace(/<[^>]*>/g, "").replace(/\u00a0/g, " ").replace(/&nbsp;/g, "");
        return document.execCommand("insertText", null, value);
      }
    }
    return false;
  };
  function plainifyCodeBlock(node) {
    return goog.array.toArray(node.childNodes);
  }
  function plainifyCrypt(node) {
    return goog.array.toArray(node.childNodes);
  }
  function plainifyTable(table) {
    if (!table) {
      return;
    }
    var trs = goog.array.toArray(table.querySelectorAll("tr"));
    var content = goog.dom.createDom("div");
    goog.array.forEach(trs, function(tr) {
      var tds = tr.querySelectorAll("td");
      goog.array.forEach(tds, function(td) {
        goog.array.forEach(td.childNodes, function(paragraph) {
          if (paragraph.innerHTML === "<br>") {
            return;
          }
          content.appendChild(paragraph);
        });
      });
      var blankLine = goog.dom.createDom("div");
      blankLine.innerHTML = "<br>";
      content.appendChild(blankLine);
    });
    goog.dom.replaceNode(content, table);
    goog.dom.flattenElement(content);
  }
  function plainifyParagraph(node, keepAttributes) {
    var div = goog.dom.createDom("div");
    var text = copy.plain.copy(node);
    div.innerHTML = paste.plain.getContent(text);
    if (div.childNodes.length === 1 && util.paragraph.isParagraph(div.firstChild)) {
      div = div.firstChild;
    }
    if (keepAttributes) {
      goog.iter.forEach(node.attributes, function(attr) {
        div.setAttribute(attr.name, attr.value);
      });
    }
    return div;
  }
  function getCursorPosition(range) {
    var node = range.getStartNode();
    var offset = range.getStartOffset();
    var position = {beginningOfLine:false};
    if (dom.isTextNode(node)) {
      if (!node.parentNode.previousSibling && offset === 0) {
        position.beginningOfLine = true;
      }
    } else {
      if (offset === 0) {
        position.beginningOfLine = true;
      }
    }
    return position;
  }
  function isObject(node) {
    return dom.isEntable(node) || dom.isHeader(node) || dom.isTable(node) || dom.isCodeBlock(node) || dom.isBlockquote(node) || dom.isRevealedCrypt(node) || util.list.isList(node);
  }
  function hasStyles(clipboardContent) {
    return goog.array.some(clipboardContent.querySelectorAll("*"), function(node) {
      return dom.isInlineStyleNode(node) || node.getAttribute("style") || dom.isHeader(node);
    });
  }
  function stripStyles(clipboardContent) {
    goog.array.forEach(clipboardContent.querySelectorAll("*"), function(node) {
      if (dom.isInlineStyleNode(node)) {
        dom.flattenElement(node);
        return;
      }
      if (node.removeAttribute) {
        node.removeAttribute("style");
      }
      if (dom.isHeader(node)) {
        dom.changeTagName(node, "div");
      }
    });
  }
  function setStyles(clipboardContent, options) {
    if (!options.matchStyle) {
      return;
    }
    stripStyles(clipboardContent);
    var paragraphs = util.paragraph.all(clipboardContent);
    goog.array.forEach(paragraphs, function(paragraph) {
      if (util.dom.isCodeBlock(paragraph.parentNode)) {
        return;
      }
      var node = document.createElement("div");
      util.styles.applyPendingStyles(node, options.editor, false);
      var p = node.parentNode;
      while (p) {
        p.innerHTML = "";
        var pp = p.parentNode;
        dom.unflattenElement(paragraph, p);
        p = pp;
      }
    });
  }
  function mergeContent(pasteTarget, paragraphs, range, options) {
    if (!paragraphs.length) {
      return false;
    }
    var pasteTargetParent = pasteTarget.parentNode;
    var pastingInList = goog.dom.getAncestor(pasteTarget, dom.isLi, true);
    var pastingAllListItems = goog.array.every(paragraphs, dom.isLi);
    var shouldSplit = !!(paragraphs.length > 1 || isObject(paragraphs[0]) || pastingAllListItems && pastingInList);
    var firstParagraph = paragraphs.shift();
    var lastParagraph = paragraphs.length ? paragraphs.pop() : null;
    var lastPara = lastParagraph || firstParagraph;
    var lastWord = dom.getLastParagraphItem(lastPara) || lastPara && lastPara.lastChild;
    var placeholder = goog.dom.createTextNode("");
    if (dom.isEmpty(pasteTarget)) {
      pasteTarget.innerHTML = "";
      pasteTarget.appendChild(placeholder);
    } else {
      var targetLastWord = dom.getLastParagraphItem(pasteTarget);
      if (dom.isBr(targetLastWord)) {
        goog.dom.removeNode(targetLastWord);
      }
      range.insertNode(placeholder);
      if (!goog.dom.contains(pasteTarget, placeholder)) {
        if (options.cursorPosition.beginningOfLine) {
          goog.dom.insertChildAt(pasteTarget, placeholder, 0);
        } else {
          pasteTarget.appendChild(placeholder);
        }
      }
    }
    if (shouldSplit) {
      var restOfParagraph = goog.editor.node.splitDomTreeAt(placeholder, null, pasteTarget);
      goog.dom.insertSiblingAfter(restOfParagraph, pasteTarget);
      var firstHalf = pasteTarget;
      var secondHalf = restOfParagraph;
      var lastItemInserted = pasteTarget;
      var firstLi;
      var secondLi;
      var span;
      if (pastingInList) {
        firstLi = util.list.itemFor(firstHalf);
        if (isObject(firstParagraph)) {
          goog.dom.insertSiblingAfter(firstParagraph, firstLi);
          lastItemInserted = firstParagraph;
          if (dom.isEmpty(firstLi)) {
            goog.dom.removeNode(firstLi);
          }
        } else {
          if (dom.isLi(firstParagraph)) {
            util.paragraph.join(firstHalf, firstParagraph.firstChild);
            util.paragraph.join(firstLi, firstParagraph);
          } else {
            util.paragraph.join(firstHalf, firstParagraph);
          }
          lastItemInserted = firstLi;
        }
        if (!dom.isEmpty(secondHalf) || !lastParagraph || !util.list.isList(lastParagraph)) {
          secondLi = util.list.createListItem();
          dom.wrap(secondHalf, secondLi);
          goog.dom.insertSiblingAfter(secondLi, lastItemInserted);
        }
        if (lastParagraph) {
          if (isObject(lastParagraph)) {
            goog.dom.insertSiblingAfter(lastParagraph, firstLi);
          } else {
            if (dom.isLi(lastParagraph)) {
              var lastChild = lastParagraph.lastChild;
              goog.dom.insertSiblingBefore(lastChild, secondHalf);
              util.paragraph.join(lastChild, secondHalf);
              var lastInserted = lastChild;
              while (lastChild = lastParagraph.lastChild) {
                goog.dom.insertSiblingBefore(lastChild, lastInserted);
                lastInserted = lastChild;
              }
            } else {
              goog.dom.insertSiblingBefore(lastParagraph, secondHalf);
              util.paragraph.join(lastParagraph, secondHalf);
            }
          }
        }
      } else {
        if (isObject(firstParagraph)) {
          goog.dom.insertSiblingAfter(firstParagraph, pasteTarget);
          goog.dom.removeNode(placeholder);
          lastItemInserted = firstParagraph;
          if (dom.isEmpty(pasteTarget)) {
            goog.dom.removeNode(pasteTarget);
          }
          if (dom.isEntable(firstParagraph)) {
            util.table.normalizeDOMPlacement(firstParagraph);
          }
        } else {
          goog.dom.insertSiblingAfter(firstParagraph, placeholder);
          goog.dom.removeNode(placeholder);
          if (firstParagraph.parentNode.childNodes.length === 1) {
            goog.dom.flattenElement(firstParagraph.parentNode);
            lastItemInserted = firstParagraph;
          } else {
            span = document.createElement("span");
            util.styles.transferStyles(util.styles.inlineStyles, firstParagraph, span);
            if (span.getAttribute("style")) {
              util.dom.unflattenElement(firstParagraph, span);
            }
            goog.dom.flattenElement(firstParagraph);
          }
        }
        if (lastParagraph) {
          if (isObject(lastParagraph)) {
            goog.dom.insertSiblingAfter(lastParagraph, lastItemInserted);
            if (!dom.isEmpty(restOfParagraph)) {
              goog.dom.insertSiblingAfter(restOfParagraph, lastParagraph);
            }
            if (dom.isEntable(lastParagraph)) {
              util.table.normalizeDOMPlacement(lastParagraph);
            }
          } else {
            goog.dom.insertSiblingAfter(restOfParagraph, lastItemInserted);
            restOfParagraph.insertBefore(lastParagraph, restOfParagraph.firstChild || null);
            lastParagraph.parentNode.normalize();
            if (lastParagraph.parentNode.childNodes.length === 1) {
              goog.dom.flattenElement(lastParagraph.parentNode);
            } else {
              span = document.createElement("span");
              util.styles.transferStyles(util.styles.inlineStyles, lastParagraph, span);
              if (span.getAttribute("style")) {
                util.dom.unflattenElement(lastParagraph, span);
              }
              goog.dom.flattenElement(lastParagraph);
            }
          }
        } else {
          if (!dom.isEmpty(restOfParagraph)) {
            goog.dom.insertSiblingAfter(restOfParagraph, lastItemInserted);
          }
        }
      }
      var node;
      var listItem;
      while (paragraphs.length) {
        node = paragraphs.shift();
        listItem = null;
        if (pastingInList && dom.isDiv(node)) {
          listItem = util.list.createListItem();
          dom.wrap(node, listItem);
        }
        goog.dom.insertSiblingAfter(listItem || node, lastItemInserted);
        if (dom.isEntable(node)) {
          util.table.normalizeDOMPlacement(node);
        }
        lastItemInserted = listItem || node;
      }
      if (secondLi && dom.isEmpty(secondLi)) {
        goog.dom.removeNode(secondLi);
      }
      if (lastWord && lastWord.parentNode) {
        goog.editor.range.placeCursorNextTo(lastWord);
      }
    } else {
      var isOnlyChild = dom.isEmpty(pasteTarget) && !(pasteTarget.children && pasteTarget.children.length);
      goog.dom.replaceNode(firstParagraph, placeholder);
      if (firstParagraph.getAttribute("style") && firstParagraph.getAttribute("style").length) {
        Array.prototype.forEach.call(firstParagraph.children, function(child) {
          util.styles.transferStyles(pastParagraphTransferStyles, firstParagraph, child);
        });
      }
      goog.dom.flattenElement(firstParagraph);
      if (isOnlyChild && !util.paragraph.isParagraph(pasteTarget)) {
        util.styles.transferStyles(pastParagraphTransferStyles, pasteTarget, firstParagraph);
        goog.dom.flattenElement(pasteTarget);
      }
    }
    util.table.normalize(pasteTargetParent);
    if (lastWord && lastWord.parentNode) {
      return goog.editor.range.placeCursorNextTo(lastWord);
    }
    return false;
  }
  var pastParagraphTransferStyles = ["backgroundColor", "color", "fontFamily", "fontFeatureSettings", "fontKerning", "fontSize", "fontStretch", "fontStyle", "fontVariant", "fontVariantCaps", "fontVariantLigatures", "fontVariantNumeric", "fontWeight", "letterSpacing", "lineHeight", "orphans", "textDecoration", "textDecorationColor", "textDecorationLine", "textDecorationSkip", "textDecorationStyle", "whiteSpace", "widows", "wordSpacing"];
  function mergeTables(pasteTarget, clipboardTable) {
    var td = goog.dom.getAncestor(pasteTarget, dom.isTd, true);
    var table = goog.dom.getAncestor(td, dom.isTable);
    var enTable = goog.dom.getAncestor(table, dom.isEntable);
    if (!enTable || !td) {
      return null;
    }
    var clipMatrix = util.table.matrix(clipboardTable);
    var matrix = util.table.matrix(table);
    var startRowIndex = util.table.rowIndex(td, false, matrix);
    var startColIndex = util.table.colIndex(td, false, matrix);
    var endRowIndex = startRowIndex + clipMatrix.length - 1;
    var endColIndex = startColIndex + clipMatrix[0].length - 1;
    var rowAddCount = Math.max(0, endRowIndex - (matrix.length - 1));
    var colAddCount = Math.max(0, endColIndex - (matrix[0].length - 1));
    var unmerged = false;
    var needfill = false;
    if (rowAddCount || colAddCount) {
      if (rowAddCount) {
        util.table.insertRows(enTable, matrix.length, rowAddCount);
      }
      if (colAddCount) {
        util.table.insertColumns(enTable, matrix[0].length, colAddCount);
      }
      matrix = util.table.matrix(table);
    }
    for (var r = endRowIndex; r >= startRowIndex; r--) {
      for (var c = endColIndex; c >= startColIndex; c--) {
        var info = matrix[r][c].info;
        var node = info.node;
        if (info.startRowIndex === r && info.startColIndex === c) {
          util.table.splitCell(node, matrix);
          unmerged = true;
          continue;
        }
        if (info.startRowIndex !== r && r === startRowIndex) {
          util.table.setRowSpan(node, r - info.startRowIndex);
          unmerged = true;
          needfill = true;
        }
        if (info.startColIndex !== c && c === startColIndex) {
          util.table.setColSpan(node, c - info.startColIndex);
          unmerged = true;
          needfill = true;
        }
      }
    }
    if (needfill) {
      matrix = util.table.matrix(table);
      matrix.forEach(function(row, rowIndex) {
        for (var colIndex = 0; colIndex < matrix[0].length; colIndex++) {
          if (row[colIndex] === undefined) {
            util.table.insertTd(util.table.createEmptyTd(), rowIndex, colIndex, table, matrix);
          }
        }
      });
    }
    if (unmerged) {
      matrix = util.table.matrix(table);
    }
    goog.array.forEachRight(clipMatrix, function(row, rowIndex) {
      goog.array.forEachRight(row, function(obj, colIndex) {
        var info = obj.info;
        if (info.startRowIndex !== rowIndex || info.startColIndex !== colIndex) {
          return;
        }
        var relativeRowIndex = rowIndex + startRowIndex;
        var relativeColIndex = colIndex + startColIndex;
        var targetTd;
        if (info.state & util.table.State.MERGED) {
          var rowOffset = info.endRowIndex - info.startRowIndex;
          var colOffset = info.endColIndex - info.startColIndex;
          var nodes = [];
          for (var r = relativeRowIndex; r <= relativeRowIndex + rowOffset; r++) {
            for (var c = relativeColIndex; c <= relativeColIndex + colOffset; c++) {
              nodes.push(matrix[r][c].info.node);
            }
          }
          targetTd = util.table.mergeCells(nodes);
        } else {
          targetTd = matrix[rowIndex + startRowIndex][colIndex + startColIndex].info.node;
        }
        targetTd.innerHTML = info.node.innerHTML;
        targetTd.style.backgroundColor = info.node.style.backgroundColor;
      });
    });
    var lastCellNode = matrix[endRowIndex][endColIndex].info.node;
    var leaf = dom.getLastParagraphItem(lastCellNode) || lastCellNode && lastCellNode.lastChild;
    if (leaf) {
      goog.editor.range.placeCursorNextTo(leaf);
    }
    return goog.dom.Range.createFromNodes(enTable, 0, enTable, enTable.childNodes.length);
  }
})();
goog.provide("uno.util.partialnormalize");
goog.require("uno.util.dom");
goog.require("goog.array");
goog.require("goog.dom");
(function() {
  var util = uno.util;
  var dom = util.dom;
  util.partialnormalize.normalizeDom = function(root, options) {
    normalizeInlineNodes(root, options);
  };
  util.partialnormalize.hasLayoutStyle = function(node) {
    var styleText = node.getAttribute("style");
    if (styleText == null || styleText === "") {
      return false;
    }
    var style = node.style;
    var result = Object.keys(style).some(function(key) {
      return isNaN(key) && style.hasOwnProperty(key) && style[key] !== "" && (inlineStyles.indexOf(key) === -1 || key === "backgroundColor" || key === "fontSize" || key === "clear");
    });
    return result;
  };
  function normalizeInlineNodes(root, options) {
    options = options || {};
    var parents = [root];
    var walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {acceptNode:function(node) {
      if (node.firstChild == null || isOpaqueElement(node)) {
        return NodeFilter.FILTER_REJECT;
      } else {
        parents.push(node);
        return NodeFilter.FILTER_ACCEPT;
      }
    }});
    while (walker.nextNode()) {
    }
    goog.array.forEachRight(parents, function(parent, index) {
      if (parent.tagName === "SPAN" && !parent.getAttribute("style") && !util.styles.hasMetadata(parent)) {
        flattenElement(parent);
      } else {
        parent = replacePtagWithDiv(parent);
        parent = matchTagNameToDisplayProperty(parent);
        ensureChildrenAreAllBlocksOrAllInline(parent);
      }
    });
    var elementsAndStyles = findContentParentsAndStyles(root, options);
    var elements = elementsAndStyles.nodes;
    var styles = elementsAndStyles.styles;
    normalizeFormatting(elements, styles, options);
  }
  function replacePtagWithDiv(el) {
    if (el.tagName === "P") {
      el = dom.changeTagName(el, "div");
      if (el.style.marginBottom.length === 0 && el.style.marginTop.length === 0) {
        util.styles.setMetadata(el, "-en-paragraph", true);
        el.style.marginTop = "1em";
        el.style.marginBottom = "1em";
      }
    }
    return el;
  }
  function matchTagNameToDisplayProperty(node) {
    if (dom.isBlockNode(node) && node.style && node.style.display === "inline") {
      node = dom.changeTagName(node, "span");
      node.style.display = "";
    } else {
      if (!dom.isBlockNode(node) && node.style && node.style.display === "block") {
        node = dom.changeTagName(node, "div");
        node.style.display = "";
      }
    }
    return node;
  }
  function ensureChildrenAreAllBlocksOrAllInline(parent) {
    if (parent.childNodes.length < 2) {
      return;
    }
    if (isOpaqueElement(parent)) {
      return;
    }
    var curCluster = {nodes:[], hasBlock:null};
    var clusters = [curCluster];
    var childrenShouldBeBlocks = false;
    goog.array.forEach(parent.childNodes, function(child) {
      var hasBlock = isBlockLayout(child);
      childrenShouldBeBlocks = childrenShouldBeBlocks || hasBlock;
      if (curCluster.hasBlock == null || hasBlock === curCluster.hasBlock) {
        curCluster.nodes.push(child);
        curCluster.hasBlock = hasBlock;
      } else {
        curCluster = {nodes:[child], hasBlock:hasBlock};
        clusters.push(curCluster);
      }
    });
    if (clusters.length > 1 && childrenShouldBeBlocks) {
      goog.array.forEach(clusters, function(cluster) {
        if (!cluster.hasBlock && !isOnlyWhitespace(cluster.nodes)) {
          var container = document.createElement("div");
          goog.dom.replaceNode(container, cluster.nodes[0]);
          goog.array.forEach(cluster.nodes, function(child) {
            container.appendChild(child);
          });
        }
      });
    }
  }
  var regexNonWhitespace = /\S/g;
  function isOnlyWhitespace(nodes) {
    var foundNonWhitespace = nodes.some(function(node) {
      return node.nodeType !== Node.TEXT_NODE || regexNonWhitespace.test(node.data);
    });
    return !foundNonWhitespace;
  }
  function findContentParentsAndStyles(root, options) {
    var parents = [];
    var parent;
    var parentStyles = [];
    var parentStyle;
    var children = [];
    var child;
    var childStyles = [];
    var resultNodes = [];
    var resultStyles = [];
    var redundantNodes = [];
    var i;
    var hasContentChild;
    var isRedundantDiv;
    var isRedundantInline;
    var temp1, temp2;
    parents.push(root);
    if (root.tagName && root.tagName === "EN-NOTE") {
      parentStyles.push({});
    } else {
      parentStyles.push(combinedStyle(root, {}, options));
    }
    while (parents.length > 0) {
      parent = parents.pop();
      parentStyle = parentStyles.pop();
      if (!isOpaqueElement(parent)) {
        hasContentChild = false;
        isRedundantDiv = parent.tagName === "DIV" && !util.partialnormalize.hasLayoutStyle(parent) && !util.styles.hasMetadata(parent);
        isRedundantInline = !dom.isBlockNode(parent) && !util.partialnormalize.hasLayoutStyle(parent) && !util.styles.hasMetadata(parent);
        for (i = parent.childNodes.length - 1; i > -1; i--) {
          child = parent.childNodes[i];
          if (child.firstChild != null && !dom.isCodeBlock(child)) {
            children.push(child);
            childStyles.push(combinedStyle(child, parentStyle, options));
          }
          if (isRedundantDiv && child.tagName !== "DIV") {
            isRedundantDiv = false;
          }
          if (!hasContentChild && (util.dom.isTextNode(child) || util.dom.isImg(child) || util.resource.isImage(child))) {
            hasContentChild = true;
          }
        }
        if (hasContentChild && Object.keys(parentStyle).length > 0) {
          resultNodes.push(parent);
          resultStyles.push(parentStyle);
        } else {
          if (isRedundantDiv || isRedundantInline) {
            redundantNodes.push(parent);
          }
        }
      }
      if (parents.length === 0) {
        temp1 = parents;
        temp2 = parentStyles;
        parents = children;
        parentStyles = childStyles;
        children = temp1;
        childStyles = temp2;
      }
    }
    goog.array.forEach(redundantNodes, flattenElement);
    return {nodes:resultNodes, styles:resultStyles};
  }
  var emUnitRegex = /(\d+\.?\d*)em$/;
  function isEMUnit(value) {
    return emUnitRegex.test(value);
  }
  function normalizeFormatting(contentParents, styles, options) {
    options = options || {};
    goog.array.forEachRight(contentParents, function(parent, index) {
      var style = styles[index];
      var wrappers;
      var clusters = [];
      var cluster;
      goog.array.forEach(parent.childNodes, function(child) {
        if (dom.isTextNode(child) || dom.isImg(child) || dom.isBr(child) || util.resource.isResource(child)) {
          if (cluster == null) {
            cluster = [];
            clusters.push(cluster);
          }
          cluster.push(child);
        } else {
          cluster = null;
        }
      });
      if (style.href != null) {
        if (parent.tagName !== "A") {
          wrappers = clusters.map(function() {
            return document.createElement("a");
          });
        }
      } else {
        if (parent.tagName !== "SPAN" || clusters.length > 1) {
          wrappers = clusters.map(function() {
            return document.createElement("span");
          });
        }
      }
      if (wrappers) {
        wrappers.forEach(function(wrapper, idx) {
          goog.dom.replaceNode(wrapper, clusters[idx][0]);
          clusters[idx].forEach(function(node) {
            wrapper.appendChild(node);
          });
          if (!dom.isBlockNode(parent)) {
            Object.keys(parent.style).forEach(function(key) {
              if (isNaN(key) && parent.style[key] != null && parent.style[key] !== "" && style[key] == null && key !== "cssText") {
                style[key] = parent.style[key];
              }
            });
            flattenElement(parent);
          }
        });
      } else {
        wrappers = [parent];
      }
      wrappers.forEach(function(wrapper) {
        applyStyleOnContentWrapper(style, wrapper, options.simplifyFormat);
      });
    });
  }
  var TAGS_TO_STYLES = {B:{name:"fontWeight", value:"bold"}, EM:{name:"fontStyle", value:"italic"}, I:{name:"fontStyle", value:"italic"}, STRIKE:{name:"textDecoration", value:"line-through"}, S:{name:"textDecoration", value:"line-through"}, STRONG:{name:"fontWeight", value:"bold"}, SUB:{name:"verticalAlign", value:"sub"}, SUP:{name:"verticalAlign", value:"super"}, U:{name:"textDecoration", value:"underline"}};
  var COMPOUND_STYLES = ["textDecoration"];
  function isBlockLayout(node) {
    return dom.isBlockNode(node) && node.style.float !== "left" && node.style.float !== "right" && node.style.display !== "inline" && node.style.display !== "inline-block";
  }
  function combinedStyle(node, parentStyle, options) {
    options = options || {};
    if (options.removeFormat) {
      return parentStyle;
    }
    var fontSize;
    var style = {};
    var declaration = node.style;
    if (declaration == null) {
      return style;
    }
    goog.object.extend(style, parentStyle);
    var styleFromTag = TAGS_TO_STYLES[node.tagName];
    if (styleFromTag) {
      if (COMPOUND_STYLES.indexOf(styleFromTag.name) !== -1 && style[styleFromTag.name] != null) {
        style[styleFromTag.name] += " " + styleFromTag.value;
      } else {
        style[styleFromTag.name] = styleFromTag.value;
      }
    } else {
      if (node.tagName === "FONT" && !options.simplifyFormat) {
        if (node.getAttribute("color")) {
          style.color = node.getAttribute("color");
        }
        if (node.getAttribute("face")) {
          style.fontFamily = node.getAttribute("face");
        }
        if (node.getAttribute("size") && declaration.fontSize === "") {
          if (isRelativeValue(node.getAttribute("size")) && isRelativeValue(style.fontSize)) {
            style.fontSize = combineRelativeValues(node.getAttribute("size"), style.fontSize);
          } else {
            style.fontSize = node.getAttribute("size");
          }
        }
      } else {
        if (node.tagName === "A") {
          if (style.color) {
            delete style.color;
          }
          if (node.getAttribute("href")) {
            style.href = node.getAttribute("href");
          }
        }
      }
    }
    var styleNames = options.simplifyFormat ? SIMPLIFY_FORMAT_STYLES : inlineStyles;
    styleNames.forEach(function(name) {
      var value = declaration[name];
      if (name === "backgroundColor" && dom.isBlockNode(node)) {
        return;
      }
      if (value != null && value !== "" && value !== "inherit") {
        style[name] = value;
      }
    });
    if (style.fontSize && isEMUnit(style.fontSize)) {
      style.fontSize = "";
    }
    if (options.simplifyFormat) {
      node.removeAttribute("style");
    } else {
      styleNames.forEach(function(name) {
        if (name !== "backgroundColor" && name !== "fontSize") {
          declaration[name] = null;
        }
      });
    }
    if (style.backgroundColor && !declaration.backgroundColor && dom.isBlockNode(node)) {
      declaration.backgroundColor = null;
    }
    if (node.getAttribute("style") === "") {
      node.removeAttribute("style");
    }
    return style;
  }
  function stripStyles(node, styleNames) {
    var declaration = node.style;
    styleNames.forEach(function(name) {
      if (declaration[name] !== "") {
        declaration[name] = "";
      }
    });
  }
  function applyStyleOnContentWrapper(style, el, simplifyFormat) {
    if (simplifyFormat) {
      el.removeAttribute("style");
    }
    goog.object.forEach(style, function(value, key) {
      if (key === "href") {
        el.href = el.href || value;
      } else {
        el.style[key] = el.style[key] || value;
      }
    });
  }
  function isRelativeValue(value) {
    return false;
  }
  function combineRelativeValues(v1, v2) {
    return v1;
  }
  function removeTags(root, tagNames) {
    if (!tagNames) {
      return;
    }
    if (typeof tagNames === "string") {
      tagNames = [tagNames];
    }
    var selector = tagNames.join(",");
    goog.array.forEach(root.querySelectorAll(selector), flattenElement);
  }
  var SIMPLIFY_FORMAT_STYLES = ["fontStyle", "fontWeight", "textDecoration"];
  function wrapTopLevelChunksInParagraphs(origins) {
    goog.array.forEach(origins, function(origin) {
      var inlineNodes = [];
      var p;
      goog.array.forEachRight(origin.childNodes, function(child) {
        if (!util.dom.isBlockNode(child)) {
          inlineNodes.push(child);
        } else {
          if (inlineNodes.length > 0) {
            p = goog.dom.createDom("div", null, inlineNodes.reverse());
            goog.dom.insertSiblingAfter(p, child);
            inlineNodes = [];
          }
        }
      });
      if (inlineNodes.length > 0) {
        p = goog.dom.createDom("div", null, inlineNodes.reverse());
        goog.dom.insertChildAt(origin, p, 0);
      }
    });
  }
  function convertBlockquoteToParagraphMargin(frag) {
    var blockquotes = frag.querySelectorAll("blockquote");
    var hierarchy = [];
    var marginIncrement = 40;
    goog.array.forEach(blockquotes, function(blockquote) {
      var paragraphs = blockquote.querySelectorAll("div");
      goog.array.forEach(paragraphs, function(p) {
        var left = parseInt(p.style.marginLeft, 10) || 0;
        left += marginIncrement;
        p.style.marginLeft = left + "px";
      });
      flattenElement(blockquote);
    });
  }
  var opaqueTagNames = ["EN-CRYPT", "EN-MEDIA", "EMBED", "OBJECT"];
  function isOpaqueElement(el) {
    return el != null && (opaqueTagNames.indexOf(el.tagName) !== -1 || el.style && el.style.display.indexOf("none") > -1);
  }
  function flattenElement(element) {
    var child, parent = element.parentNode;
    if (parent) {
      if (element.removeNode) {
        return element.removeNode(false);
      } else {
        while (child = element.firstChild) {
          parent.insertBefore(child, element);
        }
        return goog.dom.removeNode(element);
      }
    }
    return null;
  }
  var inlineStyles = ["alignmentBaseline", "backgroundColor", "baselineShift", "bottom", "breakAfter", "breakBefore", "breakInside", "color", "dominantBaseline", "fill", "fillOpacity", "fillRule", "fontFamily", "fontFeatureSettings", "fontKerning", "fontSize", "fontStretch", "fontStyle", "fontVariant", "fontVariantCaps", "fontVariantLigatures", "fontVariantNumeric", "fontWeight", "lineHeight", "textDecoration", "textDecorationColor", "textDecorationLine", "textDecorationSkip", "textDecorationStyle"];
})();
goog.provide("uno.util.normalize");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.list");
goog.require("uno.util.table");
goog.require("uno.util.paragraph");
goog.require("uno.util.richlink");
goog.require("uno.util.styles");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("uno.util.partialnormalize");
(function() {
  var util = uno.util;
  var dom = util.dom;
  util.normalize.normalizeNode = function(node, options) {
    options = options || {};
    if (dom.isTextNode(node)) {
      return;
    }
    var range = options.editor && options.editor.getRange();
    var savedCursor = null;
    var endCursor = null;
    if (range) {
      savedCursor = util.range.saveCursor(range);
    }
    node.innerHTML = util.normalize.normalizeHtml(node.innerHTML, options);
    util.normalize.normalizeDom(node, options);
    if (savedCursor) {
      endCursor = node.querySelector("#" + savedCursor.endCaretId_);
      if (range.isCollapsed() && endCursor && !dom.isBr(endCursor.nextSibling) && endCursor.parentNode.childNodes === 2) {
        goog.dom.insertSiblingAfter(document.createElement("br"), endCursor);
      }
      savedCursor.restore();
    }
    return node;
  };
  util.normalize.normalizeHtml = function(html, options) {
    var nonVoidTag = /<(?!area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)([\w-]+)([^>]*)\/>/g;
    var invalidCharacters = /[\u0000\u0001-\u0008\u000E-\u001F\u007F-\u009F\uFDD0-\uFDEF\u000B\uFFFE\uFFFF]|[\x01-\x10][\uFFFE-\uFFFF]/g;
    var zwsRegex = new RegExp(uno.defs.unicode.ZERO_WIDTH_SPACE, "g");
    options = options || {};
    html = html.replace(zwsRegex, "").replace(invalidCharacters, "").replace(/(<pre(?:>|\s[^>]*>))([\u0000-\uffff]*?)<\/pre>/g, function(m, g1, g2) {
      return "<div" + g1.substr(4) + g2.replace(/\r?\n/g, "<br>").replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;") + "</div>";
    }).replace(/^<div><span>(.*)<\/span>\n<\/div>$/, "<div>$1</div>").replace(/\n\n\/\*\*\/\n\x3c!--[\s\w{:}#;-]+>\n\/\*\*\/\n/g, "").replace(nonVoidTag, "<$1$2></$1>").replace(/<!\[CDATA\[([^]*?)\]\]>/g, function(match, raw) {
      var s = "";
      for (var i = 0, l = raw.length; i < l; i++) {
        s += "&#" + raw.charCodeAt(i) + ";";
      }
      return s;
    });
    if (options.simplifyFormat) {
      html = html.replace(/([^ ])&nbsp;([^ ])/g, "$1 $2");
    }
    html = util.normalize.removeExcessiveEmptyLinesInHtml(html);
    return html;
  };
  util.normalize.normalizeDom = function(root, options) {
    options = options || {};
    root.normalize();
    if (dom.isTextNode(root)) {
      return;
    }
    util.normalize.removeUnsupportedNodes(root);
    util.normalize.removeUnsupportedTags(root);
    util.normalize.normalizeRenderingBox(root);
    util.normalize.replaceBrsByParagraphs(root.querySelectorAll("br"));
    util.normalize.removeEmptyNodes(root, null, options.partial);
    util.list.normalize(root);
    util.table.normalize(root, {foreignSource:options.editor && options.editor.hasForeignSource()});
    if (options.partial) {
      util.partialnormalize.normalizeDom(root, options);
    } else {
      util.normalize.ensureValidParagraph(root.childNodes);
      util.normalize.migrateFormattingAttributesToStyles(root);
      util.normalize.flattenRedundantNodes(root);
      if (!options.ignoreInlineNodes) {
        util.normalize.inlineNodes(root, options);
      }
      if (options.removeFormat) {
        util.normalize.removeRichLinkFormat(root);
      }
    }
  };
  util.normalize.removeUnsupportedTags = function(frag) {
    goog.array.forEachRight(frag.querySelectorAll("en-note, script, meta, style, input, option, select, button"), goog.dom.removeNode);
    goog.array.forEachRight(frag.querySelectorAll('a[x-apple-data-detectors="true"]'), goog.dom.flattenElement);
  };
  util.normalize.normalizeRenderingBox = function(frag) {
    var nodes = frag.querySelectorAll('[style*="display"]');
    goog.array.forEachRight(nodes, function(node) {
      if (dom.inlineObjects.indexOf(node.tagName && node.tagName.toLowerCase()) > -1) {
        return;
      }
      var isLink = util.link.isLink(node);
      var unflattenLink = function(linkNode) {
        var linkClone = goog.dom.createDom("a", {href:linkNode.getAttribute("href"), target:linkNode.getAttribute("target")});
        dom.unflattenElement(linkNode, linkClone);
        linkNode.removeAttribute("href");
        linkNode.removeAttribute("target");
        util.styles.transferStyles(util.styles.inlineStyles, linkNode, linkClone, {removeOld:true});
      };
      if (dom.isBlockNode(node) && node.style && ["inline", "inline-block"].indexOf(node.style.display) > -1) {
        if (isLink) {
          unflattenLink(node);
        }
        node = dom.changeTagName(node, "span");
      }
      if (dom.isInlineNode(node) && node.style && ["block"].indexOf(node.style.display) > -1) {
        if (isLink) {
          unflattenLink(node);
        }
        node = dom.changeTagName(node, "div");
      }
      if (node.style && (node.style.display === "inline" && dom.isInlineNode(node) || node.style.display === "block" && dom.isBlockNode(node))) {
        node.style.display = "";
      }
    });
  };
  util.normalize.replaceBrsByParagraphs = function(brs) {
    var getCloneTagName = function(node) {
      return isInvalidParent(node) || dom.isNoteSection(node) || dom.isP(node) || dom.isPre(node) ? "div" : node.tagName;
    };
    goog.array.forEach(brs, function(br) {
      var clone;
      var sibling;
      var parent = br.parentNode;
      var nodes = [];
      var node;
      var hasSiblings = false;
      while (dom.isInlineStyleNode(parent) && parent.childNodes.length === 1) {
        parent = parent.parentNode;
      }
      if (dom.isBlockNode(parent) && parent.childNodes.length === 1) {
        return;
      }
      var blockAncestor = goog.dom.getAncestor(br, dom.isBlockNode);
      var hasContent = blockAncestor && !dom.isEmpty(blockAncestor);
      if (hasContent && !dom.isFollowedByContent(br) && !dom.isBlockNode(br.previousSibling)) {
        goog.dom.removeNode(br);
        return;
      }
      node = br;
      while (dom.isInlineNode(node)) {
        var siblings = [];
        sibling = node.previousSibling;
        parent = node.parentNode;
        while (sibling && dom.isInlineNode(sibling)) {
          siblings.push(sibling);
          sibling = sibling.previousSibling;
        }
        if (siblings.length) {
          hasSiblings = true;
        }
        node = node.parentNode;
        var newClone = dom.isInlineNode(node) ? node.cloneNode() : goog.dom.createDom(getCloneTagName(node));
        if (clone) {
          newClone.appendChild(clone);
        }
        clone = newClone;
        goog.array.forEach(siblings, function(child) {
          goog.dom.insertChildAt(clone, child, 0);
        });
      }
      if (hasSiblings) {
        goog.dom.removeNode(br);
        if (dom.isEmpty(clone)) {
          return;
        }
      } else {
        clone = goog.dom.createDom(getCloneTagName(node));
        clone.appendChild(br);
      }
      if (sibling) {
        goog.dom.insertSiblingAfter(clone, sibling);
      } else {
        if (parent) {
          goog.dom.insertChildAt(parent, clone, 0);
        }
      }
      if (dom.isInlineNode(clone.nextSibling) && !dom.isBr(clone.nextSibling) && dom.isEmptyContent(clone.nextSibling) && !clone.nextSibling.querySelector("br")) {
        goog.dom.removeNode(clone.nextSibling);
      }
    });
  };
  function isRemovableWhitespace(node) {
    return dom.isTextNode(node) && /^\s+$/.test(node.data) && (dom.isBlockNode(node.previousSibling) || dom.isBlockNode(node.nextSibling)) && (!node.nextSibling || dom.isBlockNode(node.nextSibling)) && (!node.previousSibling || dom.isBlockNode(node.previousSibling));
  }
  util.normalize.removeEmptyNodes = function(root, whiteList, allowLayoutOnlyNodes) {
    var deepestNodes = dom.getNodeLeaves(root, dom.inlineObjects);
    goog.array.forEachRight(deepestNodes, function(node) {
      var parent = node.parentNode;
      while (node && (util.normalize.isEmptyNode(node, whiteList, allowLayoutOnlyNodes) || isRemovableWhitespace(node))) {
        goog.dom.removeNode(node);
        node = util.dom.isElementNode(parent) ? parent : null;
        parent = node && node.parentNode;
      }
    });
  };
  util.normalize.isEmptyNode = function(node, whiteList, allowLayoutOnlyNodes) {
    return [].concat(dom.inlineObjects, dom.tableObjects, whiteList || []).indexOf(dom.getTagName(node)) === -1 && (allowLayoutOnlyNodes ? dom.isEmpty(node) : dom.isEmptyContent(node));
  };
  util.normalize.ensureValidParagraph = function(siblings) {
    var paragraphNodes = [];
    siblings = goog.array.toArray(siblings);
    goog.array.forEachRight(siblings, function(node) {
      var parentNode = node.parentNode;
      var previousSibling = node.previousSibling;
      var nextSibling = node.nextSibling;
      var paragraph = node;
      if (dom.isUIObject(node)) {
        return;
      }
      if (dom.isInlineNode(node) && (dom.isBlockNode(previousSibling) || dom.isBlockNode(nextSibling) || dom.isNoteSection(parentNode))) {
        var tagName = dom.isBlockNode(parentNode) && !dom.isNoteSection(parentNode) ? parentNode.tagName : "div";
        if (dom.isBlockNode(nextSibling) || !nextSibling) {
          paragraphNodes.push(node);
          while (dom.isInlineNode(node.previousSibling)) {
            paragraphNodes.unshift(node.previousSibling);
            node = node.previousSibling;
          }
          paragraph = goog.dom.createDom(tagName, null, paragraphNodes);
          if (nextSibling) {
            goog.dom.insertSiblingBefore(paragraph, nextSibling);
          } else {
            parentNode.appendChild(paragraph);
          }
        } else {
          if (dom.isBlockNode(previousSibling)) {
            paragraphNodes.push(node);
            while (dom.isInlineNode(node.nextSibling)) {
              paragraphNodes.push(node.nextSibling);
              node = node.nextSibling;
            }
            paragraph = goog.dom.createDom(tagName, null, paragraphNodes);
            goog.dom.insertSiblingAfter(paragraph, previousSibling);
          }
        }
        paragraphNodes = [];
      }
      if (paragraph && paragraph.childNodes.length) {
        util.normalize.ensureValidParagraph(paragraph.childNodes);
      }
    });
  };
  util.normalize.migrateFormattingAttributesToStyles = function(root) {
    var alignmentValues = ["left", "center", "right", "justify"];
    goog.array.forEach(root.querySelectorAll("[align]"), function(node) {
      if (util.dom.isBlockNode(node) && alignmentValues.indexOf(node.getAttribute("align")) !== -1) {
        if (alignmentValues.indexOf(node.style.textAlign) === -1) {
          node.style.textAlign = node.getAttribute("align");
        }
        node.removeAttribute("align");
      }
    });
  };
  var isInvalidParent = function(parentNode) {
    return !parentNode || !parentNode.parentNode || dom.isEnnote(parentNode) || dom.isFragment(parentNode);
  };
  util.normalize.flattenRedundantNodes = function(root) {
    var deepestNodes = dom.getNodeLeaves(root, dom.inlineObjects);
    var dumbParentNode = goog.dom.createDom("div");
    deepestNodes.forEach(function(node) {
      while (!isInvalidParent(node.parentNode)) {
        var parentNode = node.parentNode;
        if (dom.isUl(parentNode) || dom.isOl(parentNode) || dom.isLi(parentNode) || dom.isTd(parentNode) || dom.isTd(node) || dom.isTr(node) || dom.isColgroup(parentNode) || dom.isCodeBlock(parentNode) || dom.isRevealedCrypt(parentNode) || dom.isBlockquote(parentNode) || dom.isTextNode(node)) {
          if (dom.isTd(parentNode) || dom.isTr(node) || dom.isColgroup(parentNode)) {
            node = goog.dom.getAncestor(node, dom.isEntable) || goog.dom.getAncestor(node, dom.isTable) || parentNode;
          } else {
            node = parentNode;
          }
        } else {
          if (dom.isBlockNode(node)) {
            if (dom.isBlockNode(parentNode)) {
              if (parentNode.getAttribute("style")) {
                node = parentNode;
              } else {
                goog.array.forEachRight(parentNode.childNodes, function(child) {
                  util.styles.mergeAttributes(parentNode, child, true);
                  goog.dom.insertSiblingAfter(child, parentNode);
                });
                if (!parentNode.childNodes.length) {
                  goog.dom.removeNode(parentNode);
                } else {
                  goog.dom.flattenElement(parentNode);
                }
              }
            } else {
              goog.array.forEachRight(parentNode.childNodes, function(child) {
                var paragraphs = [child];
                if (dom.isTable(child)) {
                  paragraphs = util.table.getParagraphs(child);
                } else {
                  if (dom.isUl(child) || dom.isOl(child)) {
                    paragraphs = util.list.getParagraphs(child);
                  }
                }
                goog.array.forEach(paragraphs, function(paragraph) {
                  if (dom.isTextNode(paragraph)) {
                    paragraph = goog.dom.createDom("div", null, paragraph);
                  }
                  if (dom.isCodeBlock(paragraph)) {
                    return;
                  }
                  var newNode = parentNode.cloneNode();
                  dom.moveChildren(paragraph, newNode);
                  paragraph.appendChild(newNode);
                });
              });
              var previousSiblings = dom.getPreviousSiblings(parentNode);
              if (previousSiblings.length) {
                var leftParagraph = goog.dom.createDom("div", null, previousSiblings);
                goog.dom.insertSiblingBefore(leftParagraph, parentNode);
              }
              var nextSiblings = dom.getNextSiblings(parentNode);
              if (nextSiblings.length) {
                var rightParagraph = goog.dom.createDom("div", null, nextSiblings);
                goog.dom.insertSiblingAfter(rightParagraph, parentNode);
              }
              if (!parentNode.childNodes.length) {
                goog.dom.removeNode(parentNode);
              } else {
                goog.dom.flattenElement(parentNode);
              }
            }
          } else {
            node = parentNode;
          }
        }
      }
      util.styles.mergeAttributes(dumbParentNode, node, true);
    });
  };
  util.normalize.normalizeParagraphStructure = function(paragraph) {
    if (dom.isP(paragraph)) {
      paragraph = dom.changeTagName(paragraph, "div");
      if (paragraph.style.marginBottom.length === 0 && paragraph.style.marginTop.length === 0) {
        util.styles.setMetadata(paragraph, "-en-paragraph", true);
        paragraph.style.marginTop = "1em";
        paragraph.style.marginBottom = "1em";
      }
    }
    return paragraph;
  };
  util.normalize.inlineNodes = function(root, options) {
    var paragraphs = util.paragraph.all(root);
    var dumbNode = goog.dom.createDom("div");
    if (!paragraphs.length && dom.isElementNode(root)) {
      if (dom.isInlineObject(root)) {
        return;
      }
      paragraphs = [root];
    }
    goog.array.forEach(paragraphs, function(paragraph) {
      paragraph = util.normalize.normalizeParagraphStructure(paragraph);
      if (dom.isBlockNode(paragraph.firstChild)) {
        return;
      }
      var deepestNodes = util.dom.getNodeLeaves(paragraph, dom.inlineObjects);
      var nodes = [];
      deepestNodes.forEach(function(node) {
        var link = false;
        var element = node;
        while (element !== paragraph) {
          if (element.attributes && element.getAttribute("href")) {
            link = element;
            break;
          }
          element = element.parentNode;
        }
        if (dom.isTextNode(node)) {
          var currentNode = node;
          node = goog.dom.createDom("span", null, node.textContent);
          if (!options.removeFormat) {
            while (dom.isInlineNode(currentNode) && currentNode.parentNode) {
              util.styles.mergeAttributes(currentNode.parentNode, node, false, {disallowedStyles:"align.*|animation.*|flex.*|float|grid.*|justify.*|left|list.*|margin.*|padding.*|shape.*|text-align|transition.*", allowedAttrs:"data-.*|title|class"});
              currentNode = currentNode.parentNode;
            }
          }
          if (!node.hasAttributes()) {
            node = node.firstChild;
          }
        }
        if (link) {
          var href = link.getAttribute("href");
          if (dom.isSpan(node) || dom.isTextNode(node)) {
            var anchor = goog.dom.createDom("a", {href:href}, node.textContent);
            goog.array.forEach(node.attributes || [], function(attr) {
              anchor.setAttribute(attr.name, attr.value);
            });
            if (link.getAttribute("rev")) {
              anchor.setAttribute("rev", link.getAttribute("rev"));
            }
            node = anchor;
          } else {
            if (dom.isImg(node) || util.resource.isImage(node)) {
              node = goog.dom.createDom("a", {href:href}, node);
            }
          }
        }
        nodes.push(node);
      });
      if (nodes.length) {
        while (paragraph.firstChild) {
          paragraph.removeChild(paragraph.firstChild);
        }
        var mergeOptions = {allowedStyles:".*", disallowedStyles:options.removeFormat ? ".*" : "", disallowedAttrs:options.externalContent ? "name|id|data-.*|bgcolor|class" : "bgcolor"};
        util.styles.mergeAttributes(dumbNode, paragraph, false, mergeOptions);
        nodes.forEach(function(node) {
          paragraph.appendChild(node);
        });
        if (dom.isInlineNode(paragraph) && !paragraph.hasAttributes()) {
          goog.dom.flattenElement(paragraph);
        }
      }
    });
  };
  util.normalize.removeUnsupportedNodes = function(frag) {
    var iterator = frag.ownerDocument.createNodeIterator(frag, 8 | 128, null, false);
    var element;
    var nodeList = [];
    while (element = iterator.nextNode()) {
      nodeList.push(element);
    }
    for (var i = nodeList.length - 1; i >= 0; i--) {
      var node = nodeList[i];
      var nodeType = node.nodeType;
      if (nodeType === Node.COMMENT_NODE) {
        if (node.data.indexOf("[CDATA[") === 0) {
          var nextSibling = node.nextSibling;
          var textNode = document.createTextNode(node.data.substr(7));
          goog.dom.replaceNode(textNode, node);
          node = textNode;
          if (node.data.lastIndexOf("]]") !== node.data.length - 2 && nextSibling && nextSibling.nodeType === Node.TEXT_NODE) {
            nextSibling.data = nextSibling.data.replace(/^(.*?)\]\]>(.*?)$/gi, "$1$2");
            node.data += ">";
          } else {
            node.data = node.data.replace(/^(.*?)\]\](.*?)$/gi, "$1$2");
          }
        } else {
          node.parentNode.removeChild(node);
        }
      } else {
        goog.dom.replaceNode(document.createTextNode(node.data), node);
      }
    }
  };
  util.normalize.removeExcessiveEmptyLinesInHtml = function(html) {
    return html.replace(/(<li[^>]*>(?:(?!<\/li).)*?)(?:<div><br\s?\/><\/div>){6,}/g, "$1<div><br /></div>");
  };
  util.normalize.removeRichLinkFormat = function(frag) {
    goog.array.forEach(util.richlink.all(frag), function(link) {
      var parent = link.parentNode;
      if (util.dom.isA(parent)) {
        parent.innerHTML = parent.href;
      }
    });
  };
})();
goog.provide("uno.commands.Paste");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.editor.range");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
goog.require("uno.util.copy.plain");
goog.require("uno.util.dom");
goog.require("uno.util.img");
goog.require("uno.util.paste");
goog.require("uno.util.paste.plain");
goog.require("uno.util.table.selection");
goog.require("uno.util.normalize");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Paste");
  var util = uno.util;
  var dom = util.dom;
  var Paste = uno.commands.Paste = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Paste, uno.BasePlugin);
  Paste.prototype.isSupportedCommand = function(command) {
    return command === "paste" || command === "pasteplain";
  };
  Paste.prototype.queryCommandValue = function() {
    return true;
  };
  Paste.prototype.execCommand = function(command, value) {
    var editor = this.editor;
    var range = editor.getRange();
    var formField = editor.getFormField();
    var opt = util.paste.normalizeOptions(value, editor.context);
    editor.context.pastingInPartialTypebehind = util.typebehind.inPartialTypebehind(range);
    if (editor.context.pastingInPartialTypebehind) {
      opt.matchStyle = true;
    }
    if (!opt.pasteValue) {
      return false;
    }
    if (range && !goog.dom.getAncestor(range.getContainer(), uno.util.dom.isEnnote, true)) {
      return util.paste.pasteOutside(formField, opt);
    }
    if (!editor.multirange.isEmpty()) {
      var pasteCell = util.table.selection.getPasteCell();
      if (!pasteCell) {
        return false;
      }
      util.table.selection.clear();
      pasteCell.innerHTML = uno.defs.table.CELL_HTML;
      goog.editor.range.selectNodeStart(pasteCell);
    } else {
      if (!range) {
        editor.placeCursorAtEnd();
        range = editor.getRange();
        if (!range) {
          return false;
        }
      } else {
        if (!range.isCollapsed()) {
          editor.execCommand("delete", "selection", {smart:false});
          editor.context.format = uno.defs.format.CLIPBOARD;
          range = editor.getRange();
        }
      }
    }
    editor.dispatchBeforeChange();
    var cleanedContent = editor.prepareContentsHtml.call(editor, opt.pasteValue, {});
    util.paste.adjustOptionsFromContent(opt, cleanedContent);
    return util.styles.withPendingStyles(editor, function(range_) {
      var link2, link = util.link.for(range_.getStartNode());
      var href = link && !util.link.atLinkBoundary(range_) && link.href;
      var marker = document.createTextNode("");
      range_.insertNode(marker);
      var p = util.paragraph.for(marker);
      var rightSide = goog.editor.node.splitDomTreeAt(marker, null, p);
      p.appendChild(marker);
      var f = rightSide;
      while (f && f.firstChild) {
        f = f.firstChild;
      }
      link2 = link && util.link.for(f);
      while (rightSide.firstChild) {
        p.appendChild(rightSide.firstChild);
      }
      goog.array.forEach(p.children, function(child) {
        if (dom.isInlineWrapper(child) && dom.isSeeminglyEmpty(child)) {
          p.removeChild(child);
        }
      });
      if (opt.matchStyle) {
        cleanedContent = util.paste.plain.getContent(util.copy.plain.copy(dom.nodeFromHtml(cleanedContent)));
      }
      var startRange = goog.dom.Range.createCaret(marker.parentNode, dom.index(marker));
      marker.remove();
      var pasteRange = util.paste.paste(dom.nodeFromHtml(cleanedContent), startRange, {editor:editor, enclipboard:opt.enclipboard, matchStyle:opt.matchStyle || opt.unstyled});
      uno.util.drop.handlePaste(editor);
      if (!pasteRange) {
        return {result:false};
      }
      if (href) {
        editor.getRange().insertNode(marker);
        goog.dom.Range.createFromNodes(link.parentNode, util.dom.index(link), link2.parentNode, util.dom.index(link2) + 1).select();
        editor.execCommand("createlink", href);
        goog.dom.Range.createCaret(marker.parentNode, dom.index(marker)).select();
        marker.remove();
      }
      var savedRange = editor.saveRange();
      editor.field.normalize();
      editor.dispatchChange();
      editor.restoreRange(savedRange);
      util.range.scrollSelectionIntoView(editor);
      if (opt.select) {
        pasteRange.moveToNodes(startRange.getStartNode(), startRange.getStartOffset(), pasteRange.getEndNode(), pasteRange.getEndOffset());
        pasteRange.select();
      }
      if (pasteRange) {
        editor.dispatchEvent({type:uno.Editor.EventType.DOM_UPDATE, range:pasteRange, paste:true});
      }
      return {result:true, dontApplyStyles:true};
    });
  };
  Paste.prototype.handleBeforeExecCommand = function(event) {
    if (event.command === "paste") {
      var ed = this.editor;
      var prepasteRange = ed.context.prepasteRange;
      if (prepasteRange && ed.getRange().isCollapsed() && !prepasteRange.isCollapsed()) {
        prepasteRange.select();
        ed.context.prepasteRange = undefined;
      }
    }
  };
})();
goog.provide("uno.util.formatting");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.util.dom");
goog.require("uno.util.normalize");
goog.require("uno.util.paragraph");
goog.require("uno.util.table.selection");
goog.require("uno.util.copy.plain");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.formatting");
  var util = uno.util;
  util.formatting.simplifyFormatting = function(editor, node) {
    return util.normalize.normalizeNode(node, {editor:editor, partial:true, simplifyFormat:true});
  };
  util.formatting.removeFormatting = function(editor, node) {
    return util.normalize.normalizeNode(node, {editor:editor, removeFormat:true});
  };
  util.formatting.makePlainText = function(editor, node) {
    if (util.dom.isTextNode(node)) {
      return node;
    }
    var newNodes = [];
    var plainText = goog.string.htmlEscape(util.copy.plain.copy(node.cloneNode(true))).replace(/ {2}/g, " &nbsp;");
    if (plainText.indexOf("\n") > -1 || util.dom.isBlockOrInlineBlockNode(node)) {
      plainText = plainText.split("\n").forEach(function(line) {
        var div = goog.dom.createDom("div", null);
        div.innerHTML = line.trim() ? line : "<br>";
        newNodes.push(div);
      });
    } else {
      var span = goog.dom.createDom("span", null);
      span.innerHTML = plainText;
      newNodes.push(span);
    }
    if (node === editor.field || util.dom.isTd(node) || util.dom.isLi(node)) {
      node.innerHTML = "";
      goog.array.forEach(newNodes, function(newNode) {
        goog.dom.appendChild(node, newNode);
      });
    } else {
      if (util.list.isList(node.parentNode)) {
        var prev = node;
        do {
          prev = goog.dom.getPreviousElementSibling(prev);
        } while (prev !== null && !util.dom.isLi(prev));
        if (prev) {
          goog.array.forEach(newNodes, function(newNode) {
            goog.dom.appendChild(prev, newNode);
          });
        } else {
          goog.array.forEach(newNodes, function(newNode) {
            goog.dom.insertSiblingBefore(newNode, node.parentNode);
          });
        }
        goog.dom.removeNode(node);
      } else {
        goog.array.forEachRight(newNodes, function(newNode) {
          goog.dom.insertSiblingAfter(newNode, node);
        });
        goog.dom.removeNode(node);
      }
    }
    return newNodes;
  };
  util.formatting.processFormattingOnSelection = function(editor, fnProcessNode, fnFinalizeProcess) {
    var selection = editor.getSelection();
    var hasSelection = selection && !selection.collapsed;
    if (!hasSelection && editor.multirange.isInvoking()) {
      return false;
    }
    var processedNodes = [];
    var result;
    if (!hasSelection) {
      result = fnProcessNode(editor, editor.field);
      if (result) {
        processedNodes = processedNodes.concat(result);
      }
    } else {
      var end = splitAtMark(selection.end, true);
      var start = splitAtMark(selection.start, false);
      if (!end || !editor.field.contains(end) || util.dom.isBefore(end, start)) {
        end = start;
      }
      var newRange = goog.dom.Range.createFromNodes(start, 0, end, util.dom.isTextNode(end) ? end.length : end.childNodes.length);
      newRange.select();
      var processIfInRange = function(child) {
        if (!util.dom.isRenderedDOMNode(child)) {
          return;
        }
        if (newRange.containsNode(child)) {
          if (goog.dom.getAncestor(child, util.dom.isEntable) && !goog.dom.getAncestor(child, util.dom.isTd)) {
            result = fnProcessNode(editor, goog.dom.getAncestor(child, util.dom.isEntable));
          } else {
            result = fnProcessNode(editor, child);
          }
          if (result) {
            processedNodes = processedNodes.concat(result);
          }
        } else {
          if (newRange.containsNode(child, true)) {
            goog.array.forEachRight(child.childNodes, processIfInRange);
          }
        }
      };
      processIfInRange(newRange.getContainerElement());
    }
    processedNodes = processedNodes.filter(function(el) {
      return el.parentNode;
    }).sort(function(a, b) {
      return util.dom.isBefore(a, b) ? -1 : 1;
    });
    if (processedNodes.length >= 1) {
      var finalStartNode = processedNodes[0];
      var finalEndNode = processedNodes[processedNodes.length - 1];
      var finalRange = goog.dom.Range.createFromNodes(finalStartNode.parentNode, util.dom.index(finalStartNode), finalEndNode.parentNode, util.dom.index(finalEndNode) + 1);
      finalRange = util.range.normalize(finalRange);
      if (finalRange && finalRange.select) {
        finalRange.select();
      }
    }
    if (typeof fnFinalizeProcess === "function") {
      fnFinalizeProcess(editor);
    }
    if (!hasSelection) {
      editor.placeCursorAtEnd();
    }
    return true;
  };
  function splitAtMark(mark, isEnd) {
    var frag, leaf, trunk;
    trunk = mark.target;
    while (trunk.parentNode !== mark.paragraph) {
      trunk = trunk.parentNode;
    }
    if (mark.isText) {
      leaf = mark.target.splitText(mark.offset);
      frag = goog.editor.node.splitDomTreeAt(mark.target, null, trunk);
      if (frag) {
        goog.dom.insertSiblingAfter(frag, trunk);
      }
      leaf = isEnd ? mark.target : leaf;
      trunk = isEnd ? trunk : frag || leaf;
    } else {
      frag = goog.editor.node.splitDomTreeAt(mark.target, isEnd ? null : mark.target, trunk);
      if (frag) {
        goog.dom.insertSiblingAfter(frag, trunk);
      }
      leaf = mark.target;
      trunk = isEnd ? trunk : frag;
    }
    if (!trunk) {
      trunk = mark.paragraph;
    }
    while (leaf !== trunk.parentNode) {
      if (leaf.previousSibling && util.dom.isEmpty(leaf.previousSibling)) {
        goog.dom.removeNode(leaf.previousSibling);
      }
      if (leaf.nextSibling && util.dom.isEmpty(leaf.nextSibling)) {
        goog.dom.removeNode(leaf.nextSibling);
      }
      leaf = leaf.parentNode;
    }
    return trunk;
  }
})();
goog.provide("uno.commands.PlainText");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.formatting");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.PlainText");
  var util = uno.util;
  var PlainText = uno.commands.PlainText = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(PlainText, uno.BasePlugin);
  PlainText.prototype.isSupportedCommand = function(command) {
    return command === "plaintext";
  };
  PlainText.prototype.activeOnUneditableFields = goog.functions.TRUE;
  PlainText.prototype.execCommandInternal = function() {
    this.editor.enterEditMode({range:true});
    util.formatting.processFormattingOnSelection(this.editor, util.formatting.makePlainText, function(editor) {
      editor.execCommand("fontname", editor.config.defaults.plainTextFont);
    });
  };
})();
goog.provide("uno.commands.PrintPreview");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.dom.classlist");
goog.require("goog.functions");
goog.require("goog.object");
goog.require("goog.array");
goog.require("goog.style");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
goog.require("uno.util.todo");
(function() {
  var util = uno.util;
  var log = goog.debug.Logger.getLogger("uno.commands.PrintPreview");
  var previousPreviewContainer;
  var PrintPreview = uno.commands.PrintPreview = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(PrintPreview, uno.BasePlugin);
  PrintPreview.CONTAINER_ID = "print-container";
  PrintPreview.HEADER_TITLE_ID = "header-title";
  PrintPreview.HEADER_TABLE_ID = "header-table";
  PrintPreview.HEADER_LABEL_CLASS = "header-table-label";
  PrintPreview.HEADER_TEXT_CLASS = "header-table-text";
  PrintPreview.PRINT_INSERT_CLASS = "en-print";
  PrintPreview.CHECKBOX_CLASS = "checkbox";
  PrintPreview.CHECKED_CLASS = "checked";
  PrintPreview.PDF_CLASS = "pdf";
  PrintPreview.AUDIO_CLASS = "audio";
  PrintPreview.GENERIC_ATTACHMENT_CLASS = "generic-attachment";
  PrintPreview.HTML_PRINT_CLASS = "printing";
  PrintPreview.prototype.isSupportedCommand = function(command) {
    return command === "printpreview";
  };
  PrintPreview.prototype.activeOnUneditableFields = goog.functions.TRUE;
  PrintPreview.prototype.execCommand = function(command, localization, options) {
    var field = this.editor.field;
    var parsedLocalization = parseLocalization(localization);
    var parsedOptions = parseOptions(options);
    if (parsedOptions.disable) {
      this.disable();
      return true;
    }
    var previewContainer = goog.dom.createDom("div", {id:PrintPreview.CONTAINER_ID, class:PrintPreview.PRINT_INSERT_CLASS});
    var addMetadata = !!parsedOptions && Object.keys(parsedOptions).some(function(key) {
      return key !== "title" && parsedOptions[key] != null;
    });
    if (addMetadata) {
      var metaDataHeader = generateMetadataHeader(parsedOptions, parsedLocalization);
      previewContainer.appendChild(metaDataHeader);
      var hr = goog.dom.createDom("hr");
      previewContainer.appendChild(hr);
      previewContainer.appendChild(createGap());
    }
    var titleText = parsedOptions && parsedOptions.title;
    if (titleText) {
      var title = createTitle(titleText);
      previewContainer.appendChild(title);
      previewContainer.appendChild(createGap());
    }
    var note = copyNote(field);
    replaceEmbeds(note, parsedLocalization);
    replaceTodos(note);
    previewContainer.innerHTML = previewContainer.innerHTML + note.innerHTML;
    field.style.display = "none";
    if (previousPreviewContainer) {
      goog.dom.replaceNode(previewContainer, previousPreviewContainer);
    } else {
      goog.dom.append(field.parentElement, previewContainer);
    }
    previousPreviewContainer = previewContainer;
    if (!this.editor.config.disableBackgroundPrint) {
      goog.dom.classlist.add(document.querySelector("html"), PrintPreview.HTML_PRINT_CLASS);
    }
    this.editor.dispatchEvent("printReady");
    return true;
  };
  PrintPreview.prototype.queryCommandValue = function() {
    return util.dom.isVisibleInView(document.getElementById("print-container"));
  };
  PrintPreview.prototype.disposeInternal = function() {
    this.disable();
  };
  PrintPreview.prototype.disable = function() {
    var field = this.editor && this.editor.field;
    if (field) {
      field.style.display = "";
    }
    if (previousPreviewContainer) {
      goog.dom.removeNode(previousPreviewContainer);
    }
    previousPreviewContainer = null;
    goog.dom.classlist.remove(document.querySelector("html"), PrintPreview.HTML_PRINT_CLASS);
  };
  function generateMetadataHeader(options, localization) {
    var table, tr, td, row, col, toInsert, tds, span1, span2;
    table = goog.dom.createDom("table", {id:PrintPreview.HEADER_TABLE_ID, class:PrintPreview.PRINT_INSERT_CLASS});
    for (row = 0; row < 4; row++) {
      tr = goog.dom.createDom("tr");
      table.appendChild(tr);
      for (col = 0; col < 2; col++) {
        td = goog.dom.createDom("td");
        tr.appendChild(td);
      }
    }
    toInsert = [[localization.author, "author"], [localization.notebook, "notebook"], [localization.created, "created"], [localization.tags, "tags"], [localization.updated, "updated"], [localization.url, "url"], [localization.deleted, "deleted"], [localization.location, "location"]];
    tds = table.querySelectorAll("td");
    toInsert.forEach(function(data, i) {
      if (options[data[1]] === null) {
        return;
      }
      tds[i].innerHTML = "";
      span1 = goog.dom.createDom("span", {class:PrintPreview.HEADER_LABEL_CLASS});
      span1.textContent = data[0];
      span2 = goog.dom.createDom("span", {class:PrintPreview.HEADER_TEXT_CLASS});
      span2.textContent = " " + options[data[1]];
      tds[i].appendChild(span1);
      tds[i].appendChild(span2);
    });
    return table;
  }
  function parseOptions(options) {
    var defaultOptions = {title:null, notebook:null, created:null, updated:null, deleted:null, author:null, location:null, tags:null, url:null};
    if (typeof options === "string") {
      try {
        options = JSON.parse(options);
      } catch (e) {
        return defaultOptions;
      }
    }
    var parsedOptions = goog.object.clone(options || {});
    goog.object.extend(defaultOptions, parsedOptions);
    return defaultOptions;
  }
  function parseLocalization(localization) {
    var defaultLocalization = {notebook:"Notebook:", created:"Created:", updated:"Updated:", deleted:"Deleted:", author:"Author:", location:"Location:", tags:"Tags:", url:"Source:", pdf_file:"PDF File", audio_file:"Audio File", generic_file:"Generic File"};
    if (typeof localization === "string") {
      try {
        localization = JSON.parse(localization);
      } catch (e) {
        return defaultLocalization;
      }
    }
    var parsedLocalization = goog.object.clone(localization || {});
    goog.object.extend(defaultLocalization, parsedLocalization);
    return defaultLocalization;
  }
  function createGap() {
    return goog.dom.createDom("br", {class:PrintPreview.PRINT_INSERT_CLASS});
  }
  function createTitle(title) {
    var header = goog.dom.createDom("div", {id:PrintPreview.HEADER_TITLE_ID, class:PrintPreview.PRINT_INSERT_CLASS});
    header.textContent = title;
    return header;
  }
  function copyNote(noteElement) {
    if (!noteElement) {
      log.warning("Could not find note!");
      return document.createElement("div");
    }
    var clonedNote = noteElement.cloneNode(true);
    goog.array.forEach(clonedNote.childNodes, function(node) {
      if (node.nodeType !== Node.TEXT_NODE) {
        goog.dom.classlist.add(node, PrintPreview.PRINT_INSERT_CLASS);
      }
    });
    return clonedNote;
  }
  function replaceEmbeds(note, localization) {
    goog.array.forEach(note.querySelectorAll("embed"), function(embed) {
      var replacement = goog.dom.createDom("div", {class:PrintPreview.PRINT_INSERT_CLASS});
      var embedName = embed.getAttribute("data-filename");
      switch(embed.getAttribute("type")) {
        case "evernote/x-pdf":
          goog.dom.classlist.add(replacement, PrintPreview.PDF_CLASS);
          replacement.textContent = embedName || localization.pdf_file;
          break;
        case "evernote/x-attachment":
          var id = embed.getAttribute("id");
          var dataType = embed.getAttribute("data-type");
          if (id && id.match(/.*en-media:audio.*/) || dataType && dataType.match(/.*audio.*/)) {
            goog.dom.classlist.add(replacement, PrintPreview.AUDIO_CLASS);
            replacement.textContent = embedName || localization.audio_file;
          } else {
            goog.dom.classlist.add(replacement, PrintPreview.GENERIC_ATTACHMENT_CLASS);
            replacement.textContent = embedName || localization.generic_file;
          }
          break;
        default:
          log.warning("Found <embed> with unknown type! " + embed);
          goog.dom.classlist.add(replacement, PrintPreview.GENERIC_ATTACHMENT_CLASS);
          replacement.textContent = localization.generic_file;
      }
      goog.dom.replaceNode(replacement, embed);
    });
  }
  function replaceTodos(note) {
    goog.array.forEach(util.todo.all(note), function(todo) {
      var replacement = goog.dom.createDom("div", {class:PrintPreview.PRINT_INSERT_CLASS + " " + PrintPreview.CHECKBOX_CLASS});
      if (util.todo.isChecked(todo)) {
        goog.dom.classlist.add(replacement, PrintPreview.CHECKED_CLASS);
      }
      goog.dom.replaceNode(replacement, todo);
    });
  }
})();
goog.provide("uno.commands.Redo");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Redo");
  var Redo = uno.commands.Redo = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Redo, uno.BasePlugin);
  Redo.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Redo.prototype.isSupportedCommand = function(command) {
    return command === "redo";
  };
  Redo.prototype.execCommand = function() {
    if (this.editor.realtime && this.editor.realtime.y.undoManager) {
      return this.editor.realtime.y.undoManager.redo();
    }
    var formField = this.editor.getFormField();
    var result = false;
    if (formField) {
    } else {
      result = this.editor.execCommand(goog.editor.Command.REDO);
    }
    return result;
  };
  Redo.prototype.queryCommandValue = function() {
    return !!this.editor.queryCommandValue(goog.editor.Command.REDO);
  };
})();
goog.provide("uno.commands.RemoveFormat");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.formatting");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.RemoveFormat");
  var util = uno.util;
  var RemoveFormat = uno.commands.RemoveFormat = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(RemoveFormat, uno.BasePlugin);
  RemoveFormat.prototype.isSupportedCommand = function(command) {
    return command === "removeformat";
  };
  RemoveFormat.prototype.activeOnUneditableFields = goog.functions.TRUE;
  RemoveFormat.prototype.execCommandInternal = function() {
    this.editor.enterEditMode({range:true});
    util.formatting.processFormattingOnSelection(this.editor, util.formatting.removeFormatting);
  };
})();
goog.provide("uno.commands.Resources");
goog.require("goog.debug.Logger");
goog.require("goog.editor.range");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.img");
goog.require("uno.util.resource");
goog.require("uno.util.structure");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Resources");
  var resourcesLog = goog.debug.Logger.getLogger("resources");
  var util = uno.util;
  var Resources = uno.commands.Resources = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Resources, uno.BasePlugin);
  Resources.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Resources.prototype.isSupportedCommand = function(command) {
    return command === "resources";
  };
  Resources.prototype.execCommand = function(command, value) {
    var me = this;
    var editor = this.editor;
    var startedInEditMode = editor.inEditMode();
    var hasChanges = false;
    var hasInserts = false;
    if (!goog.isArray(value)) {
      value = [value];
    }
    hasChanges = value.some(function(dict) {
      if (dict.action === "insert" || dict.action === "delete") {
        return true;
      } else {
        if (dict.action === "update") {
          return goog.array.some(me.findElementsForDict(dict), function(el) {
            var existing = util.resource.dictFromElement(el);
            return dict.filename != null && dict.filename !== existing.filename || dict.filesize != null && dict.filesize !== existing.filesize || dict.hash != null && dict.hash !== existing.hash || dict.mime != null && dict.mime !== existing.mime || dict.url != null && dict.url !== existing.url;
          });
        }
      }
      return false;
    });
    hasInserts = value.some(function(dict) {
      return dict.action === "insert";
    });
    if (hasChanges) {
      editor.dispatchBeforeChange();
    }
    if (!startedInEditMode && hasInserts) {
      editor.enterEditMode({range:true});
    }
    var resourcesToAdd = [];
    value.forEach(function(dict) {
      if (dict.action === "insert") {
        if (dict.pos === "bottom") {
          editor.placeCursorAtEnd();
        }
        resourcesToAdd.push(me.add(dict));
      } else {
        if (dict.action === "update") {
          me.update(dict);
        } else {
          if (dict.action === "delete") {
            me.remove(dict);
          }
        }
      }
    });
    if (resourcesToAdd.length > 0) {
      var scrollTarget = resourcesToAdd[resourcesToAdd.length - 1];
      var scrollAfterLoad = util.resource.isImage(scrollTarget);
      var imagesToAdd = resourcesToAdd.filter(util.resource.isImage);
      var addResourcesPromise = imagesToAdd.map(util.img.ratioResizeIfNeeded);
      Promise.all(addResourcesPromise).then(function(resizes) {
        if (!document.body.contains(scrollTarget)) {
          return;
        }
        var shouldDispatchChange = resizes.some(function(img) {
          return !!img;
        });
        if (shouldDispatchChange) {
          editor.dispatchChange();
        }
        if (scrollAfterLoad) {
          scrollTarget.scrollIntoView();
        }
      });
      if (!scrollAfterLoad) {
        goog.editor.range.placeCursorNextTo(scrollTarget);
        scrollTarget.scrollIntoView();
      }
    }
    if (!startedInEditMode && hasInserts) {
      editor.blur();
    }
    if (hasChanges) {
      editor.dispatchChange();
    }
    return hasChanges;
  };
  Resources.prototype.add = function(dict) {
    var editor = this.editor;
    var enmedia = util.resource.createMediaFromDict(dict);
    var slug = util.resource.convertMediaToSlug(enmedia, dict, editor);
    editor.restoreRange(editor.getRange());
    var range = editor.getRange();
    if (!util.range.isInNote(editor, range)) {
      editor.placeCursorAtEnd();
    }
    var ref = dict.beforeRef || dict.afterRef;
    var refNode = dict.beforeRef || dict.afterRef ? util.resource.findByRef(ref, editor.field) : null;
    if (refNode) {
      if (dict.beforeRef) {
        goog.dom.insertSiblingBefore(slug, refNode);
      } else {
        goog.dom.insertSiblingAfter(slug, refNode);
      }
    } else {
      if (range && !util.dom.isEmpty(util.paragraph.for(range.getStartNode()))) {
        editor.execCommand("insertparagraph");
      }
      switch(dict.justify) {
        case "left":
        case "center":
        case "right":
          editor.execCommand("justify" + dict.justify);
          break;
        default:
      }
      resourcesLog.info(JSON.stringify({client:"ce_" + editor.config.client, note_guid:editor.config.note.guid, resource_hash:slug.getAttribute("data-hash"), action:"inserting resource slug: " + slug.tagName}));
      util.styles.withPendingStyles(editor, function(range_) {
        range_.insertNode(slug);
        if (util.dom.isBr(slug.nextSibling)) {
          goog.dom.removeNode(slug.nextSibling);
        }
        if (util.dom.isBr(slug.previousSibling)) {
          goog.dom.removeNode(slug.previousSibling);
        }
        return {node:slug};
      });
      goog.editor.range.placeCursorNextTo(slug);
    }
    return slug;
  };
  Resources.prototype.update = function(dict) {
    var elements;
    var enmedia;
    var slug;
    var editor = this.editor;
    elements = this.findElementsForDict(dict);
    goog.array.forEach(elements, function(el) {
      var combodict = {};
      goog.object.extend(combodict, util.resource.dictFromElement(el), dict);
      enmedia = util.resource.createMediaFromDict(combodict);
      slug = util.resource.convertMediaToSlug(enmedia, combodict, editor);
      if (el.outerHTML !== slug.outerHTML) {
        resourcesLog.info(JSON.stringify({client:"ce_" + editor.config.client, note_guid:editor.config.note.guid, resource_hash:slug.getAttribute("data-hash"), action:"updating resource slug: " + slug.tagName}));
      }
      if (slug !== el) {
        if (editor.config.realtime.enabled) {
          var domBinding = editor.realtime.y.domBinding;
          Y.DomBinding.switchAssociation(domBinding, el, slug);
        }
        goog.dom.insertSiblingBefore(slug, el);
        goog.dom.removeNode(el);
      }
    });
  };
  Resources.prototype.remove = function(dict) {
    var elements = this.findElementsForDict(dict);
    var editor = this.editor;
    goog.array.forEach(elements, function(el) {
      var par = util.paragraph.for(el);
      resourcesLog.info(JSON.stringify({client:"ce_" + editor.config.client, note_guid:editor.config.note.guid, resource_hash:el.getAttribute("data-hash"), action:"removing resource slug: " + el.tagName}));
      goog.dom.removeNode(el);
      if (util.dom.isEmpty(par)) {
        par.innerHTML = "<br>";
      }
    });
  };
  Resources.prototype.findElementsForDict = function(dict) {
    var elements;
    var el;
    if (dict.reference) {
      el = util.resource.findByRef(dict.reference, this.editor.field);
      elements = [];
      if (el) {
        elements.push(el);
      }
    } else {
      if (dict.originalURL) {
        elements = util.resource.findByURL(dict.originalURL, this.editor.field);
      } else {
        elements = util.resource.findByHash(dict.hash, this.editor.field);
      }
    }
    return elements;
  };
  Resources.prototype.queryCommandValue = function(command, opt) {
    var editor = this.editor;
    var range = editor.getRange();
    var sibling;
    var list = goog.array.map(util.resource.all(editor.field), function(el) {
      var dict = util.resource.toDict(el, range);
      if (opt === "neighbors") {
        sibling = el.previousElementSibling;
        if (util.resource.isResource(sibling)) {
          dict.prevNeighbour = util.resource.toDict(sibling, range);
        }
        sibling = el.nextElementSibling;
        if (util.resource.isResource(sibling)) {
          dict.nextNeighbour = util.resource.toDict(sibling, range);
        }
      }
      return dict;
    });
    var obj = {};
    list.forEach(function(item) {
      obj[item.hash] = {hash:item.hash, url:item.url, mime:item.mime, filename:item.filename, filesize:item.filesize};
    });
    goog.object.extend(editor.context.resources, obj);
    return list;
  };
  Resources.prototype.queryCommandEnabled = function(command, value) {
    if (!goog.isArray(value)) {
      value = [value];
    }
    var hasInsert = value.some(function(dict) {
      return dict.action === "insert";
    });
    if (hasInsert) {
      var range = this.editor.getRange();
      return range && util.structure.itemAllowed(uno.defs.structuretypes.RESOURCE, range.getContainer());
    }
    return true;
  };
})();
goog.provide("uno.commands.RichlinksConvert");
goog.require("uno.BasePlugin");
goog.require("uno.util.richlink");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.RichlinksConvert");
  var RichlinksConvert = uno.commands.RichlinksConvert = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(RichlinksConvert, uno.BasePlugin);
  RichlinksConvert.prototype.isSupportedCommand = function(command) {
    return command === "richlinks.convert";
  };
  RichlinksConvert.prototype.execCommandInternal = function() {
    uno.util.dom.queryReverse(uno.defs.richlink.ANCHOR_ELEMENT_SELECTOR, document.body).forEach(function(node) {
      uno.util.richlink.handleLink(node, true);
      RichlinksConvert.editor.dispatchEvent({type:uno.Editor.EventType.DELAYEDCHANGE});
    });
  };
})();
goog.provide("uno.commands.RichlinksRefresh");
goog.require("uno.BasePlugin");
goog.require("uno.util.richlink");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.RichlinksRefresh");
  var RichlinksRefresh = uno.commands.RichlinksRefresh = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(RichlinksRefresh, uno.BasePlugin);
  RichlinksRefresh.prototype.isSupportedCommand = function(command) {
    return command === "richlinks.refresh";
  };
  RichlinksRefresh.prototype.execCommandInternal = function() {
  };
})();
goog.provide("uno.commands.Search");
goog.require("goog.array");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.dom.Range");
goog.require("goog.events.KeyCodes");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
goog.require("uno.util.loc");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Search");
  var util = uno.util;
  var KeyCodes = goog.events.KeyCodes;
  var ENTER = KeyCodes.ENTER;
  var TAB = KeyCodes.TAB;
  var ESC = KeyCodes.ESC;
  var Search = uno.commands.Search = function() {
    uno.BasePlugin.call(this, log.getName());
    this.panel = null;
    this.timer = null;
    this.index = 0;
    this.items = [];
  };
  goog.inherits(Search, uno.BasePlugin);
  Search.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Search.prototype.isSupportedCommand = function(command) {
    return command === "search";
  };
  Search.prototype.execCommand = function(command, show) {
    if (!this.panel) {
      this.createPanel();
    }
    if (show === false) {
      this.hide();
    } else {
      this.show();
    }
  };
  Search.prototype.queryCommandValue = function() {
    return this.find(this.getFindTerm());
  };
  Search.prototype.queryCommandEnabled = function() {
    return true;
  };
  Search.prototype.disposeInternal = function() {
    this.hide();
  };
  Search.prototype.onSearchFocus = function(event) {
    this.index = 0;
    this.find(this.getFindTerm());
  };
  Search.prototype.onCloseClick = function(event) {
    this.clearHighlights();
    this.hide();
  };
  Search.prototype.onFindNextClick = function(event) {
    if (this.items.length > 0) {
      this.index = this.index === this.items.length - 1 ? 0 : this.index + 1;
      this.highlight();
    }
  };
  Search.prototype.onFindPrevClick = function(event) {
    if (this.items.length > 0) {
      this.index = this.index === 0 ? this.items.length - 1 : this.index - 1;
      this.highlight();
    }
  };
  Search.prototype.onReplaceClick = function(event) {
    this.replace();
  };
  Search.prototype.onReplaceAllClick = function(event) {
    this.replace(true);
  };
  Search.prototype.onFindInput = function(event) {
    clearTimeout(this.timer);
    this.timer = setTimeout(this.find.bind(this, event.target.value), event.target.value ? 200 : 0);
  };
  Search.prototype.onFindKeyDown = function(event) {
    if (event.keyCode === ENTER || event.keyCode === TAB) {
      this.find(event.target.value);
    }
    this.onPanelKeyDown(event);
  };
  Search.prototype.onPanelKeyDown = function(event) {
    if (event.keyCode === ESC) {
      this.onCloseClick(event);
    } else {
      if (event.keyCode === ENTER && event.shiftKey) {
        this.onReplaceAllClick(event);
      }
    }
  };
  Search.prototype.onFindCaseCheckboxChanged = function(event) {
    this.index = 0;
    this.find(this.getFindTerm());
  };
  Search.prototype.show = function() {
    document.body.appendChild(this.panel);
    this.panel.querySelector(".en-find-input").focus();
  };
  Search.prototype.hide = function() {
    if (this.timer) {
      clearTimeout(this.timer);
    }
    this.index = 0;
    this.items = [];
    if (this.panel) {
      this.panel.querySelector(".en-find-input").value = null;
      this.panel.querySelector(".en-replace-input").value = null;
      this.panel.querySelector(".en-status-row").innerHTML = "";
      goog.dom.removeNode(this.panel);
    }
  };
  Search.prototype.find = function(term) {
    var result = term ? this.editor.queryCommandValue("find", {value:term, caseSensitive:this.getCaseSensitive(), includeRangeInfo:true}) : null;
    if (result && result.items) {
      this.items = result.items;
    } else {
      this.items = [];
      this.index = 0;
    }
    this.highlight();
    return result;
  };
  Search.prototype.replace = function(all) {
    var editor = this.editor;
    var term = this.getReplaceTerm();
    var items = all ? this.items : [this.items[this.index]];
    var replaced = false;
    goog.array.forEachRight(items, function(matches) {
      goog.array.forEachRight(matches, function(item) {
        var info = item.rangeInfo;
        if (util.dom.isTextNode(info.startNode) && info.startNode === info.endNode) {
          info.startNode.replaceData(info.startOffset, info.endOffset - info.startOffset, term);
          replaced = true;
        } else {
          var range = document.createRange();
          range.setStart(info.startNode, info.startOffset);
          range.setEnd(info.endNode, info.endOffset);
          var selection = window.getSelection();
          if (selection.rangeCount > 0) {
            selection.removeAllRanges();
          }
          selection.addRange(range);
          editor.execCommand("paste", {type:"plain", value:term});
        }
      });
    });
    if (replaced) {
      this.editor.dispatchChange();
    }
    if (this.index === this.items.length - 1) {
      this.index = 0;
    }
    this.find(this.getFindTerm());
  };
  Search.prototype.highlight = function() {
    this.editor.execCommand("accentuate", {clearFirst:true, boxes:this.items, selectedBoxIndex:this.index});
    this.updateStatus();
  };
  Search.prototype.clearHighlights = function() {
    this.editor.execCommand("accentuate", {clearFirst:true});
    this.updateStatus();
  };
  Search.prototype.getCaseSensitive = function() {
    if (this.panel) {
      return !!this.panel.querySelector(".en-find-case-checkbox").checked;
    } else {
      return false;
    }
  };
  Search.prototype.getFindTerm = function() {
    if (this.panel) {
      return this.panel.querySelector(".en-find-input").value;
    }
  };
  Search.prototype.getReplaceTerm = function() {
    if (this.panel) {
      return this.panel.querySelector(".en-replace-input").value || "";
    }
  };
  Search.prototype.updateStatus = function() {
    var status = this.panel && this.panel.querySelector(".en-status-row");
    var term = this.getFindTerm();
    if (status) {
      if (term) {
        if (this.items.length > 0) {
          status.innerHTML = [util.loc.t("Match"), this.index + 1, util.loc.t("of"), this.items.length].join(" ");
        } else {
          status.innerHTML = util.loc.t("No matches found");
        }
      } else {
        status.innerHTML = "";
      }
    }
  };
  Search.prototype.createPanel = function() {
    this.panel = goog.dom.createDom("en-search", null, [goog.dom.createDom("div", ["en-search-controls"], [goog.dom.createDom("div", ["en-search-row", "en-find-row"], [goog.dom.createDom("button", "en-search-close-btn"), goog.dom.createDom("input", {type:"text", placeholder:util.loc.t("Find text in note"), class:"en-search-input en-find-input", tabIndex:"10001"}), goog.dom.createDom("button", "en-find-next-btn", util.loc.t("Next")), goog.dom.createDom("button", "en-find-prev-btn", util.loc.t("Previous")), 
    goog.dom.createDom("input", {type:"checkbox", className:"en-find-case-checkbox"}), goog.dom.createDom("span", "en-find-match-case-text", util.loc.t("Match case"))]), goog.dom.createDom("div", ["en-search-row", "en-replace-row"], [goog.dom.createDom("input", {type:"text", placeholder:util.loc.t("Replace with"), class:"en-search-input en-replace-input", tabIndex:"10002"}), goog.dom.createDom("button", "en-replace-btn", util.loc.t("Replace")), goog.dom.createDom("button", "en-replace-all-btn", util.loc.t("Replace All"))])]), 
    goog.dom.createDom("div", ["en-search-row", "en-status-row"])]);
    this.editor.eventRegister.listenWithScope(this.panel, "focus", this.onSearchFocus, false, this);
    this.editor.eventRegister.listenWithScope(this.panel.querySelector(".en-find-input"), "input", this.onFindInput, false, this);
    this.editor.eventRegister.listenWithScope(this.panel.querySelector(".en-find-input"), "paste", this.onFindInput, false, this);
    this.editor.eventRegister.listenWithScope(this.panel.querySelector(".en-find-input"), "keydown", this.onFindKeyDown, false, this);
    this.editor.eventRegister.listenWithScope(this.panel.querySelector(".en-search-close-btn"), "click", this.onCloseClick, false, this);
    this.editor.eventRegister.listenWithScope(this.panel.querySelector(".en-find-next-btn"), "click", this.onFindNextClick, false, this);
    this.editor.eventRegister.listenWithScope(this.panel.querySelector(".en-find-prev-btn"), "click", this.onFindPrevClick, false, this);
    this.editor.eventRegister.listenWithScope(this.panel.querySelector(".en-find-case-checkbox"), "change", this.onFindCaseCheckboxChanged, false, this);
    this.editor.eventRegister.listenWithScope(this.panel.querySelector(".en-replace-btn"), "click", this.onReplaceClick, false, this);
    this.editor.eventRegister.listenWithScope(this.panel.querySelector(".en-replace-all-btn"), "click", this.onReplaceAllClick, false, this);
    this.editor.eventRegister.listenWithScope(this.panel, "focusout", this.clearHighlights, false, this);
    this.editor.eventRegister.listenWithScope(this.panel, "keydown", this.onPanelKeyDown, false, this);
  };
})();
goog.provide("uno.commands.SelectAll");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.dom.Range");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.SelectAll");
  var dom = uno.util.dom;
  var SelectAll = uno.commands.SelectAll = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(SelectAll, uno.BasePlugin);
  SelectAll.SELECTOR = "en-note";
  SelectAll.prototype.isSupportedCommand = function(command) {
    return command === "selectall";
  };
  SelectAll.prototype.activeOnUneditableFields = goog.functions.TRUE;
  SelectAll.prototype.execCommand = function() {
    var currentRange = this.editor.getRange();
    if (dom.parent(currentRange.getContainerElement(), "en-search")) {
      currentRange.getContainerElement().querySelector("input[type=text]").select();
      return false;
    }
    var contentElement = goog.dom.getElement(SelectAll.SELECTOR);
    var range = goog.dom.Range.createFromNodeContents(contentElement);
    range.select();
    return true;
  };
  SelectAll.prototype.queryCommandValue = function() {
  };
})();
goog.provide("uno.commands.Selection");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.range");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Selection");
  var util = uno.util;
  var Selection = uno.commands.Selection = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Selection, uno.BasePlugin);
  Selection.prototype.isSupportedCommand = function(command) {
    return command === "selection";
  };
  Selection.prototype.execCommand = function(command, selectionPath) {
    try {
      var path = selectionPath;
      var startNode = getNodeFromPath(this.editor.field, path.startNode);
      var endNode = getNodeFromPath(this.editor.field, path.endNode);
      var range = goog.dom.Range.createFromNodes(startNode, path.startOffset, endNode, path.endOffset);
      this.editor.restoreRange(range);
      return true;
    } catch (err) {
      log.warning("could not restore the range");
      log.fine(err.stack || err);
      return false;
    }
  };
  Selection.prototype.queryCommandValue = function() {
    var range = this.editor.getRange();
    if (range) {
      var path = {startNode:getNodePath(range.getStartNode()), endNode:getNodePath(range.getEndNode()), startOffset:range.getStartOffset(), endOffset:range.getEndOffset(), collapsed:range.isCollapsed()};
      return path;
    }
    return "";
  };
  function getNodePath(node) {
    var path = [];
    goog.dom.getAncestor(node, function(element) {
      if (util.dom.isEnnote(element)) {
        return true;
      }
      path.unshift(util.dom.index(element));
      return false;
    }, true);
    return path;
  }
  function getNodeFromPath(root, path) {
    var node = root;
    path.forEach(function(index) {
      if (node.childNodes) {
        node = node.childNodes[index];
      }
    });
    return node;
  }
})();
goog.provide("uno.commands.SimpleText");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.formatting");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.SimpleText");
  var util = uno.util;
  var SimpleText = uno.commands.SimpleText = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(SimpleText, uno.BasePlugin);
  SimpleText.prototype.isSupportedCommand = function(command) {
    return command === "simpletext";
  };
  SimpleText.prototype.activeOnUneditableFields = goog.functions.TRUE;
  SimpleText.prototype.execCommandInternal = function() {
    this.editor.enterEditMode({range:true});
    util.formatting.processFormattingOnSelection(this.editor, util.formatting.simplifyFormatting);
  };
})();
goog.provide("uno.util.link");
goog.require("goog.debug.Logger");
(function() {
  var util = uno.util;
  util.link.all = function(root) {
    return root.childNodes.length ? Array.prototype.slice.call(root.querySelectorAll("a[href]")) : [];
  };
  util.link.isLink = function(node) {
    return util.dom.isA(node) && node.href && node.href.length;
  };
  util.link.for = function(node) {
    return goog.dom.getAncestor(node, util.link.isLink, true);
  };
  util.link.atLinkBoundary = function(range) {
    if (!range.isCollapsed()) {
      return false;
    }
    var node = range.getStartNode();
    var offset = range.getStartOffset();
    var link = util.link.for(node);
    if (!link) {
      return false;
    }
    while (offset === 0 && node !== link) {
      offset = util.dom.index(node);
      node = node.parentNode;
    }
    if (offset === 0 && node === link) {
      return true;
    }
    node = range.getStartNode();
    offset = range.getStartOffset();
    var length = util.dom.isTextNode(node) ? node.data.length : node.childNodes.length;
    while (offset === length && node !== link) {
      offset = util.dom.index(node) + 1;
      node = node.parentNode;
      length = util.dom.isTextNode(node) ? node.data.length : node.childNodes.length;
    }
    if (offset === length && node === link) {
      return true;
    }
    return false;
  };
})();
goog.provide("uno.commands.Stats");
goog.require("goog.array");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
goog.require("uno.util.link");
goog.require("uno.util.todo");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Stats");
  var util = uno.util;
  var Stats = uno.commands.Stats = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Stats, uno.BasePlugin);
  Stats.prototype.isSupportedCommand = function(command) {
    return command === "stats";
  };
  Stats.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Stats.prototype.queryCommandEnabled = goog.functions.TRUE;
  Stats.prototype.queryCommandValue = function() {
    var stats = {};
    stats.isEmpty = util.dom.isEmpty(this.editor.field);
    stats.isDirty = this.editor.queryCommandValue("changes");
    stats.isReadOnly = !!this.editor.readOnly;
    stats.isEditable = this.editor.inEditMode();
    stats.hasFocus = this.editor.isFocused();
    stats.todo = util.todo.all(this.editor.field).length;
    stats.link = util.link.all(this.editor.field).length;
    stats.firstLine = this.editor.field.innerText.trim().split("\n").shift();
    stats.selection = this.editor.queryCommandValue("selection");
    return stats;
  };
})();
goog.provide("uno.commands.Strikethrough");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.range");
goog.require("uno.defs");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Strikethrough");
  var Strikethrough = uno.commands.Strikethrough = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(Strikethrough, uno.BasePlugin);
  Strikethrough.prototype.isSupportedCommand = function(command) {
    return command === "strikethrough";
  };
  Strikethrough.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  Strikethrough.prototype.execCommand = function() {
    var range = this.editor.getRange();
    var underlined = this.editor.context.style.state.underline;
    if (!range.isCollapsed()) {
      var result = this.editor.execCommand(goog.editor.Command.STRIKE_THROUGH);
      this.editor.dispatchChange();
      this.editor.dispatchStyleChange();
      return result;
    }
    if (underlined) {
      document.execCommand("insertText", null, uno.defs.unicode.ZERO_WIDTH_SPACE);
      var updatedRange = this.editor.getRange();
      var node = updatedRange.getStartNode();
      var startOffset = updatedRange.getStartOffset();
      var newRange = goog.dom.Range.createFromNodes(node, startOffset - 1, node, startOffset);
      newRange.select();
      this.editor.execCommand(goog.editor.Command.STRIKE_THROUGH);
      newRange.collapse();
      newRange.select();
    } else {
      var currentState = this.editor.context.style.state.strikethrough;
      this.editor.execCommand(goog.editor.Command.STRIKE_THROUGH);
      this.editor.dispatchStyleChange({state:{strikethrough:!currentState, underline:underlined}, value:{}, enabled:{}});
    }
    return true;
  };
  Strikethrough.prototype.queryCommandValue = function() {
    return this.editor.queryCommandValue(goog.editor.Command.STRIKE_THROUGH);
  };
})();
goog.provide("uno.commands.Tab");
goog.require("goog.debug.Logger");
goog.require("goog.events.BrowserEvent");
goog.require("goog.events.KeyCodes");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Tab");
  var Tab = uno.commands.Tab = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Tab, uno.BasePlugin);
  Tab.prototype.isSupportedCommand = function(command) {
    return command === "tab";
  };
  Tab.prototype.execCommandInternal = function(command, options) {
    var event = document.createEvent("Event");
    var browserEvent = new goog.events.BrowserEvent(event);
    browserEvent.shiftKey = options === true;
    browserEvent.keyCode = goog.events.KeyCodes.TAB;
    this.editor.handleKeyDown_(browserEvent);
  };
  Tab.prototype.queryCommandValue = function() {
    return null;
  };
  Tab.prototype.queryCommandEnabled = function() {
    return true;
  };
})();
goog.provide("uno.commands.Underline");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.EditorMultiRange");
goog.require("uno.util.dom");
goog.require("uno.util.range");
goog.require("uno.defs");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Underline");
  var util = uno.util;
  var Underline = uno.commands.Underline = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(Underline, uno.BasePlugin);
  Underline.prototype.isSupportedCommand = function(command) {
    return command === "underline";
  };
  Underline.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  Underline.prototype.execCommand = function() {
    var range = this.editor.getRange();
    var strikethrough = this.editor.context.style.state.strikethrough;
    if (!range.isCollapsed()) {
      var result = this.editor.execCommand(goog.editor.Command.UNDERLINE);
      this.editor.dispatchChange();
      this.editor.dispatchStyleChange();
      return result;
    }
    if (strikethrough) {
      document.execCommand("insertText", null, uno.defs.unicode.ZERO_WIDTH_SPACE);
      var updatedRange = this.editor.getRange();
      var node = updatedRange.getStartNode();
      var startOffset = updatedRange.getStartOffset();
      var newRange = goog.dom.Range.createFromNodes(node, startOffset - 1, node, startOffset);
      newRange.select();
      this.editor.execCommand(goog.editor.Command.UNDERLINE);
      newRange.collapse();
      newRange.select();
    } else {
      var currentState = this.editor.context.style.state.underline;
      this.editor.execCommand(goog.editor.Command.UNDERLINE);
      this.editor.dispatchStyleChange({state:{underline:!currentState, strikethrough:strikethrough}, value:{}, enabled:{}});
    }
    return true;
  };
  Underline.prototype.queryCommandValue = function() {
    var range = this.editor.getRange();
    if (!range) {
      return "false";
    }
    var startNode = range.getStartNode();
    var a = util.dom.getAncestor(startNode, util.dom.isA, true);
    if (a) {
      return getComputedStyle(a.parentElement).textDecoration.indexOf("underline") > -1 ? "true" : "false";
    }
    return this.editor.queryCommandValue(goog.editor.Command.UNDERLINE);
  };
})();
goog.provide("uno.commands.Undo");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Undo");
  var Undo = uno.commands.Undo = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Undo, uno.BasePlugin);
  Undo.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Undo.prototype.isSupportedCommand = function(command) {
    return command === "undo";
  };
  Undo.prototype.execCommand = function() {
    if (this.editor.realtime && this.editor.realtime.y.undoManager) {
      return this.editor.realtime.y.undoManager.undo();
    }
    var formField = this.editor.getFormField();
    var result = false;
    if (formField) {
    } else {
      result = this.editor.execCommand(goog.editor.Command.UNDO);
    }
    return result;
  };
  Undo.prototype.queryCommandValue = function() {
    return !!this.editor.queryCommandValue(goog.editor.Command.UNDO);
  };
})();
goog.provide("goog.editor.plugins.UndoRedoState");
goog.require("goog.events.EventTarget");
goog.editor.plugins.UndoRedoState = function(asynchronous) {
  goog.editor.plugins.UndoRedoState.base(this, "constructor");
  this.asynchronous_ = asynchronous;
};
goog.inherits(goog.editor.plugins.UndoRedoState, goog.events.EventTarget);
goog.editor.plugins.UndoRedoState.ACTION_COMPLETED = "action_completed";
goog.editor.plugins.UndoRedoState.prototype.isAsynchronous = function() {
  return this.asynchronous_;
};
goog.editor.plugins.UndoRedoState.prototype.undo = goog.abstractMethod;
goog.editor.plugins.UndoRedoState.prototype.redo = goog.abstractMethod;
goog.editor.plugins.UndoRedoState.prototype.equals = goog.abstractMethod;
goog.provide("goog.editor.plugins.UndoRedoManager");
goog.provide("goog.editor.plugins.UndoRedoManager.EventType");
goog.require("goog.editor.plugins.UndoRedoState");
goog.require("goog.events");
goog.require("goog.events.EventTarget");
goog.editor.plugins.UndoRedoManager = function() {
  goog.events.EventTarget.call(this);
  this.maxUndoDepth_ = 100;
  this.undoStack_ = [];
  this.redoStack_ = [];
  this.pendingActions_ = [];
};
goog.inherits(goog.editor.plugins.UndoRedoManager, goog.events.EventTarget);
goog.editor.plugins.UndoRedoManager.EventType = {STATE_CHANGE:"state_change", STATE_ADDED:"state_added", BEFORE_UNDO:"before_undo", BEFORE_REDO:"before_redo"};
goog.editor.plugins.UndoRedoManager.prototype.inProgressActionKey_ = null;
goog.editor.plugins.UndoRedoManager.prototype.setMaxUndoDepth = function(depth) {
  this.maxUndoDepth_ = depth;
};
goog.editor.plugins.UndoRedoManager.prototype.addState = function(state) {
  if (this.undoStack_.length == 0 || !state.equals(this.undoStack_[this.undoStack_.length - 1])) {
    this.undoStack_.push(state);
    if (this.undoStack_.length > this.maxUndoDepth_) {
      this.undoStack_.shift();
    }
    var redoLength = this.redoStack_.length;
    this.redoStack_.length = 0;
    this.dispatchEvent({type:goog.editor.plugins.UndoRedoManager.EventType.STATE_ADDED, state:state});
    if (this.undoStack_.length == 1 || redoLength) {
      this.dispatchStateChange_();
    }
  }
};
goog.editor.plugins.UndoRedoManager.prototype.dispatchStateChange_ = function() {
  this.dispatchEvent(goog.editor.plugins.UndoRedoManager.EventType.STATE_CHANGE);
};
goog.editor.plugins.UndoRedoManager.prototype.undo = function() {
  this.shiftState_(this.undoStack_, this.redoStack_);
};
goog.editor.plugins.UndoRedoManager.prototype.redo = function() {
  this.shiftState_(this.redoStack_, this.undoStack_);
};
goog.editor.plugins.UndoRedoManager.prototype.hasUndoState = function() {
  return this.undoStack_.length > 0;
};
goog.editor.plugins.UndoRedoManager.prototype.hasRedoState = function() {
  return this.redoStack_.length > 0;
};
goog.editor.plugins.UndoRedoManager.prototype.shiftState_ = function(fromStack, toStack) {
  if (fromStack.length) {
    var state = fromStack.pop();
    toStack.push(state);
    this.addAction_({type:fromStack == this.undoStack_ ? goog.editor.plugins.UndoRedoManager.EventType.BEFORE_UNDO : goog.editor.plugins.UndoRedoManager.EventType.BEFORE_REDO, func:fromStack == this.undoStack_ ? state.undo : state.redo, state:state});
    if (fromStack.length == 0 || toStack.length == 1) {
      this.dispatchStateChange_();
    }
  }
};
goog.editor.plugins.UndoRedoManager.prototype.addAction_ = function(action) {
  this.pendingActions_.push(action);
  if (this.pendingActions_.length == 1) {
    this.doAction_();
  }
};
goog.editor.plugins.UndoRedoManager.prototype.doAction_ = function() {
  if (this.inProgressActionKey_ || this.pendingActions_.length == 0) {
    return;
  }
  var action = this.pendingActions_.shift();
  var e = {type:action.type, state:action.state};
  if (this.dispatchEvent(e)) {
    if (action.state.isAsynchronous()) {
      this.inProgressActionKey_ = goog.events.listen(action.state, goog.editor.plugins.UndoRedoState.ACTION_COMPLETED, this.finishAction_, false, this);
      action.func.call(action.state);
    } else {
      action.func.call(action.state);
      this.doAction_();
    }
  }
};
goog.editor.plugins.UndoRedoManager.prototype.finishAction_ = function() {
  goog.events.unlistenByKey(this.inProgressActionKey_);
  this.inProgressActionKey_ = null;
  this.doAction_();
};
goog.editor.plugins.UndoRedoManager.prototype.clearHistory = function() {
  if (this.undoStack_.length > 0 || this.redoStack_.length > 0) {
    this.undoStack_.length = 0;
    this.redoStack_.length = 0;
    this.dispatchStateChange_();
  }
};
goog.editor.plugins.UndoRedoManager.prototype.undoPeek = function() {
  return this.undoStack_[this.undoStack_.length - 1];
};
goog.editor.plugins.UndoRedoManager.prototype.redoPeek = function() {
  return this.redoStack_[this.redoStack_.length - 1];
};
goog.provide("goog.editor.plugins.UndoRedo");
goog.require("goog.dom");
goog.require("goog.dom.NodeOffset");
goog.require("goog.dom.Range");
goog.require("goog.editor.BrowserFeature");
goog.require("goog.editor.Command");
goog.require("goog.editor.Field");
goog.require("goog.editor.Plugin");
goog.require("goog.editor.node");
goog.require("goog.editor.plugins.UndoRedoManager");
goog.require("goog.editor.plugins.UndoRedoState");
goog.require("goog.events");
goog.require("goog.events.EventHandler");
goog.require("goog.log");
goog.require("goog.object");
goog.editor.plugins.UndoRedo = function(opt_manager) {
  goog.editor.Plugin.call(this);
  this.setUndoRedoManager(opt_manager || new goog.editor.plugins.UndoRedoManager);
  this.eventHandlers_ = {};
  this.currentStates_ = {};
  this.initialFieldChange_ = null;
  this.boundRestoreState_ = goog.bind(this.restoreState, this);
};
goog.inherits(goog.editor.plugins.UndoRedo, goog.editor.Plugin);
goog.editor.plugins.UndoRedo.prototype.logger = goog.log.getLogger("goog.editor.plugins.UndoRedo");
goog.editor.plugins.UndoRedo.prototype.inProgressUndo_ = null;
goog.editor.plugins.UndoRedo.prototype.undoManager_;
goog.editor.plugins.UndoRedo.prototype.managerStateChangeKey_;
goog.editor.plugins.UndoRedo.COMMAND = {UNDO:"+undo", REDO:"+redo"};
goog.editor.plugins.UndoRedo.SUPPORTED_COMMANDS_ = goog.object.transpose(goog.editor.plugins.UndoRedo.COMMAND);
goog.editor.plugins.UndoRedo.prototype.setMaxUndoDepth = function(depth) {
  this.undoManager_.setMaxUndoDepth(depth);
};
goog.editor.plugins.UndoRedo.prototype.setUndoRedoManager = function(manager) {
  if (this.managerStateChangeKey_) {
    goog.events.unlistenByKey(this.managerStateChangeKey_);
  }
  this.undoManager_ = manager;
  this.managerStateChangeKey_ = goog.events.listen(this.undoManager_, goog.editor.plugins.UndoRedoManager.EventType.STATE_CHANGE, this.dispatchCommandValueChange_, false, this);
};
goog.editor.plugins.UndoRedo.prototype.isSupportedCommand = function(command) {
  return command in goog.editor.plugins.UndoRedo.SUPPORTED_COMMANDS_;
};
goog.editor.plugins.UndoRedo.prototype.unregisterFieldObject = function(fieldObject) {
  this.disable(fieldObject);
  this.setFieldObject(null);
};
goog.editor.plugins.UndoRedo.prototype.getCurrentFieldObject = function() {
  return this.getFieldObject();
};
goog.editor.plugins.UndoRedo.prototype.getFieldObjectForHash = function(fieldHashCode) {
  return this.getFieldObject();
};
goog.editor.plugins.UndoRedo.prototype.getCurrentEventTarget = function() {
  return this.getFieldObject();
};
goog.editor.plugins.UndoRedo.prototype.enable = function(fieldObject) {
  if (this.isEnabled(fieldObject)) {
    return;
  }
  fieldObject.clearDelayedChange();
  var eventHandler = new goog.events.EventHandler(this);
  if (!goog.editor.BrowserFeature.USE_MUTATION_EVENTS) {
    eventHandler.listen(fieldObject, goog.editor.Field.EventType.BEFORECHANGE, this.handleBeforeChange_);
  }
  eventHandler.listen(fieldObject, goog.editor.Field.EventType.DELAYEDCHANGE, this.handleDelayedChange_);
  eventHandler.listen(fieldObject, goog.editor.Field.EventType.BLUR, this.handleBlur_);
  this.eventHandlers_[fieldObject.getHashCode()] = eventHandler;
  this.updateCurrentState_(fieldObject);
};
goog.editor.plugins.UndoRedo.prototype.disable = function(fieldObject) {
  fieldObject.clearDelayedChange();
  var eventHandler = this.eventHandlers_[fieldObject.getHashCode()];
  if (eventHandler) {
    eventHandler.dispose();
    delete this.eventHandlers_[fieldObject.getHashCode()];
  }
  if (this.currentStates_[fieldObject.getHashCode()]) {
    delete this.currentStates_[fieldObject.getHashCode()];
  }
};
goog.editor.plugins.UndoRedo.prototype.isEnabled = function(fieldObject) {
  return !!this.eventHandlers_[fieldObject.getHashCode()];
};
goog.editor.plugins.UndoRedo.prototype.disposeInternal = function() {
  goog.editor.plugins.UndoRedo.superClass_.disposeInternal.call(this);
  for (var hashcode in this.eventHandlers_) {
    this.eventHandlers_[hashcode].dispose();
    delete this.eventHandlers_[hashcode];
  }
  this.setFieldObject(null);
  if (this.undoManager_) {
    this.undoManager_.dispose();
    delete this.undoManager_;
  }
};
goog.editor.plugins.UndoRedo.prototype.getTrogClassId = function() {
  return "UndoRedo";
};
goog.editor.plugins.UndoRedo.prototype.execCommand = function(command, var_args) {
  if (command == goog.editor.plugins.UndoRedo.COMMAND.UNDO) {
    this.undoManager_.undo();
  } else {
    if (command == goog.editor.plugins.UndoRedo.COMMAND.REDO) {
      this.undoManager_.redo();
    }
  }
};
goog.editor.plugins.UndoRedo.prototype.queryCommandValue = function(command) {
  var state = null;
  if (command == goog.editor.plugins.UndoRedo.COMMAND.UNDO) {
    state = this.undoManager_.hasUndoState();
  } else {
    if (command == goog.editor.plugins.UndoRedo.COMMAND.REDO) {
      state = this.undoManager_.hasRedoState();
    }
  }
  return state;
};
goog.editor.plugins.UndoRedo.prototype.dispatchCommandValueChange_ = function() {
  var eventTarget = this.getCurrentEventTarget();
  eventTarget.dispatchEvent({type:goog.editor.Field.EventType.COMMAND_VALUE_CHANGE, commands:[goog.editor.plugins.UndoRedo.COMMAND.REDO, goog.editor.plugins.UndoRedo.COMMAND.UNDO]});
};
goog.editor.plugins.UndoRedo.prototype.restoreState = function(state, content, cursorPosition) {
  var fieldObj = this.getFieldObjectForHash(state.fieldHashCode);
  if (!fieldObj) {
    return;
  }
  fieldObj.stopChangeEvents(true, true);
  try {
    fieldObj.dispatchBeforeChange();
    fieldObj.execCommand(goog.editor.Command.CLEAR_LOREM, true);
    goog.editor.node.replaceInnerHtml(fieldObj.getElement(), content);
    if (cursorPosition) {
      cursorPosition.select();
    }
    var previousFieldObject = this.getCurrentFieldObject();
    fieldObj.focus();
    if (previousFieldObject && previousFieldObject.getHashCode() != state.fieldHashCode) {
      previousFieldObject.execCommand(goog.editor.Command.UPDATE_LOREM);
    }
    this.currentStates_[state.fieldHashCode].setUndoState(content, cursorPosition);
  } catch (e) {
    goog.log.error(this.logger, "Error while restoring undo state", e);
  } finally {
    this.inProgressUndo_ = state;
    fieldObj.dispatchChange();
    fieldObj.dispatchSelectionChangeEvent();
  }
};
goog.editor.plugins.UndoRedo.prototype.handleKeyboardShortcut = function(e, key, isModifierPressed) {
  if (isModifierPressed) {
    var command;
    if (key == "z") {
      command = e.shiftKey ? goog.editor.plugins.UndoRedo.COMMAND.REDO : goog.editor.plugins.UndoRedo.COMMAND.UNDO;
    } else {
      if (key == "y") {
        command = goog.editor.plugins.UndoRedo.COMMAND.REDO;
      }
    }
    if (command) {
      var state = command == goog.editor.plugins.UndoRedo.COMMAND.UNDO ? this.undoManager_.undoPeek() : this.undoManager_.redoPeek();
      if (state && state.fieldHashCode) {
        this.getCurrentFieldObject().execCommand(command);
      } else {
        this.execCommand(command);
      }
      return true;
    }
  }
  return false;
};
goog.editor.plugins.UndoRedo.prototype.clearHistory = function() {
  this.getFieldObject().stopChangeEvents(true, true);
  this.undoManager_.clearHistory();
  this.getFieldObject().startChangeEvents();
};
goog.editor.plugins.UndoRedo.prototype.refreshCurrentState = function(fieldObject) {
  if (this.isEnabled(fieldObject)) {
    if (this.currentStates_[fieldObject.getHashCode()]) {
      delete this.currentStates_[fieldObject.getHashCode()];
    }
    this.updateCurrentState_(fieldObject);
  }
};
goog.editor.plugins.UndoRedo.prototype.handleBeforeChange_ = function(e) {
  if (this.inProgressUndo_) {
    return;
  }
  var fieldObj = e.target;
  var fieldHashCode = fieldObj.getHashCode();
  if (this.initialFieldChange_ != fieldHashCode) {
    this.initialFieldChange_ = fieldHashCode;
    this.updateCurrentState_(fieldObj);
  }
};
goog.editor.plugins.UndoRedo.prototype.handleDelayedChange_ = function(e) {
  if (this.inProgressUndo_) {
    var state = this.inProgressUndo_;
    this.inProgressUndo_ = null;
    state.dispatchEvent(goog.editor.plugins.UndoRedoState.ACTION_COMPLETED);
    return;
  }
  this.updateCurrentState_(e.target);
};
goog.editor.plugins.UndoRedo.prototype.handleBlur_ = function(e) {
  var fieldObj = e.target;
  if (fieldObj) {
    fieldObj.clearDelayedChange();
  }
};
goog.editor.plugins.UndoRedo.prototype.getCursorPosition_ = function(fieldObj) {
  var cursorPos = new goog.editor.plugins.UndoRedo.CursorPosition_(fieldObj);
  if (!cursorPos.isValid()) {
    return null;
  }
  return cursorPos;
};
goog.editor.plugins.UndoRedo.prototype.updateCurrentState_ = function(fieldObj) {
  var fieldHashCode = fieldObj.getHashCode();
  var content, cursorPos;
  if (fieldObj.queryCommandValue(goog.editor.Command.USING_LOREM)) {
    content = "";
    cursorPos = null;
  } else {
    content = fieldObj.getElement().innerHTML;
    cursorPos = this.getCursorPosition_(fieldObj);
  }
  var currentState = this.currentStates_[fieldHashCode];
  if (currentState) {
    if (currentState.undoContent_ == content) {
      return;
    } else {
      if (content == "" || currentState.undoContent_ == "") {
        var emptyContents = fieldObj.getInjectableContents("", {});
        if (content == emptyContents && currentState.undoContent_ == "" || currentState.undoContent_ == emptyContents && content == "") {
          return;
        }
      }
    }
    currentState.setRedoState(content, cursorPos);
    this.undoManager_.addState(currentState);
  }
  this.currentStates_[fieldHashCode] = new goog.editor.plugins.UndoRedo.UndoState_(fieldHashCode, content, cursorPos, this.boundRestoreState_);
};
goog.editor.plugins.UndoRedo.UndoState_ = function(fieldHashCode, content, cursorPosition, restore) {
  goog.editor.plugins.UndoRedoState.call(this, true);
  this.fieldHashCode = fieldHashCode;
  this.restore_ = restore;
  this.setUndoState(content, cursorPosition);
};
goog.inherits(goog.editor.plugins.UndoRedo.UndoState_, goog.editor.plugins.UndoRedoState);
goog.editor.plugins.UndoRedo.UndoState_.prototype.undoContent_;
goog.editor.plugins.UndoRedo.UndoState_.prototype.undoCursorPosition_;
goog.editor.plugins.UndoRedo.UndoState_.prototype.redoContent_;
goog.editor.plugins.UndoRedo.UndoState_.prototype.redoCursorPosition_;
goog.editor.plugins.UndoRedo.UndoState_.prototype.undo = function() {
  this.restore_(this, this.undoContent_, this.undoCursorPosition_);
};
goog.editor.plugins.UndoRedo.UndoState_.prototype.redo = function() {
  this.restore_(this, this.redoContent_, this.redoCursorPosition_);
};
goog.editor.plugins.UndoRedo.UndoState_.prototype.setUndoState = function(content, cursorPosition) {
  this.undoContent_ = content;
  this.undoCursorPosition_ = cursorPosition;
};
goog.editor.plugins.UndoRedo.UndoState_.prototype.setRedoState = function(content, cursorPosition) {
  this.redoContent_ = content;
  this.redoCursorPosition_ = cursorPosition;
};
goog.editor.plugins.UndoRedo.UndoState_.prototype.equals = function(rhs) {
  return this.fieldHashCode == rhs.fieldHashCode && this.undoContent_ == rhs.undoContent_ && this.redoContent_ == rhs.redoContent_;
};
goog.editor.plugins.UndoRedo.CursorPosition_ = function(field) {
  this.field_ = field;
  var win = field.getEditableDomHelper().getWindow();
  var range = field.getRange();
  var isValidRange = !!range && range.isRangeInDocument() && range.getWindow() == win;
  range = isValidRange ? range : null;
  if (goog.editor.BrowserFeature.HAS_W3C_RANGES) {
    this.initW3C_(range);
  } else {
    if (goog.editor.BrowserFeature.HAS_IE_RANGES) {
      this.initIE_(range);
    }
  }
};
goog.editor.plugins.UndoRedo.CursorPosition_.prototype.initW3C_ = function(range) {
  this.isValid_ = false;
  if (!range) {
    return;
  }
  var anchorNode = range.getAnchorNode();
  var focusNode = range.getFocusNode();
  if (!anchorNode || !focusNode) {
    return;
  }
  var anchorOffset = range.getAnchorOffset();
  var anchor = new goog.dom.NodeOffset(anchorNode, this.field_.getElement());
  var focusOffset = range.getFocusOffset();
  var focus = new goog.dom.NodeOffset(focusNode, this.field_.getElement());
  if (range.isReversed()) {
    this.startOffset_ = focus;
    this.startChildOffset_ = focusOffset;
    this.endOffset_ = anchor;
    this.endChildOffset_ = anchorOffset;
  } else {
    this.startOffset_ = anchor;
    this.startChildOffset_ = anchorOffset;
    this.endOffset_ = focus;
    this.endChildOffset_ = focusOffset;
  }
  this.isValid_ = true;
};
goog.editor.plugins.UndoRedo.CursorPosition_.prototype.initIE_ = function(range) {
  this.isValid_ = false;
  if (!range) {
    return;
  }
  var ieRange = range.getTextRange(0).getBrowserRangeObject();
  if (!goog.dom.contains(this.field_.getElement(), ieRange.parentElement())) {
    return;
  }
  var contentEditableRange = this.field_.getEditableDomHelper().getDocument().body.createTextRange();
  contentEditableRange.moveToElementText(this.field_.getElement());
  var startMarker = ieRange.duplicate();
  startMarker.collapse(true);
  startMarker.setEndPoint("StartToStart", contentEditableRange);
  this.startOffset_ = goog.editor.plugins.UndoRedo.CursorPosition_.computeEndOffsetIE_(startMarker);
  var endMarker = ieRange.duplicate();
  endMarker.setEndPoint("StartToStart", contentEditableRange);
  this.endOffset_ = goog.editor.plugins.UndoRedo.CursorPosition_.computeEndOffsetIE_(endMarker);
  this.isValid_ = true;
};
goog.editor.plugins.UndoRedo.CursorPosition_.prototype.isValid = function() {
  return this.isValid_;
};
goog.editor.plugins.UndoRedo.CursorPosition_.prototype.toString = function() {
  if (goog.editor.BrowserFeature.HAS_W3C_RANGES) {
    return "W3C:" + this.startOffset_.toString() + "\n" + this.startChildOffset_ + ":" + this.endOffset_.toString() + "\n" + this.endChildOffset_;
  }
  return "IE:" + this.startOffset_ + "," + this.endOffset_;
};
goog.editor.plugins.UndoRedo.CursorPosition_.prototype.select = function() {
  var range = this.getRange_(this.field_.getElement());
  if (range) {
    if (goog.editor.BrowserFeature.HAS_IE_RANGES) {
      this.field_.getElement().focus();
    }
    goog.dom.Range.createFromBrowserRange(range).select();
  }
};
goog.editor.plugins.UndoRedo.CursorPosition_.prototype.getRange_ = function(baseNode) {
  if (goog.editor.BrowserFeature.HAS_W3C_RANGES) {
    var startNode = this.startOffset_.findTargetNode(baseNode);
    var endNode = this.endOffset_.findTargetNode(baseNode);
    if (!startNode || !endNode) {
      return null;
    }
    return goog.dom.Range.createFromNodes(startNode, this.startChildOffset_, endNode, this.endChildOffset_).getBrowserRangeObject();
  }
  var sel = baseNode.ownerDocument.body.createTextRange();
  sel.moveToElementText(baseNode);
  sel.collapse(true);
  sel.moveEnd("character", this.endOffset_);
  sel.moveStart("character", this.startOffset_);
  return sel;
};
goog.editor.plugins.UndoRedo.CursorPosition_.computeEndOffsetIE_ = function(range) {
  var testRange = range.duplicate();
  var text = range.text;
  var guess = text.length;
  testRange.collapse(true);
  testRange.moveEnd("character", guess);
  var diff;
  var numTries = 10;
  while (diff = testRange.compareEndPoints("EndToEnd", range)) {
    guess -= diff;
    testRange.moveEnd("character", -diff);
    --numTries;
    if (0 == numTries) {
      break;
    }
  }
  var offset = 0;
  var pos = text.indexOf("\n\r");
  while (pos != -1) {
    ++offset;
    pos = text.indexOf("\n\r", pos + 1);
  }
  return guess + offset;
};
goog.provide("uno.commands.UndoRedo");
goog.require("goog.editor.plugins.UndoRedo");
goog.require("goog.functions");
(function() {
  var UndoRedo = uno.commands.UndoRedo = function(optManager) {
    goog.editor.plugins.UndoRedo.call(this, optManager);
  };
  goog.inherits(UndoRedo, goog.editor.plugins.UndoRedo);
  UndoRedo.prototype.activeOnUneditableFields = goog.functions.TRUE;
})();
goog.provide("uno.commands.Unlink");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Unlink");
  var util = uno.util;
  var Unlink = uno.commands.Unlink = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Unlink, uno.BasePlugin);
  Unlink.prototype.isSupportedCommand = function(command) {
    return command === "unlink";
  };
  Unlink.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Unlink.prototype.activeOnRangeOutsideOfEditor = goog.functions.FALSE;
  function getLinks(range) {
    if (!range) {
      return [];
    }
    var container = range.getContainer();
    if (!container) {
      return [];
    }
    var links = util.link.all(container);
    links = links.filter(function(link) {
      return util.range.contains(range, link, true);
    });
    var ancestorLink = goog.dom.getAncestor(container, util.link.isLink, true);
    return ancestorLink ? links.concat(ancestorLink) : links;
  }
  Unlink.prototype.execCommand = function() {
    var range = this.editor.getRange();
    if (!range) {
      return false;
    }
    var links = getLinks(range);
    if (!links.length) {
      return false;
    }
    var savedRange = util.range.saveCursor(range);
    this.editor.dispatchBeforeChange();
    goog.array.forEach(links, goog.dom.flattenElement);
    if (savedRange) {
      savedRange.restore();
    }
    this.editor.dispatchChange();
    return true;
  };
  Unlink.prototype.queryCommandEnabled = function() {
    var links = getLinks(this.editor.getRange());
    return links.length;
  };
  Unlink.prototype.queryCommandValue = function(command) {
    return this.queryCommandEnabled(command);
  };
})();
goog.provide("uno.commands.UpdateToken");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.UpdateToken");
  var UpdateToken = uno.commands.UpdateToken = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(UpdateToken, uno.BasePlugin);
  UpdateToken.prototype.isSupportedCommand = function(command) {
    return command === "updatetoken";
  };
  UpdateToken.prototype.execCommand = function(command, value) {
    var y = this.editor.realtime.y;
    y.when("connectorReady").then(function() {
      y.connector.updateAuthToken(value);
    });
    return true;
  };
  UpdateToken.prototype.queryCommandEnabled = goog.functions.TRUE;
})();
goog.provide("uno.commands.Uppercase");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.range");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.Uppercase");
  var util = uno.util;
  var Uppercase = uno.commands.Uppercase = function() {
    uno.BasePlugin.call(this, log.getName());
    this.multiRangeMode = uno.EditorMultiRange.Mode.ALL;
  };
  goog.inherits(Uppercase, uno.BasePlugin);
  Uppercase.prototype.isSupportedCommand = function(command) {
    return command === "uppercase";
  };
  Uppercase.prototype.execCommandInternal = function() {
    var range = this.editor.getRange();
    var savedRange = range.saveUsingDom();
    util.range.forEachWord(range, function(word, wordRange) {
      var container = wordRange.startContainer;
      var text = container.nodeValue;
      container.nodeValue = text.slice(0, wordRange.startOffset) + word.toLocaleUpperCase() + text.slice(wordRange.endOffset);
    });
    savedRange.restore().select();
    return true;
  };
})();
goog.provide("uno.commands.ZoomScale");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.img");
goog.require("uno.util.preview");
goog.require("uno.util.zoomscale");
(function() {
  var log = goog.debug.Logger.getLogger("uno.commands.ZoomScale");
  var util = uno.util;
  var MIN_ZOOM_SCALE = 0.75;
  var MAX_ZOOM_SCALE = 2.0;
  function boundedZoomScale(zoomScale) {
    return Math.min(Math.max(zoomScale, MIN_ZOOM_SCALE), MAX_ZOOM_SCALE);
  }
  function zoomInFrom(fromZoomScale) {
    var toZoomScale = 1.0;
    if (Math.abs(fromZoomScale - 0.5) < 0.01 || fromZoomScale < 0.5) {
      toZoomScale = 0.67;
    } else {
      if (Math.abs(fromZoomScale - 0.67) < 0.01 || fromZoomScale < 0.67) {
        toZoomScale = 0.75;
      } else {
        if (Math.abs(fromZoomScale - 0.75) < 0.01 || fromZoomScale < 0.75) {
          toZoomScale = 0.9;
        } else {
          if (Math.abs(fromZoomScale - 0.9) < 0.01 || fromZoomScale < 0.9) {
            toZoomScale = 1.0;
          } else {
            if (Math.abs(fromZoomScale - 1.0) < 0.01 || fromZoomScale < 1.0) {
              toZoomScale = 1.1;
            } else {
              if (Math.abs(fromZoomScale - 1.1) < 0.01 || fromZoomScale < 1.1) {
                toZoomScale = 1.25;
              } else {
                if (Math.abs(fromZoomScale - 1.25) < 0.01 || fromZoomScale < 1.25) {
                  toZoomScale = 1.5;
                } else {
                  if (Math.abs(fromZoomScale - 1.5) < 0.01 || fromZoomScale < 1.5) {
                    toZoomScale = 1.75;
                  } else {
                    if (Math.abs(fromZoomScale - 1.75) < 0.01 || fromZoomScale < 1.75) {
                      toZoomScale = 2.0;
                    } else {
                      if (Math.abs(fromZoomScale - 2.0) < 0.01 || fromZoomScale < 2.0) {
                        toZoomScale = 2.5;
                      } else {
                        if (Math.abs(fromZoomScale - 2.5) < 0.01 || fromZoomScale < 2.5) {
                          toZoomScale = 3.0;
                        } else {
                          toZoomScale = 3.0;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    return boundedZoomScale(toZoomScale);
  }
  function zoomOutFrom(fromZoomScale) {
    var toZoomScale = 1.0;
    if (Math.abs(fromZoomScale - 0.5) < 0.01 || fromZoomScale < 0.5) {
      toZoomScale = 0.5;
    } else {
      if (Math.abs(fromZoomScale - 0.67) < 0.01 || fromZoomScale < 0.67) {
        toZoomScale = 0.5;
      } else {
        if (Math.abs(fromZoomScale - 0.75) < 0.01 || fromZoomScale < 0.75) {
          toZoomScale = 0.67;
        } else {
          if (Math.abs(fromZoomScale - 0.9) < 0.01 || fromZoomScale < 0.9) {
            toZoomScale = 0.75;
          } else {
            if (Math.abs(fromZoomScale - 1.0) < 0.01 || fromZoomScale < 1.0) {
              toZoomScale = 0.9;
            } else {
              if (Math.abs(fromZoomScale - 1.1) < 0.01 || fromZoomScale < 1.1) {
                toZoomScale = 1.0;
              } else {
                if (Math.abs(fromZoomScale - 1.25) < 0.01 || fromZoomScale < 1.25) {
                  toZoomScale = 1.1;
                } else {
                  if (Math.abs(fromZoomScale - 1.5) < 0.01 || fromZoomScale < 1.5) {
                    toZoomScale = 1.25;
                  } else {
                    if (Math.abs(fromZoomScale - 1.75) < 0.01 || fromZoomScale < 1.75) {
                      toZoomScale = 1.5;
                    } else {
                      if (Math.abs(fromZoomScale - 2.0) < 0.01 || fromZoomScale < 2.0) {
                        toZoomScale = 1.75;
                      } else {
                        if (Math.abs(fromZoomScale - 2.5) < 0.01 || fromZoomScale < 2.5) {
                          toZoomScale = 2.0;
                        } else {
                          if (Math.abs(fromZoomScale - 3.0) < 0.01 || fromZoomScale < 3.0) {
                            toZoomScale = 2.5;
                          } else {
                            toZoomScale = 3.0;
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    return boundedZoomScale(toZoomScale);
  }
  var ZoomScale = uno.commands.ZoomScale = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(ZoomScale, uno.BasePlugin);
  ZoomScale.prototype.isSupportedCommand = function(command) {
    return command === "zoomscale";
  };
  ZoomScale.prototype.activeOnUneditableFields = goog.functions.TRUE;
  ZoomScale.prototype.execCommand = function(command, value) {
    var fullsize = this.editor.context.fullsize || {};
    if (fullsize.enabled || fullsize.pending) {
      return false;
    }
    var zoomScale = 0;
    if (value === "+") {
      zoomScale = zoomInFrom(uno.util.zoomscale.getZoom());
    } else {
      if (value === "-") {
        zoomScale = zoomOutFrom(uno.util.zoomscale.getZoom());
      } else {
        zoomScale = parseFloat(value);
      }
    }
    if (zoomScale > 0 && zoomScale < 10.0) {
      var editorBody = this.editor.field;
      if (editorBody) {
        editorBody.style.zoom = zoomScale;
        util.img.layoutResizer();
      }
      return true;
    }
    return false;
  };
  ZoomScale.prototype.queryCommandValue = function() {
    return uno.util.zoomscale.getZoom();
  };
})();
goog.provide("uno.PluginManager");
goog.require("goog.debug.Logger");
goog.require("goog.array");
(function() {
  var log = goog.debug.Logger.getLogger("uno.PluginManager");
  var PluginManager = uno.PluginManager = function() {
    this.elements = [];
  };
  PluginManager.prototype.add = function(obj) {
    this.elements.push(obj);
  };
  PluginManager.prototype.filterRemove = function(filterFunc) {
    this.elements = goog.array.filter(this.elements, filterFunc);
  };
  PluginManager.prototype.clear = function() {
    this.elements = [];
  };
  PluginManager.prototype.forEach = function(callback) {
    if (callback == null) {
      return;
    }
    for (var i = 0; i < this.elements.length; i++) {
      callback(this.elements[i], i, this.elements);
    }
  };
  PluginManager.prototype.forEachRight = function(callback) {
    if (callback == null) {
      return;
    }
    for (var i = this.elements.length - 1; i >= 0; i--) {
      callback(this.elements[i], i, this.elements);
    }
  };
  PluginManager.prototype.firstToReturnTrue = function(funcName, funcArgs) {
    for (var i = 0; i < this.elements.length; i++) {
      if (this.tryToRun(this.elements[i], funcName, funcArgs) === true) {
        return this.elements[i];
      }
    }
    return null;
  };
  PluginManager.prototype.firstSupportedCommand = function(command) {
    return this.firstToReturnTrue("isSupportedCommand", [command]);
  };
  PluginManager.prototype.isSupportedCommand = function(command) {
    return !!this.firstToReturnTrue("isSupportedCommand", [command]);
  };
  PluginManager.prototype.execCommand = function() {
    var args = Array.prototype.slice.call(arguments);
    var command = args.length > 0 ? args[0] : null;
    var plugin = this.firstSupportedCommand(command);
    if (plugin == null) {
      return false;
    }
    var result = null;
    if (goog.isFunction(plugin.execCommandInternal)) {
      result = this.tryToRun(plugin, "execCommandInternal", args);
    }
    if (result == null) {
      result = this.tryToRun(plugin, "execCommand", args);
    }
    return !!result;
  };
  PluginManager.prototype.queryCommandEnabled = function() {
    var args = Array.prototype.slice.call(arguments);
    var command = args.length > 0 ? args[0] : null;
    var plugin = this.firstSupportedCommand(command);
    return !!this.tryToRun(plugin, "queryCommandEnabled", args);
  };
  PluginManager.prototype.queryCommandValue = function() {
    var args = Array.prototype.slice.call(arguments);
    var command = args.length > 0 ? args[0] : null;
    var plugin = this.firstSupportedCommand(command);
    var result = this.tryToRun(plugin, "queryCommandValue", args);
    if (result == null) {
      result = "";
    }
    if (!goog.isString(result)) {
      result = JSON.stringify(result);
    }
    return result;
  };
  PluginManager.prototype.tryToRun = function(element, funcName, funcArgs) {
    if (element == null) {
      log.warning("No plugin element supplied to tryToRun: \n" + JSON.stringify(funcName) + "\n---\n" + JSON.stringify(funcArgs));
      return null;
    }
    if (goog.isFunction(element[funcName])) {
      try {
        return element[funcName].apply(element, funcArgs);
      } catch (ex) {
        log.severe("Error running " + funcName + " with " + JSON.stringify(funcArgs) + ". \nDetails: " + ex + "\n" + ex.stack);
      }
    }
    return null;
  };
})();
goog.provide("uno.filters.CodeBlockFilter");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.BasePlugin");
goog.require("uno.util.codeblock");
goog.require("uno.util.styles");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.CodeBlockFilter");
  var util = uno.util;
  var CodeBlockFilter = uno.filters.CodeBlockFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(CodeBlockFilter, uno.BasePlugin);
  CodeBlockFilter.prototype.prepareContentsDom = function(frag) {
    var codeblocks = frag.querySelectorAll("[data-en-codeblock]");
    goog.array.forEachRight(codeblocks, function(enmlCodeblock) {
      var codeblock = util.codeblock.create(Array.prototype.slice.call(enmlCodeblock.childNodes));
      goog.dom.replaceNode(codeblock, enmlCodeblock);
    });
  };
  CodeBlockFilter.prototype.cleanContentsDom = function(frag) {
    var codeblocks = util.codeblock.all(frag);
    goog.array.forEachRight(codeblocks, function(codeblock) {
      var enmlCodeblock = goog.dom.createDom("div", {style:uno.defs.codeblock.style}, codeblock.childNodes);
      util.styles.setMetadata(enmlCodeblock, "-en-codeblock", "true");
      goog.dom.replaceNode(enmlCodeblock, codeblock);
    });
  };
})();
goog.provide("uno.filters.cryptfilter.win");
goog.require("goog.dom.classlist");
goog.require("uno.defs");
goog.require("uno.util.crypto");
(function() {
  var win = uno.filters.cryptfilter.win;
  var util = uno.util;
  var CRYPT_CLASS = uno.defs.crypto.CRYPT_CLASS;
  win.importHTML = function(fragment, context) {
    var cryptElements = fragment.querySelectorAll('img[src^="en-resource://database/pprotect:"]');
    Array.prototype.forEach.call(cryptElements, function(node) {
      node.setAttribute("id", "crypt-" + context.crypt.incrementUniqueId());
      node.setAttribute("data-src", node.src);
      goog.dom.classlist.add(node, CRYPT_CLASS);
    });
    return fragment;
  };
  win.exportHTML = function(fragment) {
    var cryptElements = util.crypto.all(fragment);
    Array.prototype.forEach.call(cryptElements, function(node) {
      if (util.crypto.isOpen(node)) {
        var newNode = document.createElement("img");
        newNode.setAttribute("id", node.getAttribute("id"));
        newNode.setAttribute("class", node.getAttribute("class"));
        newNode.setAttribute("src", node.getAttribute("data-src"));
        newNode.setAttribute("data-length", node.getAttribute("data-length"));
        newNode.setAttribute("data-cipher", node.getAttribute("data-cipher"));
        newNode.setAttribute("data-hint", node.getAttribute("data-hint"));
        newNode.setAttribute("data-ciphertext", node.getAttribute("data-ciphertext"));
        node.parentNode.replaceChild(newNode, node);
      } else {
        node.setAttribute("src", node.getAttribute("data-src"));
        node.removeAttribute("data-src");
      }
    });
  };
})();
goog.provide("uno.filters.CryptFilter");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.filters.cryptfilter.win");
goog.require("uno.util.crypto");
goog.require("uno.defs");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.CryptFilter");
  var util = uno.util;
  var CryptFilter = uno.filters.CryptFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(CryptFilter, uno.BasePlugin);
  CryptFilter.prototype.prepareContentsDom = function(fragment) {
    var context = this.editor.context;
    if (context.format === uno.defs.format.ENML) {
      if (this.client.importENML) {
        this.client.importENML(fragment, context);
      } else {
        Array.prototype.forEach.call(fragment.querySelectorAll("en-crypt"), function(node) {
          var newId = context.crypt.incrementUniqueId();
          var cryptInfo = {id:"crypt-" + newId};
          cryptInfo.cipherText = node.textContent;
          cryptInfo.length = node.getAttribute("length");
          cryptInfo.cipher = node.getAttribute("cipher");
          cryptInfo.hint = node.getAttribute("hint");
          var newNode = util.crypto.createCryptoPlaceholder(cryptInfo);
          goog.dom.replaceNode(newNode, node);
        });
      }
    } else {
      if (context.format === uno.defs.format.CLIENT_HTML) {
        if (this.client.importHTML) {
          this.client.importHTML(fragment, context);
        }
      } else {
        if (context.format === uno.defs.format.CLIPBOARD) {
          if (this.client.importHTML) {
            this.client.importHTML(fragment, context);
          }
        }
      }
    }
  };
  CryptFilter.prototype.cleanContentsDom = function(fragment) {
    var context = this.editor.context;
    if (context.format === uno.defs.format.ENML) {
      if (this.client.exportENML) {
        this.client.exportENML(fragment);
      } else {
        Array.prototype.forEach.call(util.crypto.all(fragment), function(node) {
          var newNode = goog.dom.createDom("en-crypt");
          newNode.setAttribute("cipher", node.getAttribute("data-cipher") || "AES");
          newNode.setAttribute("length", node.getAttribute("data-length") || "128");
          newNode.setAttribute("hint", node.getAttribute("data-hint") || "");
          newNode.innerHTML = node.getAttribute("data-ciphertext") || "";
          goog.dom.replaceNode(newNode, node);
        });
      }
    } else {
      if (context.format === uno.defs.format.CLIENT_HTML) {
        if (this.client.exportHTML) {
          this.client.exportHTML(fragment);
        }
      } else {
        if (context.format === uno.defs.format.CLIPBOARD) {
          Array.prototype.forEach.call(util.crypto.all(fragment), function(node) {
            var newId = "crypt-" + context.crypt.incrementUniqueId();
            node.id = newId;
          });
        }
      }
    }
  };
})();
goog.provide("uno.filters.CommentFilter");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.styles");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.CommentFilter");
  var defs = uno.defs;
  var util = uno.util;
  var CommentFilter = uno.filters.CommentFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(CommentFilter, uno.BasePlugin);
  CommentFilter.prototype.prepareContentsDom = function(frag) {
    var isClipboard = this.editor.context.format === defs.format.CLIPBOARD;
    var noteGuid = this.editor.config.note.guid;
    goog.array.forEach(frag.querySelectorAll("span[data-en-comment]"), function(el) {
      var pastedNoteGuid = el.getAttribute("data-en-note-guid");
      if (pastedNoteGuid) {
        util.styles.setMetadata(el, "data-en-note-guid", null);
      }
      var convertComment = isClipboard ? pastedNoteGuid === noteGuid : true;
      var commentGuid = el.getAttribute("data-en-comment");
      util.styles.setMetadata(el, "data-en-comment", null);
      if (convertComment) {
        var comment = goog.dom.createDom("en-comment");
        util.styles.setMetadata(comment, "data-en-comment", commentGuid);
        util.dom.wrap(el, comment);
      }
      var hasFormatting = !!el.getAttribute("style");
      var hasMetadata = util.styles.hasMetadata(el);
      if (!hasFormatting && !hasMetadata) {
        goog.dom.flattenElement(el);
      }
    });
  };
  CommentFilter.prototype.cleanContentsDom = function(frag) {
    var isClipboard = this.editor.context.format === defs.format.CLIPBOARD;
    var noteGuid = this.editor.config.note.guid;
    goog.array.forEach(frag.querySelectorAll("[data-en-comment]"), function(el) {
      if (isClipboard) {
        util.styles.setMetadata(el, "data-en-note-guid", noteGuid);
      }
      el.removeAttribute("class");
      if (el.tagName === "EN-COMMENT") {
        util.dom.changeTagName(el, "span");
      }
    });
  };
})();
goog.provide("uno.util.enml");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.util.objects");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.enml");
  var util = uno.util;
  var merge = util.objects.merge;
  util.enml.sanitize = function(el) {
    if (el.nodeType !== Node.ELEMENT_NODE && el.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {
      return;
    }
    goog.array.forEachRight(el.children, function(child) {
      util.enml.sanitize(child);
    });
    if (el.nodeType !== Node.ELEMENT_NODE) {
      return;
    }
    if (!schema[el.tagName]) {
      log.info("removing forbidden element <" + el.tagName + ">");
      goog.dom.flattenElement(el);
    } else {
      if (schema[el.tagName].empty) {
        while (el.firstChild) {
          el.remove(el.firstChild);
        }
      }
      var attrWhitelist = schema[el.tagName].attrs;
      for (var i = el.attributes.length - 1; i >= 0; i--) {
        var name = el.attributes[i].name;
        if (!attrWhitelist[name]) {
          el.removeAttribute(el.attributes[i].name);
        }
      }
    }
  };
  var attrs = {style:true, title:true, lang:true, "xml:lang":true, dir:true};
  var cellhalign = {align:true, char:true, charoff:true};
  var cellvalign = {valign:true};
  var coreattrs = {style:true, title:true};
  var focus = {accesskey:true, tabindex:true};
  var i18n = {lang:true, "xml:lang":true, dir:true};
  var textalign = {align:true};
  var schema = {"EN-NOTE":{attrs:merge(attrs, {bgcolor:true, text:true, xmlns:true})}, "EN-CRYPT":{attrs:{hint:true, cipher:true, length:true}}, "EN-MEDIA":{empty:true, attrs:merge(attrs, {type:true, hash:true, height:true, width:true, usemap:true, align:true, border:true, hspace:true, vspace:true, longdesc:true, alt:true})}, "EN-TODO":{empty:true, attrs:{checked:true}}, A:{attrs:merge(attrs, focus, {charset:true, type:true, name:true, href:true, hreflang:true, rel:true, rev:true, shape:true, coords:true, 
  target:true})}, ACRONYM:{attrs:attrs}, ADDRESS:{attrs:attrs}, AREA:{attrs:merge(attrs, focus, {shape:true, coords:true, href:true, nohref:true, alt:true, target:true})}, B:{attrs:attrs}, BDO:{attrs:attrs}, BIG:{attrs:attrs}, BLOCKQUOTE:{attrs:merge(attrs, {cite:true})}, BR:{attrs:merge(coreattrs, {clear:true})}, CAPTION:{attrs:merge(attrs, {align:true})}, CENTER:{attrs:attrs}, CITE:{attrs:attrs}, CODE:{attrs:attrs}, COL:{attrs:merge(attrs, cellhalign, cellvalign, {span:true, width:true})}, COLGROUP:{attrs:merge(attrs, 
  cellhalign, cellvalign, {span:true, width:true})}, DD:{attrs:attrs}, DEL:{attrs:merge(attrs, {cite:true, datetime:true})}, DFN:{attrs:attrs}, DIV:{attrs:merge(attrs, textalign)}, DL:{attrs:merge(attrs, {compact:true})}, DT:{attrs:attrs}, EM:{attrs:attrs}, FONT:{attrs:merge(attrs, {size:true, color:true, face:true})}, H1:{attrs:merge(attrs, textalign)}, H2:{attrs:merge(attrs, textalign)}, H3:{attrs:merge(attrs, textalign)}, H4:{attrs:merge(attrs, textalign)}, H5:{attrs:merge(attrs, textalign)}, 
  H6:{attrs:merge(attrs, textalign)}, HR:{attrs:merge(attrs, {align:true, noshade:true, size:true, width:true})}, I:{attrs:attrs}, IMG:{attrs:merge(attrs, {src:true, alt:true, name:true, longdesc:true, height:true, width:true, usemap:true, ismap:true, align:true, border:true, hspace:true, vspace:true})}, INS:{attrs:merge(attrs, {cite:true, datetime:true})}, KBD:{attrs:attrs}, LI:{attrs:merge(attrs, {type:true, value:true})}, MAP:{attrs:merge(i18n, {title:true, name:true})}, OL:{attrs:merge(attrs, 
  {type:true, compact:true, start:true})}, P:{attrs:merge(attrs, textalign)}, PRE:{attrs:merge(attrs, {width:true, "xml:space":true})}, Q:{attrs:merge(attrs, {cite:true})}, S:{attrs:attrs}, SAMP:{attrs:attrs}, SMALL:{attrs:attrs}, SPAN:{attrs:attrs}, STRIKE:{attrs:attrs}, STRONG:{attrs:attrs}, SUB:{attrs:attrs}, SUP:{attrs:attrs}, TABLE:{attrs:merge(attrs, {summary:true, width:true, border:true, cellspacing:true, cellpadding:true, align:true, bgcolor:true})}, TBODY:{attrs:merge(attrs, cellhalign, 
  cellvalign)}, TD:{attrs:merge(attrs, cellhalign, cellvalign, {abbr:true, rowspan:true, colspan:true, nowrap:true, bgcolor:true, width:true, height:true})}, TFOOT:{attrs:merge(attrs, cellhalign, cellvalign)}, TH:{attrs:merge(attrs, cellhalign, cellvalign, {abbr:true, rowspan:true, colspan:true, nowrap:true, bgcolor:true, width:true, height:true})}, THEAD:{attrs:merge(attrs, cellhalign, cellvalign)}, TR:{attrs:merge(attrs, cellhalign, cellvalign, {bgcolor:true})}, TT:{attrs:attrs}, U:{attrs:attrs}, 
  UL:{attrs:merge(attrs, {type:true, compact:true})}, VAR:{attrs:attrs}};
})();
goog.provide("uno.filters.EnmlFilter");
goog.require("goog.debug.Logger");
goog.require("goog.string");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.enml");
goog.require("uno.util.styles");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.EnmlFilter");
  var util = uno.util;
  var rxDocType = /^<!DOCTYPE[^>]*>\n?/g;
  var rxXhtmlNs = / +xmlns="(http:\/\/www.w3.org\/1999\/xhtml)?"/g;
  var rxInvalidHtmlChars = new RegExp(uno.defs.regex.INVALID_HTML_CHARS, "g");
  var rxEnNoteOpening = /<\s*en-note[^>]*>/;
  var rxEnNoteClosing = /<\/\s*en-note\s*>/;
  var rxEnNoteVoid = /<\s*en-note\s*\/\s*>/;
  var rxEnTodoNonVoid = /<en-todo([^>]*?)>.*?<\/en-todo>/g;
  var rxEnMediaNonVoid = /<en-media([^>]*?)>.*?<\/en-media>/g;
  var EnmlFilter = uno.filters.EnmlFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(EnmlFilter, uno.BasePlugin);
  EnmlFilter.prototype.prepareContentsHtml = function(html) {
    if (!html) {
      return html;
    }
    var openingMatch = html.match(rxEnNoteOpening);
    var closingMatch = html.match(rxEnNoteClosing);
    var voidMatch = html.match(rxEnNoteVoid);
    if (voidMatch) {
      html = "";
    } else {
      if (openingMatch && closingMatch) {
        html = html.substring(openingMatch.index + openingMatch[0].length, closingMatch.index);
      } else {
        if (this.editor.context.format === uno.defs.format.ENML) {
          log.info("html:");
          log.info(html);
          log.severe("Cannot find en-note node in ENML");
        }
      }
    }
    html = html.trim();
    return html;
  };
  EnmlFilter.prototype.prepareContentsDom = function(frag) {
    var node = frag && frag.firstChild;
    if (frag.childNodes.length === 1 && node.tagName === "SPAN" && node.attributes.length === 0 && node.firstChild) {
      while (node.firstChild) {
        frag.appendChild(node.firstChild);
      }
      frag.removeChild(node);
    }
  };
  EnmlFilter.prototype.cleanContentsDom = function(frag) {
    if (this.editor.context.format !== uno.defs.format.ENML) {
      return;
    }
    util.enml.sanitize(frag);
  };
  EnmlFilter.prototype.cleanContentsHtml = function(html) {
    if (this.editor.context.format !== uno.defs.format.ENML) {
      return html;
    }
    var liveRoot = this.editor.field;
    var enmlDTD = document.implementation.createDocumentType("en-note", "", "http://xml.evernote.com/pub/enml2.dtd");
    var enmlDocument = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "en-note", enmlDTD);
    var enmlNode = enmlDocument.documentElement;
    var legalNoteAttributes = ["style", "bgcolor", "title", "lang", "dir", "text"];
    var zwsRegex = new RegExp(uno.defs.unicode.ZERO_WIDTH_SPACE, "g");
    html = html.replace(zwsRegex, "");
    var frag = util.dom.fragFromString(html);
    if (liveRoot && liveRoot.hasAttributes()) {
      goog.array.forEach(liveRoot.attributes, function(a) {
        if (goog.array.contains(legalNoteAttributes, a.name)) {
          enmlNode.setAttribute(a.name.toLowerCase(), a.value);
        }
      });
    }
    var treeWalker = document.createTreeWalker(frag, NodeFilter.SHOW_ELEMENT);
    while (treeWalker.nextNode()) {
      var currentNode = treeWalker.currentNode;
      if (currentNode.tagName === "EN-CURSOR") {
        currentNode.remove();
        continue;
      }
      currentNode.removeAttribute("id");
      currentNode.removeAttribute("class");
      currentNode.removeAttribute("contenteditable");
      currentNode.removeAttribute("x-apple-data-detectors");
      currentNode.removeAttribute("x-apple-data-detectors-type");
      currentNode.removeAttribute("x-apple-data-detectors-result");
      for (var key in currentNode.dataset) {
        currentNode.removeAttribute(["data", goog.string.toSelectorCase(key)].join("-"));
      }
    }
    goog.array.forEachRight(frag.querySelectorAll('*[style*="-en-clipboard"]'), function(el) {
      util.styles.removeStyle(el, "-en-clipboard");
    });
    var clonedNode = enmlDocument.importNode(frag, true);
    var ennote = enmlDocument.querySelector("en-note");
    util.styles.removeStyle(ennote, "display");
    util.styles.removeStyle(ennote, "margin");
    util.styles.removeStyle(ennote, "padding");
    ennote.appendChild(clonedNode);
    var xmlString = (new XMLSerializer).serializeToString(enmlDocument);
    xmlString = xmlString.replace(rxInvalidHtmlChars, "").replace(rxDocType, '<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">').replace(rxXhtmlNs, "").replace(rxEnTodoNonVoid, "<en-todo$1 />").replace(rxEnMediaNonVoid, "<en-media$1 />");
    return xmlString;
  };
})();
goog.provide("uno.filters.FontSizeFilter");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.FontSizeFilter");
  var FontSizeFilter = uno.filters.FontSizeFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(FontSizeFilter, uno.BasePlugin);
  FontSizeFilter.prototype.cleanContentsHtml = function(html) {
    return html.replace(uno.defs.unicode.ZERO_WIDTH_SPACE, "");
  };
})();
goog.provide("uno.filters.GDocsFilter");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.array");
goog.require("uno.BasePlugin");
goog.require("uno.util.styles");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.GDocsFilter");
  var util = uno.util;
  var GDocsFilter = uno.filters.GDocsFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(GDocsFilter, uno.BasePlugin);
  GDocsFilter.prototype.prepareContentsDom = function(frag) {
    var context = this.editor.context;
    if (context.format === uno.defs.format.CLIPBOARD) {
      replaceGDocsWrapperNode(this.editor, frag);
    }
  };
  function replaceGDocsWrapperNode(editor, frag) {
    if (!frag.firstChild || !frag.firstChild.childNodes) {
      return;
    }
    var gDocsWrapper = goog.array.find(frag.firstChild.childNodes, function(node) {
      return util.dom.isB(node) && (node.style && node.style.fontWeight === "normal") && (editor.config.client === "web" || goog.string.startsWith(node.id, "docs-internal-guid-"));
    });
    if (gDocsWrapper) {
      gDocsWrapper = util.dom.changeTagName(gDocsWrapper, "div");
      gDocsWrapper.removeAttribute("style");
      gDocsWrapper.removeAttribute("id");
    }
  }
})();
goog.provide("uno.filters.IndentFilter");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.IndentFilter");
  var util = uno.util, dom = util.dom;
  var IndentFilter = uno.filters.IndentFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(IndentFilter, uno.BasePlugin);
  var isInvalidParent = function(parentNode) {
    return !parentNode || !parentNode.parentNode || dom.isEnnote(parentNode) || dom.isFragment(parentNode);
  };
  IndentFilter.prototype.prepareContentsDom = function(frag) {
    var deepestNodes = dom.getNodeLeaves(frag, dom.inlineObjects);
    deepestNodes.forEach(function(node) {
      while (!isInvalidParent(node.parentNode)) {
        var parentNode = node.parentNode;
        if (dom.isBlockquote(parentNode) && parentNode.style.marginLeft === "40px") {
          if (parentNode.childNodes.length === 1 && dom.isBlockNode(node)) {
            node.style.marginLeft = (parseInt(node.style.marginLeft, 10) || 0) + 40 + "px";
            dom.flattenElement(parentNode);
          } else {
            node = dom.changeTagName(parentNode, "div");
          }
        } else {
          node = parentNode;
        }
      }
    });
  };
})();
goog.provide("uno.filters.ListFilter");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.ListFilter");
  var util = uno.util;
  var ListFilter = uno.filters.ListFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(ListFilter, uno.BasePlugin);
  ListFilter.prototype.prepareContentsDom = function(frag) {
    var listItems = frag.querySelectorAll("li");
    goog.array.forEach(listItems, util.list.normalizeListItem);
  };
})();
goog.provide("uno.filters.MetadataFilter");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.styles");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.MetadataFilter");
  var util = uno.util;
  var MetadataFilter = uno.filters.MetadataFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(MetadataFilter, uno.BasePlugin);
  MetadataFilter.prototype.prepareContentsDom = function(frag) {
    util.styles.metadataImportSelectors.forEach(function(selector) {
      goog.array.forEachRight(frag.querySelectorAll(selector), function(el) {
        util.styles.convertStylesToDataAttributes(el);
      });
    });
  };
  MetadataFilter.prototype.cleanContentsDom = function(frag) {
    util.styles.metadataExportSelectors.forEach(function(selector) {
      goog.array.forEachRight(frag.querySelectorAll(selector), function(el) {
        util.styles.convertDataAttributesToStyles(el);
      });
    });
  };
})();
goog.provide("uno.filters.MSOfficeFilter");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.array");
goog.require("uno.BasePlugin");
goog.require("uno.util.styles");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.MSOfficeFilter");
  var util = uno.util;
  var MSOfficeFilter = uno.filters.MSOfficeFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(MSOfficeFilter, uno.BasePlugin);
  MSOfficeFilter.prototype.prepareContentsDom = function(frag) {
    var context = this.editor.context;
    if (context.format === uno.defs.format.CLIPBOARD) {
      transformMicrosoftWordListsWithMap(this.editor, frag);
    }
  };
  function transformMicrosoftWordListsWithMap(editor, frag) {
    var queue = [];
    goog.array.forEach(frag.querySelectorAll("p"), function(node) {
      if (util.dom.getNodeLength(node) === 1 && util.dom.getTagName(node.firstChild) === "o:p") {
        goog.dom.removeNode(node.firstChild);
        node.appendChild(goog.dom.createDom("br"));
        util.dom.changeTagName(node, "div");
      }
    });
    goog.array.forEach(frag.querySelectorAll('div[style*="mso-line-break-override"]'), function(node) {
      var level = 1 + ((parseFloat(node.style.marginLeft) + parseFloat(node.style.textIndent)) / 0.5 || 0);
      var results = node.querySelectorAll('span[style*="mso-special-format"]');
      if (results.length > 0) {
        var isItem;
        var listType = "ul";
        if (util.styles.getStyle(results[0], "mso-special-format").toLowerCase() !== "bullet") {
          listType = "ol";
        }
        if (util.dom.getNodeLength(results[0].parentNode) === 1) {
          isItem = true;
          goog.dom.removeNode(results[0].parentNode);
        } else {
          goog.dom.removeNode(results[0]);
        }
        appendListItem(node, queue, level, listType, isItem);
      }
    });
    var rxLevel = /level([0-9]+)/;
    var rxMsoIgnore = /ignore/i;
    var rxMsoOrderedNumbering = /[0-9a-z]+[.)]/gi;
    var rxMsoClass = /(^|\s)Mso/;
    goog.array.forEach(frag.querySelectorAll("div, p"), function(node) {
      var isMso = node.getAttribute("style") && node.getAttribute("style").indexOf("mso") >= 0 || node.className.match(rxMsoClass);
      var listMso = (util.styles.getStyle(node, "mso-list") || "").toLowerCase().match(rxLevel);
      if (isMso && listMso) {
        var level = parseInt(listMso.pop(), 10);
        var levelKey = listMso.pop();
        if (!isNaN(level)) {
          var listType = "ul";
          var spanMso = node.querySelectorAll('span[style*="mso-list:"]');
          if (spanMso) {
            goog.array.forEach(spanMso, function() {
              var span = spanMso[0];
              var spanMsoType = util.styles.getStyle(span, "mso-list").toLowerCase().match(rxMsoIgnore);
              if (spanMsoType) {
                if (span.textContent.match(rxMsoOrderedNumbering)) {
                  listType = "ol";
                }
                if (util.dom.matches(span.parentNode, "span") && util.dom.getNodeLength(span.parentNode) === 1) {
                  goog.dom.removeNode(span.parentNode);
                } else {
                  goog.dom.removeNode(span);
                }
              }
            });
          }
          appendListItem(node, queue, level, listType);
        }
      } else {
        queue = [];
        if (isMso) {
          appendListItem(node, queue);
        }
      }
    });
    if (editor.config.client === "web") {
      goog.array.forEach(frag.querySelectorAll("div, p"), function(node) {
        if (node && node.innerHTML === "") {
          node.innerHTML = "<br>";
        } else {
          if (node && util.dom.isEmptyContent(node) && node.innerHTML !== "<br>") {
            node.innerText = uno.defs.unicode.NBSP;
          }
        }
      });
    }
  }
  function getList(node, queue, level, listType) {
    if (level === undefined) {
      return queue.slice(-1).pop();
    }
    var list = null;
    var parent;
    while (!list && queue.length) {
      list = queue.pop();
      if (list.level === level) {
        if (util.dom.matches(list, listType)) {
          queue.push(list);
        } else {
          parent = list.parentNode;
          list = goog.dom.createDom(listType);
          list.level = level;
          queue.push(list);
          parent.appendChild(list);
        }
      } else {
        if (list.level < level) {
          queue.push(list);
          parent = list;
          list = goog.dom.createDom(listType);
          list.level = level;
          queue.push(list);
          parent.appendChild(list);
        } else {
          list = null;
        }
      }
    }
    if (!list) {
      list = goog.dom.createDom(listType);
      list.level = level;
      queue.push(list);
      node.parentNode.insertBefore(list, node);
    }
    return list;
  }
  function appendListItem(node, queue, level, listType, isItem) {
    var list = getList(node, queue, level, listType);
    node.removeAttribute("class");
    goog.array.forEach(node.getElementsByTagName("o:p"), function(elem) {
      goog.dom.removeNode(elem);
    });
    if (!list || !node.getAttribute("style")) {
      node.removeAttribute("style");
      return;
    }
    util.dom.detachNode(node);
    var listItem = node;
    if (isItem || util.styles.getStyle(node, "mso-list")) {
      node = util.dom.changeTagName(node, "div");
      listItem = goog.dom.createDom("li");
      listItem.appendChild(node);
    } else {
      var lastItem = list.lastElementChild;
      if (lastItem) {
        list = lastItem;
      }
    }
    if (util.dom.isTextNode(node.lastChild) && node.lastChild.textContent) {
      var content = node.lastChild.textContent;
      if (content.length && content.charCodeAt(content.length - 1) === 10) {
        node.lastChild.textContent = content.substring(0, content.length - 1);
      }
    }
    node.removeAttribute("style");
    list.appendChild(listItem);
  }
})();
goog.provide("uno.filters.NormalizeFilter");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.normalize");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.NormalizeFilter");
  var util = uno.util;
  var NormalizeFilter = uno.filters.NormalizeFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(NormalizeFilter, uno.BasePlugin);
  NormalizeFilter.prototype.prepareContentsHtml = function(html) {
    return util.normalize.normalizeHtml(html);
  };
  NormalizeFilter.prototype.prepareContentsDom = function(frag) {
    var context = this.editor.context;
    var HTML = uno.defs.format.CLIENT_HTML;
    var ENML = uno.defs.format.ENML;
    if ((context.format === ENML || context.format === HTML) && !this.editor.config.noNormalize) {
      util.normalize.normalizeDom(frag, {partial:true, editor:this.editor});
    } else {
      if (context.format === uno.defs.format.CLIPBOARD) {
        util.normalize.normalizeDom(frag, {editor:this.editor, externalContent:context.copyPaste.externalContent});
      }
    }
  };
})();
goog.provide("uno.util.typebehind");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.editor.range");
goog.require("goog.events.KeyCodes");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.typebehind");
  var util = uno.util;
  var TAB_KEY = goog.events.KeyCodes.TAB;
  var ENTER_KEY = goog.events.KeyCodes.ENTER;
  util.typebehind.tryReplacements = function(event, implementations, editor) {
    var keyCode = event.keyCode;
    var range = editor.getRange();
    if (!range || !range.isCollapsed()) {
      return false;
    }
    var node = range.getEndNode();
    var text = node.textContent.substring(0, range.getEndOffset());
    var isBeginningOfLine = !util.dom.isPrecededByInlineContent(node);
    if (!text || !goog.isString(text) || !node || node.nodeType !== Node.TEXT_NODE) {
      return false;
    }
    var insideAnchor = goog.dom.getAncestor(node, function(element) {
      return util.dom.isA(element);
    }, true);
    if (insideAnchor) {
      return false;
    }
    for (var i = 0; i < implementations.length; i++) {
      var implementation = implementations[i];
      if (!implementation.contextReplaceable(range, keyCode)) {
        continue;
      }
      if (implementation.matchBeginningOfLine && !isBeginningOfLine) {
        continue;
      }
      var result = util.typebehind.runReplacements(implementation, range, text, editor);
      if (result.success) {
        var eventHandled = true;
        if (result.node != null) {
          goog.editor.range.placeCursorNextTo(result.node, false);
        }
        var shouldPreventDefault = false;
        if (implementation.suppressTriggerKey) {
          shouldPreventDefault = true;
        } else {
          if (result.node != null && keyCode === TAB_KEY && !implementation.suppressTriggerKey) {
            var tab = goog.dom.createDom(goog.dom.TagName.SPAN, null, "\u00a0\u00a0 \u00a0");
            goog.dom.insertSiblingBefore(tab, result.node.nextSibling);
            goog.editor.range.placeCursorNextTo(tab, false);
            shouldPreventDefault = true;
          } else {
            if (keyCode === ENTER_KEY) {
              eventHandled = false;
            }
          }
        }
        editor.field.normalize();
        if (shouldPreventDefault) {
          event.preventDefault();
        }
        editor.startChangeEvents(false, shouldPreventDefault);
        log.info("Executed " + implementation.name + " typebehind");
        return eventHandled;
      }
    }
    return false;
  };
  util.typebehind.runReplacements = function(implementation, range, text, editor) {
    if (!implementation.regex || !implementation.regex.exec) {
      return {success:false};
    }
    implementation.regex.lastIndex = 0;
    var matches = implementation.regex.exec(text);
    if (!matches || matches.length < 2 || !matches[1].length) {
      return {success:false};
    }
    editor.dispatchChange(true);
    editor.stopChangeEvents(true, true);
    matches.shift();
    var matchIndex = text.lastIndexOf(matches[0]);
    var textNode = range.getEndNode();
    var newRange = goog.dom.Range.createFromNodes(textNode, matchIndex, textNode, matchIndex + matches[0].length);
    return {success:true, node:implementation.insertReplacement(newRange, matches, editor)};
  };
  util.typebehind.compileTypebehindRegex = function(pattern, matchBeginningOfLine, caseSensitive, openEnded) {
    var preRx = "(?:" + (matchBeginningOfLine ? "^[\\s\\u200b\u00a0]{0,4}" : "^|[\\s\\u200b\u00a0]{1,4}") + ")(";
    var postRx = ")" + (openEnded ? "" : "(?:[\\u200b]?$)");
    var flags = "g";
    flags += !caseSensitive ? "i" : "";
    return new RegExp(preRx + pattern + postRx, flags);
  };
  var regexPartialTextlink;
  util.typebehind.inPartialTypebehind = function(range) {
    var node = range.getEndNode();
    var text = node.textContent.substring(0, range.getEndOffset());
    if (!regexPartialTextlink) {
      regexPartialTextlink = new RegExp(util.typebehind.textlink.prelinkPatternFrag + "$", "gi");
    }
    regexPartialTextlink.lastIndex = 0;
    return regexPartialTextlink.test(text);
  };
})();
goog.provide("uno.util.typebehind.textlink");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.defs");
goog.require("uno.util.codeblock");
goog.require("uno.util.dom");
goog.require("uno.util.typebehind");
(function() {
  var textlink = uno.util.typebehind.textlink;
  var log = goog.debug.Logger.getLogger("uno.util.typebehind.textlink");
  var util = uno.util;
  textlink.name = "textlink";
  textlink.matchBeginningOfLine = false;
  textlink.suppressTriggerKey = false;
  textlink.prelinkPatternFrag = "\\[([^\\]\\n\\r]*)]\\(";
  textlink.postlinkPatternFrag = "\\)";
  textlink.regex = util.typebehind.compileTypebehindRegex(textlink.prelinkPatternFrag + "(" + uno.defs.regex.SIMPLE_URL + ")" + textlink.postlinkPatternFrag, textlink.matchBeginningOfLine);
  textlink.contextReplaceable = function(range, keyCode) {
    return !util.codeblock.for(range.getEndNode());
  };
  textlink.insertReplacement = function(range, matches, editor) {
    var matchText = matches[1];
    var matchHref = matches[2];
    var href = /^[a-zA-Z]+:\/\//.test(matchHref) ? matchHref : "http://" + matchHref;
    var newNode = goog.dom.createDom("a", {href:href});
    newNode.textContent = matchText;
    range.replaceContentsWithNode(newNode);
    return newNode;
  };
})();
goog.provide("uno.filters.PasteFilter");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.array");
goog.require("uno.BasePlugin");
goog.require("uno.util.typebehind.textlink");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.PasteFilter");
  var util = uno.util;
  var regexUrlOnly = new RegExp("^" + uno.defs.regex.SIMPLE_URL + "$", "gi");
  var PasteFilter = uno.filters.PasteFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(PasteFilter, uno.BasePlugin);
  PasteFilter.prototype.prepareContentsDom = function(frag) {
    var context = this.editor.context;
    if (context.format === uno.defs.format.CLIPBOARD) {
      regexUrlOnly.lastIndex = 0;
      if (context.pastingInPartialTypebehind && regexUrlOnly.test(frag.textContent)) {
        return;
      }
      transformURLs(frag);
    }
  };
  function transformURLs(frag) {
    var urlRe = new RegExp(uno.defs.regex.SIMPLE_URL, "gi");
    var emailRe = new RegExp(uno.defs.regex.SIMPLE_EMAIL, "gi");
    goog.array.forEachRight(util.dom.getNodeLeaves(frag), function(node) {
      var isTextNode = util.dom.isTextNode(node);
      var isLinked = !!goog.dom.getAncestor(node, function(ancestor) {
        return !!ancestor.hasAttribute && ancestor.hasAttribute("href");
      });
      if (isTextNode && !isLinked) {
        var text = node.textContent;
        var hasMatch = urlRe.test(text) || emailRe.test(text);
        if (hasMatch) {
          var c = 0;
          var matches = [];
          var replacers = [];
          var html;
          html = text.replace(emailRe, function(match) {
            matches.push(match);
            replacers.push(replaceEmail);
            return placeholder(c++);
          }).replace(urlRe, function(match) {
            matches.push(match);
            replacers.push(replaceUrl);
            return placeholder(c++);
          });
          html = goog.string.htmlEscape(html);
          matches.forEach(function(match, i) {
            html = html.replace(placeholder(i), replacers[i](match));
          });
          node.parentNode.replaceChild(util.dom.fragFromString(html), node);
        }
      }
    });
  }
  function replaceEmail(email) {
    return '<a href="mailto:' + email + '">' + email + "</a>";
  }
  function replaceUrl(url) {
    var href = /[a-z]+:\/\//i.test(url) ? url : "http://" + url;
    return '<a href="' + href + '">' + url + "</a>";
  }
  function placeholder(index) {
    return "{{__" + index + "__}}";
  }
})();
goog.provide("uno.util.typebehind.phone");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.defs");
goog.require("uno.util.codeblock");
goog.require("uno.util.dom");
goog.require("uno.util.typebehind");
(function() {
  var phone = uno.util.typebehind.phone;
  var log = goog.debug.Logger.getLogger("uno.util.typebehind.phone");
  var util = uno.util;
  var SIMPLE_PHONE = "(?!\\d{1,2}[ -]\\d{1,2}[ -](?:\\d{2}|\\d{4}))(?!(?:\\d{2}|\\d{4})[ -]\\d{1,2}[ -]\\d{1,2})(?:(?:(?:(?:(?:(?:(?:[\\\\+]|\\b)[0-9]{2,3}[\\ \\u00a0-]))|)(?:\\([0-9\\ \\u00a0]+\\))(?:[\\ \\u00a0-]?[0-9]{2,7})+(?:[\\ \\u00a0-][0-9]{2,7})*))|(?:(?:(?:(?:[\\\\+]|\\b)[0-9]{2,3}[\\ \\u00a0-])|[+]|\\b)(?:(?:(?:[0-9])(?:(?:[\\ \\u00a0-][0-9]{5,7})+|(?:[\\ \\u00a0-][0-9]{2,7}){2,}))|(?:(?:[0-9]{3,7})(?:(?:[\\ \\u00a0-][0-9]{3,7})+|(?:[\\ \\u00a0-][0-9]{2,7}){2,}))|(?:(\\b(?:[0-9]{7,15})(?!(?:\\.[\\d]+))))))\\b)";
  phone.name = "phone";
  phone.matchBeginningOfLine = false;
  phone.caseSensitive = false;
  phone.suppressTriggerKey = false;
  phone.regex = util.typebehind.compileTypebehindRegex(SIMPLE_PHONE, phone.matchBeginningOfLine, phone.caseSensitive);
  phone.regexForFilter = util.typebehind.compileTypebehindRegex(SIMPLE_PHONE, phone.matchBeginningOfLine, phone.caseSensitive, true);
  phone.contextReplaceable = function(range, keyCode) {
    return !util.codeblock.for(range.getEndNode());
  };
  phone.insertReplacement = function(range, matches, editor) {
    var matchedText = matches[0];
    var href = "tel:" + matchedText;
    var newNode = goog.dom.createDom("a", {href:href, class:"en-phone"});
    newNode.textContent = matchedText;
    range.replaceContentsWithNode(newNode);
    return newNode;
  };
})();
goog.provide("uno.filters.PhoneFilter");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.typebehind.phone");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.PhoneFilter");
  var util = uno.util;
  var phone = util.typebehind.phone;
  var excludedNodes = {a:1, html:1, head:1, style:1, title:1, link:1, meta:1, script:1, object:1, iframe:1};
  var PhoneFilter = uno.filters.PhoneFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(PhoneFilter, uno.BasePlugin);
  PhoneFilter.prototype.prepareContentsDom = function(frag, styles) {
    var editor = this.editor;
    if (!editor.config.typebehind.phone) {
      return;
    }
    var iterator = frag.ownerDocument.createNodeIterator(frag, NodeFilter.SHOW_TEXT, function(node) {
      return excludedNodes[node.parentElement.tagName.toLowerCase()] || util.codeblock.for(node) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
    });
    var element, range;
    var nodeList = [];
    while (element = iterator.nextNode()) {
      nodeList.push(element);
    }
    for (var i = 0; i < nodeList.length; i++) {
      var match;
      var stack = [];
      element = nodeList[i];
      while (match = phone.regexForFilter.exec(element.textContent)) {
        if (!match[0].length) {
          phone.regexForFilter.lastIndex++;
        } else {
          range = goog.dom.Range.createFromNodes(element, match.index, element, match.index + match[0].length);
          stack.push(range);
        }
      }
      while (stack.length) {
        range = stack.pop();
        phone.insertReplacement(range, [range.getText()]);
      }
    }
  };
  PhoneFilter.prototype.cleanContentsDom = function(frag) {
    var editor = this.editor;
    if (!editor.config.typebehind.phone) {
      return;
    }
    var elements = Array.prototype.slice.call(frag.getElementsByClassName("en-phone"));
    goog.iter.forEach(elements, goog.dom.flattenElement);
  };
})();
goog.provide("uno.filters.ResourceFilter");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
goog.require("uno.util.resource");
goog.require("uno.util.img");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.ResourceFilter");
  var defs = uno.defs;
  var util = uno.util;
  var ResourceFilter = uno.filters.ResourceFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(ResourceFilter, uno.BasePlugin);
  ResourceFilter.prototype.prepareContentsDom = function(frag) {
    var editor = this.editor;
    var context = this.editor.context;
    var dict;
    var resourcesChanged = false;
    if (context.format === defs.format.ENML) {
      goog.array.forEach(frag.querySelectorAll("en-media"), function(enmedia) {
        var hash = enmedia.getAttribute("hash");
        if (hash) {
          hash = hash.toLowerCase();
          enmedia.setAttribute("hash", hash);
        }
        dict = context.resources[hash];
        util.resource.convertMediaToSlug(enmedia, dict, editor, true);
        resourcesChanged = true;
      });
    } else {
      if (context.format === defs.format.CLIENT_HTML) {
        goog.array.forEach(util.resource.findResourcesInClientHtml(frag, editor), function(el) {
          if (util.dom.compareTagName(el, "en-media")) {
            dict = context.resources[el.getAttribute("hash")];
            util.resource.convertMediaToSlug(el, dict, editor, true);
          } else {
            util.resource.convertClientElementToSlug(el, editor);
          }
          resourcesChanged = true;
        });
      } else {
        if (context.format === defs.format.CLIPBOARD) {
          goog.array.forEach(util.resource.findResourcesInClipboardHtml(frag, editor), function(el) {
            if (util.resource.convertClipboardElementToSlug(el, context, editor)) {
              resourcesChanged = true;
            }
          });
        }
      }
    }
    if (resourcesChanged) {
      editor.dispatchEvent({type:"resourcesChanged"});
    }
  };
  ResourceFilter.prototype.cleanContentsDom = function(frag) {
    var context = this.editor.context;
    if (context.format === defs.format.ENML) {
      goog.array.forEachRight(util.resource.all(frag), function(el) {
        util.resource.convertSlugToMedia(el);
      });
    } else {
      if (context.format === defs.format.CLIENT_HTML) {
        goog.array.forEachRight(util.resource.all(frag), function(el) {
          util.resource.convertSlugToClientElement(el);
        });
      } else {
        if (context.format === defs.format.CLIPBOARD) {
          goog.array.forEachRight(util.resource.all(frag), function(el) {
            util.resource.convertSlugToClientElement(el);
          });
        }
      }
    }
  };
  ResourceFilter.prototype.cleanContentsHtml = function(html) {
    if (this.editor.context.format === defs.format.CLIENT_HTML) {
      html = util.resource.formatClientHtmlForExport(html);
      html = html.replace(uno.defs.unicode.ZERO_WIDTH_SPACE, "");
    }
    return html;
  };
  ResourceFilter.prototype.handleDomUpdate = function(event) {
    if (event.paste) {
      var images = [];
      var editor = this.editor;
      goog.iter.forEach(event.range, function(node, _, iter) {
        if (iter.isStartTag() && util.dom.isImg(node)) {
          images.push(node);
        }
      });
      Promise.all(goog.array.map(images, util.img.ratioResizeIfNeeded)).then(function(resizes) {
        if (resizes.indexOf(true) > -1) {
          editor.dispatchChange();
        }
      });
    }
  };
})();
goog.provide("uno.filters.RichlinkFilter");
goog.require("goog.array");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.richlink");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.RichlinkFilter");
  var util = uno.util;
  var RICHLINK_CONVERT_DELAY = 400;
  var RichlinkFilter = uno.filters.RichlinkFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(RichlinkFilter, uno.BasePlugin);
  RichlinkFilter.prototype.prepareContentsDom = function(frag, styles) {
    var editor = this.editor;
    var links;
    var fromClipboard = editor.context.format === uno.defs.format.CLIPBOARD;
    if (!editor.config.richlinks.enabled) {
      return;
    }
    if (fromClipboard) {
      links = util.richlink.allPlain(frag);
    } else {
      links = util.richlink.allUndecorated(frag);
    }
    if (links.length > 0) {
      goog.array.forEach(links, function(link) {
        if (util.richlink.canDecorate(link, editor)) {
          util.richlink.setPending(link, true);
        }
      });
      setTimeout(function() {
        var pendingLinks = editor.field ? util.richlink.allPending(editor.field) : [];
        goog.array.forEach(pendingLinks, function(link) {
          if (util.richlink.canDecorate(link, editor)) {
            util.richlink.setPending(link, false);
            if (fromClipboard) {
              editor.plugins_.UndoRedo.updateCurrentState_(editor);
            }
            util.richlink.decorate(link, editor);
          }
        });
      }, fromClipboard ? RICHLINK_CONVERT_DELAY : 0);
    }
  };
  RichlinkFilter.prototype.cleanContentsDom = function(frag) {
    var editor = this.editor;
    if (editor.config.richlinks.enabled) {
      goog.array.forEach(util.richlink.all(frag), function(link) {
        util.richlink.undecorate(link, editor);
      });
    }
  };
})();
goog.provide("uno.filters.SectionBreakFilter");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.styles");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.SectionBreakFilter");
  var util = uno.util;
  var SectionBreakFilter = uno.filters.SectionBreakFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(SectionBreakFilter, uno.BasePlugin);
  SectionBreakFilter.prototype.cleanContentsDom = function(frag) {
    var sectionbreaks = frag.querySelectorAll('[style*="-evernote-encp-section-break"]');
    goog.array.forEach(sectionbreaks, function(sectionbreak) {
      sectionbreak.style.display = "none";
      util.styles.setMetadata(sectionbreak, "-evernote-encp-section-break", true);
    });
  };
})();
goog.provide("uno.filters.TableFilter");
goog.require("goog.debug.Logger");
goog.require("goog.array");
goog.require("goog.iter");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.TableFilter");
  var defs = uno.defs;
  var util = uno.util;
  var TableFilter = uno.filters.TableFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(TableFilter, uno.BasePlugin);
  TableFilter.prototype.prepareContentsDom = function(frag) {
    var isClipboard = this.editor.context.format === defs.format.CLIPBOARD;
    var options = {foreignSource:this.editor.hasForeignSource()};
    goog.array.forEach(frag.querySelectorAll("table"), function(table) {
      var enTable = util.table.attachAdornments(table, options);
      if (enTable) {
        if (isClipboard) {
          var tds = util.table.cellsForNode(enTable);
          tds.forEach(function(td) {
            if (util.dom.isEmptyContent(td)) {
              td.innerHTML = uno.defs.table.CELL_HTML;
            }
          });
          if (table.hasAttribute("style")) {
            tds.forEach(function(td) {
              util.paragraph.all(td).forEach(function(p) {
                util.styles.transferStyles(util.styles.inlineStyles, table, p, {removeOld:false, overwrite:false});
              });
            });
            table.removeAttribute("style");
          }
        }
        if (!isClipboard) {
          util.table.normalizeDOMPlacement(enTable);
        }
      }
    });
  };
  TableFilter.prototype.cleanContentsDom = function(frag) {
    var isClipboard = this.editor.context.format === defs.format.CLIPBOARD;
    goog.array.forEach(frag.querySelectorAll("en-table"), function(enTable) {
      util.table.clearAdornments(enTable, !isClipboard);
    });
  };
  TableFilter.prototype.handleDomUpdate = function(event) {
    start("TableFilter.prototype.handleDomUpdate");
    var range = event.range;
    var enTable = goog.dom.getAncestor(range.getStartNode(), util.dom.isEntable, true);
    if (enTable) {
      start("table.layout");
      util.table.layout(enTable);
      stop("table.layout");
    } else {
      goog.iter.forEach(range, function(node, _, iter) {
        if (iter.isStartTag() && util.dom.isEntable(node)) {
          util.table.layout(node);
        }
      });
    }
    stop("TableFilter.prototype.handleDomUpdate");
  };
})();
goog.provide("uno.filters.TodoFilter");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
goog.require("uno.util.todo");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.TodoFilter");
  var defs = uno.defs;
  var util = uno.util;
  var TodoFilter = uno.filters.TodoFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(TodoFilter, uno.BasePlugin);
  TodoFilter.prototype.prepareContentsDom = function(frag) {
    var context = this.editor.context;
    if (context.format === defs.format.ENML) {
      goog.array.forEach(util.todo.allEnmlTodos(frag), function(entodo) {
        util.todo.decorate(entodo);
      });
    } else {
      if (context.format === defs.format.CLIPBOARD) {
        var todos = util.todo.allClipboardTodos(frag);
        Array.prototype.forEach.call(todos, function(todo) {
          var newTodo = util.todo.convertTodoInClipboard(todo);
          if (newTodo) {
            goog.dom.replaceNode(newTodo, todo);
          }
        });
      } else {
        goog.array.forEach(util.todo.findTodosInClientHtml(frag), function(el) {
          util.todo.convertClientElementToTodo(el);
        });
      }
    }
  };
  TodoFilter.prototype.cleanContentsDom = function(frag) {
    var context = this.editor.context;
    if (context.format === defs.format.ENML) {
      goog.array.forEach(util.todo.all(frag), function(entodo) {
        util.todo.undecorate(entodo);
      });
    } else {
      if (context.format === defs.format.CLIPBOARD) {
        var todos = util.todo.all(frag);
        Array.prototype.forEach.call(todos, function(todo) {
          var newTodo = util.todo.convertTodoToClipboardElement(todo);
          if (newTodo) {
            goog.dom.replaceNode(newTodo, todo);
          }
        });
      } else {
        goog.array.forEachRight(util.todo.all(frag), function(entodo) {
          util.todo.convertTodoToClientElement(entodo);
        });
      }
    }
  };
})();
goog.provide("uno.filters.BasicTextFormatterFilter");
goog.require("goog.debug.Logger");
goog.require("goog.array");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.BasicTextFormatterFilter");
  var highlightBackgroundColor = uno.defs.highlight.COLOR;
  var util = uno.util;
  var CLIENT_HTML = uno.defs.format.CLIENT_HTML;
  var ENML = uno.defs.format.ENML;
  var BasicTextFormatterFilter = uno.filters.BasicTextFormatterFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(BasicTextFormatterFilter, uno.BasePlugin);
  BasicTextFormatterFilter.prototype.prepareContentsDom = function(frag) {
    var context = this.editor.context;
    if ([ENML, CLIENT_HTML].indexOf(context.format) > -1) {
      var nodes = frag.querySelectorAll('[style*="background-color"],[data' + uno.defs.highlight.STYLE + "]");
      Array.prototype.forEach.call(nodes, function(node) {
        var bgColor = node.style.backgroundColor.toString();
        if (!bgColor || uno.defs.highlight.regex.test(bgColor)) {
          node.style.backgroundColor = highlightBackgroundColor;
          node.removeAttribute("data" + uno.defs.highlight.STYLE);
        }
      });
    }
  };
  BasicTextFormatterFilter.prototype.cleanContentsDom = function(frag) {
    var context = this.editor.context;
    if ([ENML, CLIENT_HTML].indexOf(context.format) > -1 && frag.querySelectorAll != null) {
      var nodes = frag.querySelectorAll('[style*="background-color"]');
      goog.array.forEach(nodes, function(node) {
        if (node.attributes.style) {
          var bgColor = node.style.backgroundColor.toString();
          if (uno.defs.highlight.regex.test(bgColor)) {
            util.styles.setMetadata(node, uno.defs.highlight.STYLE, "true");
          }
        }
      });
    }
  };
})();
goog.provide("uno.filters.ZoomScaleFilter");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.ZoomScaleFilter");
  var ZoomScaleFilter = uno.filters.ZoomScaleFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(ZoomScaleFilter, uno.BasePlugin);
  ZoomScaleFilter.prototype.cleanContentsDom = function(frag) {
    frag.firstElementChild && frag.firstElementChild.style.removeProperty("zoom");
  };
})();
goog.provide("uno.filters.CopyFilter");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
(function() {
  var log = goog.debug.Logger.getLogger("uno.filters.CopyFilter");
  var util = uno.util;
  var CopyFilter = uno.filters.CopyFilter = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(CopyFilter, uno.BasePlugin);
  CopyFilter.prototype.cleanContentsHtml = function(html) {
    return html;
  };
})();
goog.provide("uno.filters.All");
goog.require("uno.PluginManager");
goog.require("uno.filters.CodeBlockFilter");
goog.require("uno.filters.CryptFilter");
goog.require("uno.filters.CommentFilter");
goog.require("uno.filters.EnmlFilter");
goog.require("uno.filters.FontSizeFilter");
goog.require("uno.filters.GDocsFilter");
goog.require("uno.filters.IndentFilter");
goog.require("uno.filters.ListFilter");
goog.require("uno.filters.MetadataFilter");
goog.require("uno.filters.MSOfficeFilter");
goog.require("uno.filters.NormalizeFilter");
goog.require("uno.filters.PasteFilter");
goog.require("uno.filters.PhoneFilter");
goog.require("uno.filters.ResourceFilter");
goog.require("uno.filters.RichlinkFilter");
goog.require("uno.filters.SectionBreakFilter");
goog.require("uno.filters.TableFilter");
goog.require("uno.filters.TodoFilter");
goog.require("uno.filters.BasicTextFormatterFilter");
goog.require("uno.filters.ZoomScaleFilter");
goog.require("uno.filters.CopyFilter");
(function() {
  uno.filters.All = function() {
    var PM = new uno.PluginManager;
    PM.add(new uno.filters.EnmlFilter);
    PM.add(new uno.filters.GDocsFilter);
    PM.add(new uno.filters.MSOfficeFilter);
    PM.add(new uno.filters.MetadataFilter);
    PM.add(new uno.filters.CommentFilter);
    PM.add(new uno.filters.TodoFilter);
    PM.add(new uno.filters.IndentFilter);
    PM.add(new uno.filters.NormalizeFilter);
    PM.add(new uno.filters.PasteFilter);
    PM.add(new uno.filters.CryptFilter);
    PM.add(new uno.filters.ResourceFilter);
    PM.add(new uno.filters.RichlinkFilter);
    PM.add(new uno.filters.SectionBreakFilter);
    PM.add(new uno.filters.TableFilter);
    PM.add(new uno.filters.BasicTextFormatterFilter);
    PM.add(new uno.filters.ListFilter);
    PM.add(new uno.filters.CodeBlockFilter);
    PM.add(new uno.filters.FontSizeFilter);
    PM.add(new uno.filters.ZoomScaleFilter);
    PM.add(new uno.filters.CopyFilter);
    PM.add(new uno.filters.PhoneFilter);
    return PM;
  };
})();
goog.provide("uno.listeners.AccentuateListener");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.img");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.AccentuateListener");
  var util = uno.util;
  var AccentuateListener = uno.listeners.AccentuateListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(AccentuateListener, uno.BasePlugin);
  AccentuateListener.CONTAINER_CLASSNAME = ".accentuate-container";
  AccentuateListener.BOX_CLASSNAME = ".en-find-result";
  AccentuateListener.prototype.activeOnUneditableFields = goog.functions.TRUE;
  AccentuateListener.prototype.handleSelectionChange = function(event) {
    var config = this.editor.config.accentuate;
    if (config.clearOnClickSelector) {
      var range = this.editor.getRange();
      if (range) {
        var focusNode = range.getFocusNode();
        var selector = document.querySelector(config.clearOnClickSelector);
        var editor = this.editor;
        if (event && goog.dom.contains(selector, focusNode)) {
          editor.execCommand("accentuate", {clearFirst:true});
        }
        goog.array.forEach(util.img.all(this.editor.field), util.img.removeOverlay);
      }
    }
  };
})();
goog.provide("uno.listeners.AttachmentListener");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.resource");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.AttachmentListener");
  var util = uno.util;
  var AttachmentListener = uno.listeners.AttachmentListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(AttachmentListener, uno.BasePlugin);
  AttachmentListener.prototype.activeOnUneditableFields = goog.functions.TRUE;
  AttachmentListener.prototype.handleClick = function(e) {
    if (!util.resource.isFileUI(e.target) || !this.editor.config.resourceConfig.openLinkNotifications) {
      return false;
    }
    var target = e.target;
    var evt = {type:"linkclick", target:target, data:{action:undefined, eventType:"tap", hash:util.resource.hashFor(target), href:util.resource.urlFor(target), mime:util.resource.mimeTypeFor(target), module:"resource", reference:util.resource.referenceFor(target)}};
    if (util.resource.isDefaultContextButton(target)) {
      evt.data.action = "generic-default";
    } else {
      if (util.resource.isOverflowContextButton(target)) {
        evt.data.action = "generic-context";
      } else {
        evt.data.action = "open";
      }
    }
    this.editor.dispatchEvent(evt);
    return true;
  };
  AttachmentListener.prototype.handleMouseDown = function(e) {
    if (util.resource.isPdf(e.target)) {
      this.editor.field.blur();
    }
  };
  AttachmentListener.prototype.handleDoubleClick = function(e) {
    if (util.resource.isFileUI(e.target)) {
      this.editor.dispatchEvent({type:uno.Editor.EventType.RESOURCE_DOUBLECLICK, src:e.target.src});
      return true;
    }
    return false;
  };
})();
goog.provide("uno.listeners.AutoCorrectListener");
goog.require("goog.debug.Logger");
goog.require("goog.editor.range");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.AutoCorrectListener");
  var wordCharacterRegexp = new RegExp("[" + uno.defs.regex.WORD_CHARACTERS + "]+", "g");
  var lastCharacterIsAlphanum;
  var spellcheckOn = true;
  var AutoCorrectListener = uno.listeners.AutoCorrectListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(AutoCorrectListener, uno.BasePlugin);
  AutoCorrectListener.prototype.handleKeyPress = function(event) {
    wordCharacterRegexp.lastIndex = 0;
    var data = String.fromCharCode(event.keyCode);
    if (!wordCharacterRegexp.test(data)) {
      if (lastCharacterIsAlphanum) {
        var undoPlugin = this.editor.plugins_.UndoRedo;
        undoPlugin.updateCurrentState_(this.editor);
        lastCharacterIsAlphanum = false;
      }
    } else {
      lastCharacterIsAlphanum = true;
      if (!spellcheckOn) {
        this.editor.field.setAttribute("autocorrect", "on");
        this.editor.field.setAttribute("spellcheck", "true");
        spellcheckOn = true;
      }
    }
  };
  AutoCorrectListener.prototype.handleAfterExecCommand = function(event) {
    if (event.command === "undo") {
      if (spellcheckOn) {
        this.editor.field.setAttribute("autocorrect", "off");
        this.editor.field.setAttribute("spellcheck", "false");
        spellcheckOn = false;
      }
    }
  };
})();
goog.provide("uno.listeners.ChangeListener");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.img");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.ChangeListener");
  var ChangeListener = uno.listeners.ChangeListener = function() {
    uno.BasePlugin.call(this, log.getName());
    goog.editor.Field.isSpecialGeneratingKey_ = goog.functions.FALSE;
    goog.editor.Field.isGeneratingKey_ = goog.functions.FALSE;
  };
  goog.inherits(ChangeListener, uno.BasePlugin);
  ChangeListener.prototype.handleKeyPress = function() {
    this.editor.gotGeneratingKey_ = false;
    return false;
  };
})();
goog.provide("uno.listeners.ClipboardListener");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.ClipboardListener");
  var ClipboardListener = uno.listeners.ClipboardListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(ClipboardListener, uno.BasePlugin);
  ClipboardListener.prototype.handleCopy = function(event) {
    if (this.editor.config.clipboard.intercept) {
      this.editor.context.precopyRange = this.editor.getRange();
      copyToClipboard(JSON.parse(EN.queryCommandValue("copy", null)), event);
    }
  };
  ClipboardListener.prototype.handleCut = function(event) {
    if (this.editor.config.clipboard.intercept) {
      copyToClipboard(JSON.parse(EN.queryCommandValue("cut")), event);
    }
  };
  var REGEX = /(<a(?=\s)[^>]*?\s+href=")\s*?(evernote:\/\/.*?)\s*?(".*?>)/gi;
  function stripInternalEvernoteLinks(string) {
    return string.replace(REGEX, function(_, tagStart, uri, tagEnd) {
      return tagStart + EN.convertEvernoteLinkToPublicLink(uri) + tagEnd;
    });
  }
  function copyToClipboard(copiedData, event) {
    copiedData.plain = copiedData.plain || " ";
    copiedData.html = stripInternalEvernoteLinks(copiedData.html || "");
    event.event_.clipboardData.setData("text/plain", copiedData.plain);
    event.event_.clipboardData.setData("text/html", copiedData.html);
    event.preventDefault();
  }
  ClipboardListener.prototype.handlePaste = function(event) {
    if (this.editor.config.clipboard.intercept) {
      this.editor.context.prepasteRange = this.editor.getRange();
      var enforcedPlain = event.shiftKey && (event.metaKey || event.ctrlKey);
      EN.notifyAsync("pasteRequested", {plain:!!enforcedPlain});
    }
    event.preventDefault();
    return true;
  };
})();
goog.provide("uno.listeners.CodeBlockListener");
goog.require("uno.BasePlugin");
goog.require("uno.util.codeblock");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.CodeBlockListener");
  var util = uno.util;
  var CodeBlockListener = uno.listeners.CodeBlockListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(CodeBlockListener, uno.BasePlugin);
  CodeBlockListener.prototype.handleAfterExecCommand = function() {
    var range = this.editor.getRange();
    if (range) {
      util.codeblock.updateEmpty(range.getStartNode());
    }
  };
})();
goog.provide("uno.util.mutex");
(function() {
  var util = uno.util;
  var locks = new Set;
  util.mutex.run = function(key, fn) {
    if (!key || typeof key === "function") {
      throw new Error("Missing key as a mutex lock.");
    }
    if (!locks.has(key)) {
      locks.add(key);
      try {
        fn();
      } finally {
        locks.delete(key);
      }
    }
  };
})();
goog.provide("uno.listeners.CommentListener");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.commenting");
goog.require("uno.util.mutex");
(function() {
  var util = uno.util;
  var log = goog.debug.Logger.getLogger("uno.listeners.CommentListener");
  var CommentListener = uno.listeners.CommentListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(CommentListener, uno.BasePlugin);
  CommentListener.prototype.handleWindowResize = function() {
    var field = this.editor.field;
    var state = this.editor.context.commenting;
    util.mutex.run("commenting", function() {
      util.commenting.updateMarkers(state, field);
      util.commenting.changeColumnPaddingIfNeeded(state, field);
    });
  };
  CommentListener.prototype.handleNativeSelectionChange = function(evt) {
    if (this.editor.context.commenting.skipSelection) {
      var self = this;
      setTimeout(function() {
        self.editor.context.commenting.skipSelection = false;
      });
      return;
    }
    var range = this.editor.getRange();
    var field = this.editor.field;
    var state = this.editor.context.commenting;
    if (!state.ui.threads || !range || !goog.dom.getAncestor(range.getContainer(), uno.util.dom.isEnnote, true)) {
      if (util.commenting.layoutAdder(state)) {
        util.commenting.changeColumnPaddingIfNeeded(state, field);
      }
      return;
    }
    util.commenting.layoutAdder(state, this.editor.queryCommandEnabled("comment") ? range : null);
    var node = util.commenting.getMarkerNode(range.getFocusNode());
    if (node) {
      if (!node.classList.contains("active")) {
        util.commenting.highlight(this.editor, node.getAttribute("data-en-comment"));
        util.commenting.changeColumnPaddingIfNeeded(state, field);
      }
      return;
    }
    util.commenting.highlight(this.editor);
    util.commenting.changeColumnPaddingIfNeeded(state, field);
  };
})();
goog.provide("uno.listeners.CryptListener");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.defs");
goog.require("uno.BasePlugin");
goog.require("uno.util.crypto");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.CryptListener");
  var util = uno.util;
  var CryptListener = uno.listeners.CryptListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(CryptListener, uno.BasePlugin);
  CryptListener.prototype.activeOnUneditableFields = goog.functions.TRUE;
  CryptListener.prototype.handleClick = function(e) {
    var dispatchEvent = this.editor.dispatchEvent.bind(this);
    var readOnly = this.editor.config.crypt.readOnly;
    return util.crypto.handleClick(e.target, readOnly, dispatchEvent);
  };
  CryptListener.prototype.handleDoubleClick = function(e) {
    var el = e.target;
    if (util.crypto.isCrypt(el) && !util.crypto.isOpen(el)) {
      goog.editor.range.placeCursorNextTo(el);
      this.editor.dispatchEvent({type:"cryptdoubleclick", id:el.getAttribute("id"), src:el.getAttribute("src")});
      return true;
    }
  };
})();
goog.provide("uno.listeners.deletelistener.mac");
(function() {
  var mac = uno.listeners.deletelistener.mac;
  mac.handleAfterExecCommand = function(event, editor) {
    if (event.command === "delete" || event.command === "undo") {
      setTimeout(function fixCaret() {
        var range = editor.getRange();
        if (range && range.getStartNode() === editor.field && range.getStartOffset() === 0) {
          var first = editor.field.firstChild;
          if (first.tagName !== "DIV") {
            setTimeout(fixCaret);
            return;
          }
          var tmp = document.createElement("input");
          tmp.setAttribute("style", "width:1px;height:1px;border:none;margin:0;padding:0;top:0;left:0;position:absolute");
          tmp.setAttribute("tabIndex", "-1");
          document.body.appendChild(tmp);
          tmp.setSelectionRange(0, 0);
          var newRange = goog.dom.Range.createFromNodes(first, 0, first, 0);
          newRange.select();
          tmp.remove();
        }
      });
    }
  };
})();
goog.provide("uno.listeners.DeleteListener");
goog.require("goog.debug.Logger");
goog.require("goog.editor.range");
goog.require("goog.events.KeyCodes");
goog.require("uno.BasePlugin");
goog.require("uno.util.codeblock");
goog.require("uno.listeners.deletelistener.mac");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.DeleteListener");
  var util = uno.util;
  var BACKSPACE = goog.events.KeyCodes.BACKSPACE;
  var kKey = goog.events.KeyCodes.K;
  var DeleteListener = uno.listeners.DeleteListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(DeleteListener, uno.BasePlugin);
  DeleteListener.prototype.handleKeyDown = function(event) {
    if (event.ctrlKey && event.keyCode === kKey) {
      this.editor.dispatchChange();
    }
    if (event.keyCode === BACKSPACE) {
      if (this.editor.execCommand("delete", null, {native:true}, true)) {
        event.preventDefault();
        return true;
      } else {
        setTimeout(this.editor.dispatchChange.bind(this.editor));
      }
    }
    return false;
  };
  DeleteListener.prototype.handleAfterExecCommand = function(event) {
    if (event.command === "delete") {
      var editor = this.editor;
      var selection = editor.getSelection();
      var range = selection.range;
      util.codeblock.updateTopSpace(this.editor);
      if (selection) {
        util.codeblock.updateEmpty(selection.range.getStartNode());
      }
      setTimeout(function() {
        selection = editor.getSelection();
        if (!selection) {
          return;
        }
        range = selection && selection.range;
        var node = range.getStartNode();
        var li = util.list.itemFor(node);
        if (li && !util.dom.isDiv(li.firstChild)) {
          util.dom.unflattenElement(li);
        }
        range = util.range.normalize(range);
        range.select();
        if (range && range.isCollapsed()) {
          var p = util.paragraph.for(range.getStartNode());
          if (util.dom.isEmpty(p) && editor.context.style.hasPendingStyles) {
            util.paragraph.empty(p, true, editor);
            util.range.normalize(editor.getRange()).select();
          }
        }
        var listElement = util.list.for(node);
        if (listElement) {
          Array.from(listElement.querySelectorAll("li")).forEach(function(item) {
            if (item.childNodes.length === 0) {
              item.remove();
            }
          });
        }
      });
    }
    if (this.client.handleAfterExecCommand) {
      return this.client.handleAfterExecCommand(event, this.editor);
    }
    return false;
  };
})();
goog.provide("uno.util.drag");
goog.require("goog.debug.Logger");
goog.require("uno.defs");
goog.require("uno.util.structure");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.drag");
  var util = uno.util;
  var dom = util.dom;
  var DRAGTYPES = uno.defs.dragtypes;
  var STRUCTTYPES = uno.defs.structuretypes;
  util.drag.updateDragHint = function(target, editor) {
    var state = editor.context.dragState;
    var selection = editor.getSelection();
    var collapsed = !!(!selection || selection.collapsed);
    if (!target || !collapsed || state.isAboutToDrag && state.target === target) {
      return false;
    }
    if (!state.dragging) {
      var dragType = util.drag.getDragType(target, editor);
      if (!dragType) {
        return false;
      }
      state.dragType = dragType;
      state.isAboutToDrag = true;
      var newTarget = util.drag.getDraggableTarget(target, state, true);
      if (newTarget && dom.isElementNode(newTarget)) {
        state.target = newTarget;
        document.documentElement.classList.add("en-dragdrop-willdrag");
        return true;
      }
    }
    return false;
  };
  util.drag.start = function(target, state, options) {
    var dragType = state.dragType || util.drag.getDragType(target, options.editor, !!options.nativeDrag);
    if (state.dragging || !dragType) {
      return false;
    }
    document.documentElement.classList.remove("en-dragdrop-willdrag");
    document.documentElement.classList.add("en-dragdrop-dragging");
    options = options || {};
    state.dragging = true;
    state.dragType = dragType;
    state.dragStartedInNote = !!options.dragStartedInNote;
    state.nativeDrag = !!options.nativeDrag;
    state.editor = options.editor;
    state.selection = options.editor.getSelection();
    state.dataTransfer = options.event && options.event.dataTransfer;
    state.handleOutsideDrop = options.handleOutsideDrop;
    state.target = state.target || util.drag.getDraggableTarget(target, state);
    state.dragContentTypes = util.drag.getDragContentTypes(state);
    util.drag.prepareForDrag(state, options);
    state.draggedNodes = util.drag.getDraggedNodes(state) || [];
    goog.array.forEach(state.draggedNodes, function(item) {
      goog.dom.classlist.add(item, "en-dragdrop-dragged");
    });
    util.drag.setGhostImage(state, options.event);
    if (options.setDataTransfer) {
      state.dataTransferContent = options.setDataTransfer(options.event) || {};
    }
    return true;
  };
  util.drag.getDragType = function(node, editor, nativeDrag) {
    if (!node) {
      return false;
    }
    var listEnabled = editor.context.layoutManager.list;
    var todoEnabled = editor.context.layoutManager.todo;
    var tableEnabled = editor.context.layoutManager.table;
    var range = editor.getRange();
    var collapsed = !!(!range || range.isCollapsed());
    var consistentSelection = !range || collapsed || range.containsNode(node) || range.getContainerElement() === node;
    if (consistentSelection && collapsed && util.img.getDraggableTarget(node)) {
      return DRAGTYPES.IMAGE;
    } else {
      if (consistentSelection && (collapsed || util.table.enTablefor(node)) && util.attachment.getDraggableTarget(node)) {
        return DRAGTYPES.ATTACHMENT;
      } else {
        if (consistentSelection && !nativeDrag && collapsed && todoEnabled && util.todo.getDraggableTarget(node)) {
          return DRAGTYPES.TODO;
        } else {
          if (consistentSelection && !nativeDrag && collapsed && listEnabled && util.list.getDraggableTarget(node)) {
            return DRAGTYPES.LIST;
          } else {
            if (!nativeDrag && tableEnabled && util.table.getDraggableTarget(node)) {
              return DRAGTYPES.TABLE;
            } else {
              if (consistentSelection) {
                if (collapsed) {
                  util.range.selectNode(node);
                }
                return DRAGTYPES.NATIVE;
              } else {
                return false;
              }
            }
          }
        }
      }
    }
  };
  util.drag.isDraggableHandle = function(node, state) {
    if (!node || dom.isTextNode(node)) {
      return false;
    }
    return util.img.isDraggableHandle && util.img.isDraggableHandle(node) || util.attachment.isDraggableHandle && util.attachment.isDraggableHandle(node) || util.list.isDraggableHandle && util.list.isDraggableHandle(node) || util.todo.isDraggableHandle && util.todo.isDraggableHandle(node) || util.table.isDraggableHandle && util.table.isDraggableHandle(node) || util.paragraph.isDraggableHandle && util.paragraph.isDraggableHandle(node);
  };
  util.drag.shouldPreventNativeDrag = function(target, editor) {
    var selection = editor.getSelection();
    var collapsed = !!(!selection || selection.collapsed);
    return util.todo.isTodo(target) && collapsed || !collapsed && util.crypto.for(selection.start.node) !== util.crypto.for(selection.end.node) || !editor.multirange.isEmpty() && util.table.enTablefor(event.target);
  };
  util.drag.getHintRect = function(state) {
    var rect = null;
    switch(state.dragType) {
      case DRAGTYPES.NATIVE:
        rect = util.paragraph.getHintRect && util.paragraph.getHintRect(state);
        break;
      case DRAGTYPES.IMAGE:
        rect = util.img.getHintRect && util.img.getHintRect(state);
        break;
      case DRAGTYPES.ATTACHMENT:
        rect = util.attachment.getHintRect && util.attachment.getHintRect(state);
        break;
      case DRAGTYPES.LIST:
        rect = util.list.getHintRect && util.list.getHintRect(state);
        break;
      case DRAGTYPES.TODO:
        rect = util.todo.getHintRect && util.todo.getHintRect(state);
        break;
      case DRAGTYPES.TABLE:
        rect = util.table.getHintRect && util.table.getHintRect(state);
        break;
      default:
        break;
    }
    return rect || state.target && state.target.getBoundingClientRect();
  };
  util.drag.getDraggableTarget = function(node, state, fromHint) {
    if (!node || dom.isTextNode(node)) {
      return false;
    }
    switch(state.dragType) {
      case DRAGTYPES.NATIVE:
        return !fromHint && util.paragraph.getDraggableTarget && util.paragraph.getDraggableTarget(node);
      case DRAGTYPES.IMAGE:
        return !fromHint && util.img.getDraggableTarget && util.img.getDraggableTarget(node);
      case DRAGTYPES.ATTACHMENT:
        return !fromHint && util.attachment.getDraggableTarget && util.attachment.getDraggableTarget(node);
      case DRAGTYPES.LIST:
        return util.list.getDraggableTarget && util.list.getDraggableTarget(node);
      case DRAGTYPES.TODO:
        return util.todo.getDraggableTarget && util.todo.getDraggableTarget(node);
      case DRAGTYPES.TABLE:
        return util.table.getDraggableTarget && util.table.getDraggableTarget(node);
      default:
        return null;
    }
  };
  util.drag.getDragContentTypes = function(state) {
    switch(state.dragType) {
      case DRAGTYPES.NATIVE:
        return util.paragraph.getDragContentTypes(state);
      case DRAGTYPES.IMAGE:
        return util.img.getDragContentTypes(state);
      case DRAGTYPES.ATTACHMENT:
        return util.attachment.getDragContentTypes(state);
      case DRAGTYPES.LIST:
        return util.list.getDragContentTypes(state);
      case DRAGTYPES.TODO:
        return util.todo.getDragContentTypes(state);
      case DRAGTYPES.TABLE:
        return util.table.getDragContentTypes(state);
      default:
        return [];
    }
  };
  util.drag.prepareForDrag = function(state) {
    switch(state.dragType) {
      case DRAGTYPES.NATIVE:
        return util.paragraph.prepareForDrag && util.paragraph.prepareForDrag(state);
      case DRAGTYPES.IMAGE:
        return util.img.prepareForDrag && util.img.prepareForDrag(state);
      case DRAGTYPES.ATTACHMENT:
        return util.attachment.prepareForDrag && util.attachment.prepareForDrag(state);
      case DRAGTYPES.LIST:
        return util.list.prepareForDrag && util.list.prepareForDrag(state);
      case DRAGTYPES.TODO:
        return util.todo.prepareForDrag && util.todo.prepareForDrag(state);
      case DRAGTYPES.TABLE:
        return util.table.prepareForDrag && util.table.prepareForDrag(state);
      default:
        return null;
    }
  };
  util.drag.getDraggedNodes = function(state) {
    if (Array.isArray(state.draggedNodes) && state.draggedNodes.length) {
      return state.draggedNodes;
    }
    switch(state.dragType) {
      case DRAGTYPES.NATIVE:
        return util.paragraph.getDraggedNodes && util.paragraph.getDraggedNodes(state);
      case DRAGTYPES.IMAGE:
        return util.img.getDraggedNodes && util.img.getDraggedNodes(state);
      case DRAGTYPES.ATTACHMENT:
        return util.attachment.getDraggedNodes && util.attachment.getDraggedNodes(state);
      case DRAGTYPES.LIST:
        return util.list.getDraggedNodes && util.list.getDraggedNodes(state);
      case DRAGTYPES.TODO:
        return util.todo.getDraggedNodes && util.todo.getDraggedNodes(state);
      case DRAGTYPES.TABLE:
        return util.table.getDraggedNodes && util.table.getDraggedNodes(state);
      default:
        return [];
    }
  };
  util.drag.setGhostImage = function(state) {
    if ([DRAGTYPES.TODO, DRAGTYPES.LIST, DRAGTYPES.TABLE].indexOf(state.dragType) === -1) {
      return;
    }
    setTimeout(function() {
      if (!state.ghost || state.ghost.classList.contains("en-dragdrop-ghost-hint")) {
        if (!state.ghost) {
          state.ghost = goog.dom.createDom("div", "en-dragdrop-ghost");
          util.tools.remove(".en-dragdrop-ghost");
          util.tools.append(state.ghost);
        }
        state.ghost.classList.remove("en-dragdrop-ghost-hint");
        state.ghost.classList.add("en-dragdrop-ghost-moving");
        var ghost;
        switch(state.dragType) {
          case DRAGTYPES.LIST:
            ghost = util.list.getGhostImage(state.target);
            break;
          case DRAGTYPES.TODO:
            ghost = util.todo.getGhostImage(state.target);
            break;
          case DRAGTYPES.TABLE:
            ghost = util.table.getGhostImage(state.target);
            setTimeout(function() {
              state.ghost.style.width = "120px";
            });
            break;
          default:
        }
        if (ghost) {
          state.ghost.style.opacity = "0";
          state.ghost.appendChild(ghost);
        }
      }
    });
  };
  util.drag.updateGhostPosition = function(event, state) {
    if (state.ghost) {
      var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
      state.ghost.style.left = event.clientX - 20 + "px";
      state.ghost.style.top = scrollTop + event.clientY - 10 + "px";
      state.ghost.style.opacity = "1";
    }
  };
  util.drag.scrollWhenNeeded = function(position, state) {
    if (!state.dragging) {
      return;
    }
    state.position = position;
    if (state.scrolling) {
      return;
    }
    state.scrolling = true;
    clearInterval(state.scrollId);
    var maxScroll = document.body.querySelector("en-note").scrollHeight;
    state.scrollId = setInterval(function() {
      var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
      if (state.dragging && state.scrolling) {
        var percent = state.position.clientY / window.innerHeight;
        if (scrollTop + window.innerHeight <= maxScroll && (percent < 0.2 || percent > 0.8)) {
          if (percent < 0.2) {
            document.documentElement.scrollTop -= 10 * (1 - percent);
            document.body.scrollTop -= 10 * (1 - percent);
          } else {
            if (percent > 0.8) {
              document.documentElement.scrollTop += 10 * percent;
              document.body.scrollTop += 10 * percent;
            }
          }
        }
        util.drag.updateGhostPosition(state.position, state);
      }
    }, 10);
  };
  util.drag.removeGhost = function(state, toNode, cancelled) {
    if (state.ghost && toNode) {
      if (cancelled) {
        var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
        var rect = util.drag.getHintRect(state);
        goog.dom.classlist.add(state.ghost, "en-dragdrop-ghost-dropping");
        state.ghost.style.top = scrollTop + rect.top + "px";
        state.ghost.style.left = rect.left + "px";
        state.ghost.style.height = rect.height + "px";
        state.ghost.style.width = rect.width + "px";
        state.ghost.style.opacity = 0;
        state.ghost.style.opacity = 0;
        var ghost = state.ghost;
        setTimeout(function() {
          util.tools.remove(".en-dragdrop-ghost");
        }, 300);
      } else {
        util.tools.remove(".en-dragdrop-ghost");
      }
    }
  };
})();
goog.provide("uno.util.drop");
goog.require("goog.debug.Logger");
goog.require("uno.util.structure");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.drop");
  var util = uno.util;
  var dom = util.dom;
  var DRAGTYPES = uno.defs.dragtypes;
  var DROPAREA = uno.defs.droparea;
  util.drop.updateDroppableTarget = function(event, state) {
    if (!event.target || [DRAGTYPES.TODO, DRAGTYPES.LIST, DRAGTYPES.TABLE].indexOf(state.dragType) === -1) {
      return false;
    }
    var offset = 25;
    var element = document.elementFromPoint(event.clientX, event.clientY - offset);
    var dropTarget = util.list.itemFor(element) || util.paragraph.for(element);
    if (!dropTarget || dom.isEnnote(element) || dom.isEnnote(dropTarget) || dom.isTd(dropTarget) || util.list.isList(dropTarget) || dom.isBlockObject(dropTarget)) {
      return false;
    }
    var dropRect = dropTarget.getBoundingClientRect();
    if (dropRect.bottom > event.clientY) {
      return false;
    }
    if (dropTarget) {
      if (dom.isBlockObject(dropTarget) || dom.uiFor(dropTarget)) {
        return false;
      }
      if (util.structure.itemsAllowed(state.dragContentTypes, dropTarget)) {
        var dropArea;
        if (dropTarget !== state.dropTarget) {
          state.dropClientX = event.clientX;
        }
        if (util.dom.isLi(dropTarget) && !util.list.isList(dropTarget.nextSibling)) {
          if (dropTarget === state.dropTarget && event.clientX - state.dropClientX > 15) {
            dropArea = DROPAREA.RIGHT;
          } else {
            dropArea = DROPAREA.LEFT;
          }
        }
        if (dropTarget === state.dropTarget && dropArea === state.dropArea || dropTarget.classList.contains("en-dragdrop-dragged")) {
          return false;
        }
        state.dropTarget = dropTarget;
        state.dropArea = dropArea;
        document.documentElement.classList.remove("en-dragdrop-prevent");
        if (!state.dropline) {
          state.dropline = goog.dom.createDom("div", "en-drop-line", [goog.dom.createDom("div", "en-drop-linelevel"), goog.dom.createDom("div", "en-drop-linenotch"), goog.dom.createDom("div", "en-drop-linebreak")]);
          util.tools.remove(".en-drop-line");
          util.tools.append(state.dropline);
          setTimeout(function() {
            if (state.dropline) {
              state.dropline.classList.add("en-drop-line-animate");
            }
          });
        }
        state.dropline.classList.remove("en-drop-indentedline");
        state.dropline.classList.remove("en-drop-indentedline-right");
        state.dropline.classList.remove("en-drop-indentedline-left");
        if (dropArea) {
          state.dropline.classList.add("en-drop-indentedline");
          if (dropArea === DROPAREA.RIGHT) {
            state.dropline.classList.add("en-drop-indentedline-right");
          } else {
            if (dropArea === DROPAREA.LEFT) {
              state.dropline.classList.add("en-drop-indentedline-left");
            }
          }
        }
        var rect = dropTarget.getBoundingClientRect();
        var currentDisplayStyle = dropTarget.style.display;
        var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
        var style = window.getComputedStyle(dropTarget);
        state.dropline.style.width = rect.width + "px";
        state.dropline.style.top = scrollTop + rect.bottom - 1 + "px";
        state.dropline.style.left = rect.left + "px";
        if (dom.isLi(state.dropTarget)) {
          var bulletPadding = 18;
          state.dropline.style.width = rect.width + bulletPadding + "px";
          state.dropline.style.left = rect.left - bulletPadding + "px";
        }
        return true;
      } else {
        document.documentElement.classList.add("en-dragdrop-prevent");
        dropTarget.classList.add("en-dragdrop-frozen");
        dropTarget.setAttribute("contenteditable", false);
      }
    }
    return false;
  };
  util.drop.dropItems = function(event, state, editor) {
    var requiresRange = [DRAGTYPES.NATIVE, DRAGTYPES.IMAGE, DRAGTYPES.ATTACHMENT].indexOf(state.dragType) > -1;
    var container;
    if (editor.readOnly) {
      return false;
    }
    if (requiresRange) {
      var dropRange = util.range.createFromPoints(event.clientX, event.clientY);
      if (dropRange) {
        state.dropRange = dropRange;
        container = dropRange.getContainer();
      }
    } else {
      if (state.dropTarget) {
        container = state.dropTarget.parentNode;
      }
    }
    if (!container || !util.structure.isDroppableTarget(container, state)) {
      return false;
    }
    if (!state.dragStartedInNote && state.handleOutsideDrop && state.handleOutsideDrop(event, state, editor)) {
      return true;
    }
    var tds = (state.draggedNodes || []).map(function(item) {
      return util.table.tdFor(item);
    });
    var listItems = (state.draggedNodes || []).map(function(item) {
      return util.list.itemFor(item);
    });
    var dropData = {};
    switch(state.dragType) {
      case DRAGTYPES.NATIVE:
        dropData = handleCopyPasteDrop(event, state, editor);
        break;
      case DRAGTYPES.IMAGE:
      case DRAGTYPES.ATTACHMENT:
        dropData = handleDropAtCaret(event, state, editor);
        break;
      case DRAGTYPES.LIST:
      case DRAGTYPES.TODO:
      case DRAGTYPES.TABLE:
        dropData = handleDropOnTarget(event, state, editor);
        break;
      default:
        break;
    }
    tds.forEach(function(td) {
      if (dom.isEmpty(td) || !td.firstChild) {
        util.table.resetTd(td);
      }
    });
    listItems.forEach(function(listItem) {
      if (dom.isEmpty(listItem) || !listItem.firstChild) {
        util.list.resetListItem(listItem);
      }
    });
    return !!dropData;
  };
  function handleDropOnTarget(event, state, editor) {
    if (!state.dropTarget) {
      return {};
    }
    var items = dom.isLi(state.target) ? util.list.getValidDraggedItems(state.target) : state.draggedNodes;
    if (!items.length) {
      return {};
    }
    var parent = dom.isLi(state.target) ? util.list.for(items[0]) : items[0] && items[0].parentNode;
    var lastItem = items[items.length - 1];
    var initialDropTarget = state.dropTarget;
    if (dom.isLi(state.dropTarget)) {
      var prevInserted = state.dropTarget;
      var nextSibling = util.list.isList(state.dropTarget.nextSibling) && util.dom.isLi(state.dropTarget.nextSibling.firstChild) && state.dropTarget.nextSibling.firstChild;
      if (nextSibling && nextSibling !== state.target) {
        prevInserted = items.shift();
        if (!dom.isLi(prevInserted)) {
          prevInserted = util.list.createListItem(prevInserted);
        }
        goog.dom.insertSiblingBefore(prevInserted, nextSibling);
      }
      if (state.dropArea === DROPAREA.RIGHT) {
        var newList = goog.dom.createDom(dom.isUl(state.dropTarget.parentNode) ? "ul" : "ol");
        goog.dom.insertSiblingAfter(newList, prevInserted);
        prevInserted = items.shift();
        if (!dom.isLi(prevInserted)) {
          prevInserted = util.list.createListItem(prevInserted);
        }
        newList.appendChild(prevInserted);
      }
      goog.array.forEach(items, function(list) {
        if (!dom.isLi(list) && !util.list.isList(list)) {
          list = util.list.createListItem(list);
        }
        goog.dom.insertSiblingAfter(list, prevInserted);
        prevInserted = list;
      });
    } else {
      if (dom.isLi(state.target)) {
        var listType = dom.isUl(parent) ? "ul" : "ol";
        var target = goog.dom.createDom(listType);
        goog.dom.insertSiblingAfter(target, state.dropTarget);
        goog.array.forEach(items, function(item) {
          target.appendChild(item);
        });
      } else {
        var lastInsertedItem = state.dropTarget;
        goog.array.forEach(items, function(item) {
          goog.dom.insertSiblingAfter(item, lastInsertedItem);
          lastInsertedItem = item;
        });
      }
    }
    if (dom.isEmpty(parent) && !dom.isTd(parent)) {
      goog.dom.removeNode(parent);
    }
    if (dom.isEmpty(initialDropTarget)) {
      goog.dom.removeNode(initialDropTarget);
    }
    return {};
  }
  function handleDropAtCaret(event, state, editor) {
    if (state.dropRange) {
      state.dropRange.insertNode(state.draggedNodes[0]);
      editor.selectContent(state.draggedNodes[0]);
      return {};
    }
    return null;
  }
  function handleCopyPasteDrop(event, state, editor) {
    var dataTransfer = event.dataTransfer;
    var hasCopiedContent = !!(state.copiedContent && (state.copiedContent.plain || state.copiedContent.html));
    var transferredHtml = dataTransfer && dataTransfer.getData("text/html");
    var transferredText = dataTransfer && dataTransfer.getData("text/plain");
    if (state.selection && state.selection.collapsed) {
      return false;
    }
    if (hasCopiedContent || transferredHtml || transferredText) {
      if (event.synthetic) {
      } else {
        event.preventDefault();
        event.stopPropagation();
        var range = util.range.createFromPoints(event.clientX, event.clientY);
        if (range) {
          editor.saveRangeWithCarets(range);
        }
        if (state.dragStartedInNote && state.selection.range) {
          state.selection.range.select();
          editor.execCommand("delete");
        }
        if (range) {
          editor.restoreRangeWithCarets();
        }
      }
      editor.dispatchStyleChange();
      if (hasCopiedContent) {
        editor.execCommand("paste", {value:state.copiedContent.html, type:"html", resources:state.copiedContent.resources, fromDrag:true});
      } else {
        editor.execCommand("paste", {value:transferredHtml || transferredText, type:transferredText ? "text" : "html", fromDrag:true});
      }
      return true;
    }
    return false;
  }
  util.drop.clearHint = function(state, editor, dragType) {
    if (state.isAboutToDrag && state.dragType === dragType) {
      util.drop.clear(state, editor);
    }
  };
  util.drop.handlePaste = function(editor) {
    if (!editor.context.dragState.dragging) {
      return;
    }
    setTimeout(function() {
      util.drop.clear(editor.context.dragState, editor);
    });
  };
  util.drop.clear = function(state, editor, cancelled) {
    if (!state.dragging && !state.isAboutToDrag) {
      return false;
    }
    util.drag.removeGhost(state, state.target, cancelled);
    clearInterval(state.scrollId);
    state.dragStartedInNote = false;
    state.nativeDrag = false;
    state.selection = null;
    state.dataTransfer = null;
    state.dataTransferContent = {};
    state.handleOutsideDrop = null;
    state.dropTarget = null;
    state.dropline = null;
    state.dragType = "";
    state.target = null;
    state.dragging = false;
    state.hintKeyPressed = false;
    state.mousedown = false;
    state.mousedownTarget = null;
    state.dropRange = null;
    state.preventDrag = false;
    state.dragContentTypes = [];
    state.draggedNodes = [];
    state.scrolling = false;
    state.position = {};
    state.scrollId = 0;
    state.ghost = null;
    state.copiedContent = null;
    state.isAboutToDrag = false;
    state.initialCoordinates = {};
    var draggedNodes = editor.field.querySelectorAll(".en-dragdrop-dragged");
    goog.array.forEach(draggedNodes, function(item) {
      goog.dom.classlist.remove(item, "en-dragdrop-dragged");
    });
    var frozenNodes = editor.field.querySelectorAll(".en-dragdrop-frozen");
    goog.array.forEach(frozenNodes, function(item) {
      item.classList.remove("en-dragdrop-frozen");
      item.removeAttribute("contenteditable");
    });
    util.tools.remove(".en-drop-line");
    document.documentElement.classList.remove("en-dragdrop-dragging");
    document.documentElement.classList.remove("en-dragdrop-willdrag");
    document.documentElement.classList.remove("en-dragdrop-prevent");
    document.body.classList.remove("en-selecting");
    return true;
  };
})();
goog.provide("uno.listeners.dragdroplistener.win");
goog.require("uno.util.resource");
goog.require("uno.util.dom");
goog.require("uno.util.img");
(function() {
  var win = uno.listeners.dragdroplistener.win;
  var util = uno.util;
  function getFiles(event) {
    var dt = event.dataTransfer;
    var files = [];
    if (dt.items) {
      for (var i = 0; i < dt.items.length; i++) {
        if (dt.items[i].kind === "file") {
          files.push(dt.items[i].getAsFile());
        }
      }
    } else {
      for (var j = 0; j < dt.files.length; j++) {
        files.push(dt.files[j]);
      }
    }
    return files;
  }
  win.setDataTransfer = function(event) {
    if (!event.target) {
      return null;
    }
    var dataUrl;
    var fileName;
    if (util.resource.isFileUI(event.target) || util.resource.isImage(event.target) || util.img.isResource(event.target)) {
      dataUrl = event.target.src.replace("database", "raw");
      fileName = event.target.getAttribute("data-filename") || "";
    } else {
      if (util.dom.isInlinedImage(event.target)) {
        dataUrl = event.target.src;
        fileName = "";
      }
    }
    if (!dataUrl) {
      return null;
    }
    var data = {type:"DownloadURL", value:"application/octet-stream:" + fileName.replace(/:/g, "-") + ":" + dataUrl};
    var dataTransferContent = {};
    dataTransferContent[data.type] = data.value;
    event.dataTransfer.setData(data.type, data.value);
    return dataTransferContent;
  };
  win.handleOutsideDrop = function(event, state) {
    var files = getFiles(event);
    if (files.length) {
      event.preventDefault();
      files.forEach(function(file, i) {
        var filereader = new FileReader;
        var xhr = new XMLHttpRequest;
        xhr.open("POST", "http://loadhtml/dragdata");
        xhr.setRequestHeader("Content-Type", "application/octet-stream");
        xhr.setRequestHeader("X-Content-Filename", encodeURIComponent(file.name));
        xhr.setRequestHeader("X-File-Sequence", i + 1 + " of " + files.length);
        if (i === files.length - 1) {
          xhr.setRequestHeader("X-File-Final", true);
        }
        filereader.addEventListener("loadend", function(e) {
          var buffer = filereader.result;
          var dataview = new Uint8Array(buffer);
          xhr.send(dataview);
        });
        filereader.readAsArrayBuffer(file);
      });
      return true;
    }
    return false;
  };
})();
goog.provide("uno.listeners.DragDropListener");
goog.require("goog.debug.Logger");
goog.require("goog.events.KeyCodes");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
goog.require("uno.util.drag");
goog.require("uno.util.drop");
goog.require("uno.listeners.dragdroplistener.win");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.DragDropListener");
  var KeyCodes = goog.events.KeyCodes;
  var util = uno.util;
  var drag = util.drag;
  var drop = util.drop;
  var DragDropListener = uno.listeners.DragDropListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(DragDropListener, uno.BasePlugin);
  DragDropListener.prototype.activeOnUneditableFields = goog.functions.TRUE;
  function getEvent(event) {
    event = event.event_ || event;
    if (event.touches && event.touches.length) {
      return event.touches[0];
    }
    return event;
  }
  function handleDragStart(event, dragState, options) {
    var target = event.target;
    return drag.start(target, dragState, {event:event, editor:options.editor, nativeDrag:options.nativeDrag, dragStartedInNote:options.dragStartedInNote, setDataTransfer:options.setDataTransfer, handleOutsideDrop:options.handleOutsideDrop});
  }
  function handleDragMove(event, state, editor) {
    if (state.dragging) {
      drag.updateGhostPosition(event, state);
      drop.updateDroppableTarget(event, state);
      drag.scrollWhenNeeded(event, state);
      return true;
    }
    return false;
  }
  function handleDrop(event, state, editor) {
    if (state.dragging) {
      event.preventDefault();
      if (drop.dropItems(event, state, editor)) {
        editor.dispatchChange();
      }
    }
    drop.clear(state, editor);
  }
  DragDropListener.prototype.handleDragStart = function(event) {
    if (util.drag.shouldPreventNativeDrag(event.target, this.editor)) {
      event.preventDefault();
      return true;
    }
    var nativeEvent = getEvent(event);
    if (this.editor.getSelection().collapsed && (nativeEvent.dataTransfer.dropEffect === "none" && nativeEvent.dataTransfer.effectAllowed === "uninitialized") && util.dom.isA(nativeEvent.target)) {
      goog.dom.Range.createFromNodeContents(nativeEvent.target).select();
    }
    var dragState = this.editor.context.dragState;
    return handleDragStart(nativeEvent, dragState, {editor:this.editor, nativeDrag:true, dragStartedInNote:true, setDataTransfer:this.client.setDataTransfer});
  };
  DragDropListener.prototype.handleWindowMouseDown = function(event) {
    var dragState = this.editor.context.dragState;
    if (!this.editor.field.contains(event.target)) {
      return false;
    }
    dragState.mousedown = true;
    dragState.mousedownTarget = event.target;
    dragState.initialCoordinates = {clientX:event.clientX, clientY:event.clientY};
    if (dragState.isAboutToDrag && dragState.target) {
      event.preventDefault();
      handleDragStart({target:dragState.target}, dragState, {editor:this.editor, dragStartedInNote:true, setDataTransfer:this.client.setDataTransfer});
      return true;
    }
    return false;
  };
  DragDropListener.prototype.handleMouseMove = function(event) {
    var dragState = this.editor.context.dragState;
    if (dragState.mousedown) {
      var deltaX = Math.abs(dragState.initialCoordinates.clientX - event.clientX);
      var deltaY = Math.abs(dragState.initialCoordinates.clientY - event.clientY);
      if (dragState.dragging) {
        if (deltaY > 5 || deltaX > 5) {
          return handleDragMove(getEvent(event), dragState, this.editor);
        }
        return true;
      } else {
        if (drag.isDraggableHandle(event.target, dragState) && !dragState.preventDrag) {
          return handleDragStart(getEvent(event), dragState, {editor:this.editor, dragStartedInNote:true, setDataTransfer:this.client.setDataTransfer});
        } else {
          if (!dragState.dragging && !dragState.preventDrag) {
            dragState.preventDrag = true;
            document.body.classList.add("en-selecting");
          }
        }
      }
    }
    return false;
  };
  DragDropListener.prototype.handleDragEnter = function(event) {
    event.preventDefault();
    var dragState = this.editor.context.dragState;
    if (dragState.dragging) {
      handleDragMove(getEvent(event), this.editor.context.dragState, this.editor);
    }
  };
  DragDropListener.prototype.handleDragOver = function(event) {
    var dragState = this.editor.context.dragState;
    if (dragState.dragging) {
      handleDragMove(getEvent(event), dragState, this.editor);
    } else {
      handleDragStart({target:dragState.mousedownTarget || this.editor.field, dataTransfer:getEvent(event).dataTransfer}, dragState, {editor:this.editor, nativeDrag:true, dragStartedInNote:!!dragState.mousedownTarget, setDataTransfer:this.client.setDataTransfer, handleOutsideDrop:this.client.handleOutsideDrop});
    }
  };
  DragDropListener.prototype.handleMouseUp = function(event) {
    var dragState = this.editor.context.dragState;
    if (dragState.dragging) {
      handleDrop(getEvent(event), dragState, this.editor);
    }
    dragState.mousedown = false;
    dragState.mousedownTarget = null;
    dragState.preventDrag = false;
    document.body.classList.remove("en-selecting");
  };
  DragDropListener.prototype.handleDrop = function(event) {
    handleDrop(getEvent(event), this.editor.context.dragState, this.editor);
  };
  DragDropListener.prototype.handleBlur = function(event) {
    drop.clear(this.editor.context.dragState, this.editor, true);
  };
  DragDropListener.prototype.handleWindowMouseUp = function(event) {
    var dragState = this.editor.context.dragState;
    if (dragState.dragging) {
      drop.clear(dragState, this.editor, true);
    }
  };
  DragDropListener.prototype.handleKeyUp = function(event) {
    var dragState = this.editor.context.dragState;
    if (event.keyCode === KeyCodes.ESC) {
      drop.clear(dragState, this.editor, true);
    }
  };
  DragDropListener.prototype.handleDragEnd = function(event) {
    if (this.editor.context.dragState.dragging) {
      drop.clear(this.editor.context.dragState, this.editor, true);
    }
  };
  DragDropListener.prototype.disposeInternal = function(event) {
    drop.clear(this.editor.context.dragState, {field:document.querySelector("en-note")}, true);
  };
  DragDropListener.prototype.handleSelectStart = function(event) {
    if (this.editor.context.dragState.dragging) {
      event.preventDefault();
      event.stopPropagation();
    }
  };
})();
goog.provide("uno.listeners.EnterListener");
goog.require("goog.debug.Logger");
goog.require("goog.events.KeyCodes");
goog.require("uno.BasePlugin");
goog.require("uno.util.paragraph");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.EnterListener");
  var util = uno.util;
  var dom = util.dom;
  var ENTER = goog.events.KeyCodes.ENTER;
  var EnterListener = uno.listeners.EnterListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(EnterListener, uno.BasePlugin);
  EnterListener.prototype.handleKeyDown = function(event) {
    if (event.keyCode === ENTER) {
      var range = this.editor.getRange();
      var table = range.getStartNode();
      if (table === range.getEndNode() && dom.isEntable(table)) {
        var paragraph = util.paragraph.create();
        goog.dom.replaceNode(paragraph, table);
        this.editor.selectContent(paragraph, true);
        this.editor.dispatchChange();
        return true;
      }
    }
    return false;
  };
})();
goog.provide("uno.listeners.NoteListener");
goog.require("goog.array");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("goog.events.KeyCodes");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
goog.require("uno.util.paragraph");
goog.require("uno.util.todo");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.NoteListener");
  var util = uno.util;
  var selectingLines = false;
  var DOWN = goog.events.KeyCodes.DOWN;
  var UP = goog.events.KeyCodes.UP;
  var LEFT = goog.events.KeyCodes.LEFT;
  var RIGHT = goog.events.KeyCodes.RIGHT;
  var NoteListener = uno.listeners.NoteListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(NoteListener, uno.BasePlugin);
  NoteListener.prototype.activeOnUneditableFields = goog.functions.TRUE;
  NoteListener.prototype.handleKeyDown = function(e) {
    if ([DOWN, UP, LEFT, RIGHT].indexOf(e.keyCode) > -1 && e.shiftKey && !selectingLines) {
      selectingLines = true;
    } else {
      selectingLines = false;
    }
  };
  NoteListener.prototype.handleNativeSelectionChange = function() {
    var range = this.editor.getRange();
    if (range && !range.isCollapsed() && !selectingLines) {
      var rx = "^(<br( ?\\/)?>\\s*)?" + "(<\\/[^>]+>\\s*)+" + "(<[^\\/>]+>\\s*)+" + "(<br( ?\\/)?>\\s*)?$";
      rx = new RegExp(rx, "i");
      if (this.editor.multirange.isEmpty() && rx.test(range.getHtmlFragment())) {
        range.collapse(true);
        range.select();
      }
    }
    if (range && range.isCollapsed()) {
      var node = range.getStartNode();
      if (!node.childNodes.length && util.dom.isInlineWrapper(node)) {
        node.textContent = uno.defs.unicode.ZERO_WIDTH_SPACE;
        util.range.selectNode(node.firstChild);
        this.editor.getRange().collapse();
      }
    }
    selectingLines = false;
  };
  NoteListener.prototype.handleClick = function(e) {
    if (!this.editor.readOnly) {
      var isOutsideNote = !goog.dom.getAncestor(e.target, util.dom.isEnnote, true);
      var focus = this.editor.config.stayInEditMode ? isOutsideNote : true;
      if (focus && this.editor.config.client === "ios") {
        this.editor.saveRange(util.range.createFromPoints(e.clientX, e.clientY));
      }
      this.editor.enterEditMode({range:focus, focus:focus});
    } else {
      this.editor.dispatchEvent({type:uno.Editor.EventType.ACTION_DENIED, reason:{readOnly:true}});
    }
  };
  NoteListener.prototype.handleDelayedChange = function() {
    var lastNode = goog.dom.getLastElementChild(this.editor.field);
    if (!lastNode) {
      return;
    }
    var addNewLine = goog.array.some(lastNode.childNodes, function(node) {
      return util.dom.isBlockNode(node) || util.dom.isImageLikeElement(node) && !util.todo.isTodo(node);
    });
    if (addNewLine) {
      var newDiv = goog.dom.createDom("div", {}, goog.dom.createDom("br"));
      this.editor.field.appendChild(newDiv);
    }
  };
})();
goog.provide("uno.listeners.ForwardDeleteListener");
goog.require("goog.debug.Logger");
goog.require("goog.editor.range");
goog.require("goog.events.KeyCodes");
goog.require("uno.BasePlugin");
goog.require("uno.util.paragraph");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.ForwardDeleteListener");
  var DELETE = goog.events.KeyCodes.DELETE;
  var ForwardDeleteListener = uno.listeners.ForwardDeleteListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(ForwardDeleteListener, uno.BasePlugin);
  ForwardDeleteListener.prototype.handleKeyDown = function(event) {
    if (event.keyCode === DELETE) {
      if (this.editor.execCommand("delete", null, {forward:true, native:true}, true)) {
        event.preventDefault();
        return true;
      } else {
        setTimeout(this.editor.dispatchChange.bind(this.editor));
      }
    }
  };
})();
goog.provide("uno.listeners.HighlightListener");
goog.require("goog.debug.Logger");
goog.require("uno.util.dom");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.HighlightListener");
  var util = uno.util;
  var HighlightListener = uno.listeners.HighlightListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(HighlightListener, uno.BasePlugin);
  HighlightListener.prototype.handleNativeSelectionChange = function() {
    var range = this.editor.getRange();
    if (range) {
      var node = range.getStartNode();
      if (node && node.nodeType === Node.TEXT_NODE) {
        node = node.parentNode;
      }
      if (util.dom.isElementNode(node)) {
        var style = window.getComputedStyle(node);
        if (style.backgroundColor === "rgb(255, 255, 255)") {
          node.style.backgroundColor = "";
        }
      }
    }
  };
})();
goog.provide("uno.listeners.imglistener.generic");
goog.require("goog.events");
goog.require("goog.events.KeyCodes");
goog.require("goog.functions");
goog.require("uno.util.img");
goog.require("uno.util.preview");
goog.require("uno.util.resource");
(function() {
  var generic = uno.listeners.imglistener.generic;
  var util = uno.util;
  generic.handleImgResourceClick = function(event, editor) {
    var target = event.target;
    if (editor.readOnly || !util.img.isResource(target)) {
      return false;
    }
    if (util.img.isSelected(target)) {
      util.preview.requestOpen(editor, target);
    } else {
      util.img.setSelected(target, editor);
    }
    editor.dispatchEvent({type:uno.Editor.EventType.IMAGE_CLICK, name:"", src:util.resource.urlFor(target), tagname:"img", reference:target.getAttribute("data-reference") || ""});
    return true;
  };
  generic.handleImgResourceKeyDown = function(evt, editor) {
    var img = util.img.getSelectedImage();
    if (img && evt.keyCode === goog.events.KeyCodes.SPACE) {
      evt.preventDefault();
      util.preview.requestOpen(editor, img);
      return true;
    }
    return false;
  };
})();
goog.provide("uno.listeners.imglistener.ios");
goog.require("uno.util.img");
goog.require("uno.util.resource");
(function() {
  var ios = uno.listeners.imglistener.ios;
  var util = uno.util;
  ios.handleImgResourceClick = function(event, editor) {
    var target = event.target;
    if (!util.img.isResource(target)) {
      return false;
    }
    var a;
    var offsetX = event.offsetX;
    var horizontalThreshold = editor.config.images.horizontalThreshold;
    var thresholdWidth = horizontalThreshold * 3;
    if (target.width > thresholdWidth && (offsetX < horizontalThreshold || offsetX > target.offsetWidth - horizontalThreshold)) {
      if (editor.inEditMode()) {
        setTimeout(function() {
          goog.editor.range.placeCursorNextTo(target, offsetX < horizontalThreshold);
        });
      } else {
        var parent = target.parentElement;
        var offset = offsetX < horizontalThreshold ? 0 : 1;
        var index = util.dom.index(target) + offset;
        var newRange = goog.dom.Range.createFromNodes(parent, index, parent, index);
        editor.enterEditMode({range:newRange});
      }
    } else {
      a = goog.dom.getAncestorByTagNameAndClass(target, "a");
      editor.dispatchEvent({type:"linkclick", target:event.target, data:{action:"open", eventType:"tap", hash:util.resource.hashFor(target), href:util.resource.urlFor(target), mime:util.resource.mimeTypeFor(target), module:"resource", reference:util.resource.referenceFor(target), anchorHref:a && a.href || undefined}});
      event.preventDefault();
    }
    return true;
  };
  ios.handleImgResourceKeyDown = goog.functions.FALSE;
})();
goog.provide("uno.listeners.imglistener.android");
goog.require("uno.util.img");
goog.require("uno.util.resource");
goog.require("uno.listeners.imglistener.ios");
(function() {
  var ios = uno.listeners.imglistener.ios;
  var android = uno.listeners.imglistener.android;
  var util = uno.util;
  android.handleImgResourceClick = ios.handleImgResourceClick;
  android.handleLongTouch = function(event, editor) {
    var target = event.target;
    if (!util.resource.isResource(target)) {
      return false;
    }
    editor.dispatchEvent({type:"linkclick", target:event.target, data:{action:"open", eventType:"press", hash:util.resource.hashFor(target), href:util.resource.urlFor(target), mime:util.resource.mimeTypeFor(target), module:"resource", reference:util.resource.referenceFor(target)}});
    return true;
  };
  android.handleImgResourceKeyDown = goog.functions.FALSE;
})();
goog.provide("uno.listeners.imglistener.mac");
goog.require("uno.util.img");
(function() {
  var mac = uno.listeners.imglistener.mac;
  var generic = uno.listeners.imglistener.generic;
  var util = uno.util;
  mac.handleImgResourceClick = generic.handleImgResourceClick;
  mac.handleImgResourceKeyDown = function(evt, editor) {
    var img = util.img.getSelectedImage();
    if (img && evt.keyCode === goog.events.KeyCodes.SPACE) {
      evt.preventDefault();
      setTimeout(function() {
        util.preview.requestOpen(editor, img);
      }, 250);
      return true;
    }
    return false;
  };
})();
goog.provide("uno.listeners.ImgListener");
goog.require("goog.debug.Logger");
goog.require("goog.editor.style");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.listeners.imglistener.generic");
goog.require("uno.listeners.imglistener.android");
goog.require("uno.listeners.imglistener.ios");
goog.require("uno.listeners.imglistener.mac");
goog.require("uno.util.img");
goog.require("uno.util.resource");
goog.require("uno.util.zoomscale");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.ImgListener");
  var util = uno.util;
  var ImgListener = uno.listeners.ImgListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(ImgListener, uno.BasePlugin);
  ImgListener.prototype.activeOnUneditableFields = goog.functions.TRUE;
  ImgListener.prototype.handleClick = function(event) {
    if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) {
      return false;
    }
    return this.client.handleImgResourceClick(event, this.editor);
  };
  ImgListener.prototype.handleLongTouch = function(event) {
    if (this.client.handleLongTouch) {
      return this.client.handleLongTouch(event, this.editor);
    }
  };
  ImgListener.prototype.handleNativeSelectionChange = function() {
    var range = this.editor.getRange();
    if (range && !util.img.isSelected(range)) {
      util.img.setSelected(null, this.editor);
    }
  };
  ImgListener.prototype.handleKeyDown = function(event) {
    return this.client.handleImgResourceKeyDown(event, this.editor);
  };
  ImgListener.prototype.handleScroll = function(event) {
    util.img.hideToolsOnScrollIfNeeded(event.target);
  };
})();
goog.provide("uno.listeners.linklistener.web");
(function() {
  var web = uno.listeners.linklistener.web;
  web.handleClick = function(event) {
    event.preventDefault();
  };
})();
goog.provide("uno.listeners.LinkListener");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("goog.style");
goog.require("uno.BasePlugin");
goog.require("uno.listeners.linklistener.web");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.LinkListener");
  var util = uno.util;
  var LinkListener = uno.listeners.LinkListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(LinkListener, uno.BasePlugin);
  LinkListener.prototype.activeOnUneditableFields = goog.functions.TRUE;
  LinkListener.prototype.handleClick = function(event) {
    if (this.client.handleClick) {
      this.client.handleClick(event);
    }
    var link = event.target && goog.dom.getAncestor(event.target, util.link.isLink, true);
    if (link) {
      var bounds = goog.style.getBounds(link);
      this.editor.dispatchEvent({type:"linkclick", target:link, data:{href:link.href, module:"link", left:bounds.left, top:bounds.top, width:bounds.width, height:bounds.height}});
      return true;
    }
  };
})();
goog.provide("uno.listeners.ListListener");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.editor.Command");
goog.require("goog.editor.range");
goog.require("goog.events.KeyCodes");
goog.require("goog.userAgent");
goog.require("uno.BasePlugin");
goog.require("uno.util.list");
goog.require("uno.util.dom");
goog.require("uno.defs");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.ListListener");
  var util = uno.util;
  var ENTER = goog.events.KeyCodes.ENTER;
  var TAB = goog.events.KeyCodes.TAB;
  var DRAGTYPES = uno.defs.dragtypes;
  var CURSOR_PARKING = "mobile-cursor-parking";
  var ListListener = uno.listeners.ListListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(ListListener, uno.BasePlugin);
  var iosWorkaroundSavedRange;
  function workaroundIOSEnterIssue(editor) {
    iosWorkaroundSavedRange = editor.getRange().saveUsingDom();
    var tempParking = goog.dom.createDom(CURSOR_PARKING);
    tempParking.setAttribute("style", "width:1px;height:1px;top:-9999px;left:-9999px;position:absolute");
    tempParking.setAttribute("tabIndex", "-1");
    tempParking.appendChild(document.createElement("br"));
    editor.field.appendChild(tempParking);
    goog.dom.Range.createCaret(tempParking, 0).select();
  }
  ListListener.prototype.handleMouseMove = function(event) {
    var listItem;
    if (event.offsetX >= 20 && event.offsetX < 35 && util.list.isList(event.target) || event.offsetX < -5 && (listItem = goog.dom.getAncestor(event.target, util.dom.isLi, true))) {
      var target = event.target;
      if (util.list.isList(target)) {
        var gap = 60;
        var node = document.elementFromPoint(event.clientX + (gap - event.offsetX), event.clientY);
        var li = goog.dom.getAncestor(node, util.dom.isLi, true);
        if (util.dom.isLi(li)) {
          listItem = li;
        } else {
          return false;
        }
      }
      return util.drag.updateDragHint(listItem, this.editor);
    } else {
      util.drop.clearHint(this.editor.context.dragState, this.editor, DRAGTYPES.LIST);
    }
    return false;
  };
  ListListener.prototype.handleKeyDown = function(event) {
    var selection = this.editor.getSelection();
    if (!selection) {
      return false;
    }
    var keyCode = event.keyCode;
    var shiftKey = event.shiftKey;
    var result;
    if (util.list.isSelectionInList(selection, "all")) {
      if (!selection.collapsed && keyCode === ENTER) {
        document.execCommand("delete");
        selection = this.editor.getSelection();
      }
      var paragraph = selection.start.paragraph;
      if (keyCode === ENTER && shiftKey) {
        result = util.paragraph.splitParagraph(this.editor);
      } else {
        if (keyCode === ENTER && !shiftKey) {
          var startsWithTodo = util.paragraph.startsWithTodo(paragraph);
          if (startsWithTodo && util.paragraph.onlyHasTodo(paragraph)) {
            paragraph.removeChild(paragraph.firstChild);
            if (util.dom.isEmpty(paragraph)) {
              util.paragraph.empty(paragraph);
            }
            result = true;
          } else {
            result = util.list.splitListItem(this.editor);
            if (startsWithTodo) {
              this.editor.insertNodeAtCursor(util.todo.create(), {selectNode:true});
            }
          }
        }
      }
      if (keyCode === TAB && shiftKey) {
        result = util.list.outdentSelection(this.editor);
      } else {
        if (keyCode === TAB && !shiftKey) {
          result = util.list.indentSelection(this.editor);
        }
      }
    }
    if (result) {
      if (goog.userAgent.IOS && keyCode === ENTER) {
        workaroundIOSEnterIssue(this.editor);
      } else {
        event.preventDefault();
      }
      this.editor.dispatchChange();
    }
    return !!result;
  };
  ListListener.prototype.handleInput = function(event) {
    if (iosWorkaroundSavedRange && event.event_.inputType === "insertParagraph") {
      iosWorkaroundSavedRange.restore().select();
      iosWorkaroundSavedRange = null;
      Array.from(this.editor.field.querySelectorAll(CURSOR_PARKING)).forEach(goog.dom.removeNode);
    }
  };
  ListListener.prototype.handleKeyUp = function(event) {
    var selection = this.editor.getSelection();
    if (!selection || !selection.collapsed) {
      return false;
    }
    var li = util.list.itemFor(selection.start.paragraph);
    if (li && li.childNodes.length === 1 && li.clientHeight >= 2 * li.firstChild.clientHeight) {
      log.warning("android strike list workaround activated.");
      li.style.verticalAlign = "top";
      setTimeout(function() {
        li.style.verticalAlign = "";
      }, 100);
    }
    return false;
  };
})();
goog.provide("uno.listeners.RichlinkListener");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.RichlinkListener");
  var util = uno.util;
  var RichlinkListener = uno.listeners.RichlinkListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(RichlinkListener, uno.BasePlugin);
  RichlinkListener.prototype.activeOnUneditableFields = goog.functions.TRUE;
  RichlinkListener.prototype.handleClick = function(event) {
    var el = util.richlink.componentElementFor(event.target);
    if (el) {
      return util.richlink.handleClick(el, event, this.editor);
    }
  };
  RichlinkListener.prototype.handleMouseMove = function(event) {
    var el = util.richlink.componentElementFor(event.target);
    if (el) {
      return util.richlink.handleMouseMove(el, event, this.editor);
    }
  };
  RichlinkListener.prototype.handleMouseOut = function(event) {
    var el = util.richlink.componentElementFor(event.target);
    if (el) {
      return util.richlink.handleMouseOut(el, event, this.editor);
    }
  };
})();
goog.provide("goog.async.Debouncer");
goog.require("goog.Disposable");
goog.require("goog.Timer");
goog.async.Debouncer = function(listener, interval, opt_handler) {
  goog.async.Debouncer.base(this, "constructor");
  this.listener_ = opt_handler != null ? goog.bind(listener, opt_handler) : listener;
  this.interval_ = interval;
  this.callback_ = goog.bind(this.onTimer_, this);
  this.shouldFire_ = false;
  this.pauseCount_ = 0;
  this.timer_ = null;
  this.refireAt_ = null;
  this.args_ = [];
};
goog.inherits(goog.async.Debouncer, goog.Disposable);
goog.async.Debouncer.prototype.fire = function(var_args) {
  this.args_ = arguments;
  this.shouldFire_ = false;
  if (this.timer_) {
    this.refireAt_ = goog.now() + this.interval_;
    return;
  }
  this.timer_ = goog.Timer.callOnce(this.callback_, this.interval_);
};
goog.async.Debouncer.prototype.stop = function() {
  if (this.timer_) {
    goog.Timer.clear(this.timer_);
    this.timer_ = null;
  }
  this.refireAt_ = null;
  this.shouldFire_ = false;
  this.args_ = [];
};
goog.async.Debouncer.prototype.pause = function() {
  ++this.pauseCount_;
};
goog.async.Debouncer.prototype.resume = function() {
  if (!this.pauseCount_) {
    return;
  }
  --this.pauseCount_;
  if (!this.pauseCount_ && this.shouldFire_) {
    this.doAction_();
  }
};
goog.async.Debouncer.prototype.disposeInternal = function() {
  this.stop();
  goog.async.Debouncer.base(this, "disposeInternal");
};
goog.async.Debouncer.prototype.onTimer_ = function() {
  if (this.refireAt_) {
    this.timer_ = goog.Timer.callOnce(this.callback_, this.refireAt_ - goog.now());
    this.refireAt_ = null;
    return;
  }
  this.timer_ = null;
  if (!this.pauseCount_) {
    this.doAction_();
  } else {
    this.shouldFire_ = true;
  }
};
goog.async.Debouncer.prototype.doAction_ = function() {
  this.shouldFire_ = false;
  this.listener_.apply(null, this.args_);
};
goog.provide("uno.listeners.SearchResizeListener");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("goog.async.Debouncer");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.SearchResizeListener");
  var editor;
  var SearchResizeListener = uno.listeners.SearchResizeListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(SearchResizeListener, uno.BasePlugin);
  var debouncer = new goog.async.Debouncer(function(editor) {
    editor.queryCommandValue("search");
  }, 300);
  SearchResizeListener.prototype.handleWindowResize = function() {
    log.fine("SearchResizeListener.prototype.handleWindowResize");
    debouncer.fire(this.editor);
  };
})();
goog.provide("goog.editor.plugins.LinkShortcutPlugin");
goog.require("goog.editor.Command");
goog.require("goog.editor.Plugin");
goog.editor.plugins.LinkShortcutPlugin = function() {
  goog.editor.plugins.LinkShortcutPlugin.base(this, "constructor");
};
goog.inherits(goog.editor.plugins.LinkShortcutPlugin, goog.editor.Plugin);
goog.editor.plugins.LinkShortcutPlugin.prototype.getTrogClassId = function() {
  return "LinkShortcutPlugin";
};
goog.editor.plugins.LinkShortcutPlugin.prototype.handleKeyboardShortcut = function(e, key, isModifierPressed) {
  if (isModifierPressed && key == "k" && !e.shiftKey) {
    var link = this.getFieldObject().execCommand(goog.editor.Command.LINK);
    if (link) {
      link.finishLinkCreation(this.getFieldObject());
    }
    return true;
  }
  return false;
};
goog.provide("goog.editor.plugins.HeaderFormatter");
goog.require("goog.editor.Command");
goog.require("goog.editor.Plugin");
goog.require("goog.userAgent");
goog.editor.plugins.HeaderFormatter = function() {
  goog.editor.Plugin.call(this);
};
goog.inherits(goog.editor.plugins.HeaderFormatter, goog.editor.Plugin);
goog.editor.plugins.HeaderFormatter.prototype.getTrogClassId = function() {
  return "HeaderFormatter";
};
goog.editor.plugins.HeaderFormatter.HEADER_COMMAND = {H1:"H1", H2:"H2", H3:"H3", H4:"H4"};
goog.editor.plugins.HeaderFormatter.prototype.handleKeyboardShortcut = function(e, key, isModifierPressed) {
  if (!isModifierPressed) {
    return false;
  }
  var command = null;
  switch(key) {
    case "1":
      command = goog.editor.plugins.HeaderFormatter.HEADER_COMMAND.H1;
      break;
    case "2":
      command = goog.editor.plugins.HeaderFormatter.HEADER_COMMAND.H2;
      break;
    case "3":
      command = goog.editor.plugins.HeaderFormatter.HEADER_COMMAND.H3;
      break;
    case "4":
      command = goog.editor.plugins.HeaderFormatter.HEADER_COMMAND.H4;
      break;
  }
  if (command) {
    this.getFieldObject().execCommand(goog.editor.Command.FORMAT_BLOCK, command);
    if (goog.userAgent.GECKO) {
      e.stopPropagation();
    }
    return true;
  }
  return false;
};
goog.provide("uno.listeners.ShortcutListener");
goog.require("goog.debug.Logger");
goog.require("goog.editor.plugins.UndoRedo");
goog.require("goog.editor.plugins.RemoveFormatting");
goog.require("goog.editor.plugins.LinkShortcutPlugin");
goog.require("goog.editor.plugins.HeaderFormatter");
goog.require("goog.editor.plugins.BasicTextFormatter");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.ShortcutListener");
  var ShortcutListener = uno.listeners.ShortcutListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(ShortcutListener, uno.BasePlugin);
  goog.editor.plugins.UndoRedo.prototype.handleKeyboardShortcut = goog.functions.FALSE;
  goog.editor.plugins.RemoveFormatting.prototype.handleKeyboardShortcut = goog.functions.FALSE;
  goog.editor.plugins.LinkShortcutPlugin.prototype.handleKeyboardShortcut = goog.functions.FALSE;
  goog.editor.plugins.HeaderFormatter.prototype.handleKeyboardShortcut = goog.functions.FALSE;
  goog.editor.plugins.BasicTextFormatter.prototype.handleKeyboardShortcut = goog.functions.FALSE;
})();
goog.provide("uno.listeners.SmartScrollListener");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.util.range");
goog.require("goog.events.KeyCodes");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.SmartScrollListener");
  var util = uno.util;
  var SmartScrollListener = uno.listeners.SmartScrollListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(SmartScrollListener, uno.BasePlugin);
  var delayedScrollTimerID = 0;
  SmartScrollListener.prototype._triggerDelayedScroll = function() {
    var editor = this.editor;
    if (delayedScrollTimerID) {
      clearTimeout(delayedScrollTimerID);
    }
    delayedScrollTimerID = setTimeout(function() {
      log.fine("  SmartScrollListener.prototype._triggerDelayedScroll");
      util.range.scrollSelectionIntoView(editor);
    });
  };
  SmartScrollListener.prototype.handleSelectionChange = function() {
    if (this.editor.config.smartScrollEnabled) {
      log.fine("SmartScrollListener.prototype.handleSelectionChange");
      this._triggerDelayedScroll();
    }
  };
  SmartScrollListener.prototype.handleNativeSelectionChange = function() {
    if (this.editor.config.smartScrollEnabled) {
      log.fine("  SmartScrollListener.prototype.handleNativeSelectionChange");
      var range = this.editor.getRange();
      if (range && range.isCollapsed()) {
        this._triggerDelayedScroll();
      }
    }
  };
  SmartScrollListener.prototype.handleWindowResize = function() {
    log.fine("SmartScrollListener.prototype.handleWindowResize");
    util.range.scrollSelectionIntoView(this.editor);
  };
})();
goog.provide("goog.events.WheelEvent");
goog.require("goog.asserts");
goog.require("goog.events.BrowserEvent");
goog.events.WheelEvent = function(browserEvent, deltaMode, deltaX, deltaY, deltaZ) {
  goog.events.WheelEvent.base(this, "constructor", browserEvent);
  goog.asserts.assert(browserEvent, "Expecting a non-null browserEvent");
  this.type = goog.events.WheelEvent.EventType.WHEEL;
  this.deltaMode = deltaMode;
  this.deltaX = deltaX;
  this.deltaY = deltaY;
  this.deltaZ = deltaZ;
  var pixelRatio = 1;
  switch(deltaMode) {
    case goog.events.WheelEvent.DeltaMode.PAGE:
      pixelRatio *= goog.events.WheelEvent.PIXELS_PER_PAGE_;
      break;
    case goog.events.WheelEvent.DeltaMode.LINE:
      pixelRatio *= goog.events.WheelEvent.PIXELS_PER_LINE_;
      break;
  }
  this.pixelDeltaX = this.deltaX * pixelRatio;
  this.pixelDeltaY = this.deltaY * pixelRatio;
  this.pixelDeltaZ = this.deltaZ * pixelRatio;
};
goog.inherits(goog.events.WheelEvent, goog.events.BrowserEvent);
goog.events.WheelEvent.EventType = {WHEEL:"wheel"};
goog.events.WheelEvent.DeltaMode = {PIXEL:0, LINE:1, PAGE:2};
goog.events.WheelEvent.PIXELS_PER_LINE_ = 15;
goog.events.WheelEvent.PIXELS_PER_PAGE_ = 30 * goog.events.WheelEvent.PIXELS_PER_LINE_;
goog.provide("goog.events.WheelHandler");
goog.require("goog.dom");
goog.require("goog.events");
goog.require("goog.events.EventTarget");
goog.require("goog.events.WheelEvent");
goog.require("goog.style");
goog.require("goog.userAgent");
goog.require("goog.userAgent.product");
goog.require("goog.userAgent.product.isVersion");
goog.events.WheelHandler = function(element, opt_capture) {
  goog.events.WheelHandler.base(this, "constructor");
  this.element_ = element;
  var rtlElement = goog.dom.isElement(this.element_) ? this.element_ : this.element_.body;
  this.isRtl_ = !!rtlElement && goog.style.isRightToLeft(rtlElement);
  this.listenKey_ = goog.events.listen(this.element_, goog.events.WheelHandler.getDomEventType(), this, opt_capture);
};
goog.inherits(goog.events.WheelHandler, goog.events.EventTarget);
goog.events.WheelHandler.getDomEventType = function() {
  if (goog.userAgent.GECKO && goog.userAgent.isVersionOrHigher(17) || goog.userAgent.IE && goog.userAgent.isVersionOrHigher(9) || goog.userAgent.product.CHROME && goog.userAgent.product.isVersion(31)) {
    return "wheel";
  }
  return goog.userAgent.GECKO ? "DOMMouseScroll" : "mousewheel";
};
goog.events.WheelHandler.prototype.handleEvent = function(e) {
  var deltaMode = goog.events.WheelEvent.DeltaMode.PIXEL;
  var deltaX = 0;
  var deltaY = 0;
  var deltaZ = 0;
  var be = e.getBrowserEvent();
  if (be.type == "wheel") {
    deltaMode = be.deltaMode;
    deltaX = be.deltaX;
    deltaY = be.deltaY;
    deltaZ = be.deltaZ;
  } else {
    if (be.type == "mousewheel") {
      if (goog.isDef(be.wheelDeltaX)) {
        deltaX = -be.wheelDeltaX;
        deltaY = -be.wheelDeltaY;
      } else {
        deltaY = -be.wheelDelta;
      }
    } else {
      deltaMode = goog.events.WheelEvent.DeltaMode.LINE;
      if (goog.isDef(be.axis) && be.axis === be.HORIZONTAL_AXIS) {
        deltaX = be.detail;
      } else {
        deltaY = be.detail;
      }
    }
  }
  if (this.isRtl_) {
    deltaX = -deltaX;
  }
  var newEvent = new goog.events.WheelEvent(be, deltaMode, deltaX, deltaY, deltaZ);
  this.dispatchEvent(newEvent);
};
goog.events.WheelHandler.prototype.disposeInternal = function() {
  goog.events.WheelHandler.superClass_.disposeInternal.call(this);
  goog.events.unlistenByKey(this.listenKey_);
  this.listenKey_ = null;
};
goog.provide("uno.listeners.tablelistener.generic");
goog.require("goog.events.KeyCodes");
(function() {
  var generic = uno.listeners.tablelistener.generic;
  generic.isToggleKey = function(event) {
    return event && event.metaKey;
  };
  generic.getDeltaX = function(event) {
    return event.deltaX * 0.5;
  };
})();
goog.provide("uno.listeners.tablelistener.win");
goog.require("goog.events.KeyCodes");
(function() {
  var win = uno.listeners.tablelistener.win;
  win.isToggleKey = function(event) {
    return event && event.ctrlKey;
  };
  win.getDeltaX = function(event) {
    return event.deltaX * 26;
  };
})();
goog.provide("uno.listeners.tablelistener.web");
goog.require("goog.events.KeyCodes");
(function() {
  var clients = uno.listeners.tablelistener;
  var web = clients.web;
  web.isToggleKey = function() {
    if (goog.userAgent.MAC) {
      return isMacToggleKey;
    }
    return isWinToggleKey;
  }();
  function isWinToggleKey(event) {
    return event && event.ctrlKey;
  }
  function isMacToggleKey(event) {
    return event && event.metaKey;
  }
  web.getDeltaX = function(event) {
    return event.pixelDeltaX;
  };
})();
goog.provide("uno.util.table.drag");
goog.require("goog.debug.Logger");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.table");
goog.require("uno.util.table.selection");
goog.require("uno.util.tools");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.table.drag");
  var util = uno.util;
  var State = util.table.State;
  var Axis = util.table.Axis;
  var model = null;
  util.table.drag.prepare = function(enTable, event) {
    var target = event.target;
    if (model || !target || !target.classList.contains("handle") || event.type !== "mousedown") {
      return;
    }
    var obj = util.table.handleToObject(target);
    var indexes = obj.axis === Axis.VERTICAL ? util.table.selection.getColumnIndexes(State.DRAGGABLE) : util.table.selection.getRowIndexes(State.DRAGGABLE);
    if (indexes.indexOf(obj.index) === -1) {
      return;
    }
    model = {enTable:enTable, baseX:event.clientX, baseY:event.clientY, baseIndex:obj.index, baseAxis:obj.axis};
  };
  util.table.drag.tryStart = function(enTable, event) {
    if (!model || !enTable || !event || model.preview || model.enTable !== enTable || !util.table.selection.isActive(enTable)) {
      return false;
    }
    if (["mousemove", "mouseover"].indexOf(event.type) === -1) {
      return false;
    }
    if (event.ctrlKey || event.shiftKey || event.metaKey || event.altKey) {
      return false;
    }
    if (event.type === "mousemove" && distance(model.baseX, model.baseY, event.clientX, event.clientY) <= 5) {
      return false;
    }
    var indexes = model.baseAxis === Axis.VERTICAL ? util.table.selection.getColumnIndexes(State.DRAGGABLE) : util.table.selection.getRowIndexes(State.DRAGGABLE);
    if (indexes.indexOf(model.baseIndex) === -1) {
      return false;
    }
    util.table.drag.start(enTable, event.clientX, event.clientY, indexes, model.baseAxis);
    return true;
  };
  util.table.drag.start = function(enTable, clientX, clientY, indexes, axis) {
    if (model) {
      util.table.drag.cancel();
    }
    document.documentElement.classList.add("table-dragging");
    var container = util.table.query_(enTable, ".container");
    var containerBounds = container.getBoundingClientRect();
    var bounds = false;
    var animated = !!bounds;
    if (!animated) {
      bounds = containerBounds;
    }
    var preview = createPreview(clientX, clientY, bounds, axis, indexes.length, animated);
    model = {enTable:enTable, preview:preview, axis:axis, indexes:indexes, sequence:isSequence(indexes), baseX:clientX, baseY:clientY, baseLeft:parseInt(preview.style.left, 10), baseTop:parseInt(preview.style.top, 10), zones:{}};
  };
  util.table.drag.move = function(enTable, clientX, clientY) {
    if (!model) {
      return;
    }
    if (model.zones.ownerEnTable !== enTable) {
      if (model.zones.current) {
        util.table.setLine(model.zones.ownerEnTable);
        model.zones.current = null;
      }
      clearAnimationFrame(model.zones.scroll);
      if (enTable) {
        model.zones = createZones(enTable, model.axis, enTable === model.enTable ? model.indexes : [], model.sequence);
      }
    }
    if (enTable) {
      var coordinate = model.axis === Axis.VERTICAL ? clientX : clientY;
      scrollIfNeeded(coordinate);
      updateIfNeeded(coordinate);
    }
    var left = model.baseLeft + (clientX - model.baseX);
    var top = model.baseTop + (clientY - model.baseY) + util.dom.scrollTop(document.body);
    model.preview.style.left = left + "px";
    model.preview.style.top = top + "px";
  };
  util.table.drag.end = function(multirange) {
    if (!model) {
      return false;
    }
    var changed = false;
    if (model.zones.current) {
      moveCells(model.enTable, model.zones.ownerEnTable, model.axis, model.indexes, model.zones.current.index, multirange);
      changed = true;
    }
    cleanup();
    return changed;
  };
  util.table.drag.cancel = function() {
    if (!model) {
      return;
    }
    cleanup();
  };
  function cleanup() {
    document.documentElement.classList.remove("table-dragging");
    if (model.preview) {
      model.preview.remove();
    }
    if (model.zones) {
      if (model.zones.ownerEnTable) {
        util.table.setLine(model.zones.ownerEnTable);
      }
      clearAnimationFrame(model.zones.scroll);
    }
    model = null;
  }
  function scrollIfNeeded(coordinate) {
    var sdata = model.zones.scroll;
    if (!sdata) {
      return;
    }
    var container = model.zones.container;
    var bounds = container.getBoundingClientRect();
    var offset = 0;
    var detectionWidth = 50;
    if (coordinate < bounds.left + detectionWidth) {
      offset = bounds.left + detectionWidth - coordinate;
    } else {
      if (coordinate > bounds.right - detectionWidth) {
        offset = bounds.right - detectionWidth - coordinate;
      }
    }
    sdata.direction = offset === 0 ? 0 : offset > 0 ? -1 : 1;
    sdata.coordinate = coordinate;
    if (sdata.direction === 0 || isScrolledToEnd(container, sdata.direction)) {
      clearAnimationFrame(sdata);
      return;
    }
    sdata.speed = Math.pow(Math.min(Math.max(Math.abs(offset), 1), detectionWidth) * 2, 1.7);
    if (sdata.rafID === null) {
      sdata.then = Date.now();
      scroll();
    }
  }
  function updateIfNeeded(coordinate) {
    var zone = findZone(model.zones, coordinate, model.axis);
    if (zone !== model.zones.current) {
      model.zones.current = zone;
      if (zone) {
        util.table.setLine(model.zones.ownerEnTable, zone.index, model.axis);
      } else {
        util.table.setLine(model.zones.ownerEnTable);
      }
    }
  }
  function scroll() {
    var sdata = model.zones.scroll;
    var container = model.zones.container;
    if (!sdata || sdata.direction === 0 || isScrolledToEnd(container, sdata.direction)) {
      clearAnimationFrame(sdata);
      return;
    }
    var now = Date.now();
    var delta = (now - sdata.then) / 1000;
    var velocity = sdata.speed * delta * sdata.direction;
    container.scrollLeft = Math.ceil(container.scrollLeft + velocity);
    updateIfNeeded(sdata.coordinate);
    sdata.then = now;
    sdata.rafID = requestAnimationFrame(scroll);
  }
  function moveCells(sourceEnTable, targetEnTable, axis, indexes, dropIndex, multirange) {
    var inPlace = sourceEnTable === targetEnTable;
    if (inPlace) {
      var refDropIndex = dropIndex;
      indexes.forEach(function(v) {
        if (v < refDropIndex) {
          dropIndex -= 1;
        }
      });
    }
    util.table.selection.clear();
    var diffSize = inPlace ? 0 : fitTargetTableSize(sourceEnTable, targetEnTable, axis);
    var transferObj = removeSubmatrix(sourceEnTable, indexes, diffSize, axis);
    if (!inPlace && sourceEnTable.parentNode) {
      util.table.normalizeCellBorders(util.table.query_(sourceEnTable, "table"));
      util.table.layout(sourceEnTable);
    }
    insertSubmatrix(targetEnTable, transferObj, dropIndex, axis);
    util.table.normalizeCellBorders(util.table.query_(targetEnTable, "table"));
    util.table.layout(targetEnTable);
    util.table.setActive(targetEnTable, targetEnTable.querySelector("td.selected"));
    util.table.selection.create(targetEnTable, multirange);
  }
  function removeSubmatrix(sourceEnTable, indexes, diffSize, axis) {
    var table = util.table.query_(sourceEnTable, "table");
    var matrix = util.table.matrix(table);
    var vert = axis === Axis.VERTICAL;
    var submatrix = [];
    var cols = [];
    var vector = vert ? matrix[0] : matrix;
    if (vert) {
      matrix.forEach(function(row, rowIndex) {
        var subitems = [];
        submatrix.push(subitems);
        indexes.forEach(function(colIndex) {
          var info = row[colIndex].info;
          var node = null;
          if (info.startColIndex === colIndex && info.startRowIndex === rowIndex) {
            node = info.node;
            node.classList.add("selected");
            node.remove();
          }
          subitems.push(node);
        });
      });
      for (var i = diffSize; i > 0; i--) {
        var subitems = [];
        submatrix.push(subitems);
        indexes.forEach(function() {
          subitems.push(util.table.createEmptyTd({class:"selected"}));
        });
      }
      var colgroup = util.table.query_(sourceEnTable, "colgroup");
      goog.array.forEachRight(indexes, function(rowIndex) {
        var col = colgroup.children[rowIndex];
        col.remove();
        cols.push(col);
      });
    } else {
      indexes.forEach(function(rowIndex) {
        var subitems = [];
        submatrix.push(subitems);
        matrix[rowIndex].forEach(function(obj, colIndex) {
          var info = obj.info;
          var node = null;
          if (info.startColIndex === colIndex && info.startRowIndex === rowIndex) {
            node = info.node;
            node.classList.add("selected");
            node.remove();
          }
          subitems.push(node);
        });
        for (var i = diffSize; i > 0; i--) {
          subitems.push(util.table.createEmptyTd({class:"selected"}));
        }
      });
      goog.array.forEachRight(indexes, function(rowIndex) {
        table.rows[rowIndex].remove();
      });
    }
    if (vector.length === indexes.length) {
      sourceEnTable.remove();
    }
    return {submatrix:submatrix, cols:cols};
  }
  function insertSubmatrix(targetEnTable, transferObj, dropIndex, axis) {
    var table = util.table.query_(targetEnTable, "table");
    var colgroup = axis === Axis.VERTICAL ? util.table.query_(targetEnTable, "colgroup") : null;
    transferObj.submatrix.forEach(function(row, rowIndex) {
      var tr = null;
      if (axis === Axis.HORIZONTAL) {
        tr = document.createElement("tr");
        table.tBodies[0].insertBefore(tr, table.rows[rowIndex + dropIndex] || null);
      }
      row.forEach(function(td, colIndex) {
        if (td && axis === Axis.HORIZONTAL) {
          tr.appendChild(td);
        } else {
          if (td) {
            util.table.insertTd(td, rowIndex, colIndex + dropIndex, table);
          }
        }
        if (rowIndex === 0 && axis === Axis.VERTICAL) {
          colgroup.insertBefore(transferObj.cols.pop(), colgroup.children[colIndex + dropIndex] || null);
        }
      });
    });
  }
  function fitTargetTableSize(sourceEnTable, targetEnTable, axis) {
    var vert = axis === Axis.VERTICAL;
    var sourceMatrix = util.table.matrix(sourceEnTable);
    var targetMatrix = util.table.matrix(targetEnTable);
    var sourceItemCount = vert ? sourceMatrix.length : sourceMatrix[0].length;
    var targetItemCount = vert ? targetMatrix.length : targetMatrix[0].length;
    if (targetItemCount < sourceItemCount) {
      fn = vert ? util.table.insertRows : util.table.insertColumns;
      fn(targetEnTable, targetItemCount, sourceItemCount - targetItemCount);
    }
    return targetItemCount - sourceItemCount;
  }
  function getVisibleSelectedBounds(enTable, x, y, axis, indexes) {
    var table = util.table.query_(enTable, "table");
    var container = util.table.query_(enTable, ".container");
    var contBounds = container.getBoundingClientRect();
    var groups = [];
    var low = null;
    var high = null;
    var vert = axis === Axis.VERTICAL;
    var lowProp = vert ? "left" : "top";
    var highProp = vert ? "right" : "bottom";
    var items = vert ? table.rows[0].children : table.rows;
    goog.array.forEach(items, function(item, i) {
      if (indexes.indexOf(i) === -1) {
        return;
      }
      var td = vert ? item : item.firstChild;
      var tdBounds = td.getBoundingClientRect();
      if (contBounds[highProp] > tdBounds[lowProp] && tdBounds[lowProp] < contBounds[highProp]) {
        var l = Math.max(tdBounds[lowProp], contBounds[lowProp]);
        var h = Math.min(tdBounds[highProp], contBounds[highProp]);
        var group = goog.array.peek(groups);
        if (!group || group.high !== l) {
          group = {low:l, high:null};
          groups.push(group);
        }
        group.high = h;
      }
    });
    if (groups.length === 0) {
      return null;
    }
    var axisVal = vert ? x : y;
    groups.forEach(function(group) {
      group.distance = Math.min(Math.abs(group.low - axisVal), Math.abs(group.high - axisVal));
    });
    var group = groups.sort(function(a, b) {
      return a.distance - b.distance;
    })[0];
    var bounds = axis === "y" ? {top:contBounds.top - 13, left:group.low, right:group.high, bottom:contBounds.bottom} : {top:group.low, left:contBounds.left - 13, right:contBounds.right, bottom:group.high};
    bounds.width = bounds.right - bounds.left;
    bounds.height = bounds.bottom - bounds.top;
    return bounds;
  }
  function findZone(zones, coordinate, axis) {
    if (!zones) {
      return null;
    }
    var contBounds = zones.container.getBoundingClientRect();
    if (axis === Axis.VERTICAL) {
      coordinate = coordinate - contBounds.left + (zones.scroll ? zones.container.scrollLeft : 0);
    } else {
      coordinate = coordinate - contBounds.top;
    }
    if (zones.current) {
      var b = zones.current.bounds;
      if (b[0] <= coordinate && b[1] > coordinate) {
        return zones.current;
      }
    }
    for (var i = zones.all.length - 1; i >= 0; i--) {
      var chunk = zones.all[i];
      var b = chunk.bounds;
      if (b[0] <= coordinate && b[1] > coordinate) {
        return chunk;
      }
    }
    return null;
  }
  function createZones(enTable, axis, dragIndexes, sequence) {
    var container = util.table.query_(enTable, ".container");
    var matrix = util.table.matrix(enTable);
    var scrollable = axis === Axis.VERTICAL && container.offsetWidth < container.scrollWidth;
    var dropIndexes = createDropIndexes(matrix, axis);
    var all = createZoneBounds(matrix, dragIndexes, dropIndexes, sequence, axis);
    return {all:all, container:container, current:null, ownerEnTable:enTable, scroll:scrollable ? {speed:0, direction:0, coordinate:null, then:null, rafID:null} : null};
  }
  function createZoneBounds(matrix, dragIndexes, dropIndexes, sequence, axis) {
    var vert = axis === Axis.VERTICAL;
    var items = vert ? matrix[0] : matrix;
    var posProp = vert ? "offsetLeft" : "offsetTop";
    var sizeProp = vert ? "offsetWidth" : "offsetHeight";
    var zones = [];
    var dragIndexObj = dragIndexes.reduce(function(obj, val) {
      obj[val] = true;
      return obj;
    }, {});
    var dropIndexObj = dropIndexes.reduce(function(obj, val) {
      obj[val] = true;
      return obj;
    }, {});
    for (var i = 0, length = items.length; i <= length; i++) {
      var selected = dragIndexObj[i];
      var selectedPrev = dragIndexObj[i - 1];
      if (!dropIndexObj[i] || sequence && (selected || selectedPrev) || !sequence && selected && selectedPrev) {
        continue;
      }
      var itemIndex = i === length ? i - 1 : i;
      var td = vert ? items[itemIndex].info.node : items[itemIndex][0].info.node;
      var lastTd;
      var lowBound;
      var highBound;
      if (i === 0) {
        lowBound = -34;
      } else {
        if (i === length && selectedPrev) {
          lowBound = td[posProp] + td[sizeProp] - 16;
        } else {
          if (i === length) {
            lowBound = td[posProp] + Math.ceil(td[sizeProp] / 2);
          } else {
            if (selectedPrev) {
              lowBound = td[posProp] - 16;
            } else {
              lastTd = vert ? items[itemIndex - 1].info.node : items[itemIndex - 1][0].info.node;
              lowBound = td[posProp] - Math.ceil(lastTd[sizeProp] / 2);
            }
          }
        }
      }
      if (i === length) {
        highBound = td[posProp] + td[sizeProp] + 34;
      } else {
        if (selected) {
          highBound = td[posProp] + 16;
        } else {
          highBound = td[posProp] + Math.ceil(td[sizeProp] / 2);
        }
      }
      zones.push({bounds:[lowBound, highBound], index:i});
    }
    return zones;
  }
  function createDropIndexes(matrix, axis) {
    var vert = axis === Axis.VERTICAL;
    var length = vert ? matrix[0].length : matrix.length;
    var blockedIndexes = {};
    var dropIndexes = [];
    matrix.forEach(function(row, rowIndex) {
      row.forEach(function(obj, colIndex) {
        var info = obj.info;
        if (vert && info.endColIndex > colIndex) {
          blockedIndexes[colIndex + 1] = true;
        } else {
          if (!vert && info.endRowIndex > rowIndex) {
            blockedIndexes[rowIndex + 1] = true;
          }
        }
      });
    });
    for (var i = 0; i <= length; i++) {
      if (!blockedIndexes[i]) {
        dropIndexes.push(i);
      }
    }
    return dropIndexes;
  }
  function createPreview(x, y, bounds, axis, count, animated) {
    var preview = util.tools.query(".en-drag-colrow");
    if (!preview) {
      preview = goog.dom.createDom("div", {class:"en-drag-colrow"});
      util.tools.append(preview);
    }
    preview.setAttribute("data-count", count);
    var width = 48;
    var height = 40;
    var left = 0;
    var top = 0;
    if (axis === "y") {
      height = Math.min(Math.max(bounds.height, height), 150);
      left = Math.round(x - width / 2);
      top = y - 10;
    } else {
      width = Math.min(Math.max(bounds.width, width), 200);
      left = x - 10;
      top = Math.round(y - height / 2);
    }
    preview.style.width = width + "px";
    preview.style.height = height + "px";
    preview.style.left = left + "px";
    preview.style.top = top + "px";
    if (animated) {
      preview.style.opacity = 0;
      preview.style.transform = ["translate3d(" + (bounds.left - left) + "px, " + (bounds.top - top) + "px, 0)", "scale(" + bounds.width / width + ", " + bounds.height / height + ")"].join(" ");
      setTimeout(function() {
        preview.style.opacity = 1;
        preview.style.transform = "translate3d(0, 0, 0) scale(1, 1)";
      }, 0);
    }
    return preview;
  }
  function clearAnimationFrame(scrollObj) {
    if (scrollObj && scrollObj.rafID) {
      cancelAnimationFrame(scrollObj.rafID);
      scrollObj.rafID = null;
    }
  }
  function isSequence(indexes) {
    if (indexes.length === 0) {
      return false;
    }
    if (indexes.length === 1) {
      return true;
    }
    for (var i = indexes.length - 2; i >= 0; i--) {
      if (indexes[i] + 1 !== indexes[i + 1]) {
        return false;
      }
    }
    return true;
  }
  function isScrolledToEnd(container, direction) {
    var sLeft = container.scrollLeft;
    var sWidth = container.scrollWidth;
    var oWidth = container.offsetWidth;
    return direction < 0 && sLeft === 0 || direction > 0 && sWidth - oWidth - sLeft === 0;
  }
  function distance(x1, y1, x2, y2) {
    var dx = x1 - x2;
    var dy = y1 - y2;
    return Math.sqrt(dx * dx + dy * dy);
  }
})();
goog.provide("uno.util.table.resizer");
goog.require("goog.debug.Logger");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.table.resizer");
  var util = uno.util;
  var model = null;
  util.table.resizer.start = function(enTable, yline, clientX, colIndex) {
    if (model) {
      util.table.resizer.end();
    }
    var table = util.table.query_(enTable, "table");
    var col = util.table.query_(enTable, "colgroup").children[colIndex];
    var minWidth = util.table.getColumnsMinWidth(enTable, colIndex)[colIndex];
    var baseColWidth = parseInt(col.style.width, 10);
    if (colIndex === 0) {
      minWidth += 1;
    }
    yline.classList.add("active");
    document.documentElement.classList.add("col-resizing");
    model = {enTable:enTable, col:col, yline:yline, baseX:clientX, baseYlineLeft:parseInt(yline.style.left, 10), baseColWidth:baseColWidth, baseTableWidth:parseInt(table.style.width, 10), minDelta:Math.min(minWidth - baseColWidth, 0)};
  };
  util.table.resizer.end = function() {
    document.documentElement.classList.remove("col-resizing");
    model.yline.classList.remove("active");
    model = null;
  };
  util.table.resizer.resize = function(clientX) {
    if (!model) {
      return;
    }
    var delta = Math.max(clientX - model.baseX, model.minDelta);
    model.yline.style.left = model.baseYlineLeft + delta + "px";
    model.col.style.width = model.baseColWidth + delta + "px";
    util.table.updateWidth(model.enTable, model.baseTableWidth + delta);
    util.table.updateAdornments(model.enTable);
    util.table.translateX(model.enTable);
    util.table.layoutMenuButton();
  };
  util.table.resizer.getTarget = function() {
    return model ? model.enTable : null;
  };
})();
goog.provide("uno.util.table.scroller");
goog.require("goog.debug.Logger");
goog.require("uno.util.table");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.table.scroller");
  var util = uno.util;
  var model = null;
  util.table.scroller.start = function(enTable, thumb, clientX) {
    if (model) {
      util.table.scroller.end();
    }
    var container = util.table.query_(enTable, ".container");
    var scrollLeft = container.scrollLeft;
    var scrollWidth = container.scrollWidth;
    var offsetWidth = container.offsetWidth;
    var scale = offsetWidth / scrollWidth;
    thumb.classList.add("active");
    document.documentElement.classList.add("table-scrolling");
    model = {enTable:enTable, container:container, thumb:thumb, baseX:clientX, baseLeft:scrollLeft, maxDelta:(scrollWidth - offsetWidth - scrollLeft) * scale, minDelta:-scrollLeft * scale, scale:scale};
  };
  util.table.scroller.end = function() {
    document.documentElement.classList.remove("table-scrolling");
    model.thumb.classList.remove("active");
    model = null;
  };
  util.table.scroller.scrollByDrag = function(clientX) {
    if (!model) {
      return;
    }
    var delta = Math.min(Math.max(clientX - model.baseX, model.minDelta), model.maxDelta);
    model.container.scrollLeft = model.baseLeft + delta / model.scale;
    util.table.translateX(model.enTable);
  };
  util.table.scroller.scrollByWheel = function(enTable, deltaX) {
    var container = util.table.query_(enTable, ".container");
    if (container.offsetWidth >= container.scrollWidth) {
      return false;
    }
    container.scrollLeft += deltaX;
    return true;
  };
  util.table.scroller.scrollByClick = function(enTable, scrollbarX) {
    var container = util.table.query_(enTable, ".container");
    var offsetWidth = container.offsetWidth;
    if (offsetWidth >= container.scrollWidth) {
      return false;
    }
    var thumb = util.table.query_(enTable, ".scrollbar-thumb");
    var transform = thumb.style.transform || thumb.style.webkitTransform || "";
    var match = transform.match(/translateX\((\d+)(?:\.\d+)?px\)?/);
    var x = match.length === 2 ? parseInt(match[1], 10) : null;
    if (x === null || isNaN(x)) {
      return false;
    }
    container.scrollLeft += x > scrollbarX ? -offsetWidth : offsetWidth;
    return true;
  };
})();
goog.provide("uno.listeners.TableListener");
goog.require("goog.debug.Logger");
goog.require("goog.array");
goog.require("goog.dom");
goog.require("goog.editor.range");
goog.require("goog.events.KeyCodes");
goog.require("goog.events.WheelHandler");
goog.require("goog.events.WheelEvent");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
goog.require("uno.listeners.tablelistener.generic");
goog.require("uno.listeners.tablelistener.win");
goog.require("uno.listeners.tablelistener.web");
goog.require("uno.util.dom");
goog.require("uno.util.menu");
goog.require("uno.util.table");
goog.require("uno.util.table.drag");
goog.require("uno.util.table.resizer");
goog.require("uno.util.table.scroller");
goog.require("uno.util.table.selection");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.TableListener");
  var util = uno.util;
  var Axis = util.table.Axis;
  var KeyCodes = goog.events.KeyCodes;
  var WheelHandler = goog.events.WheelHandler;
  var WheelEvent = goog.events.WheelEvent;
  var TableListener = uno.listeners.TableListener = function() {
    uno.BasePlugin.call(this, log.getName());
    this.selectable = true;
    this.scrollable = false;
    this.scrolling = false;
    this.resizing = false;
    this.dragging = false;
    this.leftMouseDown = false;
    this.leftMouseMoving = false;
    this.clicked = false;
    this.clickTimer = null;
    var wheelHandler = new WheelHandler(document.body);
    goog.events.listen(wheelHandler, WheelEvent.EventType.WHEEL, this.handleMouseWheel, true, this);
    this.lastRangeState = null;
    this.lastKeyState = null;
    this.isSelectableCellCandidate = false;
    this.lastMouseDownEnTable = null;
    this.lastMouseOverEnTable = null;
    this.lastMouseOverSelectionTd = null;
    this.lastMouseMoveTd = null;
    this.lastMouseMoveInsertion = null;
    this.lastMouseMoveYIndex = -1;
  };
  goog.inherits(TableListener, uno.BasePlugin);
  TableListener.prototype.activeOnUneditableFields = goog.functions.TRUE;
  TableListener.prototype.handleKeyDown = function(event) {
    if (this.editor.readOnly) {
      return false;
    }
    var range = this.editor.getRange();
    var keyCode = event.keyCode;
    var enTable = util.table.getActive();
    var cell = util.table.getActiveCell();
    var ignoreKeyCodes = [KeyCodes.BACKSPACE, KeyCodes.DELETE];
    var arrowKeyCodes = [KeyCodes.LEFT, KeyCodes.RIGHT, KeyCodes.UP, KeyCodes.DOWN];
    var targetNode = null;
    this.lastKeyState = null;
    if (!cell || (event.metaKey || event.ctrlKey || event.altKey) || ignoreKeyCodes.indexOf(keyCode) > -1) {
      return false;
    }
    if (util.table.selection.isActive(enTable)) {
      if (keyCode === KeyCodes.ESC && this.dragging) {
        util.table.drag.cancel();
        this.dragging = false;
        return preventStop(event);
      } else {
        if (keyCode === KeyCodes.ESC) {
          util.table.selection.clear();
          goog.dom.Range.createCaret(cell, 0).select();
          return preventStop(event);
        } else {
          if (event.shiftKey && arrowKeyCodes.indexOf(keyCode) > -1) {
            var focusTd = util.table.navigatedFocusSelectionCell(util.table.createKeyState(enTable, cell, event));
            if (focusTd) {
              util.table.selection.selectTo(focusTd);
            }
            return preventStop(event);
          }
        }
      }
      if (!KeyCodes.isTextModifyingKeyEvent(event)) {
        return preventStop(event);
      }
      util.table.selection.clear();
      cell.innerHTML = uno.defs.table.CELL_HTML;
      goog.dom.Range.createCaret(cell, 0).select();
      this.editor.dispatchChange();
    }
    if (keyCode === KeyCodes.TAB && (!util.dom.getAncestor(range.getAnchorNode(), util.dom.isLi, true) || !util.dom.getAncestor(range.getFocusNode(), util.dom.isLi, true))) {
      targetNode = event.shiftKey ? util.table.prevCell(cell, true) : util.table.nextCell(cell, true);
      if (!targetNode && !event.shiftKey) {
        this.editor.execCommand("inserttablerow", "after");
        targetNode = util.table.nextCell(cell, true);
      }
      if (targetNode) {
        uno.util.range.selectNodeContents(targetNode);
        util.table.scrollCellIntoView(targetNode);
      }
      return preventStop(event);
    } else {
      if (arrowKeyCodes.indexOf(keyCode) > -1) {
        this.lastKeyState = util.table.createKeyState(enTable, cell, event);
      }
    }
    return false;
  };
  TableListener.prototype.handleDoubleClick = function(event) {
    if (this.editor.readOnly) {
      return;
    }
    var target = event.target;
    if (target.classList.contains("yline") && util.table.fitColumnContent(this.lastMouseOverEnTable, this.lastMouseMoveYIndex - 1)) {
      this.editor.dispatchChange();
    }
    var focusTd = goog.dom.getAncestor(target, util.dom.isTd, true);
    if (!focusTd) {
      return;
    }
    var range = this.editor.getRange();
    if (util.table.shouldSelectCell(focusTd, range)) {
      this.lastRangeState = null;
      util.table.selection.create(util.table.getActive(), this.editor.multirange, focusTd);
      return;
    }
    this.isSelectableCellCandidate = util.table.isSelectableCellCandidate(focusTd, range);
  };
  TableListener.prototype.handleClick = function(event) {
    var target = event.target;
    this.activeCellCandidate = null;
    if (!target || this.editor.readOnly) {
      return false;
    }
    var focusTd;
    if (event.getBrowserEvent().detail === 3 && this.isSelectableCellCandidate) {
      focusTd = goog.dom.getAncestor(target, util.dom.isTd, true);
      if (!focusTd) {
        return null;
      }
      util.table.selection.create(util.table.getActive(), this.editor.multirange, focusTd);
      return null;
    }
    var enTable = util.table.getActive();
    var cell = util.table.getActiveCell();
    var obj, matrix;
    if (enTable && cell && target.classList.contains("en-cell-btn")) {
      util.menu.presentTableContextMenu(target, this.editor);
      return true;
    } else {
      if (target.classList.contains("insertion")) {
        obj = util.table.insertionToObject(target);
        var fn = obj.axis === Axis.VERTICAL ? util.table.insertColumns : util.table.insertRows;
        var inserted = fn(this.lastMouseOverEnTable, obj.index);
        if (inserted) {
          if (util.table.selection.isActive(this.lastMouseOverEnTable)) {
            util.table.selection.create(this.lastMouseOverEnTable, this.editor.multirange);
          }
          this.editor.dispatchChange();
        }
        return true;
      } else {
        if (target.classList.contains("handle")) {
          matrix = util.table.matrix(this.lastMouseOverEnTable);
          obj = util.table.handleToObject(target);
          focusTd = obj.axis === Axis.VERTICAL ? matrix[0][obj.index].info.node : matrix[obj.index][0].info.node;
          this.lastRangeState = null;
          var isActiveSelection = util.table.selection.isActive(this.lastMouseOverEnTable);
          if (isActiveSelection && (this.client.isToggleKey(event) || event.shiftKey)) {
            if (event.shiftKey) {
              util.table.selection.selectTo(focusTd, obj.axis);
            } else {
              util.table.selection.toggleAt(focusTd, obj.axis);
            }
            this.editor.dispatchStyleChange();
          } else {
            util.table.selection.create(this.lastMouseOverEnTable, this.editor.multirange, focusTd, null, obj.axis);
          }
          return true;
        } else {
          if (target.classList.contains("en-table-btn")) {
            matrix = util.table.matrix(this.lastMouseOverEnTable);
            var lastCol = goog.array.peek(matrix[0]);
            var anchorTd = matrix[0][0].info.node;
            focusTd = (lastCol.origin || lastCol.info).node;
            this.lastRangeState = null;
            util.table.selection.create(this.lastMouseOverEnTable, this.editor.multirange, anchorTd, focusTd, Axis.VERTICAL);
            util.table.setActive(this.lastMouseOverEnTable, cell || anchorTd);
            return true;
          } else {
            if (enTable && this.client.isToggleKey(event) && !util.table.selection.isActive(enTable)) {
              focusTd = goog.dom.getAncestor(target, util.dom.isTd, true);
              this.lastRangeState = null;
              util.table.selection.create(enTable, this.editor.multirange, focusTd);
              return true;
            }
          }
        }
      }
    }
    return false;
  };
  TableListener.prototype.handleMouseDown = function(event) {
    var target = event.target;
    this.leftMouseDown = true;
    if (!this.lastMouseOverEnTable) {
      return false;
    }
    if (target.classList.contains("handle")) {
      util.table.drag.prepare(this.lastMouseOverEnTable, event);
      event.preventDefault();
      return true;
    }
    if (target.classList.contains("en-cell-btn") || target.classList.contains("en-table-btn") || target.classList.contains("insertion")) {
      event.preventDefault();
      return true;
    }
    if (target.classList.contains("yline")) {
      util.table.layout(this.lastMouseOverEnTable);
      util.table.resizer.start(this.lastMouseOverEnTable, target, event.clientX, this.lastMouseMoveYIndex - 1);
      this.resizing = true;
      return preventStop(event);
    }
    if (target.classList.contains("scrollbar-thumb")) {
      util.table.scroller.start(this.lastMouseOverEnTable, target, event.clientX);
      this.scrolling = true;
      return preventStop(event);
    }
    if (target.classList.contains("scrollbar")) {
      util.table.scroller.scrollByClick(this.lastMouseOverEnTable, event.clientX - target.getBoundingClientRect().left);
      return preventStop(event);
    }
    var td = goog.dom.getAncestor(target, util.dom.isTd, true);
    if (td) {
      this.clicked = true;
      clearTimeout(this.clickTimer);
      this.clickTimer = setTimeout(function() {
        this.clicked = false;
      }.bind(this), 10);
      this.lastMouseDownEnTable = this.lastMouseOverEnTable;
      this.lastMouseDownEnTable.classList.add("selecting");
      var isSelection = util.table.selection.isActive(this.lastMouseOverEnTable);
      var isSelectionChange = isSelection && (event.shiftKey || this.client.isToggleKey(event));
      var isActive = util.table.getActive() === this.lastMouseOverEnTable && util.table.getActiveCell() !== td;
      if (isSelectionChange || isActive && event.shiftKey) {
        if (isSelectionChange) {
          if (event.shiftKey) {
            util.table.selection.selectTo(td);
          } else {
            util.table.selection.toggleAt(td);
          }
          this.editor.dispatchStyleChange();
        } else {
          this.lastRangeState = null;
          util.table.selection.create(this.lastMouseOverEnTable, this.editor.multirange, util.table.getActiveCell(), td);
        }
        return preventStop(event);
      }
      this.activeCellCandidate = td;
    }
    return false;
  };
  TableListener.prototype.handleWindowResize = function() {
    goog.array.forEach(this.editor.field.querySelectorAll("en-table"), util.table.translateX);
  };
  TableListener.prototype.handleWindowMouseUp = function() {
    this.leftMouseDown = false;
    this.leftMouseMoving = false;
    if (this.lastMouseDownEnTable) {
      this.lastMouseDownEnTable.classList.remove("selecting");
      this.lastMouseDownEnTable = null;
    }
    if (this.dragging) {
      this.dragging = false;
      if (util.table.drag.end(this.editor.multirange)) {
        this.editor.dispatchChange();
      }
      return true;
    }
    if (this.resizing) {
      util.table.resizer.end();
      this.resizing = false;
      this.editor.dispatchChange();
      return true;
    }
    if (this.scrolling) {
      util.table.scroller.end();
      this.scrolling = false;
      return true;
    }
    util.table.drag.cancel();
    return false;
  };
  TableListener.prototype.handleWindowMouseMove = function(event) {
    if (this.scrolling) {
      util.table.scroller.scrollByDrag(event.clientX);
      return preventStop(event);
    }
    if (this.resizing) {
      util.table.resizer.resize(event.clientX);
      return preventStop(event);
    }
    if (this.dragging) {
      util.table.drag.move(this.lastMouseOverEnTable, event.clientX, event.clientY);
      return preventStop(event);
    }
    return false;
  };
  TableListener.prototype.handleMouseMove = function(event) {
    if (this.editor.readOnly) {
      return false;
    }
    var target = event.target;
    this.leftMouseMoving = this.leftMouseDown;
    if (this.leftMouseMoving || this.resizing || this.scrolling || this.dragging || target.classList.contains("yline")) {
      if (this.leftMouseMoving && util.table.drag.tryStart(this.lastMouseOverEnTable, event)) {
        this.dragging = true;
        return preventStop(event);
      } else {
        if (this.leftMouseMoving && !this.resizing && !this.scrolling && !this.dragging && util.table.selection.isActive(this.lastMouseOverEnTable)) {
          return preventStop(event);
        }
      }
      return false;
    }
    if (this.lastMouseOverEnTable && util.dom.isTd(target) && !this.lastMouseOverEnTable.classList.contains("selected")) {
      var next = event.offsetX > target.offsetWidth / 2;
      var yIndex = event.offsetX > 6 && event.offsetX < target.offsetWidth - 6 ? -1 : util.table.colIndex(target, next);
      if (yIndex === 0) {
        yIndex = -1;
      }
      if (this.lastMouseMoveTd === target && this.lastMouseMoveYIndex === yIndex) {
        return false;
      }
      this.lastMouseMoveTd = target;
      this.lastMouseMoveYIndex = yIndex;
      if (yIndex > -1) {
        util.table.setLine(this.lastMouseOverEnTable, yIndex, Axis.VERTICAL);
      } else {
        util.table.setLine(this.lastMouseOverEnTable);
      }
    } else {
      if (target.classList.contains("insertion")) {
        if (target === this.lastMouseMoveInsertion) {
          return false;
        }
        this.lastMouseMoveInsertion = target;
        var obj = util.table.insertionToObject(target);
        util.table.setLine(this.lastMouseOverEnTable, obj.index, obj.axis);
      } else {
        if (this.lastMouseMoveTd || this.lastMouseMoveInsertion) {
          this.lastMouseMoveTd = null;
          this.lastMouseMoveInsertion = null;
          this.lastMouseMoveYIndex = -1;
          if (this.lastMouseOverEnTable) {
            util.table.setLine(this.lastMouseOverEnTable);
          }
        }
      }
    }
    return false;
  };
  TableListener.prototype.handleMouseOver = function(event) {
    var target = event.target;
    var oldEnTable = this.lastMouseOverEnTable;
    var overTable = false;
    var enTable = goog.dom.getAncestor(target, function(node) {
      if (util.dom.isTable(node)) {
        overTable = true;
      }
      return util.dom.isEntable(node);
    }, true);
    this.scrollable = !!(overTable && enTable);
    this.lastMouseOverEnTable = enTable;
    if (enTable !== oldEnTable && oldEnTable) {
      util.table.setLine(oldEnTable);
    }
    if (enTable && (!this.leftMouseMoving && enTable.getAttribute("data-lazy") || this.dragging && enTable.getAttribute("data-lazy"))) {
      util.table.layout(enTable, true);
      return;
    }
    if (this.resizing || this.scrolling || this.dragging || this.editor.readOnly || !enTable) {
      return;
    }
    if (this.leftMouseMoving && util.table.drag.tryStart(enTable, event)) {
      this.dragging = true;
      return;
    }
    if (this.leftMouseMoving && overTable && util.table.selection.isActive(enTable)) {
      var td = goog.dom.getAncestor(target, util.dom.isTd, true);
      if (td && td !== this.lastMouseOverSelectionTd) {
        this.lastMouseOverSelectionTd = td;
        util.table.selection.selectTo(td);
        this.editor.dispatchStyleChange();
      }
    }
  };
  TableListener.prototype.handleMouseWheel = function(event) {
    if (this.resizing || this.scrolling || !this.scrollable || this.lastMouseDownEnTable || !this.lastMouseOverEnTable || Math.abs(event.pixelDeltaX) <= Math.abs(event.pixelDeltaY)) {
      return;
    }
    if (util.table.scroller.scrollByWheel(this.lastMouseOverEnTable, this.client.getDeltaX(event))) {
      event.preventDefault();
    }
  };
  TableListener.prototype.handleScroll = function(event) {
    var target = event.target;
    if (target && util.dom.isEntable(target.parentNode)) {
      util.table.translateX(target.parentNode);
    }
  };
  TableListener.prototype.handleNativeSelectionChange = function() {
    var range = this.editor.getRange();
    if (!range || this.editor.readOnly) {
      return;
    }
    var activeCellCandidate = this.activeCellCandidate;
    this.activeCellCandidate = null;
    if (activeCellCandidate && range.isCollapsed() && !activeCellCandidate.contains(range.getStartNode())) {
      goog.dom.Range.createCaret(activeCellCandidate, 0).select();
      return;
    }
    if (util.table.selection.isPending() || this.leftMouseMoving && util.table.selection.isActive(this.lastMouseOverEnTable)) {
      return;
    }
    if (!util.table.isProcessedRange(range, this.lastRangeState)) {
      var source = this.clicked ? "multiclick" : this.lastKeyState ? "arrowkey" : null;
      var lks = this.lastKeyState;
      var lrs = util.table.processRange(range, this.editor.field.querySelectorAll("en-table"), source);
      this.lastRangeState = lrs;
      if (lks && lrs.cell && lks.cell !== lrs.cell && !lks.shiftKey && util.table.navigateByKeyState(lks)) {
        this.lastKeyState = null;
        return;
      }
      util.table.setActive(lrs.enTable, lrs.cell);
      util.table.selection.clear();
      if (this.selectable && lrs.enTable && lrs.isSelection) {
        var anchorCell = lrs.cell;
        var focusCell = lrs.focusCell;
        if (lks && lks.shiftKey) {
          focusCell = util.table.navigatedFocusSelectionCell(lks);
        }
        util.table.selection.create(lrs.enTable, this.editor.multirange, anchorCell, focusCell);
      }
      this.lastKeyState = null;
    }
  };
  TableListener.prototype.handleContextMenu = function(event) {
    setTimeout(function() {
      this.handleWindowMouseUp();
    }.bind(this), 0);
  };
  TableListener.prototype.handleBeforeExecCommand = function(event) {
    if (event.command === "undo" || event.command === "redo") {
      var tableContainers = Array.prototype.slice.call(this.editor.field.querySelectorAll("en-table .container"));
      this.tableOffsets = tableContainers.map(function(container) {
        return container.scrollLeft;
      });
      util.table.selection.clear();
      this.lastRangeState = null;
      this.selectable = false;
    }
  };
  TableListener.prototype.handleAfterExecCommand = function(event) {
    if (event.command === "undo" || event.command === "redo") {
      setTimeout(function() {
        goog.array.forEach(document.querySelectorAll("cursor-proxy"), goog.dom.removeNode);
        this.selectable = true;
        var td = this.editor.field.querySelector("en-table td.selected");
        var enTable = goog.dom.getAncestor(td, util.dom.isEntable);
        if (enTable) {
          util.table.setActive(enTable, td);
          util.table.selection.create(enTable, this.editor.multirange);
        }
        var tableContainers = Array.prototype.slice.call(this.editor.field.querySelectorAll("en-table .container"));
        if (this.tableOffsets && this.tableOffsets.length === tableContainers.length) {
          this.tableOffsets.forEach(function(offset, idx) {
            tableContainers[idx].scrollLeft = offset;
          });
          this.tableOffsets = null;
        }
      }.bind(this), 0);
    }
  };
  function preventStop(event) {
    event.preventDefault();
    event.stopPropagation();
    return true;
  }
})();
goog.provide("uno.listeners.textinputlistener.android");
(function() {
  var android = uno.listeners.textinputlistener.android;
  var util = uno.util;
  var CURSOR_PARKING = "mobile-cursor-parking";
  var whitespace;
  var androidWorkaroundSavedRange;
  var savedStyles = {};
  function workaroundAndroidWhitespaceIssue(editor) {
    savedStyles.state = editor.context.style.state;
    savedStyles.value = editor.context.style.value;
    androidWorkaroundSavedRange = editor.getRange().saveUsingDom();
    var tempParking = goog.dom.createDom(CURSOR_PARKING);
    tempParking.setAttribute("style", "width:1px;height:1px;top:0px;left:-9999px;position:fixed");
    tempParking.setAttribute("tabIndex", "-1");
    tempParking.appendChild(document.createElement("br"));
    editor.field.appendChild(tempParking);
    goog.dom.Range.createCaret(tempParking, 0).select();
  }
  function insertTextAtCursor(editor, text) {
    var textNode = goog.dom.createTextNode(text);
    editor.getRange().replaceContentsWithNode(textNode);
    goog.dom.Range.createCaret(textNode, text.length).select();
    var parent = textNode.parentElement;
    parent.normalize();
    util.range.normalize(editor.getRange()).select();
    Object.keys(savedStyles.state).forEach(function(command) {
      var currentValue = editor.queryCommandState(command);
      if (currentValue !== savedStyles.state[command]) {
        editor.execCommand(command);
      }
    });
    Object.keys(savedStyles.value).forEach(function(command) {
      var currentValue = editor.queryCommandValue(command);
      var savedValue = savedStyles.value[command];
      if (currentValue !== savedValue) {
        editor.execCommand(command, savedValue);
      }
    });
  }
  android.handleInput = function(event, editor) {
    var e = event.event_;
    var inputType = e.inputType;
    var lastChar;
    if (inputType === "insertText" || inputType === "insertCompositionText") {
      if (androidWorkaroundSavedRange) {
        androidWorkaroundSavedRange.restore().select();
        androidWorkaroundSavedRange = null;
        var parkings = Array.from(editor.field.querySelectorAll(CURSOR_PARKING));
        var text;
        if (parkings.length) {
          text = parkings[0].textContent;
        }
        parkings.forEach(goog.dom.removeNode);
        if (text !== undefined) {
          lastChar = text[text.length - 1];
          if (lastChar.match(/^\s$/)) {
            text = text.slice(0, text.length - 1);
          }
          if (text) {
            insertTextAtCursor(editor, text);
          }
        }
        if (!editor.emitKeyboardEvent("keydown", whitespace)) {
          if (!editor.emitKeyboardEvent("keypress", whitespace)) {
            if (whitespace === "\n") {
              document.execCommand("insertparagraph");
            } else {
              insertTextAtCursor(editor, lastChar || whitespace);
            }
            editor.emitKeyboardEvent("keyup", whitespace);
          }
        }
      }
    }
  };
  android.handleBeforeInput = function(event, editor) {
    var e = event.event_;
    var inputType = e.inputType;
    if ((inputType === "insertText" || inputType === "insertCompositionText") && e.data) {
      var str = e.data, c = str[str.length - 1];
      if (c === " " || c === "\n") {
        whitespace = c;
        workaroundAndroidWhitespaceIssue(editor);
      }
    }
  };
})();
goog.provide("uno.listeners.TextInputListener");
goog.require("goog.debug.Logger");
goog.require("uno.BasePlugin");
goog.require("uno.listeners.textinputlistener.android");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.TextInputListener");
  var TextInputListener = uno.listeners.TextInputListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(TextInputListener, uno.BasePlugin);
  TextInputListener.prototype.handleTextInput = function(event) {
    if (this.client.handleTextInput) {
      this.client.handleTextInput(event, this.editor);
    }
  };
  TextInputListener.prototype.handleInput = function(event) {
    if (this.client.handleInput) {
      this.client.handleInput(event, this.editor);
    }
  };
  TextInputListener.prototype.handleBeforeInput = function(event) {
    if (this.client.handleBeforeInput) {
      this.client.handleBeforeInput(event, this.editor);
    }
  };
})();
goog.provide("uno.listeners.TodoListener");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.BasePlugin");
goog.require("uno.util.todo");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.TodoListener");
  var util = uno.util;
  var DRAGTYPES = uno.defs.dragtypes;
  var TodoListener = uno.listeners.TodoListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(TodoListener, uno.BasePlugin);
  TodoListener.prototype.activeOnUneditableFields = goog.functions.TRUE;
  TodoListener.prototype.handleClick = function(event) {
    if (util.todo.isTodo(event.target)) {
      if (this.editor.readOnly) {
        this.editor.dispatchEvent({type:uno.Editor.EventType.ACTION_DENIED, reason:{readOnly:true}});
        return false;
      }
      event.preventDefault();
      util.todo.toggle(event.target);
      this.editor.dispatchChange();
      return true;
    }
    return false;
  };
  TodoListener.prototype.handleMouseMove = function(event) {
    if (util.todo.isTodo(event.target)) {
      return util.drag.updateDragHint(event.target, this.editor);
    } else {
      util.drop.clearHint(this.editor.context.dragState, this.editor, DRAGTYPES.TODO);
    }
    return false;
  };
})();
goog.provide("uno.listeners.TodoListListener");
goog.require("goog.debug.Logger");
goog.require("goog.editor.range");
goog.require("goog.events.KeyCodes");
goog.require("uno.BasePlugin");
goog.require("uno.util.paragraph");
goog.require("uno.util.range");
goog.require("uno.util.styles");
goog.require("uno.util.todo");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.TodoListListener");
  var ENTER_KEY = goog.events.KeyCodes.ENTER;
  var TAB_KEY = goog.events.KeyCodes.TAB;
  var util = uno.util;
  var TodoListListener = uno.listeners.TodoListListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(TodoListListener, uno.BasePlugin);
  TodoListListener.prototype.handleKeyPress = function(event) {
    var currentPar;
    var todo;
    if (event.keyCode === ENTER_KEY) {
      if (event.altKey) {
        this.editor.execCommand("inserttodo");
        event.preventDefault();
        event.stopPropagation();
        return true;
      }
      var range = this.editor.getRange();
      if ((currentPar = util.paragraph.for(range.getStartNode())) == null) {
        return false;
      }
      if ((todo = util.paragraph.getLeadingTodo(currentPar)) == null) {
        return false;
      }
      if (util.range.atBeginningOfParagraph(range)) {
        return false;
      }
      if (util.paragraph.hasVisibleContent(currentPar, {excluding:todo})) {
        this.editor.context.pendingTodo = !util.todo.tryToInsertTodo(this.editor);
      } else {
        util.styles.createPendingStyles(this.editor);
        util.paragraph.empty(currentPar, true, this.editor);
        var br = currentPar.querySelector("br");
        if (br) {
          goog.editor.range.placeCursorNextTo(br, true);
        }
      }
      if (!this.editor.context.pendingTodo) {
        event.preventDefault();
        event.stopPropagation();
      }
      return true;
    }
    return false;
  };
  TodoListListener.prototype.handleKeyUp = function(event) {
    if ((event.keyCode === ENTER_KEY || event.keyCode === 0) && this.editor.context.pendingTodo) {
      this.editor.context.pendingTodo = false;
      this.editor.execCommand("inserttodo");
    }
  };
})();
goog.provide("uno.util.typebehind.code");
goog.require("goog.debug.Logger");
goog.require("goog.editor.range");
goog.require("uno.defs");
goog.require("uno.util.codeblock");
goog.require("uno.util.dom");
goog.require("uno.util.paragraph");
goog.require("uno.util.structure");
goog.require("uno.util.typebehind");
(function() {
  var code = uno.util.typebehind.code;
  var log = goog.debug.Logger.getLogger("uno.util.typebehind.code");
  var util = uno.util;
  code.name = "code";
  code.matchBeginningOfLine = true;
  code.suppressTriggerKey = true;
  code.regex = util.typebehind.compileTypebehindRegex("```", code.matchBeginningOfLine);
  code.contextReplaceable = function(range) {
    var endNode = range.getEndNode();
    return util.codeblock.for(endNode) && !util.paragraph.nextParagraph(util.paragraph.for(endNode)) || util.structure.itemAllowedInRange(uno.defs.structuretypes.CODE, range);
  };
  code.insertReplacement = function(range, matches, editor) {
    var codeblockContainer = util.codeblock.for(range.getEndNode());
    var p;
    if (codeblockContainer) {
      range.removeContents();
      p = util.paragraph.for(range.getStartNode());
      if (util.dom.isEmpty(p)) {
        util.paragraph.remove(p);
      }
      var nextSibling = goog.dom.getNextElementSibling(codeblockContainer);
      if (!nextSibling) {
        nextSibling = util.paragraph.insertAfter(codeblockContainer);
      }
      if (!codeblockContainer.textContent.length) {
        codeblockContainer.parentNode.removeChild(codeblockContainer);
      }
      if (nextSibling) {
        editor.selectStart(nextSibling);
      }
    } else {
      range.removeContents();
      p = util.paragraph.for(range.getStartNode());
      if (p.textContent.length) {
        util.paragraph.placeCursorAtStart(util.paragraph.insertBefore(p));
      } else {
        util.paragraph.empty(p);
      }
      editor.execCommand("codeblock");
    }
    return null;
  };
})();
goog.provide("uno.util.typebehind.email");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.defs");
goog.require("uno.util.codeblock");
goog.require("uno.util.dom");
goog.require("uno.util.typebehind");
(function() {
  var email = uno.util.typebehind.email;
  var log = goog.debug.Logger.getLogger("uno.util.typebehind.email");
  var util = uno.util;
  email.name = "email";
  email.matchBeginningOfLine = false;
  email.suppressTriggerKey = false;
  email.regex = util.typebehind.compileTypebehindRegex(uno.defs.regex.SIMPLE_EMAIL, email.matchBeginningOfLine);
  email.contextReplaceable = function(range, keyCode) {
    return !util.codeblock.for(range.getEndNode());
  };
  email.insertReplacement = function(range, matches, editor) {
    var matchedText = matches[0];
    var href = "mailto:" + matchedText;
    var newNode = goog.dom.createDom("a", {href:href});
    newNode.textContent = matchedText;
    range.replaceContentsWithNode(newNode);
    return newNode;
  };
})();
goog.provide("uno.util.emoticon");
goog.require("goog.debug.Logger");
(function() {
  var util = uno.util;
  var log = goog.debug.Logger.getLogger("uno.util.typebehind.emoticon");
  util.emoticon.smileySymbolToAliases = {"\u2764\ufe0f":["<3"], "\ud83d\udc94":["</3"], "\ud83d\ude0e":["8)", "8=)", "8-)", "B=)", "B-)"], "\ud83d\ude27":["D:"], "\ud83d\ude22":[":'(", ";(", ";=(", ";-("], "\ud83d\udc35":[":o)"], "\ud83d\udc8b":[":*", ":-*"], "\ud83d\ude03":["=)", "=-)", ":=)"], "\ud83d\ude04":[":D", ":-D"], "\ud83d\ude09":[";)", ";-)", ";=)"], "\ud83d\ude06":[":>", ":->"], "\ud83d\ude10":[":|", ":-|", ":=|"], "\ud83d\ude2e":[":o", ":-o", ":O", ":-O", ":=o", ":=O"], "\ud83d\ude20":[">:(", 
  ">:-("], "\ud83d\ude42":[":)", "(:", ":-)"], "\ud83d\ude1e":[":(", "):", ":-(", ":=("], "\ud83d\ude15":[":/", ":-/", ":\\", ":-\\"], "\ud83d\ude1b":[":p", ":-p", ":b", ":-b", ":P", ":-P", ":=p", ":=P"], "\ud83d\ude1c":[";p", ";-p", ";b", ";-b", ";P", ";-P"], "\ud83d\ude0a":[":$", ":-$", ":=$"], "\ud83d\ude21":[":@", ":-@", ":=@", "x(", "x-(", "x=(", "X(", "(X=("], "\ud83d\ude07":["O:)", "O:=)", "O:-)", "o:)", "o:=)", "o:-)"], "\ud83d\ude2a":["|-)", "I-)", "I=)"]};
  util.emoticon.emojiSymbolToAliases = {"\ud83d\ude00":["grinningface", "grinning_face", "grinning"], "\ud83d\ude01":["beamingfacewithsmilingeyes", "beaming_face_with_smiling_eyes", "grin"], "\ud83d\ude02":["facewithtearsofjoy", "face_with_tears_of_joy", "joy"], "\ud83e\udd23":["rollingonthefloorlaughing", "rolling_on_the_floor_laughing", "rofl"], "\ud83d\ude03":["grinningfacewithbigeyes", "grinning_face_with_big_eyes", "smiley"], "\ud83d\ude04":["grinningfacewithsmilingeyes", "grinning_face_with_smiling_eyes", 
  "smile"], "\ud83d\ude05":["grinningfacewithsweat", "grinning_face_with_sweat", "sweatsmile", "sweat_smile"], "\ud83d\ude06":["grinningsquintingface", "grinning_squinting_face", "laughing"], "\ud83d\ude09":["winkingface", "winking_face", "wink"], "\ud83d\ude0a":["smilingfacewithsmilingeyes", "smiling_face_with_smiling_eyes", "blush"], "\ud83d\ude0b":["facesavoringfood", "face_savoring_food", "yum"], "\ud83d\ude0e":["smilingfacewithsunglasses", "smiling_face_with_sunglasses", "sunglasses"], "\ud83d\ude0d":["smilingfacewithhearteyes", 
  "smiling_face_with_heart_eyes", "hearteyes", "heart_eyes"], "\ud83d\ude18":["faceblowingakiss", "face_blowing_a_kiss", "kissingheart", "kissing_heart"], "\ud83d\ude17":["kissingface", "kissing_face", "kissing"], "\ud83d\ude19":["kissingfacewithsmilingeyes", "kissing_face_with_smiling_eyes", "kissingsmilingeyes", "kissing_smiling_eyes"], "\ud83d\ude1a":["kissingfacewithclosedeyes", "kissing_face_with_closed_eyes", "kissingclosedeyes", "kissing_closed_eyes"], "\u263a\ufe0f":["smilingface", "smiling_face", 
  "relaxed"], "\ud83d\ude42":["slightlysmilingface", "slightly_smiling_face"], "\ud83e\udd17":["huggingface", "hugging_face"], "\ud83e\udd29":["star-struck"], "\ud83e\udd14":["thinkingface", "thinking_face"], "\ud83e\udd28":["facewithraisedeyebrow", "face_with_raised_eyebrow"], "\ud83d\ude10":["neutralface", "neutral_face"], "\ud83d\ude11":["expressionlessface", "expressionless_face", "expressionless"], "\ud83d\ude36":["facewithoutmouth", "face_without_mouth", "nomouth", "no_mouth"], "\ud83d\ude44":["facewithrollingeyes", 
  "face_with_rolling_eyes"], "\ud83d\ude0f":["smirkingface", "smirking_face", "smirk"], "\ud83d\ude23":["perseveringface", "persevering_face", "persevere"], "\ud83d\ude25":["sadbutrelievedface", "sad_but_relieved_face", "disappointedrelieved", "disappointed_relieved"], "\ud83d\ude2e":["facewithopenmouth", "face_with_open_mouth", "openmouth", "open_mouth"], "\ud83e\udd10":["zippermouthface", "zipper_mouth_face"], "\ud83d\ude2f":["hushedface", "hushed_face", "hushed"], "\ud83d\ude2a":["sleepyface", 
  "sleepy_face", "sleepy"], "\ud83d\ude2b":["tiredface", "tired_face"], "\ud83d\ude34":["sleepingface", "sleeping_face", "sleeping"], "\ud83d\ude0c":["relievedface", "relieved_face", "relieved"], "\ud83d\ude1b":["facewithtongue", "face_with_tongue", "stuckouttongue", "stuck_out_tongue"], "\ud83d\ude1c":["winkingfacewithtongue", "winking_face_with_tongue", "stuckouttonguewinkingeye", "stuck_out_tongue_winking_eye"], "\ud83d\ude1d":["squintingfacewithtongue", "squinting_face_with_tongue", "stuckouttongueclosedeyes", 
  "stuck_out_tongue_closed_eyes"], "\ud83e\udd24":["droolingface", "drooling_face"], "\ud83d\ude12":["unamusedface", "unamused_face", "unamused"], "\ud83d\ude13":["downcastfacewithsweat", "downcast_face_with_sweat", "sweat"], "\ud83d\ude14":["pensiveface", "pensive_face", "pensive"], "\ud83d\ude15":["confusedface", "confused_face", "confused"], "\ud83d\ude43":["upsidedownface", "upside_down_face"], "\ud83e\udd11":["moneymouthface", "money_mouth_face"], "\ud83d\ude32":["astonishedface", "astonished_face", 
  "astonished"], "\u2639\ufe0f":["frowningface", "frowning_face", "whitefrowningface", "white_frowning_face"], "\ud83d\ude41":["slightlyfrowningface", "slightly_frowning_face"], "\ud83d\ude16":["confoundedface", "confounded_face", "confounded"], "\ud83d\ude1e":["disappointedface", "disappointed_face", "disappointed"], "\ud83d\ude1f":["worriedface", "worried_face", "worried"], "\ud83d\ude24":["facewithsteamfromnose", "face_with_steam_from_nose", "triumph"], "\ud83d\ude22":["cryingface", "crying_face", 
  "cry"], "\ud83d\ude2d":["loudlycryingface", "loudly_crying_face", "sob"], "\ud83d\ude26":["frowningfacewithopenmouth", "frowning_face_with_open_mouth", "frowning"], "\ud83d\ude27":["anguishedface", "anguished_face", "anguished"], "\ud83d\ude28":["fearfulface", "fearful_face", "fearful"], "\ud83d\ude29":["wearyface", "weary_face", "weary"], "\ud83e\udd2f":["explodinghead", "exploding_head"], "\ud83d\ude2c":["grimacingface", "grimacing_face", "grimacing"], "\ud83d\ude30":["anxiousfacewithsweat", 
  "anxious_face_with_sweat", "coldsweat", "cold_sweat"], "\ud83d\ude31":["facescreaminginfear", "face_screaming_in_fear", "scream"], "\ud83d\ude33":["flushedface", "flushed_face", "flushed"], "\ud83e\udd2a":["zanyface", "zany_face"], "\ud83d\ude35":["dizzyface", "dizzy_face"], "\ud83d\ude21":["poutingface", "pouting_face", "rage"], "\ud83d\ude20":["angryface", "angry_face", "angry"], "\ud83e\udd2c":["facewithsymbolsonmouth", "face_with_symbols_on_mouth"], "\ud83d\ude37":["facewithmedicalmask", "face_with_medical_mask", 
  "mask"], "\ud83e\udd12":["facewiththermometer", "face_with_thermometer"], "\ud83e\udd15":["facewithheadbandage", "face_with_head_bandage"], "\ud83e\udd22":["nauseatedface", "nauseated_face"], "\ud83e\udd2e":["facevomiting", "face_vomiting"], "\ud83e\udd27":["sneezingface", "sneezing_face"], "\ud83d\ude07":["smilingfacewithhalo", "smiling_face_with_halo", "innocent"], "\ud83e\udd20":["cowboyhatface", "cowboy_hat_face", "facewithcowboyhat", "face_with_cowboy_hat"], "\ud83e\udd25":["lyingface", "lying_face"], 
  "\ud83e\udd2b":["shushingface", "shushing_face"], "\ud83e\udd2d":["facewithhandovermouth", "face_with_hand_over_mouth"], "\ud83e\uddd0":["facewithmonocle", "face_with_monocle"], "\ud83e\udd13":["nerdface", "nerd_face"], "\ud83d\ude08":["smilingfacewithhorns", "smiling_face_with_horns", "smilingimp", "smiling_imp"], "\ud83d\udc7f":["angryfacewithhorns", "angry_face_with_horns", "imp"], "\ud83e\udd21":["clownface", "clown_face"], "\ud83d\udc79":["ogre", "japaneseogre", "japanese_ogre"], "\ud83d\udc7a":["goblin", 
  "japanesegoblin", "japanese_goblin"], "\ud83d\udc80":["skull"], "\u2620\ufe0f":["skullandcrossbones", "skull_and_crossbones"], "\ud83d\udc7b":["ghost"], "\ud83d\udc7d":["alien"], "\ud83d\udc7e":["alienmonster", "alien_monster", "spaceinvader", "space_invader"], "\ud83e\udd16":["robotface", "robot_face"], "\ud83d\udca9":["pileofpoo", "pile_of_poo", "hankey"], "\ud83d\ude3a":["smileycat", "smiley_cat"], "\ud83d\ude38":["grinningcatface", "grinning_cat_face", "smilecat", "smile_cat"], "\ud83d\ude39":["catfacewithtearsofjoy", 
  "cat_face_with_tears_of_joy", "joycat", "joy_cat"], "\ud83d\ude3b":["catfacewithhearteyes", "cat_face_with_heart_eyes", "hearteyescat", "heart_eyes_cat"], "\ud83d\ude3c":["catfacewithwrysmile", "cat_face_with_wry_smile", "smirkcat", "smirk_cat"], "\ud83d\ude3d":["kissingcatface", "kissing_cat_face", "kissingcat", "kissing_cat"], "\ud83d\ude40":["wearycatface", "weary_cat_face", "screamcat", "scream_cat"], "\ud83d\ude3f":["cryingcatface", "crying_cat_face"], "\ud83d\ude3e":["poutingcatface", "pouting_cat_face", 
  "poutingcat", "pouting_cat"], "\ud83d\ude48":["seenoevilmonkey", "see_no_evil_monkey", "seenoevil", "see_no_evil"], "\ud83d\ude49":["hearnoevilmonkey", "hear_no_evil_monkey", "hearnoevil", "hear_no_evil"], "\ud83d\ude4a":["speaknoevilmonkey", "speak_no_evil_monkey", "speaknoevil", "speak_no_evil"], "\ud83d\udc76":["baby"], "\ud83e\uddd2":["child"], "\ud83d\udc66":["boy"], "\ud83d\udc67":["girl"], "\ud83e\uddd1":["person", "adult"], "\ud83d\udc71":["personblondhair", "person_blond_hair", "personwithblondhair", 
  "person_with_blond_hair"], "\ud83d\udc68":["man"], "\ud83d\udc71\u200d\u2642\ufe0f":["manblondhair", "man_blond_hair", "blondhairedman", "blond_haired_man", "blond-haired-man"], "\ud83e\uddd4":["manbeard", "man_beard", "beardedman", "bearded_man", "beardedperson", "bearded_person"], "\ud83d\udc69":["woman"], "\ud83d\udc71\u200d\u2640\ufe0f":["womanblondhair", "woman_blond_hair", "blondhairedwoman", "blond_haired_woman", "blond-haired-woman"], "\ud83e\uddd3":["olderperson", "older_person", "olderadult", 
  "older_adult"], "\ud83d\udc74":["oldman", "old_man", "olderman", "older_man"], "\ud83d\udc75":["oldwoman", "old_woman", "olderwoman", "older_woman"], "\ud83d\udc68\u200d\u2695\ufe0f":["manhealthworker", "man_health_worker", "maledoctor", "male_doctor", "male-doctor"], "\ud83d\udc69\u200d\u2695\ufe0f":["womanhealthworker", "woman_health_worker", "femaledoctor", "female_doctor", "female-doctor"], "\ud83d\udc68\u200d\ud83c\udf93":["manstudent", "man_student", "malestudent", "male_student", "male-student"], 
  "\ud83d\udc69\u200d\ud83c\udf93":["womanstudent", "woman_student", "femalestudent", "female_student", "female-student"], "\ud83d\udc68\u200d\ud83c\udfeb":["manteacher", "man_teacher", "maleteacher", "male_teacher", "male-teacher"], "\ud83d\udc69\u200d\ud83c\udfeb":["womanteacher", "woman_teacher", "femaleteacher", "female_teacher", "female-teacher"], "\ud83d\udc68\u200d\u2696\ufe0f":["manjudge", "man_judge", "malejudge", "male_judge", "male-judge"], "\ud83d\udc69\u200d\u2696\ufe0f":["womanjudge", 
  "woman_judge", "femalejudge", "female_judge", "female-judge"], "\ud83d\udc68\u200d\ud83c\udf3e":["manfarmer", "man_farmer", "malefarmer", "male_farmer", "male-farmer"], "\ud83d\udc69\u200d\ud83c\udf3e":["womanfarmer", "woman_farmer", "femalefarmer", "female_farmer", "female-farmer"], "\ud83d\udc68\u200d\ud83c\udf73":["mancook", "man_cook", "malecook", "male_cook", "male-cook"], "\ud83d\udc69\u200d\ud83c\udf73":["womancook", "woman_cook", "femalecook", "female_cook", "female-cook"], "\ud83d\udc68\u200d\ud83d\udd27":["manmechanic", 
  "man_mechanic", "malemechanic", "male_mechanic", "male-mechanic"], "\ud83d\udc69\u200d\ud83d\udd27":["womanmechanic", "woman_mechanic", "femalemechanic", "female_mechanic", "female-mechanic"], "\ud83d\udc68\u200d\ud83c\udfed":["manfactoryworker", "man_factory_worker", "malefactoryworker", "male_factory_worker", "male-factory-worker"], "\ud83d\udc69\u200d\ud83c\udfed":["womanfactoryworker", "woman_factory_worker", "femalefactoryworker", "female_factory_worker", "female-factory-worker"], "\ud83d\udc68\u200d\ud83d\udcbc":["manofficeworker", 
  "man_office_worker", "maleofficeworker", "male_office_worker", "male-office-worker"], "\ud83d\udc69\u200d\ud83d\udcbc":["womanofficeworker", "woman_office_worker", "femaleofficeworker", "female_office_worker", "female-office-worker"], "\ud83d\udc68\u200d\ud83d\udd2c":["manscientist", "man_scientist", "malescientist", "male_scientist", "male-scientist"], "\ud83d\udc69\u200d\ud83d\udd2c":["womanscientist", "woman_scientist", "femalescientist", "female_scientist", "female-scientist"], "\ud83d\udc68\u200d\ud83d\udcbb":["mantechnologist", 
  "man_technologist", "maletechnologist", "male_technologist", "male-technologist"], "\ud83d\udc69\u200d\ud83d\udcbb":["womantechnologist", "woman_technologist", "femaletechnologist", "female_technologist", "female-technologist"], "\ud83d\udc68\u200d\ud83c\udfa4":["mansinger", "man_singer", "malesinger", "male_singer", "male-singer"], "\ud83d\udc69\u200d\ud83c\udfa4":["womansinger", "woman_singer", "femalesinger", "female_singer", "female-singer"], "\ud83d\udc68\u200d\ud83c\udfa8":["manartist", "man_artist", 
  "maleartist", "male_artist", "male-artist"], "\ud83d\udc69\u200d\ud83c\udfa8":["womanartist", "woman_artist", "femaleartist", "female_artist", "female-artist"], "\ud83d\udc68\u200d\u2708\ufe0f":["manpilot", "man_pilot", "malepilot", "male_pilot", "male-pilot"], "\ud83d\udc69\u200d\u2708\ufe0f":["womanpilot", "woman_pilot", "femalepilot", "female_pilot", "female-pilot"], "\ud83d\udc68\u200d\ud83d\ude80":["manastronaut", "man_astronaut", "maleastronaut", "male_astronaut", "male-astronaut"], "\ud83d\udc69\u200d\ud83d\ude80":["womanastronaut", 
  "woman_astronaut", "femaleastronaut", "female_astronaut", "female-astronaut"], "\ud83d\udc68\u200d\ud83d\ude92":["manfirefighter", "man_firefighter", "malefirefighter", "male_firefighter", "male-firefighter"], "\ud83d\udc69\u200d\ud83d\ude92":["womanfirefighter", "woman_firefighter", "femalefirefighter", "female_firefighter", "female-firefighter"], "\ud83d\udc6e":["policeofficer", "police_officer", "cop"], "\ud83d\udc6e\u200d\u2642\ufe0f":["manpoliceofficer", "man_police_officer", "policeman", 
  "malepoliceofficer", "male_police_officer", "male-police-officer"], "\ud83d\udc6e\u200d\u2640\ufe0f":["womanpoliceofficer", "woman_police_officer", "policewoman", "femalepoliceofficer", "female_police_officer", "female-police-officer"], "\ud83d\udd75\ufe0f":["detective", "sleuthorspy", "sleuth_or_spy"], "\ud83d\udd75\ufe0f\u200d\u2642\ufe0f":["mandetective", "man_detective", "maledetective", "male_detective", "male-detective"], "\ud83d\udd75\ufe0f\u200d\u2640\ufe0f":["womandetective", "woman_detective", 
  "femaledetective", "female_detective", "female-detective"], "\ud83d\udc82":["guard", "guardsman"], "\ud83d\udc82\u200d\u2642\ufe0f":["manguard", "man_guard", "maleguard", "male_guard", "male-guard"], "\ud83d\udc82\u200d\u2640\ufe0f":["womanguard", "woman_guard", "femaleguard", "female_guard", "female-guard"], "\ud83d\udc77":["constructionworker", "construction_worker"], "\ud83d\udc77\u200d\u2642\ufe0f":["manconstructionworker", "man_construction_worker", "maleconstructionworker", "male_construction_worker", 
  "male-construction-worker"], "\ud83d\udc77\u200d\u2640\ufe0f":["womanconstructionworker", "woman_construction_worker", "femaleconstructionworker", "female_construction_worker", "female-construction-worker"], "\ud83e\udd34":["prince"], "\ud83d\udc78":["princess"], "\ud83d\udc73":["personwearingturban", "person_wearing_turban", "man_with_turban"], "\ud83d\udc73\u200d\u2642\ufe0f":["manwearingturban", "man_wearing_turban", "man-wearing-turban"], "\ud83d\udc73\u200d\u2640\ufe0f":["womanwearingturban", 
  "woman_wearing_turban", "woman-wearing-turban"], "\ud83d\udc72":["manwithchinesecap", "man_with_chinese_cap", "manwithguapimao", "man_with_gua_pi_mao"], "\ud83e\uddd5":["womanwithheadscarf", "woman_with_headscarf", "personwithheadscarf", "person_with_headscarf"], "\ud83e\udd35":["manintuxedo", "man_in_tuxedo"], "\ud83d\udc70":["bridewithveil", "bride_with_veil"], "\ud83e\udd30":["pregnantwoman", "pregnant_woman"], "\ud83e\udd31":["breastfeeding", "breast_feeding", "breast-feeding"], "\ud83d\udc7c":["babyangel", 
  "baby_angel", "angel"], "\ud83c\udf85":["santaclaus", "santa_claus", "santa"], "\ud83e\udd36":["mrsclaus", "mrs_claus"], "\ud83e\uddd9":["mage"], "\ud83e\uddd9\u200d\u2640\ufe0f":["womanmage", "woman_mage", "femalemage", "female_mage"], "\ud83e\uddd9\u200d\u2642\ufe0f":["manmage", "man_mage", "malemage", "male_mage"], "\ud83e\uddda":["fairy"], "\ud83e\uddda\u200d\u2640\ufe0f":["womanfairy", "woman_fairy", "femalefairy", "female_fairy"], "\ud83e\uddda\u200d\u2642\ufe0f":["manfairy", "man_fairy", 
  "malefairy", "male_fairy"], "\ud83e\udddb":["vampire"], "\ud83e\udddb\u200d\u2640\ufe0f":["womanvampire", "woman_vampire", "femalevampire", "female_vampire"], "\ud83e\udddb\u200d\u2642\ufe0f":["manvampire", "man_vampire", "malevampire", "male_vampire"], "\ud83e\udddc":["merperson"], "\ud83e\udddc\u200d\u2640\ufe0f":["mermaid"], "\ud83e\udddc\u200d\u2642\ufe0f":["merman"], "\ud83e\udddd":["elf"], "\ud83e\udddd\u200d\u2640\ufe0f":["womanelf", "woman_elf", "femaleelf", "female_elf"], "\ud83e\udddd\u200d\u2642\ufe0f":["manelf", 
  "man_elf", "maleelf", "male_elf"], "\ud83e\uddde":["genie"], "\ud83e\uddde\u200d\u2640\ufe0f":["womangenie", "woman_genie", "femalegenie", "female_genie"], "\ud83e\uddde\u200d\u2642\ufe0f":["mangenie", "man_genie", "malegenie", "male_genie"], "\ud83e\udddf":["zombie"], "\ud83e\udddf\u200d\u2640\ufe0f":["womanzombie", "woman_zombie", "femalezombie", "female_zombie"], "\ud83e\udddf\u200d\u2642\ufe0f":["manzombie", "man_zombie", "malezombie", "male_zombie"], "\ud83d\ude4d":["personfrowning", "person_frowning"], 
  "\ud83d\ude4d\u200d\u2642\ufe0f":["manfrowning", "man_frowning", "man-frowning"], "\ud83d\ude4d\u200d\u2640\ufe0f":["womanfrowning", "woman_frowning", "woman-frowning"], "\ud83d\ude4e":["personpouting", "person_pouting", "personwithpoutingface", "person_with_pouting_face"], "\ud83d\ude4e\u200d\u2642\ufe0f":["manpouting", "man_pouting", "man-pouting"], "\ud83d\ude4e\u200d\u2640\ufe0f":["womanpouting", "woman_pouting", "woman-pouting"], "\ud83d\ude45":["persongesturingno", "person_gesturing_no", 
  "nogood", "no_good"], "\ud83d\ude45\u200d\u2642\ufe0f":["mangesturingno", "man_gesturing_no", "man-gesturing-no"], "\ud83d\ude45\u200d\u2640\ufe0f":["womangesturingno", "woman_gesturing_no", "woman-gesturing-no"], "\ud83d\ude46":["persongesturingok", "person_gesturing_ok", "okwoman", "ok_woman"], "\ud83d\ude46\u200d\u2642\ufe0f":["mangesturingok", "man_gesturing_ok", "man-gesturing-ok"], "\ud83d\ude46\u200d\u2640\ufe0f":["womangesturingok", "woman_gesturing_ok", "woman-gesturing-ok"], "\ud83d\udc81":["persontippinghand", 
  "person_tipping_hand", "informationdeskperson", "information_desk_person"], "\ud83d\udc81\u200d\u2642\ufe0f":["mantippinghand", "man_tipping_hand", "man-tipping-hand"], "\ud83d\udc81\u200d\u2640\ufe0f":["womantippinghand", "woman_tipping_hand", "woman-tipping-hand"], "\ud83d\ude4b":["personraisinghand", "person_raising_hand", "raisinghand", "raising_hand"], "\ud83d\ude4b\u200d\u2642\ufe0f":["manraisinghand", "man_raising_hand", "man-raising-hand"], "\ud83d\ude4b\u200d\u2640\ufe0f":["womanraisinghand", 
  "woman_raising_hand", "woman-raising-hand"], "\ud83d\ude47":["personbowing", "person_bowing", "bow"], "\ud83d\ude47\u200d\u2642\ufe0f":["manbowing", "man_bowing", "man-bowing"], "\ud83d\ude47\u200d\u2640\ufe0f":["womanbowing", "woman_bowing", "woman-bowing"], "\ud83e\udd26":["personfacepalming", "person_facepalming", "facepalm", "face_palm"], "\ud83e\udd26\u200d\u2642\ufe0f":["manfacepalming", "man_facepalming", "man-facepalming"], "\ud83e\udd26\u200d\u2640\ufe0f":["womanfacepalming", "woman_facepalming", 
  "woman-facepalming"], "\ud83e\udd37":["personshrugging", "person_shrugging", "shrug"], "\ud83e\udd37\u200d\u2642\ufe0f":["manshrugging", "man_shrugging", "man-shrugging"], "\ud83e\udd37\u200d\u2640\ufe0f":["womanshrugging", "woman_shrugging", "woman-shrugging"], "\ud83d\udc86":["persongettingmassage", "person_getting_massage", "massage"], "\ud83d\udc86\u200d\u2642\ufe0f":["mangettingmassage", "man_getting_massage", "man-getting-massage"], "\ud83d\udc86\u200d\u2640\ufe0f":["womangettingmassage", 
  "woman_getting_massage", "woman-getting-massage"], "\ud83d\udc87":["persongettinghaircut", "person_getting_haircut", "haircut"], "\ud83d\udc87\u200d\u2642\ufe0f":["mangettinghaircut", "man_getting_haircut", "man-getting-haircut"], "\ud83d\udc87\u200d\u2640\ufe0f":["womangettinghaircut", "woman_getting_haircut", "woman-getting-haircut"], "\ud83d\udeb6":["personwalking", "person_walking", "walking"], "\ud83d\udeb6\u200d\u2642\ufe0f":["manwalking", "man_walking", "man-walking"], "\ud83d\udeb6\u200d\u2640\ufe0f":["womanwalking", 
  "woman_walking", "woman-walking"], "\ud83c\udfc3":["personrunning", "person_running", "runner"], "\ud83c\udfc3\u200d\u2642\ufe0f":["manrunning", "man_running", "man-running"], "\ud83c\udfc3\u200d\u2640\ufe0f":["womanrunning", "woman_running", "woman-running"], "\ud83d\udc83":["womandancing", "woman_dancing", "dancer"], "\ud83d\udd7a":["mandancing", "man_dancing"], "\ud83d\udc6f":["peoplewithbunnyears", "people_with_bunny_ears", "dancers"], "\ud83d\udc6f\u200d\u2642\ufe0f":["manwithbunnyears", "man_with_bunny_ears", 
  "man-with-bunny-ears-partying"], "\ud83d\udc6f\u200d\u2640\ufe0f":["womanwithbunnyears", "woman_with_bunny_ears", "woman-with-bunny-ears-partying"], "\ud83e\uddd6":["personinsteamyroom", "person_in_steamy_room"], "\ud83e\uddd6\u200d\u2640\ufe0f":["womaninsteamyroom", "woman_in_steamy_room"], "\ud83e\uddd6\u200d\u2642\ufe0f":["maninsteamyroom", "man_in_steamy_room"], "\ud83e\uddd7":["personclimbing", "person_climbing"], "\ud83e\uddd7\u200d\u2640\ufe0f":["womanclimbing", "woman_climbing"], "\ud83e\uddd7\u200d\u2642\ufe0f":["manclimbing", 
  "man_climbing"], "\ud83e\uddd8":["personinlotusposition", "person_in_lotus_position"], "\ud83e\uddd8\u200d\u2640\ufe0f":["womaninlotusposition", "woman_in_lotus_position"], "\ud83e\uddd8\u200d\u2642\ufe0f":["maninlotusposition", "man_in_lotus_position"], "\ud83d\udec0":["persontakingbath", "person_taking_bath", "bath"], "\ud83d\udecc":["personinbed", "person_in_bed", "sleepingaccommodation", "sleeping_accommodation"], "\ud83d\udd74\ufe0f":["maninsuitlevitating", "man_in_suit_levitating", "maninbusinesssuitlevitating", 
  "man_in_business_suit_levitating"], "\ud83d\udde3\ufe0f":["speakinghead", "speaking_head", "speakingheadinsilhouette", "speaking_head_in_silhouette"], "\ud83d\udc64":["bustinsilhouette", "bust_in_silhouette"], "\ud83d\udc65":["bustsinsilhouette", "busts_in_silhouette"], "\ud83e\udd3a":["personfencing", "person_fencing", "fencer"], "\ud83c\udfc7":["horseracing", "horse_racing"], "\u26f7\ufe0f":["skier"], "\ud83c\udfc2":["snowboarder"], "\ud83c\udfcc\ufe0f":["persongolfing", "person_golfing", "golfer"], 
  "\ud83c\udfcc\ufe0f\u200d\u2642\ufe0f":["mangolfing", "man_golfing", "man-golfing"], "\ud83c\udfcc\ufe0f\u200d\u2640\ufe0f":["womangolfing", "woman_golfing", "woman-golfing"], "\ud83c\udfc4":["personsurfing", "person_surfing", "surfer"], "\ud83c\udfc4\u200d\u2642\ufe0f":["mansurfing", "man_surfing", "man-surfing"], "\ud83c\udfc4\u200d\u2640\ufe0f":["womansurfing", "woman_surfing", "woman-surfing"], "\ud83d\udea3":["personrowingboat", "person_rowing_boat", "rowboat"], "\ud83d\udea3\u200d\u2642\ufe0f":["manrowingboat", 
  "man_rowing_boat", "man-rowing-boat"], "\ud83d\udea3\u200d\u2640\ufe0f":["womanrowingboat", "woman_rowing_boat", "woman-rowing-boat"], "\ud83c\udfca":["personswimming", "person_swimming", "swimmer"], "\ud83c\udfca\u200d\u2642\ufe0f":["manswimming", "man_swimming", "man-swimming"], "\ud83c\udfca\u200d\u2640\ufe0f":["womanswimming", "woman_swimming", "woman-swimming"], "\u26f9\ufe0f":["personbouncingball", "person_bouncing_ball", "person_with_ball"], "\u26f9\ufe0f\u200d\u2642\ufe0f":["manbouncingball", 
  "man_bouncing_ball", "man-bouncing-ball"], "\u26f9\ufe0f\u200d\u2640\ufe0f":["womanbouncingball", "woman_bouncing_ball", "woman-bouncing-ball"], "\ud83c\udfcb\ufe0f":["personliftingweights", "person_lifting_weights", "weightlifter", "weight_lifter"], "\ud83c\udfcb\ufe0f\u200d\u2642\ufe0f":["manliftingweights", "man_lifting_weights", "man-lifting-weights"], "\ud83c\udfcb\ufe0f\u200d\u2640\ufe0f":["womanliftingweights", "woman_lifting_weights", "woman-lifting-weights"], "\ud83d\udeb4":["personbiking", 
  "person_biking", "bicyclist"], "\ud83d\udeb4\u200d\u2642\ufe0f":["manbiking", "man_biking", "man-biking"], "\ud83d\udeb4\u200d\u2640\ufe0f":["womanbiking", "woman_biking", "woman-biking"], "\ud83d\udeb5":["personmountainbiking", "person_mountain_biking", "mountain_bicyclist"], "\ud83d\udeb5\u200d\u2642\ufe0f":["manmountainbiking", "man_mountain_biking", "man-mountain-biking"], "\ud83d\udeb5\u200d\u2640\ufe0f":["womanmountainbiking", "woman_mountain_biking", "woman-mountain-biking"], "\ud83c\udfce\ufe0f":["racingcar", 
  "racing_car"], "\ud83c\udfcd\ufe0f":["motorcycle", "racingmotorcycle", "racing_motorcycle"], "\ud83e\udd38":["personcartwheeling", "person_cartwheeling", "persondoingcartwheel", "person_doing_cartwheel"], "\ud83e\udd38\u200d\u2642\ufe0f":["mancartwheeling", "man_cartwheeling", "man-cartwheeling"], "\ud83e\udd38\u200d\u2640\ufe0f":["womancartwheeling", "woman_cartwheeling", "woman-cartwheeling"], "\ud83e\udd3c":["personwrestling", "person_wrestling", "wrestlers"], "\ud83e\udd3c\u200d\u2642\ufe0f":["manwrestling", 
  "man_wrestling", "man-wrestling"], "\ud83e\udd3c\u200d\u2640\ufe0f":["womanwrestling", "woman_wrestling", "woman-wrestling"], "\ud83e\udd3d":["personplayingwaterpolo", "person_playing_water_polo", "water_polo"], "\ud83e\udd3d\u200d\u2642\ufe0f":["manplayingwaterpolo", "man_playing_water_polo", "man-playing-water-polo"], "\ud83e\udd3d\u200d\u2640\ufe0f":["womanplayingwaterpolo", "woman_playing_water_polo", "woman-playing-water-polo"], "\ud83e\udd3e":["personplayinghandball", "person_playing_handball", 
  "handball"], "\ud83e\udd3e\u200d\u2642\ufe0f":["manplayinghandball", "man_playing_handball", "man-playing-handball"], "\ud83e\udd3e\u200d\u2640\ufe0f":["womanplayinghandball", "woman_playing_handball", "woman-playing-handball"], "\ud83e\udd39":["personjuggling", "person_juggling", "juggling"], "\ud83e\udd39\u200d\u2642\ufe0f":["manjuggling", "man_juggling", "man-juggling"], "\ud83e\udd39\u200d\u2640\ufe0f":["womanjuggling", "woman_juggling", "woman-juggling"], "\ud83d\udc6b":["manandwomanholdinghands", 
  "man_and_woman_holding_hands", "couple"], "\ud83d\udc6c":["twomenholdinghands", "two_men_holding_hands"], "\ud83d\udc6d":["twowomenholdinghands", "two_women_holding_hands"], "\ud83d\udc8f":["couplekiss", "couple_kiss"], "\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68":["kiss_woman_man", "woman-kiss-man"], "\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68":["kiss_man_man", "man-kiss-man"], "\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69":["kiss_woman_woman", 
  "woman-kiss-woman"], "\ud83d\udc91":["couplewithheart", "couple_with_heart"], "\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc68":["couple_woman_man", "woman-heart-man"], "\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68":["couple_man_man", "man-heart-man"], "\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc69":["couple_woman_woman", "woman-heart-woman"], "\ud83d\udc6a":["family"], "\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66":["family_man_woman_boy", "man-woman-boy"], "\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67":["family_man_woman_girl", 
  "man-woman-girl"], "\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d\udc66":["family_man_woman_girl_boy", "man-woman-girl-boy"], "\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66":["family_man_woman_boy_boy", "man-woman-boy-boy"], "\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d\udc67":["family_man_woman_girl_girl", "man-woman-girl-girl"], "\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66":["family_man_man_boy", "man-man-boy"], "\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67":["family_man_man_girl", 
  "man-man-girl"], "\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d\udc66":["family_man_man_girl_boy", "man-man-girl-boy"], "\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66":["family_man_man_boy_boy", "man-man-boy-boy"], "\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d\udc67":["family_man_man_girl_girl", "man-man-girl-girl"], "\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66":["family_woman_woman_boy", "woman-woman-boy"], "\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67":["family_woman_woman_girl", 
  "woman-woman-girl"], "\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d\udc66":["family_woman_woman_girl_boy", "woman-woman-girl-boy"], "\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66":["family_woman_woman_boy_boy", "woman-woman-boy-boy"], "\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d\udc67":["family_woman_woman_girl_girl", "woman-woman-girl-girl"], "\ud83d\udc68\u200d\ud83d\udc66":["family_man_boy", "man-boy"], "\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66":["family_man_boy_boy", 
  "man-boy-boy"], "\ud83d\udc68\u200d\ud83d\udc67":["family_man_girl", "man-girl"], "\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d\udc66":["family_man_girl_boy", "man-girl-boy"], "\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d\udc67":["family_man_girl_girl", "man-girl-girl"], "\ud83d\udc69\u200d\ud83d\udc66":["family_woman_boy", "woman-boy"], "\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66":["family_woman_boy_boy", "woman-boy-boy"], "\ud83d\udc69\u200d\ud83d\udc67":["family_woman_girl", "woman-girl"], 
  "\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d\udc66":["family_woman_girl_boy", "woman-girl-boy"], "\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d\udc67":["family_woman_girl_girl", "woman-girl-girl"], "\ud83e\udd33":["selfie"], "\ud83d\udcaa":["flexedbiceps", "flexed_biceps", "muscle"], "\ud83d\udc48":["backhandindexpointingleft", "backhand_index_pointing_left", "pointleft", "point_left"], "\ud83d\udc49":["backhandindexpointingright", "backhand_index_pointing_right", "pointright", "point_right"], "\u261d\ufe0f":["indexpointingup", 
  "index_pointing_up", "pointup", "point_up"], "\ud83d\udc46":["backhandindexpointingup", "backhand_index_pointing_up", "pointup2", "point_up_2"], "\ud83d\udd95":["middlefinger", "middle_finger"], "\ud83d\udc47":["backhandindexpointingdown", "backhand_index_pointing_down", "point_down"], "\u270c\ufe0f":["victoryhand", "victory_hand", "v"], "\ud83e\udd1e":["crossedfingers", "crossed_fingers"], "\ud83d\udd96":["vulcansalute", "vulcan_salute", "spockhand", "spock_hand", "spock-hand"], "\ud83e\udd18":["signofthehorns", 
  "sign_of_the_horns", "thehorns", "the_horns", "rockon", "rock_on", "metal"], "\ud83e\udd19":["callmehand", "call_me_hand"], "\ud83d\udd90\ufe0f":["handwithfingerssplayed", "hand_with_fingers_splayed", "raisedhandwithfingerssplayed", "raised_hand_with_fingers_splayed"], "\u270b":["raisedhand", "raised_hand", "hand"], "\ud83d\udc4c":["okhand", "ok_hand"], "\ud83d\udc4d":["thumbsup", "thumbs_up", "+1"], "\ud83d\udc4e":["thumbsdown", "thumbs_down", "-1"], "\u270a":["raisedfist", "raised_fist", "fist"], 
  "\ud83d\udc4a":["oncomingfist", "oncoming_fist", "facepunch", "face_punch"], "\ud83e\udd1b":["leftfacingfist", "left_facing_fist", "left-facing_fist", "fistleft", "fist_left"], "\ud83e\udd1c":["rightfacingfist", "right_facing_fist", "right-facing_fist", "fistright", "fist_right"], "\ud83e\udd1a":["raisedbackofhand", "raised_back_of_hand"], "\ud83d\udc4b":["wavinghand", "waving_hand", "wave"], "\ud83e\udd1f":["loveyougesture", "love_you_gesture", "iloveyouhandsign", "i_love_you_hand_sign"], "\u270d\ufe0f":["writinghand", 
  "writing_hand"], "\ud83d\udc4f":["clappinghands", "clapping_hands", "clap"], "\ud83d\udc50":["openhands", "open_hands"], "\ud83d\ude4c":["raisinghands", "raising_hands", "raisedhands", "raised_hands"], "\ud83e\udd32":["palmsuptogether", "palms_up_together"], "\ud83d\ude4f":["foldedhands", "folded_hands", "pray"], "\ud83e\udd1d":["handshake"], "\ud83d\udc85":["nailpolish", "nail_polish", "nailcare", "nail_care"], "\ud83d\udc42":["ear"], "\ud83d\udc43":["nose"], "\ud83d\udc63":["footprints"], "\ud83d\udc40":["eyes"], 
  "\ud83d\udc41\ufe0f":["eye"], "\ud83d\udc41\ufe0f\u200d\ud83d\udde8\ufe0f":["eyeinspeechbubble", "eye_in_speech_bubble", "eye-in-speech-bubble"], "\ud83e\udde0":["brain"], "\ud83d\udc45":["tongue"], "\ud83d\udc44":["mouth", "lips"], "\ud83c\udffb":["lightskintone", "light_skin_tone", "skin-tone-2"], "\ud83c\udffc":["mediumlightskintone", "medium_light_skin_tone", "skin-tone-3"], "\ud83c\udffd":["mediumskintone", "medium_skin_tone", "skin-tone-4"], "\ud83c\udffe":["mediumdarkskintone", "medium_dark_skin_tone", 
  "skin-tone-5"], "\ud83c\udfff":["darkskintone", "dark_skin_tone", "skin-tone-6"], "\ud83d\udc8b":["kissmark", "kiss_mark", "kiss"], "\ud83d\udc98":["heartwitharrow", "heart_with_arrow", "cupid"], "\ud83d\udc9d":["heartwithribbon", "heart_with_ribbon", "giftheart", "gift_heart"], "\ud83d\udc96":["sparklingheart", "sparkling_heart"], "\ud83d\udc97":["growingheart", "growing_heart", "heartpulse"], "\ud83d\udc93":["beatingheart", "beating_heart", "heartbeat"], "\ud83d\udc9e":["revolvinghearts", "revolving_hearts"], 
  "\ud83d\udc95":["twohearts", "two_hearts"], "\ud83d\udc8c":["loveletter", "love_letter"], "\u2763\ufe0f":["heavyheartexclamation", "heavy_heart_exclamation", "heavyheartexclamationmarkornament", "heavy_heart_exclamation_mark_ornament"], "\ud83d\udc94":["brokenheart", "broken_heart"], "\u2764\ufe0f":["redheart", "red_heart", "heart"], "\ud83e\udde1":["orangeheart", "orange_heart"], "\ud83d\udc9b":["yellowheart", "yellow_heart"], "\ud83d\udc9a":["greenheart", "green_heart"], "\ud83d\udc99":["blueheart", 
  "blue_heart"], "\ud83d\udc9c":["purpleheart", "purple_heart"], "\ud83d\udda4":["blackheart", "black_heart"], "\ud83d\udc9f":["heartdecoration", "heart_decoration"], "\ud83d\udca4":["zzz"], "\ud83d\udca2":["angersymbol", "anger_symbol", "anger"], "\ud83d\udca3":["bomb"], "\ud83d\udca5":["collision", "boom"], "\ud83d\udca6":["sweatdroplets", "sweat_droplets", "sweatdrops", "sweat_drops"], "\ud83d\udca8":["dashingaway", "dashing_away", "dash"], "\ud83d\udcab":["dizzy"], "\ud83d\udcac":["speechballoon", 
  "speech_balloon"], "\ud83d\udde8\ufe0f":["leftspeechbubble", "left_speech_bubble"], "\ud83d\uddef\ufe0f":["rightangerbubble", "right_anger_bubble"], "\ud83d\udcad":["thoughtballoon", "thought_balloon"], "\ud83d\udd73\ufe0f":["hole"], "\ud83d\udc53":["glasses", "eyeglasses"], "\ud83d\udd76\ufe0f":["darksunglasses", "dark_sunglasses"], "\ud83d\udc54":["necktie"], "\ud83d\udc55":["tshirt", "shirt"], "\ud83d\udc56":["jeans"], "\ud83e\udde3":["scarf"], "\ud83e\udde4":["gloves"], "\ud83e\udde5":["coat"], 
  "\ud83e\udde6":["socks"], "\ud83d\udc57":["dress"], "\ud83d\udc58":["kimono"], "\ud83d\udc59":["bikini"], "\ud83d\udc5a":["womansclothes", "womans_clothes"], "\ud83d\udc5b":["purse"], "\ud83d\udc5c":["handbag"], "\ud83d\udc5d":["clutchbag", "clutch_bag", "pouch"], "\ud83d\udecd\ufe0f":["shoppingbags", "shopping_bags"], "\ud83c\udf92":["backpack", "schoolsatchel", "school_satchel"], "\ud83d\udc5e":["mansshoe", "mans_shoe"], "\ud83d\udc5f":["runningshoe", "running_shoe", "athleticshoe", "athletic_shoe"], 
  "\ud83d\udc60":["highheeledshoe", "high_heeled_shoe", "highheel", "high_heel"], "\ud83d\udc61":["womanssandal", "womans_sandal", "sandal"], "\ud83d\udc62":["womansboot", "womans_boot", "boot"], "\ud83d\udc51":["crown"], "\ud83d\udc52":["womanshat", "womans_hat"], "\ud83c\udfa9":["tophat", "top_hat"], "\ud83c\udf93":["graduationcap", "graduation_cap", "mortarboard", "mortar_board"], "\ud83e\udde2":["billedcap", "billed_cap"], "\u26d1\ufe0f":["rescueworkershelmet", "rescue_workers_helmet", "helmetwithwhitecross", 
  "helmet_with_white_cross"], "\ud83d\udcff":["prayerbeads", "prayer_beads"], "\ud83d\udc84":["lipstick"], "\ud83d\udc8d":["ring"], "\ud83d\udc8e":["gemstone", "gem_stone", "gem"], "\ud83d\udc35":["monkeyface", "monkey_face"], "\ud83d\udc12":["monkey"], "\ud83e\udd8d":["gorilla"], "\ud83d\udc36":["dogface", "dog_face", "dog"], "\ud83d\udc15":["dog2"], "\ud83d\udc29":["poodle"], "\ud83d\udc3a":["wolfface", "wolf_face", "wolf"], "\ud83e\udd8a":["foxface", "fox_face"], "\ud83d\udc31":["catface", "cat_face", 
  "cat"], "\ud83d\udc08":["cat2"], "\ud83e\udd81":["lionface", "lion_face"], "\ud83d\udc2f":["tigerface", "tiger_face", "tiger"], "\ud83d\udc05":["tiger2"], "\ud83d\udc06":["leopard"], "\ud83d\udc34":["horseface", "horse_face", "horse"], "\ud83d\udc0e":["racehorse", "race_horse"], "\ud83e\udd84":["unicornface", "unicorn_face"], "\ud83e\udd93":["zebra", "zebraface", "zebra_face"], "\ud83e\udd8c":["deer"], "\ud83d\udc2e":["cowface", "cow_face", "cow"], "\ud83d\udc02":["ox"], "\ud83d\udc03":["waterbuffalo", 
  "water_buffalo"], "\ud83d\udc04":["cow2"], "\ud83d\udc37":["pigface", "pig_face", "pig"], "\ud83d\udc16":["pig2"], "\ud83d\udc17":["boar"], "\ud83d\udc3d":["pignose", "pig_nose"], "\ud83d\udc0f":["ram"], "\ud83d\udc11":["ewe", "sheep"], "\ud83d\udc10":["goat"], "\ud83d\udc2a":["dromedarycamel", "dromedary_camel"], "\ud83d\udc2b":["twohumpcamel", "two_hump_camel", "camel"], "\ud83e\udd92":["giraffe", "giraffeface", "giraffe_face"], "\ud83d\udc18":["elephant"], "\ud83e\udd8f":["rhinoceros"], "\ud83d\udc2d":["mouseface", 
  "mouse_face", "mouse"], "\ud83d\udc01":["mouse2"], "\ud83d\udc00":["rat"], "\ud83d\udc39":["hamsterface", "hamster_face", "hamster"], "\ud83d\udc30":["rabbitface", "rabbit_face", "rabbit"], "\ud83d\udc07":["rabbit2"], "\ud83d\udc3f\ufe0f":["chipmunk"], "\ud83e\udd94":["hedgehog"], "\ud83e\udd87":["bat"], "\ud83d\udc3b":["bearface", "bear_face", "bear"], "\ud83d\udc28":["koala"], "\ud83d\udc3c":["pandaface", "panda_face"], "\ud83d\udc3e":["pawprints", "paw_prints", "feet"], "\ud83e\udd83":["turkey"], 
  "\ud83d\udc14":["chicken"], "\ud83d\udc13":["rooster"], "\ud83d\udc23":["hatchingchick", "hatching_chick"], "\ud83d\udc24":["babychick", "baby_chick"], "\ud83d\udc25":["hatchedchick", "hatched_chick"], "\ud83d\udc26":["bird"], "\ud83d\udc27":["penguin"], "\ud83d\udd4a\ufe0f":["dove", "doveofpeace", "dove_of_peace"], "\ud83e\udd85":["eagle"], "\ud83e\udd86":["duck"], "\ud83e\udd89":["owl"], "\ud83d\udc38":["frogface", "frog_face", "frog"], "\ud83d\udc0a":["crocodile"], "\ud83d\udc22":["turtle"], 
  "\ud83e\udd8e":["lizard"], "\ud83d\udc0d":["snake"], "\ud83d\udc32":["dragonface", "dragon_face"], "\ud83d\udc09":["dragon"], "\ud83e\udd95":["sauropod"], "\ud83e\udd96":["t-rex", "trex", "t_rex"], "\ud83d\udc33":["spoutingwhale", "spouting_whale", "whale"], "\ud83d\udc0b":["whale2"], "\ud83d\udc2c":["dolphin"], "\ud83d\udc1f":["fish"], "\ud83d\udc20":["tropicalfish", "tropical_fish"], "\ud83d\udc21":["blowfish"], "\ud83e\udd88":["shark"], "\ud83d\udc19":["octopus"], "\ud83d\udc1a":["spiralshell", 
  "spiral_shell", "shell"], "\ud83e\udd80":["crab"], "\ud83e\udd90":["shrimp"], "\ud83e\udd91":["squid"], "\ud83d\udc0c":["snail"], "\ud83e\udd8b":["butterfly"], "\ud83d\udc1b":["bug"], "\ud83d\udc1c":["ant"], "\ud83d\udc1d":["honeybee", "bee"], "\ud83d\udc1e":["ladybeetle", "lady_beetle", "beetle"], "\ud83e\udd97":["cricket"], "\ud83d\udd77\ufe0f":["spider"], "\ud83d\udd78\ufe0f":["spiderweb", "spider_web"], "\ud83e\udd82":["scorpion"], "\ud83d\udc90":["bouquet"], "\ud83c\udf38":["cherryblossom", 
  "cherry_blossom"], "\ud83d\udcae":["whiteflower", "white_flower"], "\ud83c\udff5\ufe0f":["rosette"], "\ud83c\udf39":["rose"], "\ud83e\udd40":["wiltedflower", "wilted_flower"], "\ud83c\udf3a":["hibiscus"], "\ud83c\udf3b":["sunflower"], "\ud83c\udf3c":["blossom"], "\ud83c\udf37":["tulip"], "\ud83c\udf31":["seedling"], "\ud83c\udf32":["evergreentree", "evergreen_tree"], "\ud83c\udf33":["deciduoustree", "deciduous_tree"], "\ud83c\udf34":["palmtree", "palm_tree"], "\ud83c\udf35":["cactus"], "\ud83c\udf3e":["sheafofrice", 
  "sheaf_of_rice", "earofrice", "ear_of_rice"], "\ud83c\udf3f":["herb"], "\u2618\ufe0f":["shamrock"], "\ud83c\udf40":["fourleafclover", "four_leaf_clover"], "\ud83c\udf41":["mapleleaf", "maple_leaf"], "\ud83c\udf42":["fallenleaf", "fallen_leaf"], "\ud83c\udf43":["leafflutteringinwind", "leaf_fluttering_in_wind", "leaves"], "\ud83c\udf47":["grapes"], "\ud83c\udf48":["melon"], "\ud83c\udf49":["watermelon"], "\ud83c\udf4a":["tangerine"], "\ud83c\udf4b":["lemon"], "\ud83c\udf4c":["banana"], "\ud83c\udf4d":["pineapple"], 
  "\ud83c\udf4e":["redapple", "red_apple", "apple"], "\ud83c\udf4f":["greenapple", "green_apple"], "\ud83c\udf50":["pear"], "\ud83c\udf51":["peach"], "\ud83c\udf52":["cherries"], "\ud83c\udf53":["strawberry"], "\ud83e\udd5d":["kiwifruit", "kiwi_fruit"], "\ud83c\udf45":["tomato"], "\ud83e\udd65":["coconut"], "\ud83e\udd51":["avocado"], "\ud83c\udf46":["eggplant"], "\ud83e\udd54":["potato"], "\ud83e\udd55":["carrot"], "\ud83c\udf3d":["earofcorn", "ear_of_corn", "corn"], "\ud83c\udf36\ufe0f":["hotpepper", 
  "hot_pepper"], "\ud83e\udd52":["cucumber"], "\ud83e\udd66":["broccoli"], "\ud83c\udf44":["mushroom"], "\ud83e\udd5c":["peanuts"], "\ud83c\udf30":["chestnut"], "\ud83c\udf5e":["bread"], "\ud83e\udd50":["croissant"], "\ud83e\udd56":["baguettebread", "baguette_bread"], "\ud83e\udd68":["pretzel"], "\ud83e\udd5e":["pancakes"], "\ud83e\uddc0":["cheesewedge", "cheese_wedge"], "\ud83c\udf56":["meatonbone", "meat_on_bone"], "\ud83c\udf57":["poultryleg", "poultry_leg"], "\ud83e\udd69":["cutofmeat", "cut_of_meat"], 
  "\ud83e\udd53":["bacon"], "\ud83c\udf54":["hamburger"], "\ud83c\udf5f":["frenchfries", "french_fries", "fries"], "\ud83c\udf55":["pizza"], "\ud83c\udf2d":["hotdog", "hot_dog"], "\ud83e\udd6a":["sandwich"], "\ud83c\udf2e":["taco"], "\ud83c\udf2f":["burrito"], "\ud83e\udd59":["stuffedflatbread", "stuffed_flatbread"], "\ud83e\udd5a":["egg"], "\ud83c\udf73":["cooking", "friedegg", "fried_egg"], "\ud83e\udd58":["shallowpanoffood", "shallow_pan_of_food"], "\ud83c\udf72":["potoffood", "pot_of_food", "stew"], 
  "\ud83e\udd63":["bowlwithspoon", "bowl_with_spoon"], "\ud83e\udd57":["greensalad", "green_salad"], "\ud83c\udf7f":["popcorn"], "\ud83e\udd6b":["cannedfood", "canned_food"], "\ud83c\udf71":["bentobox", "bento_box", "bento"], "\ud83c\udf58":["ricecracker", "rice_cracker"], "\ud83c\udf59":["riceball", "rice_ball"], "\ud83c\udf5a":["cookedrice", "cooked_rice", "rice"], "\ud83c\udf5b":["curryrice", "curry_rice", "curry"], "\ud83c\udf5c":["steamingbowl", "steaming_bowl", "ramen"], "\ud83c\udf5d":["spaghetti"], 
  "\ud83c\udf60":["roastedsweetpotato", "roasted_sweet_potato", "sweetpotato", "sweet_potato"], "\ud83c\udf62":["oden"], "\ud83c\udf63":["sushi"], "\ud83c\udf64":["friedshrimp", "fried_shrimp"], "\ud83c\udf65":["fishcakewithswirl", "fish_cake_with_swirl", "fishcake", "fish_cake"], "\ud83c\udf61":["dango"], "\ud83e\udd5f":["dumpling"], "\ud83e\udd60":["fortunecookie", "fortune_cookie"], "\ud83e\udd61":["takeoutbox", "takeout_box"], "\ud83c\udf66":["softicecream", "soft_ice_cream", "icecream"], "\ud83c\udf67":["shavedice", 
  "shaved_ice"], "\ud83c\udf68":["ice_cream"], "\ud83c\udf69":["doughnut"], "\ud83c\udf6a":["cookie"], "\ud83c\udf82":["birthdaycake", "birthday_cake", "birthday"], "\ud83c\udf70":["shortcake", "cake"], "\ud83e\udd67":["pie"], "\ud83c\udf6b":["chocolatebar", "chocolate_bar"], "\ud83c\udf6c":["candy"], "\ud83c\udf6d":["lollipop"], "\ud83c\udf6e":["custard"], "\ud83c\udf6f":["honeypot", "honey_pot"], "\ud83c\udf7c":["babybottle", "baby_bottle"], "\ud83e\udd5b":["glassofmilk", "glass_of_milk"], "\u2615":["hotbeverage", 
  "hot_beverage", "coffee"], "\ud83c\udf75":["teacup", "tea"], "\ud83c\udf76":["sake"], "\ud83c\udf7e":["bottlewithpoppingcork", "bottle_with_popping_cork", "champagne"], "\ud83c\udf77":["wineglass", "wine_glass"], "\ud83c\udf78":["cocktailglass", "cocktail_glass", "cocktail"], "\ud83c\udf79":["tropicaldrink", "tropical_drink"], "\ud83c\udf7a":["beermug", "beer_mug", "beer"], "\ud83c\udf7b":["clinkingbeermugs", "clinking_beer_mugs", "beers"], "\ud83e\udd42":["clinkingglasses", "clinking_glasses"], 
  "\ud83e\udd43":["tumblerglass", "tumbler_glass"], "\ud83e\udd64":["cupwithstraw", "cup_with_straw"], "\ud83e\udd62":["chopsticks"], "\ud83c\udf7d\ufe0f":["forkandknifewithplate", "fork_and_knife_with_plate", "knifeforkplate", "knife_fork_plate"], "\ud83c\udf74":["forkandknife", "fork_and_knife"], "\ud83e\udd44":["spoon"], "\ud83d\udd2a":["kitchenknife", "kitchen_knife", "hocho"], "\ud83c\udffa":["amphora"], "\ud83c\udf0d":["globeshowingeuropeafrica", "globe_showing_europe_africa", "earthafrica", 
  "earth_africa"], "\ud83c\udf0e":["globeshowingamericas", "globe_showing_americas", "earthamericas", "earth_americas"], "\ud83c\udf0f":["globeshowingasiaaustralia", "globe_showing_asia_australia", "earthasia", "earth_asia"], "\ud83c\udf10":["globewithmeridians", "globe_with_meridians"], "\ud83d\uddfa\ufe0f":["worldmap", "world_map"], "\ud83d\uddfe":["mapofjapan", "map_of_japan", "japan"], "\ud83c\udfd4\ufe0f":["snowcappedmountain", "snow_capped_mountain"], "\u26f0\ufe0f":["mountain"], "\ud83c\udf0b":["volcano"], 
  "\ud83d\uddfb":["mountfuji", "mount_fuji"], "\ud83c\udfd5\ufe0f":["camping"], "\ud83c\udfd6\ufe0f":["beachwithumbrella", "beach_with_umbrella"], "\ud83c\udfdc\ufe0f":["desert"], "\ud83c\udfdd\ufe0f":["desertisland", "desert_island"], "\ud83c\udfde\ufe0f":["nationalpark", "national_park"], "\ud83c\udfdf\ufe0f":["stadium"], "\ud83c\udfdb\ufe0f":["classicalbuilding", "classical_building"], "\ud83c\udfd7\ufe0f":["buildingconstruction", "building_construction"], "\ud83c\udfd8\ufe0f":["houses", "housebuildings", 
  "house_buildings"], "\ud83c\udfda\ufe0f":["derelicthouse", "derelict_house", "derelicthousebuilding", "derelict_house_building"], "\ud83c\udfe0":["house"], "\ud83c\udfe1":["housewithgarden", "house_with_garden"], "\ud83c\udfe2":["officebuilding", "office_building", "office"], "\ud83c\udfe3":["japanesepostoffice", "japanese_post_office", "postoffice", "post_office"], "\ud83c\udfe4":["europeanpostoffice", "european_post_office"], "\ud83c\udfe5":["hospital"], "\ud83c\udfe6":["bank"], "\ud83c\udfe8":["hotel"], 
  "\ud83c\udfe9":["lovehotel", "love_hotel"], "\ud83c\udfea":["conveniencestore", "convenience_store"], "\ud83c\udfeb":["school"], "\ud83c\udfec":["departmentstore", "department_store"], "\ud83c\udfed":["factory"], "\ud83c\udfef":["japanesecastle", "japanese_castle"], "\ud83c\udff0":["castle", "europeancastle", "european_castle"], "\ud83d\udc92":["wedding"], "\ud83d\uddfc":["tokyotower", "tokyo_tower"], "\ud83d\uddfd":["statueofliberty", "statue_of_liberty"], "\u26ea":["church"], "\ud83d\udd4c":["mosque"], 
  "\ud83d\udd4d":["synagogue"], "\u26e9\ufe0f":["shintoshrine", "shinto_shrine"], "\ud83d\udd4b":["kaaba"], "\u26f2":["fountain"], "\u26fa":["tent"], "\ud83c\udf01":["foggy"], "\ud83c\udf03":["nightwithstars", "night_with_stars"], "\ud83c\udfd9\ufe0f":["cityscape"], "\ud83c\udf04":["sunriseovermountains", "sunrise_over_mountains"], "\ud83c\udf05":["sunrise"], "\ud83c\udf06":["cityscapeatdusk", "cityscape_at_dusk", "citysunset", "city_sunset"], "\ud83c\udf07":["sunset", "citysunrise", "city_sunrise"], 
  "\ud83c\udf09":["bridgeatnight", "bridge_at_night"], "\u2668\ufe0f":["hotsprings", "hot_springs"], "\ud83c\udf0c":["milkyway", "milky_way"], "\ud83c\udfa0":["carouselhorse", "carousel_horse"], "\ud83c\udfa1":["ferriswheel", "ferris_wheel"], "\ud83c\udfa2":["rollercoaster", "roller_coaster"], "\ud83d\udc88":["barberpole", "barber_pole", "barber"], "\ud83c\udfaa":["circustent", "circus_tent"], "\ud83d\ude82":["locomotive", "steamlocomotive", "steam_locomotive"], "\ud83d\ude83":["railwaycar", "railway_car"], 
  "\ud83d\ude84":["highspeedtrain", "high_speed_train", "bullettrainside", "bullettrain_side"], "\ud83d\ude85":["bullettrain", "bullet_train", "bullettrainfront", "bullettrain_front"], "\ud83d\ude86":["train2"], "\ud83d\ude87":["metro"], "\ud83d\ude88":["lightrail", "light_rail"], "\ud83d\ude89":["station"], "\ud83d\ude8a":["tram"], "\ud83d\ude9d":["monorail"], "\ud83d\ude9e":["mountainrailway", "mountain_railway"], "\ud83d\ude8b":["tramcar", "tram_car", "train"], "\ud83d\ude8c":["bus"], "\ud83d\ude8d":["oncomingbus", 
  "oncoming_bus"], "\ud83d\ude8e":["trolleybus"], "\ud83d\ude90":["minibus"], "\ud83d\ude91":["ambulance"], "\ud83d\ude92":["fireengine", "fire_engine"], "\ud83d\ude93":["policecar", "police_car"], "\ud83d\ude94":["oncomingpolicecar", "oncoming_police_car"], "\ud83d\ude95":["taxi"], "\ud83d\ude96":["oncomingtaxi", "oncoming_taxi"], "\ud83d\ude97":["automobile", "car", "redcar", "red_car"], "\ud83d\ude98":["oncomingautomobile", "oncoming_automobile"], "\ud83d\ude99":["sportutilityvehicle", "sport_utility_vehicle", 
  "bluecar", "blue_car"], "\ud83d\ude9a":["deliverytruck", "delivery_truck", "truck"], "\ud83d\ude9b":["articulatedlorry", "articulated_lorry", "semi"], "\ud83d\ude9c":["tractor"], "\ud83d\udeb2":["bicycle", "bike"], "\ud83d\udef4":["kickscooter", "kick_scooter", "scooter"], "\ud83d\udef5":["motorscooter", "motor_scooter"], "\ud83d\ude8f":["busstop", "bus_stop"], "\ud83d\udee3\ufe0f":["motorway"], "\ud83d\udee4\ufe0f":["railwaytrack", "railway_track"], "\ud83d\udee2\ufe0f":["oildrum", "oil_drum"], 
  "\u26fd":["fuelpump", "fuel_pump"], "\ud83d\udea8":["policecarlight", "police_car_light", "rotatinglight", "rotating_light"], "\ud83d\udea5":["horizontaltrafficlight", "horizontal_traffic_light", "trafficlight", "traffic_light"], "\ud83d\udea6":["verticaltrafficlight", "vertical_traffic_light"], "\ud83d\uded1":["stopsign", "stop_sign", "octagonalsign", "octagonal_sign"], "\ud83d\udea7":["construction"], "\u2693":["anchor"], "\u26f5":["sailboat", "boat"], "\ud83d\udef6":["canoe"], "\ud83d\udea4":["speedboat"], 
  "\ud83d\udef3\ufe0f":["passengership", "passenger_ship"], "\u26f4\ufe0f":["ferry"], "\ud83d\udee5\ufe0f":["motorboat", "motor_boat"], "\ud83d\udea2":["ship"], "\u2708\ufe0f":["airplane"], "\ud83d\udee9\ufe0f":["smallairplane", "small_airplane"], "\ud83d\udeeb":["airplanedeparture", "airplane_departure"], "\ud83d\udeec":["airplanearrival", "airplane_arrival", "airplanearriving", "airplane_arriving"], "\ud83d\udcba":["seat"], "\ud83d\ude81":["helicopter"], "\ud83d\ude9f":["suspensionrailway", "suspension_railway"], 
  "\ud83d\udea0":["mountaincableway", "mountain_cableway"], "\ud83d\udea1":["aerialtramway", "aerial_tramway"], "\ud83d\udef0\ufe0f":["satellite"], "\ud83d\ude80":["rocket"], "\ud83d\udef8":["flyingsaucer", "flying_saucer", "ufo"], "\ud83d\udece\ufe0f":["bellhopbell", "bellhop_bell"], "\u231b":["hourglassdone", "hourglass_done", "hourglass"], "\u23f3":["hourglassnotdone", "hourglass_not_done", "hourglassflowingsand", "hourglass_flowing_sand"], "\u231a":["watch"], "\u23f0":["alarmclock", "alarm_clock"], 
  "\u23f1\ufe0f":["stopwatch"], "\u23f2\ufe0f":["timerclock", "timer_clock"], "\ud83d\udd70\ufe0f":["mantelpiececlock", "mantelpiece_clock"], "\ud83d\udd5b":["twelveo\u2019clock", "twelve_o_clock", "clock12"], "\ud83d\udd67":["twelvethirty", "twelve_thirty", "clock1230"], "\ud83d\udd50":["oneo\u2019clock", "one_o_clock", "clock1"], "\ud83d\udd5c":["onethirty", "one_thirty", "clock130"], "\ud83d\udd51":["twoo\u2019clock", "two_o_clock", "clock2"], "\ud83d\udd5d":["twothirty", "two_thirty", "clock230"], 
  "\ud83d\udd52":["threeo\u2019clock", "three_o_clock", "clock3"], "\ud83d\udd5e":["threethirty", "three_thirty", "clock330"], "\ud83d\udd53":["fouro\u2019clock", "four_o_clock", "clock4"], "\ud83d\udd5f":["fourthirty", "four_thirty", "clock430"], "\ud83d\udd54":["fiveo\u2019clock", "five_o_clock", "clock5"], "\ud83d\udd60":["fivethirty", "five_thirty", "clock530"], "\ud83d\udd55":["sixo\u2019clock", "six_o_clock", "clock6"], "\ud83d\udd61":["sixthirty", "six_thirty", "clock630"], "\ud83d\udd56":["seveno\u2019clock", 
  "seven_o_clock", "clock7"], "\ud83d\udd62":["seventhirty", "seven_thirty", "clock730"], "\ud83d\udd57":["eighto\u2019clock", "eight_o_clock", "clock8"], "\ud83d\udd63":["eightthirty", "eight_thirty", "clock830"], "\ud83d\udd58":["nineo\u2019clock", "nine_o_clock", "clock9"], "\ud83d\udd64":["ninethirty", "nine_thirty", "clock930"], "\ud83d\udd59":["teno\u2019clock", "ten_o_clock", "clock10"], "\ud83d\udd65":["tenthirty", "ten_thirty", "clock1030"], "\ud83d\udd5a":["elevenoclock", "eleven_o_clock", 
  "clock11"], "\ud83d\udd66":["eleventhirty", "eleven_thirty", "clock1130"], "\ud83c\udf11":["newmoon", "new_moon"], "\ud83c\udf12":["waxingcrescentmoon", "waxing_crescent_moon"], "\ud83c\udf13":["firstquartermoon", "first_quarter_moon"], "\ud83c\udf14":["waxinggibbousmoon", "waxing_gibbous_moon", "moon"], "\ud83c\udf15":["fullmoon", "full_moon"], "\ud83c\udf16":["waninggibbousmoon", "waning_gibbous_moon"], "\ud83c\udf17":["lastquartermoon", "last_quarter_moon"], "\ud83c\udf18":["waningcrescentmoon", 
  "waning_crescent_moon"], "\ud83c\udf19":["crescentmoon", "crescent_moon"], "\ud83c\udf1a":["newmoonface", "new_moon_face", "newmoonwithface", "new_moon_with_face"], "\ud83c\udf1b":["firstquartermoonface", "first_quarter_moon_face", "firstquartermoonwithface", "first_quarter_moon_with_face"], "\ud83c\udf1c":["lastquartermoonface", "last_quarter_moon_face", "lastquartermoonwithface", "last_quarter_moon_with_face"], "\ud83c\udf21\ufe0f":["thermometer"], "\u2600\ufe0f":["sun", "sunny"], "\ud83c\udf1d":["fullmoonface", 
  "full_moon_face", "fullmoonwithface", "full_moon_with_face"], "\ud83c\udf1e":["sunwithface", "sun_with_face"], "\u2b50":["star"], "\ud83c\udf1f":["glowingstar", "glowing_star", "star2"], "\ud83c\udf20":["shootingstar", "shooting_star", "stars"], "\u2601\ufe0f":["cloud"], "\u26c5":["sunbehindcloud", "sun_behind_cloud", "partlysunny", "partly_sunny"], "\u26c8\ufe0f":["cloudwithlightningandrain", "cloud_with_lightning_and_rain", "thundercloudandrain", "thunder_cloud_and_rain"], "\ud83c\udf24\ufe0f":["sunbehindsmallcloud", 
  "sun_behind_small_cloud", "mostlysunny", "mostly_sunny"], "\ud83c\udf25\ufe0f":["sunbehindlargecloud", "sun_behind_large_cloud", "barelysunny", "barely_sunny"], "\ud83c\udf26\ufe0f":["sunbehindraincloud", "sun_behind_rain_cloud", "partlysunnyrain", "partly_sunny_rain"], "\ud83c\udf27\ufe0f":["cloudwithrain", "cloud_with_rain", "raincloud", "rain_cloud"], "\ud83c\udf28\ufe0f":["cloudwithsnow", "cloud_with_snow", "snowcloud", "snow_cloud"], "\ud83c\udf29\ufe0f":["cloudwithlightning", "cloud_with_lightning", 
  "lightning"], "\ud83c\udf2a\ufe0f":["tornado"], "\ud83c\udf2b\ufe0f":["fog"], "\ud83c\udf2c\ufe0f":["windface", "wind_face", "windblowingface", "wind_blowing_face"], "\ud83c\udf00":["cyclone"], "\ud83c\udf08":["rainbow"], "\ud83c\udf02":["closedumbrella", "closed_umbrella"], "\u2602\ufe0f":["umbrella"], "\u2614":["umbrellawithraindrops", "umbrella_with_rain_drops"], "\u26f1\ufe0f":["umbrellaonground", "umbrella_on_ground"], "\u26a1":["highvoltage", "high_voltage", "zap"], "\u2744\ufe0f":["snowflake"], 
  "\u2603\ufe0f":["snowman", "snowmanwithsnow", "snowman_with_snow"], "\u26c4":["snowmanwithoutsnow", "snowman_without_snow"], "\u2604\ufe0f":["comet"], "\ud83d\udd25":["fire"], "\ud83d\udca7":["droplet"], "\ud83c\udf0a":["waterwave", "water_wave", "ocean"], "\ud83c\udf83":["jackolantern", "jack_o_lantern"], "\ud83c\udf84":["christmastree", "christmas_tree"], "\ud83c\udf86":["fireworks"], "\ud83c\udf87":["sparkler"], "\u2728":["sparkles"], "\ud83c\udf88":["balloon"], "\ud83c\udf89":["partypopper", 
  "party_popper", "tada"], "\ud83c\udf8a":["confettiball", "confetti_ball"], "\ud83c\udf8b":["tanabatatree", "tanabata_tree"], "\ud83c\udf8d":["pinedecoration", "pine_decoration", "bamboo"], "\ud83c\udf8e":["japanesedolls", "japanese_dolls", "dolls"], "\ud83c\udf8f":["carpstreamer", "carp_streamer", "flags"], "\ud83c\udf90":["windchime", "wind_chime"], "\ud83c\udf91":["moonviewingceremony", "moon_viewing_ceremony", "ricescene", "rice_scene"], "\ud83c\udf80":["ribbon"], "\ud83c\udf81":["wrappedgift", 
  "wrapped_gift", "gift"], "\ud83c\udf97\ufe0f":["reminderribbon", "reminder_ribbon"], "\ud83c\udf9f\ufe0f":["admissiontickets", "admission_tickets"], "\ud83c\udfab":["ticket"], "\ud83c\udf96\ufe0f":["militarymedal", "military_medal", "medal"], "\ud83c\udfc6":["trophy"], "\ud83c\udfc5":["sportsmedal", "sports_medal"], "\ud83e\udd47":["1stplacemedal", "1st_place_medal", "firstplacemedal", "first_place_medal"], "\ud83e\udd48":["2ndplacemedal", "2nd_place_medal", "secondplacemedal", "second_place_medal"], 
  "\ud83e\udd49":["3rdplacemedal", "3rd_place_medal", "thirdplacemedal", "third_place_medal"], "\u26bd":["soccerball", "soccer_ball", "soccer"], "\u26be":["baseball"], "\ud83c\udfc0":["basketball"], "\ud83c\udfd0":["volleyball"], "\ud83c\udfc8":["americanfootball", "american_football", "football"], "\ud83c\udfc9":["rugbyfootball", "rugby_football"], "\ud83c\udfbe":["tennis"], "\ud83c\udfb3":["bowling"], "\ud83c\udfcf":["cricketgame", "cricket_game", "cricketbatandball", "cricket_bat_and_ball"], "\ud83c\udfd1":["fieldhockey", 
  "field_hockey", "fieldhockeystickandball", "field_hockey_stick_and_ball"], "\ud83c\udfd2":["icehockey", "ice_hockey", "icehockeystickandpuck", "ice_hockey_stick_and_puck"], "\ud83c\udfd3":["pingpong", "ping_pong", "tabletennispaddleandball", "table_tennis_paddle_and_ball"], "\ud83c\udff8":["badminton", "badmintonracquetandshuttlecock", "badminton_racquet_and_shuttlecock"], "\ud83e\udd4a":["boxingglove", "boxing_glove"], "\ud83e\udd4b":["martialartsuniform", "martial_arts_uniform"], "\ud83e\udd45":["goalnet", 
  "goal_net"], "\u26f3":["flaginhole", "flag_in_hole", "golf"], "\u26f8\ufe0f":["iceskate", "ice_skate"], "\ud83c\udfa3":["fishingpole", "fishing_pole", "fishingpoleandfish", "fishing_pole_and_fish"], "\ud83c\udfbd":["runningshirt", "running_shirt", "runningshirtwithsash", "running_shirt_with_sash"], "\ud83c\udfbf":["skis", "ski"], "\ud83d\udef7":["sled"], "\ud83e\udd4c":["curlingstone", "curling_stone"], "\ud83c\udfaf":["directhit", "direct_hit", "dart"], "\ud83c\udfb1":["pool8ball", "pool_8_ball", 
  "8ball", "8_ball", "eightball", "eight_ball"], "\ud83d\udd2e":["crystalball", "crystal_ball"], "\ud83c\udfae":["videogame", "video_game"], "\ud83d\udd79\ufe0f":["joystick"], "\ud83c\udfb0":["slotmachine", "slot_machine"], "\ud83c\udfb2":["gamedie", "game_die"], "\u2660\ufe0f":["spadesuit", "spade_suit", "spades"], "\u2665\ufe0f":["heartsuit", "heart_suit", "hearts"], "\u2666\ufe0f":["diamondsuit", "diamond_suit", "diamonds"], "\u2663\ufe0f":["clubsuit", "club_suit", "clubs"], "\ud83c\udccf":["joker", 
  "blackjoker", "black_joker"], "\ud83c\udc04":["mahjongreddragon", "mahjong_red_dragon", "mahjong"], "\ud83c\udfb4":["flowerplayingcards", "flower_playing_cards"], "\ud83c\udfad":["performingarts", "performing_arts"], "\ud83d\uddbc\ufe0f":["framedpicture", "framed_picture", "framewithpicture", "frame_with_picture"], "\ud83c\udfa8":["artistpalette", "artist_palette", "art"], "\ud83d\udd07":["mutedspeaker", "muted_speaker", "mute"], "\ud83d\udd08":["speakerlowvolume", "speaker_low_volume", "speaker"], 
  "\ud83d\udd09":["speakermediumvolume", "speaker_medium_volume", "sound"], "\ud83d\udd0a":["speakerhighvolume", "speaker_high_volume", "loudsound", "loud_sound"], "\ud83d\udce2":["loudspeaker"], "\ud83d\udce3":["megaphone", "mega"], "\ud83d\udcef":["postalhorn", "postal_horn"], "\ud83d\udd14":["bell"], "\ud83d\udd15":["bellwithslash", "bell_with_slash", "nobell", "no_bell"], "\ud83c\udfbc":["musicalscore", "musical_score"], "\ud83c\udfb5":["musicalnote", "musical_note"], "\ud83c\udfb6":["musicalnotes", 
  "musical_notes", "notes"], "\ud83c\udf99\ufe0f":["studiomicrophone", "studio_microphone"], "\ud83c\udf9a\ufe0f":["levelslider", "level_slider"], "\ud83c\udf9b\ufe0f":["controlknobs", "control_knobs"], "\ud83c\udfa4":["microphone"], "\ud83c\udfa7":["headphone", "headphones"], "\ud83d\udcfb":["radio"], "\ud83c\udfb7":["saxophone"], "\ud83c\udfb8":["guitar"], "\ud83c\udfb9":["musicalkeyboard", "musical_keyboard"], "\ud83c\udfba":["trumpet"], "\ud83c\udfbb":["violin"], "\ud83e\udd41":["drum", "drumwithdrumsticks", 
  "drum_with_drumsticks"], "\ud83d\udcf1":["mobilephone", "mobile_phone", "iphone"], "\ud83d\udcf2":["mobilephonewitharrow", "mobile_phone_with_arrow", "calling"], "\u260e\ufe0f":["telephone", "phone"], "\ud83d\udcde":["telephonereceiver", "telephone_receiver"], "\ud83d\udcdf":["pager"], "\ud83d\udce0":["faxmachine", "fax_machine", "fax"], "\ud83d\udd0b":["battery"], "\ud83d\udd0c":["electricplug", "electric_plug"], "\ud83d\udcbb":["laptopcomputer", "laptop_computer", "computer"], "\ud83d\udda5\ufe0f":["desktopcomputer", 
  "desktop_computer"], "\ud83d\udda8\ufe0f":["printer"], "\u2328\ufe0f":["keyboard"], "\ud83d\uddb1\ufe0f":["computermouse", "computer_mouse", "threebuttonmouse", "three_button_mouse"], "\ud83d\uddb2\ufe0f":["trackball"], "\ud83d\udcbd":["computerdisk", "computer_disk", "minidisc"], "\ud83d\udcbe":["floppydisk", "floppy_disk"], "\ud83d\udcbf":["opticaldisk", "optical_disk", "cd"], "\ud83d\udcc0":["dvd"], "\ud83c\udfa5":["moviecamera", "movie_camera"], "\ud83c\udf9e\ufe0f":["filmframes", "film_frames"], 
  "\ud83d\udcfd\ufe0f":["filmprojector", "film_projector"], "\ud83c\udfac":["clapperboard", "clapper_board", "clapper"], "\ud83d\udcfa":["television", "tv"], "\ud83d\udcf7":["camera"], "\ud83d\udcf8":["camerawithflash", "camera_with_flash"], "\ud83d\udcf9":["videocamera", "video_camera"], "\ud83d\udcfc":["videocassette", "vhs"], "\ud83d\udd0d":["magnifyingglassleft", "magnifying_glass_left", "mag"], "\ud83d\udd0e":["magnifyingglassright", "magnifying_glass_right", "magright", "mag_right"], "\ud83d\udd6f\ufe0f":["candle"], 
  "\ud83d\udca1":["lightbulb", "light_bulb", "bulb"], "\ud83d\udd26":["flashlight"], "\ud83c\udfee":["redpaperlantern", "red_paper_lantern", "izakayalantern", "izakaya_lantern"], "\ud83d\udcd4":["notebookwithdecorativecover", "notebook_with_decorative_cover"], "\ud83d\udcd5":["closedbook", "closed_book"], "\ud83d\udcd6":["openbook", "open_book", "book"], "\ud83d\udcd7":["greenbook", "green_book"], "\ud83d\udcd8":["bluebook", "blue_book"], "\ud83d\udcd9":["orangebook", "orange_book"], "\ud83d\udcda":["books"], 
  "\ud83d\udcd3":["notebook"], "\ud83d\udcd2":["ledger"], "\ud83d\udcc3":["pagewithcurl", "page_with_curl"], "\ud83d\udcdc":["scroll"], "\ud83d\udcc4":["pagefacingup", "page_facing_up"], "\ud83d\udcf0":["newspaper"], "\ud83d\uddde\ufe0f":["rolledupnewspaper", "rolled_up_newspaper"], "\ud83d\udcd1":["bookmarktabs", "bookmark_tabs"], "\ud83d\udd16":["bookmark"], "\ud83c\udff7\ufe0f":["label"], "\ud83d\udcb0":["moneybag", "money_bag"], "\ud83d\udcb4":["yenbanknote", "yen_banknote", "yen"], "\ud83d\udcb5":["dollarbanknote", 
  "dollar_banknote", "dollar"], "\ud83d\udcb6":["eurobanknote", "euro_banknote", "euro"], "\ud83d\udcb7":["poundbanknote", "pound_banknote", "pound"], "\ud83d\udcb8":["moneywithwings", "money_with_wings"], "\ud83d\udcb3":["creditcard", "credit_card"], "\ud83d\udcb9":["chartincreasingwithyen", "chart_increasing_with_yen", "chart"], "\ud83d\udcb1":["currencyexchange", "currency_exchange"], "\ud83d\udcb2":["heavydollarsign", "heavy_dollar_sign"], "\u2709\ufe0f":["envelope", "email"], "\ud83d\udce7":["e-mail"], 
  "\ud83d\udce8":["incomingenvelope", "incoming_envelope"], "\ud83d\udce9":["envelopewitharrow", "envelope_with_arrow"], "\ud83d\udce4":["outboxtray", "outbox_tray"], "\ud83d\udce5":["inboxtray", "inbox_tray"], "\ud83d\udce6":["package"], "\ud83d\udceb":["mailbox"], "\ud83d\udcea":["mailboxclosed", "mailbox_closed"], "\ud83d\udcec":["mailboxwithmail", "mailbox_with_mail"], "\ud83d\udced":["mailboxwithnomail", "mailbox_with_no_mail"], "\ud83d\udcee":["postbox"], "\ud83d\uddf3\ufe0f":["ballotboxwithballot", 
  "ballot_box_with_ballot", "ballotbox", "ballot_box"], "\u270f\ufe0f":["pencil2"], "\u2712\ufe0f":["blacknib", "black_nib"], "\ud83d\udd8b\ufe0f":["fountainpen", "fountain_pen", "lowerleftfountainpen", "lower_left_fountain_pen"], "\ud83d\udd8a\ufe0f":["pen", "lowerleftballpointpen", "lower_left_ballpoint_pen"], "\ud83d\udd8c\ufe0f":["paintbrush", "lowerleftpaintbrush", "lower_left_paintbrush"], "\ud83d\udd8d\ufe0f":["crayon", "lowerleftcrayon", "lower_left_crayon"], "\ud83d\udcdd":["memo", "pencil"], 
  "\ud83d\udcbc":["briefcase"], "\ud83d\udcc1":["filefolder", "file_folder"], "\ud83d\udcc2":["openfilefolder", "open_file_folder"], "\ud83d\uddc2\ufe0f":["cardindexdividers", "card_index_dividers"], "\ud83d\udcc5":["calendardate", "calendar_date", "date"], "\ud83d\udcc6":["calendar", "tearoffcalendar", "tear_off_calendar"], "\ud83d\uddd2\ufe0f":["spiralnotepad", "spiral_notepad", "spiral_note_pad"], "\ud83d\uddd3\ufe0f":["spiralcalendar", "spiral_calendar", "spiralcalendarpad", "spiral_calendar_pad"], 
  "\ud83d\udcc7":["cardindex", "card_index"], "\ud83d\udcc8":["chartincreasing", "chart_increasing", "chartwithupwardstrend", "chart_with_upwards_trend"], "\ud83d\udcc9":["chartdecreasing", "chart_decreasing", "chartwithdownwardstrend", "chart_with_downwards_trend"], "\ud83d\udcca":["barchart", "bar_chart"], "\ud83d\udccb":["clipboard"], "\ud83d\udccc":["pushpin"], "\ud83d\udccd":["roundpushpin", "round_pushpin"], "\ud83d\udcce":["paperclip"], "\ud83d\udd87\ufe0f":["linkedpaperclips", "linked_paperclips"], 
  "\ud83d\udccf":["straightruler", "straight_ruler"], "\ud83d\udcd0":["triangularruler", "triangular_ruler"], "\u2702\ufe0f":["scissors"], "\ud83d\uddc3\ufe0f":["cardfilebox", "card_file_box"], "\ud83d\uddc4\ufe0f":["filecabinet", "file_cabinet"], "\ud83d\uddd1\ufe0f":["wastebasket"], "\ud83d\udd12":["locked", "lock"], "\ud83d\udd13":["unlocked", "unlock"], "\ud83d\udd0f":["lockedwithpen", "locked_with_pen", "lockwithinkpen", "lock_with_ink_pen"], "\ud83d\udd10":["lockedwithkey", "locked_with_key", 
  "closedlockwithkey", "closed_lock_with_key"], "\ud83d\udd11":["key"], "\ud83d\udddd\ufe0f":["oldkey", "old_key"], "\ud83d\udd28":["hammer"], "\u26cf\ufe0f":["pick"], "\u2692\ufe0f":["hammerandpick", "hammer_and_pick"], "\ud83d\udee0\ufe0f":["hammerandwrench", "hammer_and_wrench"], "\ud83d\udde1\ufe0f":["dagger", "dagger_knife"], "\u2694\ufe0f":["crossedswords", "crossed_swords"], "\ud83d\udd2b":["pistol", "gun"], "\ud83c\udff9":["bowandarrow", "bow_and_arrow"], "\ud83d\udee1\ufe0f":["shield"], 
  "\ud83d\udd27":["wrench"], "\ud83d\udd29":["nutandbolt", "nut_and_bolt"], "\u2699\ufe0f":["gear"], "\ud83d\udddc\ufe0f":["clamp", "compression"], "\u2696\ufe0f":["balancescale", "balance_scale", "scales"], "\ud83d\udd17":["link"], "\u26d3\ufe0f":["chains"], "\u2697\ufe0f":["alembic"], "\ud83d\udd2c":["microscope"], "\ud83d\udd2d":["telescope"], "\ud83d\udce1":["satelliteantenna", "satellite_antenna"], "\ud83d\udc89":["syringe"], "\ud83d\udc8a":["pill"], "\ud83d\udeaa":["door"], "\ud83d\udecf\ufe0f":["bed"], 
  "\ud83d\udecb\ufe0f":["couchandlamp", "couch_and_lamp"], "\ud83d\udebd":["toilet"], "\ud83d\udebf":["shower"], "\ud83d\udec1":["bathtub"], "\ud83d\uded2":["shoppingcart", "shopping_cart", "shoppingtrolley", "shopping_trolley"], "\ud83d\udeac":["cigarette", "smoking"], "\u26b0\ufe0f":["coffin"], "\u26b1\ufe0f":["funeralurn", "funeral_urn"], "\ud83d\uddff":["moai", "moyai"], "\ud83c\udfe7":["atm"], "\ud83d\udeae":["litterinbin", "litter_in_bin", "putlitterinitsplace", "put_litter_in_its_place"], 
  "\ud83d\udeb0":["potablewater", "potable_water"], "\u267f":["wheelchair", "wheelchair_symbol"], "\ud83d\udeb9":["mens"], "\ud83d\udeba":["womens"], "\ud83d\udebb":["restroom"], "\ud83d\udebc":["babysymbol", "baby_symbol"], "\ud83d\udebe":["watercloset", "water_closet", "wc"], "\ud83d\udec2":["passportcontrol", "passport_control"], "\ud83d\udec3":["customs"], "\ud83d\udec4":["baggageclaim", "baggage_claim"], "\ud83d\udec5":["leftluggage", "left_luggage"], "\u26a0\ufe0f":["warning"], "\ud83d\udeb8":["childrencrossing", 
  "children_crossing"], "\u26d4":["noentry", "no_entry"], "\ud83d\udeab":["prohibited", "noentrysign", "no_entry_sign"], "\ud83d\udeb3":["nobicycles", "no_bicycles"], "\ud83d\udead":["nosmoking", "no_smoking"], "\ud83d\udeaf":["nolittering", "no_littering", "donotlitter", "do_not_litter"], "\ud83d\udeb1":["nonpotablewater", "non_potable_water", "non-potable_water"], "\ud83d\udeb7":["nopedestrians", "no_pedestrians"], "\ud83d\udcf5":["nomobilephones", "no_mobile_phones"], "\ud83d\udd1e":["nooneundereighteen", 
  "no_one_under_eighteen", "underage"], "\u2622\ufe0f":["radioactive", "radioactivesign", "radioactive_sign"], "\u2623\ufe0f":["biohazard", "biohazardsign", "biohazard_sign"], "\u2b06\ufe0f":["uparrow", "up_arrow", "arrowup", "arrow_up"], "\u2197\ufe0f":["uprightarrow", "up_right_arrow", "arrowupperright", "arrow_upper_right"], "\u27a1\ufe0f":["rightarrow", "right_arrow", "arrowright", "arrow_right"], "\u2198\ufe0f":["downrightarrow", "down_right_arrow", "arrowlowerright", "arrow_lower_right"], "\u2b07\ufe0f":["downarrow", 
  "down_arrow", "arrowdown", "arrow_down"], "\u2199\ufe0f":["downleftarrow", "down_left_arrow", "arrowlowerleft", "arrow_lower_left"], "\u2b05\ufe0f":["leftarrow", "left_arrow", "arrowleft", "arrow_left"], "\u2196\ufe0f":["upleftarrow", "up_left_arrow", "arrowupperleft", "arrow_upper_left"], "\u2195\ufe0f":["updownarrow", "up_down_arrow", "arrowupdown", "arrow_up_down"], "\u2194\ufe0f":["leftrightarrow", "left_right_arrow"], "\u21a9\ufe0f":["rightarrowcurvingleft", "right_arrow_curving_left", "leftwardsarrowwithhook", 
  "leftwards_arrow_with_hook"], "\u21aa\ufe0f":["leftarrowcurvingright", "left_arrow_curving_right", "arrowrighthook", "arrow_right_hook"], "\u2934\ufe0f":["rightarrowcurvingup", "right_arrow_curving_up", "arrowheadingup", "arrow_heading_up"], "\u2935\ufe0f":["rightarrowcurvingdown", "right_arrow_curving_down", "arrowheadingdown", "arrow_heading_down"], "\ud83d\udd03":["clockwiseverticalarrows", "clockwise_vertical_arrows", "arrowsclockwise", "arrows_clockwise"], "\ud83d\udd04":["counterclockwisearrows", 
  "counterclockwise_arrows", "arrowscounterclockwise", "arrows_counterclockwise"], "\ud83d\udd19":["backarrow", "back_arrow", "back"], "\ud83d\udd1a":["endarrow", "end_arrow", "end"], "\ud83d\udd1b":["onarrow", "on_arrow", "on"], "\ud83d\udd1c":["soonarrow", "soon_arrow", "soon"], "\ud83d\udd1d":["toparrow", "top_arrow", "top"], "\ud83d\uded0":["placeofworship", "place_of_worship"], "\u269b\ufe0f":["atom", "atomsymbol", "atom_symbol"], "\ud83d\udd49\ufe0f":["om", "omsymbol", "om_symbol"], "\u2721\ufe0f":["starofdavid", 
  "star_of_david"], "\u2638\ufe0f":["wheelofdharma", "wheel_of_dharma"], "\u262f\ufe0f":["yinyang", "yin_yang"], "\u271d\ufe0f":["latincross", "latin_cross"], "\u2626\ufe0f":["orthodoxcross", "orthodox_cross"], "\u262a\ufe0f":["starandcrescent", "star_and_crescent"], "\u262e\ufe0f":["peace", "peacesymbol", "peace_symbol"], "\ud83d\udd4e":["menorah", "menorahwithninebranches", "menorah_with_nine_branches"], "\ud83d\udd2f":["sixpointedstar", "six_pointed_star"], "\u2648":["aries"], "\u2649":["taurus"], 
  "\u264a":["gemini"], "\u264b":["cancer"], "\u264c":["leo"], "\u264d":["virgo"], "\u264e":["libra"], "\u264f":["scorpio", "scorpius"], "\u2650":["sagittarius"], "\u2651":["capricorn"], "\u2652":["aquarius"], "\u2653":["pisces"], "\u26ce":["ophiuchus"], "\ud83d\udd00":["shuffletracks", "shuffle_tracks", "shuffle", "twistedrightwardsarrows", "twisted_rightwards_arrows"], "\ud83d\udd01":["repeat"], "\ud83d\udd02":["repeatsingle", "repeat_single", "repeatone", "repeat_one"], "\u25b6\ufe0f":["play", 
  "arrowforward", "arrow_forward"], "\u23e9":["fastforward", "fast_forward"], "\u23ed\ufe0f":["nexttrack", "next_track", "next", "blackrightpointingdoubletrianglewithverticalbar", "black_right_pointing_double_triangle_with_vertical_bar"], "\u23ef\ufe0f":["playorpause", "play_or_pause", "playpause", "play_pause", "blackrightpointingtrianglewithdoubleverticalbar", "black_right_pointing_triangle_with_double_vertical_bar"], "\u25c0\ufe0f":["reverse", "arrowbackward", "arrow_backward"], "\u23ea":["fastreverse", 
  "fast_reverse", "rewind"], "\u23ee\ufe0f":["lasttrack", "last_track", "previous", "blackleftpointingdoubletrianglewithverticalbar", "black_left_pointing_double_triangle_with_vertical_bar"], "\ud83d\udd3c":["upwards", "arrowupsmall", "arrow_up_small"], "\u23eb":["fastup", "fast_up", "arrowdoubleup", "arrow_double_up"], "\ud83d\udd3d":["downwards", "arrowdownsmall", "arrow_down_small"], "\u23ec":["fastdown", "fast_down", "arrowdoubledown", "arrow_double_down"], "\u23f8\ufe0f":["pause", "doubleverticalbar", 
  "double_vertical_bar"], "\u23f9\ufe0f":["stop", "blacksquareforstop", "black_square_for_stop"], "\u23fa\ufe0f":["record", "blackcircleforrecord", "black_circle_for_record"], "\u23cf\ufe0f":["eject"], "\ud83c\udfa6":["cinema"], "\ud83d\udd05":["dim", "lowbrightness", "low_brightness"], "\ud83d\udd06":["bright", "highbrightness", "high_brightness"], "\ud83d\udcf6":["antennabars", "antenna_bars", "signalstrength", "signal_strength"], "\ud83d\udcf3":["vibrationmode", "vibration_mode"], "\ud83d\udcf4":["mobilephoneoff", 
  "mobile_phone_off"], "\u2640\ufe0f":["female", "femalesign", "female_sign"], "\u2642\ufe0f":["male", "malesign", "male_sign"], "\u2695\ufe0f":["medical", "health", "staffofaesculapius", "staff_of_aesculapius", "medicalsymbol", "medical_symbol"], "\u267b\ufe0f":["recycling", "recycle"], "\u269c\ufe0f":["fleurdelis", "fleur_de_lis"], "\ud83d\udd31":["trident"], "\ud83d\udcdb":["namebadge", "name_badge"], "\ud83d\udd30":["beginner"], "\u2b55":["heavylargecircle", "heavy_large_circle", "o"], "\u2705":["whitecheckmark", 
  "white_check_mark"], "\u2611\ufe0f":["ballotboxwithcheck", "ballot_box_with_check"], "\u2714\ufe0f":["heavycheckmark", "heavy_check_mark"], "\u2716\ufe0f":["heavymultiplicationx", "heavy_multiplication_x"], "\u274c":["crossmark", "cross_mark", "x"], "\u274e":["whitecrossmark", "white_cross_mark", "crossmarkbutton", "cross_mark_button", "negativesquaredcrossmark", "negative_squared_cross_mark"], "\u2795":["heavyplussign", "heavy_plus_sign"], "\u2796":["heavyminussign", "heavy_minus_sign"], "\u2797":["heavydivisionsign", 
  "heavy_division_sign"], "\u27b0":["curlyloop", "curly_loop"], "\u27bf":["doublecurlyloop", "double_curly_loop", "loop"], "\u303d\ufe0f":["partalternationmark", "part_alternation_mark"], "\u2733\ufe0f":["eightspokedasterisk", "eight_spoked_asterisk"], "\u2734\ufe0f":["eightpointedstar", "eight_pointed_star", "eightpointedblackstar", "eight_pointed_black_star"], "\u2747\ufe0f":["sparkle"], "\u203c\ufe0f":["doubleexclamationmark", "double_exclamation_mark", "bangbang"], "\u2049\ufe0f":["exclamationquestionmark", 
  "exclamation_question_mark", "interrobang"], "\u2753":["questionmark", "question_mark", "question"], "\u2754":["whitequestionmark", "white_question_mark", "greyquestion", "grey_question"], "\u2755":["whiteexclamationmark", "white_exclamation_mark", "greyexclamation", "grey_exclamation"], "\u2757":["exclamationmark", "exclamation_mark", "exclamation"], "\u3030\ufe0f":["wavydash", "wavy_dash"], "\u00a9\ufe0f":["copyright"], "\u00ae\ufe0f":["registered"], "\u2122\ufe0f":["trademark", "trade_mark", 
  "tm"], "#\ufe0f\u20e3":["keycaphash", "keycap_hash", "hash"], "*\ufe0f\u20e3":["keycapstar", "keycap_star", "keycapasterisk", "keycap_asterisk", "asterisk"], "0\ufe0f\u20e3":["keycapzero", "keycap_zero", "zero"], "1\ufe0f\u20e3":["keycapone", "keycap_one", "one"], "2\ufe0f\u20e3":["keycaptwo", "keycap_two", "two"], "3\ufe0f\u20e3":["keycapthree", "keycap_three", "three"], "4\ufe0f\u20e3":["keycapfour", "keycap_four", "four"], "5\ufe0f\u20e3":["keycapfive", "keycap_five", "five"], "6\ufe0f\u20e3":["keycapsix", 
  "keycap_six", "six"], "7\ufe0f\u20e3":["keycapseven", "keycap_seven", "seven"], "8\ufe0f\u20e3":["keycapeight", "keycap_eight", "eight"], "9\ufe0f\u20e3":["keycapnine", "keycap_nine", "nine"], "\ud83d\udd1f":["keycapten", "keycap_ten", "ten"], "\ud83d\udcaf":["100"], "\ud83d\udd20":["abcd_uppercase", "capital_abcd"], "\ud83d\udd21":["abcd"], "\ud83d\udd22":["1234"], "\ud83d\udd23":["inputsymbols", "input_symbols", "symbols"], "\ud83d\udd24":["abc"], "\ud83c\udd70\ufe0f":["bloodtypea", "bloodtype_a", 
  "a"], "\ud83c\udd8e":["bloodtypeab", "bloodtype_ab", "ab"], "\ud83c\udd71\ufe0f":["bloodtypeb", "bloodtype_b", "b"], "\ud83c\udd91":["cl"], "\ud83c\udd92":["cool"], "\ud83c\udd93":["free"], "\u2139\ufe0f":["i", "info", "informationsource", "information_source"], "\ud83c\udd94":["id", "identity"], "\u24c2\ufe0f":["m"], "\ud83c\udd95":["new"], "\ud83c\udd96":["ng"], "\ud83c\udd7e\ufe0f":["bloodtypeo", "bloodtype_o", "o2"], "\ud83c\udd97":["ok"], "\ud83c\udd7f\ufe0f":["parking"], "\ud83c\udd98":["sos"], 
  "\ud83c\udd99":["up"], "\ud83c\udd9a":["vs", "versus"], "\ud83c\ude01":["here", "koko"], "\ud83c\ude02\ufe0f":["servicecharge", "service_charge", "sa"], "\ud83c\ude37\ufe0f":["monthlyamount", "monthly_amount", "u6708"], "\ud83c\ude36":["notfreeofcharge", "not_free_of_charge", "u6709"], "\ud83c\ude2f":["reserved", "u6307"], "\ud83c\ude50":["bargain", "advantage", "ideograph_advantage"], "\ud83c\ude39":["discount", "u5272"], "\ud83c\ude1a":["freeofcharge", "free_of_charge", "u7121"], "\ud83c\ude32":["prohibited_jp", 
  "u7981"], "\ud83c\ude51":["acceptable", "accept"], "\ud83c\ude38":["application", "u7533"], "\ud83c\ude34":["passinggrade", "passing_grade", "u5408"], "\ud83c\ude33":["vacancy", "u7a7a"], "\u3297\ufe0f":["congratulations"], "\u3299\ufe0f":["secret"], "\ud83c\ude3a":["openforbusiness", "open_for_business", "u55b6"], "\ud83c\ude35":["novacancy", "no_vacancy", "u6e80"], "\u25aa\ufe0f":["blacksmallsquare", "black_small_square"], "\u25ab\ufe0f":["whitesmallsquare", "white_small_square"], "\u25fb\ufe0f":["whitemediumsquare", 
  "white_medium_square"], "\u25fc\ufe0f":["blackmediumsquare", "black_medium_square"], "\u25fd":["whitemediumsmallsquare", "white_medium_small_square"], "\u25fe":["blackmediumsmallsquare", "black_medium_small_square"], "\u2b1b":["blacklargesquare", "black_large_square"], "\u2b1c":["whitelargesquare", "white_large_square"], "\ud83d\udd36":["largeorangediamond", "large_orange_diamond"], "\ud83d\udd37":["largebluediamond", "large_blue_diamond"], "\ud83d\udd38":["smallorangediamond", "small_orange_diamond"], 
  "\ud83d\udd39":["smallbluediamond", "small_blue_diamond"], "\ud83d\udd3a":["smallredtriangle", "small_red_triangle"], "\ud83d\udd3b":["smallredtriangledown", "small_red_triangle_down"], "\ud83d\udca0":["diamondshapewithadotinside", "diamond_shape_with_a_dot_inside"], "\ud83d\udd18":["radiobutton", "radio_button"], "\ud83d\udd32":["blacksquarebutton", "black_square_button"], "\ud83d\udd33":["whitesquarebutton", "white_square_button"], "\u26aa":["whitecircle", "white_circle"], "\u26ab":["blackcircle", 
  "black_circle"], "\ud83d\udd34":["redcircle", "red_circle"], "\ud83d\udd35":["bluecircle", "blue_circle", "large_blue_circle"], "\ud83c\udfc1":["chequeredflag", "chequered_flag", "checkeredflag", "checkered_flag"], "\ud83d\udea9":["triangularflag", "triangular_flag", "triangularflagonpost", "triangular_flag_on_post", "redflag", "red_flag"], "\ud83c\udf8c":["crossedflags", "crossed_flags", "twoflags", "two_flags"], "\ud83c\udff4":["blackflag", "black_flag", "waving_black_flag"], "\ud83c\udff3\ufe0f":["whiteflag", 
  "white_flag", "waving_white_flag"], "\ud83c\udff3\ufe0f\u200d\ud83c\udf08":["pride", "rainbowflag", "rainbow_flag"], "\ud83c\udde6\ud83c\udde8":["ascensionisland", "ascension_island"], "\ud83c\udde6\ud83c\udde9":["flag-ad", "flag-and", "andorra"], "\ud83c\udde6\ud83c\uddea":["flag-ae", "flag-are", "unitedarabemirates", "united_arab_emirates"], "\ud83c\udde6\ud83c\uddeb":["flag-af", "flag-afg", "afghanistan"], "\ud83c\udde6\ud83c\uddec":["flag-ag", "flag-atg", "antiguabarbuda", "antigua_barbuda"], 
  "\ud83c\udde6\ud83c\uddee":["flag-ai", "flag-aia", "anguilla"], "\ud83c\udde6\ud83c\uddf1":["flag-al", "flag-alb", "albania"], "\ud83c\udde6\ud83c\uddf2":["flag-am", "flag-arm", "armenia"], "\ud83c\udde6\ud83c\uddf4":["flag-ao", "flag-ago", "angola"], "\ud83c\udde6\ud83c\uddf6":["flag-aq", "flag-ata", "antarctica"], "\ud83c\udde6\ud83c\uddf7":["flag-ar", "flag-arg", "argentina"], "\ud83c\udde6\ud83c\uddf8":["flag-as", "flag-asm", "americansamoa", "american_samoa"], "\ud83c\udde6\ud83c\uddf9":["flag-at", 
  "flag-aut", "austria"], "\ud83c\udde6\ud83c\uddfa":["flag-au", "flag-aus", "australia"], "\ud83c\udde6\ud83c\uddfc":["flag-aw", "flag-abw", "aruba"], "\ud83c\udde6\ud83c\uddfd":["flag-ax", "alandislands", "aland_islands"], "\ud83c\udde6\ud83c\uddff":["flag-az", "flag-aze", "azerbaijan"], "\ud83c\udde7\ud83c\udde6":["flag-ba", "flag-bih", "bosniaherzegovina", "bosnia_herzegovina"], "\ud83c\udde7\ud83c\udde7":["flag-bb", "flag-brb", "barbados"], "\ud83c\udde7\ud83c\udde9":["flag-bd", "flag-bgd", 
  "bangladesh"], "\ud83c\udde7\ud83c\uddea":["flag-be", "flag-bel", "belgium"], "\ud83c\udde7\ud83c\uddeb":["flag-bf", "flag-bfa", "burkinafaso", "burkina_faso"], "\ud83c\udde7\ud83c\uddec":["flag-bg", "flag-bgr", "bulgaria"], "\ud83c\udde7\ud83c\udded":["flag-bh", "flag-bhr", "bahrain"], "\ud83c\udde7\ud83c\uddee":["flag-bi", "flag-bdi", "burundi"], "\ud83c\udde7\ud83c\uddef":["flag-bj", "flag-ben", "benin"], "\ud83c\udde7\ud83c\uddf1":["flag-bl", "flag-blm", "stbarthelemy", "st_barthelemy"], "\ud83c\udde7\ud83c\uddf2":["flag-bm", 
  "flag-bmu", "bermuda"], "\ud83c\udde7\ud83c\uddf3":["flag-bn", "flag-brn", "brunei"], "\ud83c\udde7\ud83c\uddf4":["flag-bo", "flag-bol", "bolivia"], "\ud83c\udde7\ud83c\uddf6":["flag-bq", "flag-bes", "caribbeannetherlands", "caribbean_netherlands"], "\ud83c\udde7\ud83c\uddf7":["flag-br", "flag-bra", "brazil"], "\ud83c\udde7\ud83c\uddf8":["flag-bs", "flag-bhs", "bahamas"], "\ud83c\udde7\ud83c\uddf9":["flag-bt", "flag-btn", "bhutan"], "\ud83c\udde7\ud83c\uddfb":["flag-bv", "flag-bvt", "bouvetisland", 
  "bouvet_island"], "\ud83c\udde7\ud83c\uddfc":["flag-bw", "flag-bwa", "botswana"], "\ud83c\udde7\ud83c\uddfe":["flag-by", "flag-blr", "belarus"], "\ud83c\udde7\ud83c\uddff":["flag-bz", "flag-blz", "belize"], "\ud83c\udde8\ud83c\udde6":["flag-ca", "flag-can", "canada"], "\ud83c\udde8\ud83c\udde8":["flag-cc", "flag-cck", "cocoskeelingislands", "cocos_keeling_islands"], "\ud83c\udde8\ud83c\udde9":["flag-cd", "flag-cod"], "\ud83c\udde8\ud83c\uddeb":["flag-cf", "flag-caf", "centralafricanrepublic", "central_african_republic"], 
  "\ud83c\udde8\ud83c\uddec":["flag-cg", "flag-cog"], "\ud83c\udde8\ud83c\udded":["flag-ch", "flag-che", "switzerland"], "\ud83c\udde8\ud83c\uddee":["flag-ci", "flag-civ", "cotedivoire", "cote_divoire"], "\ud83c\udde8\ud83c\uddf0":["flag-ck", "flag-cok", "cookislands", "cook_islands"], "\ud83c\udde8\ud83c\uddf1":["flag-cl", "flag-chl", "chile"], "\ud83c\udde8\ud83c\uddf2":["flag-cm", "flag-cmr", "cameroon"], "\ud83c\udde8\ud83c\uddf3":["flag-cn", "flag-chn", "china"], "\ud83c\udde8\ud83c\uddf4":["flag-co", 
  "flag-col", "colombia"], "\ud83c\udde8\ud83c\uddf5":["clippertonisland", "clipperton_island"], "\ud83c\udde8\ud83c\uddf7":["flag-cr", "flag-cri", "costarica", "costa_rica"], "\ud83c\udde8\ud83c\uddfa":["flag-cu", "flag-cub", "cuba"], "\ud83c\udde8\ud83c\uddfb":["flag-cv", "flag-cpv", "capeverde", "cape_verde"], "\ud83c\udde8\ud83c\uddfc":["flag-cw", "flag-cuw", "curacao"], "\ud83c\udde8\ud83c\uddfd":["flag-cx", "flag-cxr", "christmasisland", "christmas_island"], "\ud83c\udde8\ud83c\uddfe":["flag-cy", 
  "flag-cyp", "cyprus"], "\ud83c\udde8\ud83c\uddff":["flag-cz", "flag-cze", "czechia"], "\ud83c\udde9\ud83c\uddea":["flag-de", "flag-deu", "germany"], "\ud83c\udde9\ud83c\uddec":["diegogarcia", "diego_garcia"], "\ud83c\udde9\ud83c\uddef":["flag-dj", "flag-dji", "djibouti"], "\ud83c\udde9\ud83c\uddf0":["flag-dk", "flag-dnk", "denmark"], "\ud83c\udde9\ud83c\uddf2":["flag-dm", "flag-dma", "dominica"], "\ud83c\udde9\ud83c\uddf4":["flag-do", "flag-dom", "dominicanrepublic", "dominican_republic"], "\ud83c\udde9\ud83c\uddff":["flag-dz", 
  "flag-dza", "algeria"], "\ud83c\uddea\ud83c\udde6":["ceutamelilla", "ceuta_melilla"], "\ud83c\uddea\ud83c\udde8":["flag-ec", "flag-ecu", "ecuador"], "\ud83c\uddea\ud83c\uddea":["flag-ee", "flag-est", "estonia"], "\ud83c\uddea\ud83c\uddec":["flag-eg", "flag-egy", "egypt"], "\ud83c\uddea\ud83c\udded":["flag-eh", "flag-esh", "westernsahara", "western_sahara"], "\ud83c\uddea\ud83c\uddf7":["flag-er", "flag-eri", "eritrea"], "\ud83c\uddea\ud83c\uddf8":["flag-es", "flag-esp", "spain"], "\ud83c\uddea\ud83c\uddf9":["flag-et", 
  "flag-eth", "ethiopia"], "\ud83c\uddea\ud83c\uddfa":["flag-eu", "europeanunion", "european_union"], "\ud83c\uddeb\ud83c\uddee":["flag-fi", "flag-fin", "finland"], "\ud83c\uddeb\ud83c\uddef":["flag-fj", "flag-fji", "fiji"], "\ud83c\uddeb\ud83c\uddf0":["flag-fk", "flag-flk", "falklandislands", "falkland_islands"], "\ud83c\uddeb\ud83c\uddf2":["flag-fm", "flag-fsm", "micronesia"], "\ud83c\uddeb\ud83c\uddf4":["flag-fo", "flag-fro", "faroeislands", "faroe_islands"], "\ud83c\uddeb\ud83c\uddf7":["flag-fr", 
  "flag-fra", "france"], "\ud83c\uddec\ud83c\udde6":["flag-ga", "flag-gab", "gabon"], "\ud83c\uddec\ud83c\udde7":["flag-gb", "flag-gbr", "unitedkingdom", "united_kingdom", "uk"], "\ud83c\uddec\ud83c\udde9":["flag-gd", "flag-grd", "grenada"], "\ud83c\uddec\ud83c\uddea":["flag-ge", "flag-geo", "georgia"], "\ud83c\uddec\ud83c\uddeb":["flag-gf", "flag-guf", "frenchguiana", "french_guiana"], "\ud83c\uddec\ud83c\uddec":["flag-gg", "flag-ggy", "guernsey"], "\ud83c\uddec\ud83c\udded":["flag-gh", "flag-gha", 
  "ghana"], "\ud83c\uddec\ud83c\uddee":["flag-gi", "flag-gib", "gibraltar"], "\ud83c\uddec\ud83c\uddf1":["flag-gl", "flag-grl", "greenland"], "\ud83c\uddec\ud83c\uddf2":["flag-gm", "flag-gmb", "gambia"], "\ud83c\uddec\ud83c\uddf3":["flag-gn", "flag-gin", "guinea"], "\ud83c\uddec\ud83c\uddf5":["flag-gp", "flag-glp", "guadeloupe"], "\ud83c\uddec\ud83c\uddf6":["flag-gq", "flag-gnq", "equatorialguinea", "equatorial_guinea"], "\ud83c\uddec\ud83c\uddf7":["flag-gr", "flag-grc", "greece"], "\ud83c\uddec\ud83c\uddf8":["flag-gs", 
  "flag-sgs", "southgeorgiasouthsandwichislands", "south_georgia_south_sandwich_islands"], "\ud83c\uddec\ud83c\uddf9":["flag-gt", "flag-gtm", "guatemala"], "\ud83c\uddec\ud83c\uddfa":["flag-gu", "flag-gum", "guam"], "\ud83c\uddec\ud83c\uddfc":["flag-gw", "flag-gnb", "guinea-bissau"], "\ud83c\uddec\ud83c\uddfe":["flag-gy", "flag-guy", "guyana"], "\ud83c\udded\ud83c\uddf0":["flag-hk", "flag-hkg", "hongkongsarchina", "hong_kong_sar_china"], "\ud83c\udded\ud83c\uddf2":["flag-hm", "flag-hmd", "heardmcdonaldislands", 
  "heard_mcdonald_islands"], "\ud83c\udded\ud83c\uddf3":["flag-hn", "flag-hnd", "honduras"], "\ud83c\udded\ud83c\uddf7":["flag-hr", "flag-hrv", "croatia"], "\ud83c\udded\ud83c\uddf9":["flag-ht", "flag-hti", "haiti"], "\ud83c\udded\ud83c\uddfa":["flag-hu", "flag-hun", "hungary"], "\ud83c\uddee\ud83c\udde8":["canaryislands", "canary_islands"], "\ud83c\uddee\ud83c\udde9":["flag-id", "flag-idn", "indonesia"], "\ud83c\uddee\ud83c\uddea":["flag-ie", "flag-irl", "ireland"], "\ud83c\uddee\ud83c\uddf1":["flag-il", 
  "flag-isr", "israel"], "\ud83c\uddee\ud83c\uddf2":["flag-im", "flag-imn", "isleofman", "isle_of_man"], "\ud83c\uddee\ud83c\uddf3":["flag-in", "flag-ind", "india"], "\ud83c\uddee\ud83c\uddf4":["flag-io", "flag-iot", "britishindianoceanterritory", "british_indian_ocean_territory"], "\ud83c\uddee\ud83c\uddf6":["flag-iq", "flag-irq", "iraq"], "\ud83c\uddee\ud83c\uddf7":["flag-ir", "flag-irn", "iran"], "\ud83c\uddee\ud83c\uddf8":["flag-is", "flag-isl", "iceland"], "\ud83c\uddee\ud83c\uddf9":["flag-it", 
  "flag-ita", "italy"], "\ud83c\uddef\ud83c\uddea":["flag-je", "flag-jey", "jersey"], "\ud83c\uddef\ud83c\uddf2":["flag-jm", "flag-jam", "jamaica"], "\ud83c\uddef\ud83c\uddf4":["flag-jo", "flag-jor", "jordan"], "\ud83c\uddef\ud83c\uddf5":["flag-jp", "flag-jpn", "jp"], "\ud83c\uddf0\ud83c\uddea":["flag-ke", "flag-ken", "kenya"], "\ud83c\uddf0\ud83c\uddec":["flag-kg", "flag-kgz", "kyrgyzstan"], "\ud83c\uddf0\ud83c\udded":["flag-kh", "flag-khm", "cambodia"], "\ud83c\uddf0\ud83c\uddee":["flag-ki", "flag-kir", 
  "kiribati"], "\ud83c\uddf0\ud83c\uddf2":["flag-km", "flag-com", "comoros"], "\ud83c\uddf0\ud83c\uddf3":["flag-kn", "flag-kna", "stkittsnevis", "st_kitts_nevis"], "\ud83c\uddf0\ud83c\uddf5":["flag-kp", "flag-prk", "northkorea", "north_korea"], "\ud83c\uddf0\ud83c\uddf7":["flag-kr", "flag-kor", "southkorea", "south_korea", "kr"], "\ud83c\uddf0\ud83c\uddfc":["flag-kw", "flag-kwt", "kuwait"], "\ud83c\uddf0\ud83c\uddfe":["flag-ky", "flag-cym", "caymanislands", "cayman_islands"], "\ud83c\uddf0\ud83c\uddff":["flag-kz", 
  "flag-kaz", "kazakhstan"], "\ud83c\uddf1\ud83c\udde6":["flag-la", "flag-lao", "laos"], "\ud83c\uddf1\ud83c\udde7":["flag-lb", "flag-lbn", "lebanon"], "\ud83c\uddf1\ud83c\udde8":["flag-lc", "flag-lca", "stlucia", "st_lucia"], "\ud83c\uddf1\ud83c\uddee":["flag-li", "flag-lie", "liechtenstein"], "\ud83c\uddf1\ud83c\uddf0":["flag-lk", "flag-lka", "srilanka", "sri_lanka"], "\ud83c\uddf1\ud83c\uddf7":["flag-lr", "flag-lbr", "liberia"], "\ud83c\uddf1\ud83c\uddf8":["flag-ls", "flag-lso", "lesotho"], "\ud83c\uddf1\ud83c\uddf9":["flag-lt", 
  "flag-ltu", "lithuania"], "\ud83c\uddf1\ud83c\uddfa":["flag-lu", "flag-lux", "luxembourg"], "\ud83c\uddf1\ud83c\uddfb":["flag-lv", "flag-lva", "latvia"], "\ud83c\uddf1\ud83c\uddfe":["flag-ly", "flag-lby", "libya"], "\ud83c\uddf2\ud83c\udde6":["flag-ma", "flag-mar", "morocco"], "\ud83c\uddf2\ud83c\udde8":["flag-mc", "flag-mco", "monaco"], "\ud83c\uddf2\ud83c\udde9":["flag-md", "flag-mda", "moldova"], "\ud83c\uddf2\ud83c\uddea":["flag-me", "flag-mne", "montenegro"], "\ud83c\uddf2\ud83c\uddeb":["flag-mf", 
  "flag-maf", "stmartin", "st_martin"], "\ud83c\uddf2\ud83c\uddec":["flag-mg", "flag-mdg", "madagascar"], "\ud83c\uddf2\ud83c\udded":["flag-mh", "flag-mhl", "marshallislands", "marshall_islands"], "\ud83c\uddf2\ud83c\uddf0":["flag-mk", "flag-mkd", "macedonia"], "\ud83c\uddf2\ud83c\uddf1":["flag-ml", "flag-mli", "mali"], "\ud83c\uddf2\ud83c\uddf2":["flag-mm", "flag-mmr", "myanmar"], "\ud83c\uddf2\ud83c\uddf3":["flag-mn", "flag-mng", "mongolia"], "\ud83c\uddf2\ud83c\uddf4":["flag-mo", "flag-mac", "macau"], 
  "\ud83c\uddf2\ud83c\uddf5":["flag-mp", "flag-mnp", "northernmarianaislands", "northern_mariana_islands"], "\ud83c\uddf2\ud83c\uddf6":["flag-mq", "flag-mtq", "martinique"], "\ud83c\uddf2\ud83c\uddf7":["flag-mr", "flag-mrt", "mauritania"], "\ud83c\uddf2\ud83c\uddf8":["flag-ms", "flag-msr", "montserrat"], "\ud83c\uddf2\ud83c\uddf9":["flag-mt", "flag-mlt", "malta"], "\ud83c\uddf2\ud83c\uddfa":["flag-mu", "flag-mus", "mauritius"], "\ud83c\uddf2\ud83c\uddfb":["flag-mv", "flag-mdv", "maldives"], "\ud83c\uddf2\ud83c\uddfc":["flag-mw", 
  "flag-mwi", "malawi"], "\ud83c\uddf2\ud83c\uddfd":["flag-mx", "flag-mex", "mexico"], "\ud83c\uddf2\ud83c\uddfe":["flag-my", "flag-mys", "malaysia"], "\ud83c\uddf2\ud83c\uddff":["flag-mz", "flag-moz", "mozambique"], "\ud83c\uddf3\ud83c\udde6":["flag-na", "flag-nam", "namibia"], "\ud83c\uddf3\ud83c\udde8":["flag-nc", "flag-ncl", "newcaledonia", "new_caledonia"], "\ud83c\uddf3\ud83c\uddea":["flag-ne", "flag-ner", "niger"], "\ud83c\uddf3\ud83c\uddeb":["flag-nf", "flag-nfk", "norfolkisland", "norfolk_island"], 
  "\ud83c\uddf3\ud83c\uddec":["flag-ng", "flag-nga", "nigeria"], "\ud83c\uddf3\ud83c\uddee":["flag-ni", "flag-nic", "nicaragua"], "\ud83c\uddf3\ud83c\uddf1":["flag-nl", "flag-nld", "netherlands"], "\ud83c\uddf3\ud83c\uddf4":["flag-no", "flag-nor", "norway"], "\ud83c\uddf3\ud83c\uddf5":["flag-np", "flag-npl", "nepal"], "\ud83c\uddf3\ud83c\uddf7":["flag-nr", "flag-nru", "nauru"], "\ud83c\uddf3\ud83c\uddfa":["flag-nu", "flag-niu", "niue"], "\ud83c\uddf3\ud83c\uddff":["flag-nz", "flag-nzl", "newzealand", 
  "new_zealand"], "\ud83c\uddf4\ud83c\uddf2":["flag-om", "flag-omn", "oman"], "\ud83c\uddf5\ud83c\udde6":["flag-pa", "flag-pan", "panama"], "\ud83c\uddf5\ud83c\uddea":["flag-pe", "flag-per", "peru"], "\ud83c\uddf5\ud83c\uddeb":["flag-pf", "flag-pyf", "frenchpolynesia", "french_polynesia"], "\ud83c\uddf5\ud83c\uddec":["flag-pg", "flag-png", "papuanewguinea", "papua_new_guinea"], "\ud83c\uddf5\ud83c\udded":["flag-ph", "flag-phl", "philippines"], "\ud83c\uddf5\ud83c\uddf0":["flag-pk", "flag-pak", "pakistan"], 
  "\ud83c\uddf5\ud83c\uddf1":["flag-pl", "flag-pol", "poland"], "\ud83c\uddf5\ud83c\uddf2":["flag-pm", "flag-spm", "stpierremiquelon", "st_pierre_miquelon"], "\ud83c\uddf5\ud83c\uddf3":["flag-pn", "flag-pcn", "pitcairnislands", "pitcairn_islands"], "\ud83c\uddf5\ud83c\uddf7":["flag-pr", "flag-pri", "puertorico", "puerto_rico"], "\ud83c\uddf5\ud83c\uddf8":["flag-ps", "flag-pse", "palestine"], "\ud83c\uddf5\ud83c\uddf9":["flag-pt", "flag-prt", "portugal"], "\ud83c\uddf5\ud83c\uddfc":["flag-pw", "flag-plw", 
  "palau"], "\ud83c\uddf5\ud83c\uddfe":["flag-py", "flag-pry", "paraguay"], "\ud83c\uddf6\ud83c\udde6":["flag-qa", "flag-qat", "qatar"], "\ud83c\uddf7\ud83c\uddea":["flag-re", "flag-reu", "r\u00e9union"], "\ud83c\uddf7\ud83c\uddf4":["flag-ro", "flag-rou", "romania"], "\ud83c\uddf7\ud83c\uddf8":["flag-rs", "flag-srb", "serbia"], "\ud83c\uddf7\ud83c\uddfa":["flag-ru", "flag-rus", "russia", "russianfederation"], "\ud83c\uddf7\ud83c\uddfc":["flag-rw", "flag-rwa", "rwanda"], "\ud83c\uddf8\ud83c\udde6":["flag-sa", 
  "flag-sau", "saudiarabia", "saudi_arabia"], "\ud83c\uddf8\ud83c\udde7":["flag-sb", "flag-slb", "solomonislands", "solomon_islands"], "\ud83c\uddf8\ud83c\udde8":["flag-sc", "flag-syc", "seychelles"], "\ud83c\uddf8\ud83c\udde9":["flag-sd", "flag-sdn", "sudan"], "\ud83c\uddf8\ud83c\uddea":["flag-se", "flag-swe", "sweden"], "\ud83c\uddf8\ud83c\uddec":["flag-sg", "flag-sgp", "singapore"], "\ud83c\uddf8\ud83c\udded":["flag-sh", "flag-shn", "sthelena", "st_helena"], "\ud83c\uddf8\ud83c\uddee":["flag-si", 
  "flag-svn", "slovenia"], "\ud83c\uddf8\ud83c\uddef":["flag-sj", "flag-sjm", "svalbardjanmayen", "svalbard_jan_mayen"], "\ud83c\uddf8\ud83c\uddf0":["flag-sk", "flag-svk", "slovakia"], "\ud83c\uddf8\ud83c\uddf1":["flag-sl", "flag-sle", "sierraleone", "sierra_leone"], "\ud83c\uddf8\ud83c\uddf2":["flag-sm", "flag-smr", "sanmarino", "san_marino"], "\ud83c\uddf8\ud83c\uddf3":["flag-sn", "flag-sen", "senegal"], "\ud83c\uddf8\ud83c\uddf4":["flag-so", "flag-som", "somalia"], "\ud83c\uddf8\ud83c\uddf7":["flag-sr", 
  "flag-sur", "suriname"], "\ud83c\uddf8\ud83c\uddf8":["flag-ss", "flag-ssd", "southsudan", "south_sudan"], "\ud83c\uddf8\ud83c\uddf9":["flag-st", "flag-stp", "saotomeprincipe", "sao_tome_principe"], "\ud83c\uddf8\ud83c\uddfb":["flag-sv", "flag-slv", "elsalvador", "el_salvador"], "\ud83c\uddf8\ud83c\uddfd":["flag-sx", "flag-sxm", "sintmaarten", "sint_maarten"], "\ud83c\uddf8\ud83c\uddfe":["flag-sy", "flag-syr", "syria"], "\ud83c\uddf8\ud83c\uddff":["flag-sz", "flag-swz", "swaziland"], "\ud83c\uddf9\ud83c\udde6":["tristandacunha", 
  "tristan_da_cunha"], "\ud83c\uddf9\ud83c\udde8":["flag-tc", "flag-tca", "turkscaicosislands", "turks_caicos_islands"], "\ud83c\uddf9\ud83c\udde9":["flag-td", "flag-tcd", "chad"], "\ud83c\uddf9\ud83c\uddeb":["flag-tf", "flag-atf", "frenchsouthernterritories", "french_southern_territories"], "\ud83c\uddf9\ud83c\uddec":["flag-tg", "flag-tgo", "togo"], "\ud83c\uddf9\ud83c\udded":["flag-th", "flag-tha", "thailand"], "\ud83c\uddf9\ud83c\uddef":["flag-tj", "flag-tjk", "tajikistan"], "\ud83c\uddf9\ud83c\uddf0":["flag-tk", 
  "flag-tkl", "tokelau"], "\ud83c\uddf9\ud83c\uddf1":["flag-tl", "flag-tls", "timor-leste"], "\ud83c\uddf9\ud83c\uddf2":["flag-tm", "flag-tkm", "turkmenistan"], "\ud83c\uddf9\ud83c\uddf3":["flag-tn", "flag-tun", "tunisia"], "\ud83c\uddf9\ud83c\uddf4":["flag-to", "flag-ton", "tonga"], "\ud83c\uddf9\ud83c\uddf7":["flag-tr", "flag-tur"], "\ud83c\uddf9\ud83c\uddf9":["flag-tt", "flag-tto", "trinidadtobago", "trinidad_tobago"], "\ud83c\uddf9\ud83c\uddfb":["flag-tv", "flag-tuv", "tuvalu"], "\ud83c\uddf9\ud83c\uddfc":["flag-tw", 
  "flag-twn", "taiwan"], "\ud83c\uddf9\ud83c\uddff":["flag-tz", "flag-tza", "tanzania"], "\ud83c\uddfa\ud83c\udde6":["flag-ua", "flag-ukr", "ukraine"], "\ud83c\uddfa\ud83c\uddec":["flag-ug", "flag-uga", "uganda"], "\ud83c\uddfa\ud83c\uddf2":["flag-um", "flag-umi"], "\ud83c\uddfa\ud83c\uddf3":["flag-un", "unitednations", "united_nations"], "\ud83c\uddfa\ud83c\uddf8":["flag-us", "flag-usa", "unitedstates", "united_states", "us"], "\ud83c\uddfa\ud83c\uddfe":["flag-uy", "flag-ury", "uruguay"], "\ud83c\uddfa\ud83c\uddff":["flag-uz", 
  "flag-uzb", "uzbekistan"], "\ud83c\uddfb\ud83c\udde6":["flag-va", "flag-vat", "vaticancity", "vatican_city"], "\ud83c\uddfb\ud83c\udde8":["flag-vc", "flag-vct", "stvincentgrenadines", "st_vincent_grenadines"], "\ud83c\uddfb\ud83c\uddea":["flag-ve", "flag-ven", "venezuela"], "\ud83c\uddfb\ud83c\uddec":["flag-vg", "flag-vgb", "britishvirginislands", "british_virgin_islands"], "\ud83c\uddfb\ud83c\uddee":["flag-vi", "flag-vir", "usvirginislands", "us_virgin_islands"], "\ud83c\uddfb\ud83c\uddf3":["flag-vn", 
  "flag-vnm", "vietnam"], "\ud83c\uddfb\ud83c\uddfa":["flag-vu", "flag-vut", "vanuatu"], "\ud83c\uddfc\ud83c\uddeb":["flag-wf", "flag-wlf", "wallisfutuna", "wallis_futuna"], "\ud83c\uddfc\ud83c\uddf8":["flag-ws", "flag-wsm", "samoa"], "\ud83c\uddfd\ud83c\uddf0":["flag-xk", "flag-xkx", "kosovo"], "\ud83c\uddfe\ud83c\uddea":["flag-ye", "flag-yem", "yemen"], "\ud83c\uddfe\ud83c\uddf9":["flag-yt", "flag-myt", "mayotte"], "\ud83c\uddff\ud83c\udde6":["flag-za", "flag-zaf", "southafrica", "south_africa"], 
  "\ud83c\uddff\ud83c\uddf2":["flag-zm", "flag-zmb", "zambia"], "\ud83c\uddff\ud83c\uddfc":["flag-zw", "flag-zwe", "zimbabwe"]};
  function dictionaryFromEmoticonList(list) {
    var dict = {};
    Object.keys(list).forEach(function(symbol) {
      var patterns = list[symbol];
      patterns.forEach(function(pattern) {
        if (typeof dict[pattern] !== "undefined") {
          log.warning("pattern collision for alias: " + pattern);
        }
        dict[pattern] = symbol;
      });
    });
    return dict;
  }
  util.emoticon.smileyAliasToSymbol = dictionaryFromEmoticonList(util.emoticon.smileySymbolToAliases);
  util.emoticon.emojiAliasToSymbol = dictionaryFromEmoticonList(util.emoticon.emojiSymbolToAliases);
  function concatPropertyArrays(arrayDict) {
    return Object.keys(arrayDict).reduce(function(acc, key) {
      return acc.concat(goog.isArray(arrayDict[key]) ? arrayDict[key] : []);
    }, []);
  }
  util.emoticon.allSmileyAliases = concatPropertyArrays(util.emoticon.smileySymbolToAliases);
  util.emoticon.allEmojiAliases = concatPropertyArrays(util.emoticon.emojiSymbolToAliases);
})();
goog.provide("uno.util.typebehind.emoji");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.defs");
goog.require("uno.util.emoticon");
goog.require("uno.util.string");
goog.require("uno.util.structure");
goog.require("uno.util.typebehind");
(function() {
  var util = uno.util;
  var emoji = uno.util.typebehind.emoji;
  var log = goog.debug.Logger.getLogger("uno.util.typebehind.emoji");
  emoji.name = "emoji";
  emoji.matchBeginningOfLine = false;
  emoji.suppressTriggerKey = false;
  emoji.regex = util.typebehind.compileTypebehindRegex("(?::(" + util.emoticon.allEmojiAliases.map(util.string.escapeRegexChars).join("|") + "):)", emoji.matchBeginningOfLine);
  emoji.contextReplaceable = function(range, keyCode) {
    return util.structure.itemAllowedInRange(uno.defs.structuretypes.EMOTICON, range);
  };
  emoji.insertReplacement = function(range, matches, editor) {
    var matchedAlias = matches[1];
    var symbol = util.emoticon.emojiAliasToSymbol[matchedAlias.toLowerCase()];
    if (symbol) {
      var newTextNode = goog.dom.createTextNode(symbol);
      range.replaceContentsWithNode(newTextNode);
      return newTextNode;
    } else {
      return range.getStartNode();
    }
  };
})();
goog.provide("uno.util.typebehind.hr");
goog.require("goog.debug.Logger");
goog.require("goog.events.KeyCodes");
goog.require("uno.defs");
goog.require("uno.util.structure");
goog.require("uno.util.typebehind");
goog.require("uno.util.hr");
(function() {
  var hr = uno.util.typebehind.hr;
  var log = goog.debug.Logger.getLogger("uno.util.typebehind.hr");
  var util = uno.util;
  var ENTER_KEY = goog.events.KeyCodes.ENTER;
  hr.name = "hr";
  hr.matchBeginningOfLine = true;
  hr.suppressTriggerKey = true;
  hr.regex = util.typebehind.compileTypebehindRegex("\\*{3,}|\\-{3,}|\\={3,}", hr.matchBeginningOfLine);
  hr.contextReplaceable = function(range, keyCode) {
    return keyCode === ENTER_KEY && util.structure.itemAllowedInRange(uno.defs.structuretypes.HR, range);
  };
  hr.insertReplacement = function(range, matches, editor) {
    range.replaceContentsWithNode(document.createTextNode(""));
    util.hr.insertHrAtRange(editor);
    return null;
  };
})();
goog.provide("uno.util.typebehind.ol");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.defs");
goog.require("uno.util.paragraph");
goog.require("uno.util.structure");
goog.require("uno.util.typebehind");
(function() {
  var ol = uno.util.typebehind.ol;
  var log = goog.debug.Logger.getLogger("uno.util.typebehind.ol");
  var util = uno.util;
  ol.name = "ol";
  ol.matchBeginningOfLine = true;
  ol.suppressTriggerKey = true;
  ol.regex = util.typebehind.compileTypebehindRegex("(\\d+)[\\.\\)]", ol.matchBeginningOfLine);
  ol.contextReplaceable = function(range) {
    return util.structure.itemAllowedInRange(uno.defs.structuretypes.TYPE_LIST, range);
  };
  ol.insertReplacement = function(range, matches, editor) {
    var matchedNumber = matches[1];
    range.removeContents();
    var p = util.paragraph.for(range.getStartNode());
    if (!util.paragraph.hasBr(p)) {
      util.paragraph.appendBr(p);
    }
    editor.execCommand("insertorderedlist");
    var startNumber = parseInt(matchedNumber, 10);
    var node = ed.getRange().getStartNode();
    var parentList = goog.dom.getAncestor(node, function(element) {
      return util.dom.isOl(element);
    }, true);
    if (parentList && startNumber > 1) {
      parentList.setAttribute("start", startNumber);
    }
    return null;
  };
})();
goog.provide("uno.util.typebehind.smiley");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.defs");
goog.require("uno.util.emoticon");
goog.require("uno.util.string");
goog.require("uno.util.structure");
goog.require("uno.util.typebehind");
(function() {
  var util = uno.util;
  var smiley = uno.util.typebehind.smiley;
  var log = goog.debug.Logger.getLogger("uno.util.typebehind.smiley");
  smiley.name = "smiley";
  smiley.matchBeginningOfLine = false;
  smiley.suppressTriggerKey = false;
  smiley.regex = util.typebehind.compileTypebehindRegex("(" + util.emoticon.allSmileyAliases.map(util.string.escapeRegexChars).join("|") + ")", smiley.matchBeginningOfLine, true);
  smiley.contextReplaceable = function(range, keyCode) {
    return util.structure.itemAllowedInRange(uno.defs.structuretypes.EMOTICON, range);
  };
  smiley.insertReplacement = function(range, matches, editor) {
    var matchedAlias = matches[1];
    var symbol = util.emoticon.smileyAliasToSymbol[matchedAlias];
    if (symbol) {
      var newTextNode = goog.dom.createTextNode(symbol);
      range.replaceContentsWithNode(newTextNode);
      return newTextNode;
    } else {
      return range.getStartNode();
    }
  };
})();
goog.provide("uno.util.typebehind.table");
goog.require("goog.debug.Logger");
goog.require("uno.defs");
goog.require("uno.util.structure");
goog.require("uno.util.typebehind");
(function() {
  var table = uno.util.typebehind.table;
  var log = goog.debug.Logger.getLogger("uno.util.typebehind.table");
  var util = uno.util;
  table.name = "table";
  table.matchBeginningOfLine = true;
  table.suppressTriggerKey = true;
  table.regex = util.typebehind.compileTypebehindRegex("((?:\\[\\s*\\]){2,})(?:x(\\d+))?", table.matchBeginningOfLine);
  table.contextReplaceable = function(range) {
    return util.structure.itemAllowedInRange(uno.defs.structuretypes.TABLE, range);
  };
  table.insertReplacement = function(range, matches, editor) {
    var colText = matches[1];
    var rowText = matches[2];
    range.removeContents();
    editor.execCommand("inserttable", {columns:colText ? colText.split("][").length : 1, rows:rowText ? parseInt(rowText, 10) : 1});
    return null;
  };
})();
goog.provide("uno.util.typebehind.todo");
goog.require("goog.debug.Logger");
goog.require("uno.defs");
goog.require("uno.util.dom");
goog.require("uno.util.paragraph");
goog.require("uno.util.todo");
goog.require("uno.util.structure");
goog.require("uno.util.typebehind");
(function() {
  var todo = uno.util.typebehind.todo;
  var log = goog.debug.Logger.getLogger("uno.util.typebehind.todo");
  var util = uno.util;
  todo.name = "todo";
  todo.matchBeginningOfLine = false;
  todo.suppressTriggerKey = true;
  todo.regex = util.typebehind.compileTypebehindRegex("\\[[\\sx]?\\]", todo.matchBeginningOfLine);
  todo.contextReplaceable = function(range) {
    return util.structure.itemAllowedInRange(uno.defs.structuretypes.TODO, range);
  };
  todo.insertReplacement = function(range, matches, editor) {
    var matchedText = matches[0];
    var checked = matchedText.toLowerCase().indexOf("x") > 0;
    var newTodo = util.todo.create(checked);
    range.removeContents();
    var p = util.paragraph.for(range.getStartNode());
    if (util.dom.isEmptyContent(p) && !util.paragraph.hasBr(p)) {
      util.paragraph.appendBr(p);
    }
    range.insertNode(newTodo);
    return newTodo;
  };
})();
goog.provide("uno.util.typebehind.ul");
goog.require("goog.debug.Logger");
goog.require("uno.defs");
goog.require("uno.util.paragraph");
goog.require("uno.util.structure");
goog.require("uno.util.typebehind");
(function() {
  var ul = uno.util.typebehind.ul;
  var log = goog.debug.Logger.getLogger("uno.util.typebehind.ul");
  var util = uno.util;
  ul.name = "ul";
  ul.matchBeginningOfLine = true;
  ul.suppressTriggerKey = true;
  ul.regex = util.typebehind.compileTypebehindRegex("\\*|\\-", ul.matchBeginningOfLine);
  ul.contextReplaceable = function(range) {
    return util.structure.itemAllowedInRange(uno.defs.structuretypes.TYPE_LIST, range);
  };
  ul.insertReplacement = function(range, matches, editor) {
    var matchedNumber = matches[1];
    range.removeContents();
    var p = util.paragraph.for(range.getStartNode());
    if (!util.paragraph.hasBr(p)) {
      util.paragraph.appendBr(p);
    }
    editor.execCommand("insertunorderedlist");
    return null;
  };
})();
goog.provide("uno.util.typebehind.url");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.defs");
goog.require("uno.util.codeblock");
goog.require("uno.util.dom");
goog.require("uno.util.typebehind");
(function() {
  var url = uno.util.typebehind.url;
  var log = goog.debug.Logger.getLogger("uno.util.typebehind.url");
  var util = uno.util;
  url.name = "url";
  url.matchBeginningOfLine = false;
  url.suppressTriggerKey = false;
  url.regex = util.typebehind.compileTypebehindRegex(uno.defs.regex.SIMPLE_URL, url.matchBeginningOfLine);
  url.contextReplaceable = function(range, keyCode) {
    return !util.codeblock.for(range.getEndNode());
  };
  url.insertReplacement = function(range, matches, editor) {
    var matchedText = matches[0];
    var href = /^[a-zA-Z]+:\/\//.test(matchedText) ? matchedText : "http://" + matchedText;
    var newNode = goog.dom.createDom("a", {href:href});
    newNode.textContent = matchedText;
    range.replaceContentsWithNode(newNode);
    return newNode;
  };
})();
goog.provide("uno.listeners.TypeBehindListener");
goog.require("goog.debug.Logger");
goog.require("goog.events.KeyCodes");
goog.require("uno.BasePlugin");
goog.require("uno.util.typebehind");
goog.require("uno.util.typebehind.code");
goog.require("uno.util.typebehind.email");
goog.require("uno.util.typebehind.emoji");
goog.require("uno.util.typebehind.hr");
goog.require("uno.util.typebehind.ol");
goog.require("uno.util.typebehind.phone");
goog.require("uno.util.typebehind.smiley");
goog.require("uno.util.typebehind.table");
goog.require("uno.util.typebehind.textlink");
goog.require("uno.util.typebehind.todo");
goog.require("uno.util.typebehind.ul");
goog.require("uno.util.typebehind.url");
(function() {
  var log = goog.debug.Logger.getLogger("uno.listeners.TypeBehindListener");
  var SPACE_KEY = goog.events.KeyCodes.SPACE;
  var TAB_KEY = goog.events.KeyCodes.TAB;
  var ENTER_KEY = goog.events.KeyCodes.ENTER;
  var BACKSPACE_KEY = goog.events.KeyCodes.BACKSPACE;
  var util = uno.util;
  var TypeBehindListener = uno.listeners.TypeBehindListener = function() {
    uno.BasePlugin.call(this, log.getName());
    this.implementations = [];
    this.recentUndoCommand = false;
    this.recentExecTypebehind = false;
  };
  goog.inherits(TypeBehindListener, uno.BasePlugin);
  TypeBehindListener.IMPLEMENTATIONS = {code:uno.util.typebehind.code, email:uno.util.typebehind.email, emoticon:[uno.util.typebehind.emoji, uno.util.typebehind.smiley], horizontalrule:uno.util.typebehind.hr, list:[uno.util.typebehind.ol, uno.util.typebehind.ul], phone:uno.util.typebehind.phone, table:uno.util.typebehind.table, todo:uno.util.typebehind.todo, url:[uno.util.typebehind.url, uno.util.typebehind.textlink]};
  TypeBehindListener.prototype.registerFieldObject = function(fieldObject) {
    var me = this;
    uno.BasePlugin.prototype.registerFieldObject.call(this, fieldObject);
    Object.keys(TypeBehindListener.IMPLEMENTATIONS).forEach(function(name) {
      if (fieldObject.config.typebehind[name]) {
        if (goog.isArray(TypeBehindListener.IMPLEMENTATIONS[name])) {
          TypeBehindListener.IMPLEMENTATIONS[name].forEach(function(implementation) {
            me.implementations.push(implementation);
          });
        } else {
          me.implementations.push(TypeBehindListener.IMPLEMENTATIONS[name]);
        }
      }
    });
  };
  TypeBehindListener.prototype.handleAfterExecCommand = function(event) {
    this.recentUndoCommand = event.command === "undo";
  };
  TypeBehindListener.prototype.handleKeyDown = function(event) {
    var typebehindExecuted = false;
    var typebehindUndone = false;
    var featureEnabled = this.editor.context.typebehind.undo;
    var keyCode = event.keyCode;
    if (!this.recentUndoCommand && (keyCode === SPACE_KEY || keyCode === TAB_KEY || keyCode === ENTER_KEY)) {
      typebehindExecuted = util.typebehind.tryReplacements(event, this.implementations, this.editor);
      if (typebehindExecuted) {
        this.editor.dispatchChange();
      }
    } else {
      if (featureEnabled && this.recentExecTypebehind && keyCode === BACKSPACE_KEY) {
        log.info("Undoing typebehind via backspace key");
        event.preventDefault();
        this.editor.execCommand("undo");
        typebehindUndone = true;
      }
    }
    this.recentUndoCommand = typebehindUndone;
    this.recentExecTypebehind = typebehindExecuted;
    return typebehindExecuted || typebehindUndone;
  };
})();
goog.setTestOnly("goog.testing.stacktrace");
goog.provide("goog.testing.stacktrace");
goog.provide("goog.testing.stacktrace.Frame");
goog.testing.stacktrace.Frame = function(context, name, alias, path) {
  this.context_ = context;
  this.name_ = name;
  this.alias_ = alias;
  this.path_ = path;
};
goog.testing.stacktrace.Frame.prototype.getName = function() {
  return this.name_;
};
goog.testing.stacktrace.Frame.prototype.isAnonymous = function() {
  return !this.name_ || this.context_ == "[object Object]";
};
goog.testing.stacktrace.Frame.prototype.toCanonicalString = function() {
  var htmlEscape = goog.testing.stacktrace.htmlEscape_;
  var deobfuscate = goog.testing.stacktrace.maybeDeobfuscateFunctionName_;
  var canonical = [this.context_ ? htmlEscape(this.context_) + "." : "", this.name_ ? htmlEscape(deobfuscate(this.name_)) : "anonymous", this.alias_ ? " [as " + htmlEscape(deobfuscate(this.alias_)) + "]" : ""];
  if (this.path_) {
    canonical.push(" at ");
    canonical.push(htmlEscape(this.path_));
  }
  return canonical.join("");
};
goog.testing.stacktrace.MAX_DEPTH_ = 20;
goog.testing.stacktrace.MAX_FIREFOX_FRAMESTRING_LENGTH_ = 500000;
goog.testing.stacktrace.IDENTIFIER_PATTERN_ = "[a-zA-Z_$][\\w$]*";
goog.testing.stacktrace.V8_ALIAS_PATTERN_ = "(?: \\[as (" + goog.testing.stacktrace.IDENTIFIER_PATTERN_ + ")\\])?";
goog.testing.stacktrace.V8_CONTEXT_PATTERN_ = "(?:((?:new )?(?:\\[object Object\\]|" + goog.testing.stacktrace.IDENTIFIER_PATTERN_ + "(?:\\." + goog.testing.stacktrace.IDENTIFIER_PATTERN_ + ")*))\\.)?";
goog.testing.stacktrace.V8_FUNCTION_NAME_PATTERN_ = "(?:new )?(?:" + goog.testing.stacktrace.IDENTIFIER_PATTERN_ + "|<anonymous>)";
goog.testing.stacktrace.V8_FUNCTION_CALL_PATTERN_ = " " + goog.testing.stacktrace.V8_CONTEXT_PATTERN_ + "(" + goog.testing.stacktrace.V8_FUNCTION_NAME_PATTERN_ + ")" + goog.testing.stacktrace.V8_ALIAS_PATTERN_;
goog.testing.stacktrace.URL_PATTERN_ = "((?:http|https|file)://[^\\s)]+|javascript:.*)";
goog.testing.stacktrace.CHROME_URL_PATTERN_ = " (?:" + "\\(unknown source\\)" + "|" + "\\(native\\)" + "|" + "\\((.+)\\)|(.+))";
goog.testing.stacktrace.V8_STACK_FRAME_REGEXP_ = new RegExp("^    at" + "(?:" + goog.testing.stacktrace.V8_FUNCTION_CALL_PATTERN_ + ")?" + goog.testing.stacktrace.CHROME_URL_PATTERN_ + "$");
goog.testing.stacktrace.FIREFOX_FUNCTION_CALL_PATTERN_ = "(" + goog.testing.stacktrace.IDENTIFIER_PATTERN_ + "(?:\\." + goog.testing.stacktrace.IDENTIFIER_PATTERN_ + ")*" + ")?" + "(\\(.*\\))?@";
goog.testing.stacktrace.FIREFOX_STACK_FRAME_REGEXP_ = new RegExp("^" + goog.testing.stacktrace.FIREFOX_FUNCTION_CALL_PATTERN_ + "(?::0|" + goog.testing.stacktrace.URL_PATTERN_ + ")$");
goog.testing.stacktrace.OPERA_ANONYMOUS_FUNCTION_NAME_PATTERN_ = "<anonymous function(?:\\: " + "(?:(" + goog.testing.stacktrace.IDENTIFIER_PATTERN_ + "(?:\\." + goog.testing.stacktrace.IDENTIFIER_PATTERN_ + ")*)\\.)?" + "(" + goog.testing.stacktrace.IDENTIFIER_PATTERN_ + "))?>";
goog.testing.stacktrace.OPERA_FUNCTION_CALL_PATTERN_ = "(?:(?:(" + goog.testing.stacktrace.IDENTIFIER_PATTERN_ + ")|" + goog.testing.stacktrace.OPERA_ANONYMOUS_FUNCTION_NAME_PATTERN_ + ")(\\(.*\\)))?@";
goog.testing.stacktrace.OPERA_STACK_FRAME_REGEXP_ = new RegExp("^" + goog.testing.stacktrace.OPERA_FUNCTION_CALL_PATTERN_ + goog.testing.stacktrace.URL_PATTERN_ + "?$");
goog.testing.stacktrace.FUNCTION_SOURCE_REGEXP_ = new RegExp("^function (" + goog.testing.stacktrace.IDENTIFIER_PATTERN_ + ")");
goog.testing.stacktrace.IE_FUNCTION_CALL_PATTERN_ = "(" + goog.testing.stacktrace.IDENTIFIER_PATTERN_ + "(?:\\." + goog.testing.stacktrace.IDENTIFIER_PATTERN_ + ")*" + "(?:\\s+\\w+)*)";
goog.testing.stacktrace.IE_STACK_FRAME_REGEXP_ = new RegExp("^   at " + goog.testing.stacktrace.IE_FUNCTION_CALL_PATTERN_ + "\\s*\\(" + "(" + "eval code:[^)]*" + "|" + "Unknown script code:[^)]*" + "|" + goog.testing.stacktrace.URL_PATTERN_ + ")\\)?$");
goog.testing.stacktrace.followCallChain_ = function() {
  var frames = [];
  var fn = arguments.callee.caller;
  var depth = 0;
  while (fn && depth < goog.testing.stacktrace.MAX_DEPTH_) {
    var fnString = Function.prototype.toString.call(fn);
    var match = fnString.match(goog.testing.stacktrace.FUNCTION_SOURCE_REGEXP_);
    var functionName = match ? match[1] : "";
    frames.push(new goog.testing.stacktrace.Frame("", functionName, "", ""));
    try {
      fn = fn.caller;
    } catch (e) {
      break;
    }
    depth++;
  }
  return frames;
};
goog.testing.stacktrace.parseStackFrame_ = function(frameStr) {
  var m = frameStr.match(goog.testing.stacktrace.V8_STACK_FRAME_REGEXP_);
  if (m) {
    return new goog.testing.stacktrace.Frame(m[1] || "", m[2] || "", m[3] || "", m[4] || m[5] || m[6] || "");
  }
  if (frameStr.length > goog.testing.stacktrace.MAX_FIREFOX_FRAMESTRING_LENGTH_) {
    return null;
  }
  m = frameStr.match(goog.testing.stacktrace.FIREFOX_STACK_FRAME_REGEXP_);
  if (m) {
    return new goog.testing.stacktrace.Frame("", m[1] || "", "", m[3] || "");
  }
  m = frameStr.match(goog.testing.stacktrace.OPERA_STACK_FRAME_REGEXP_);
  if (m) {
    return new goog.testing.stacktrace.Frame(m[2] || "", m[1] || m[3] || "", "", m[5] || "");
  }
  m = frameStr.match(goog.testing.stacktrace.IE_STACK_FRAME_REGEXP_);
  if (m) {
    return new goog.testing.stacktrace.Frame("", m[1] || "", "", m[2] || "");
  }
  return null;
};
goog.testing.stacktrace.deobfuscateFunctionName_;
goog.testing.stacktrace.setDeobfuscateFunctionName = function(fn) {
  goog.testing.stacktrace.deobfuscateFunctionName_ = fn;
};
goog.testing.stacktrace.maybeDeobfuscateFunctionName_ = function(name) {
  return goog.testing.stacktrace.deobfuscateFunctionName_ ? goog.testing.stacktrace.deobfuscateFunctionName_(name) : name;
};
goog.testing.stacktrace.htmlEscape_ = function(text) {
  return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
};
goog.testing.stacktrace.framesToString_ = function(frames) {
  var lastIndex = frames.length - 1;
  while (frames[lastIndex] && frames[lastIndex].isAnonymous()) {
    lastIndex--;
  }
  var privateAssertIndex = -1;
  for (var i = 0; i < frames.length; i++) {
    if (frames[i] && frames[i].getName() == "_assert") {
      privateAssertIndex = i;
      break;
    }
  }
  var canonical = [];
  for (var i = privateAssertIndex + 1; i <= lastIndex; i++) {
    canonical.push("> ");
    if (frames[i]) {
      canonical.push(frames[i].toCanonicalString());
    } else {
      canonical.push("(unknown)");
    }
    canonical.push("\n");
  }
  return canonical.join("");
};
goog.testing.stacktrace.parse_ = function(stack) {
  var lines = stack.replace(/\s*$/, "").split("\n");
  var frames = [];
  for (var i = 0; i < lines.length; i++) {
    frames.push(goog.testing.stacktrace.parseStackFrame_(lines[i]));
  }
  return frames;
};
goog.testing.stacktrace.canonicalize = function(stack) {
  var frames = goog.testing.stacktrace.parse_(stack);
  return goog.testing.stacktrace.framesToString_(frames);
};
goog.testing.stacktrace.getNativeStack_ = function() {
  var tmpError = new Error;
  if (tmpError.stack) {
    return tmpError.stack;
  }
  try {
    null.x();
  } catch (e) {
    return e.stack;
  }
  return "";
};
goog.testing.stacktrace.get = function() {
  var stack = goog.testing.stacktrace.getNativeStack_();
  var frames;
  if (!stack) {
    frames = goog.testing.stacktrace.followCallChain_();
  } else {
    if (goog.isArray(stack)) {
      frames = goog.testing.stacktrace.callSitesToFrames_(stack);
    } else {
      frames = goog.testing.stacktrace.parse_(stack);
    }
  }
  return goog.testing.stacktrace.framesToString_(frames);
};
goog.testing.stacktrace.callSitesToFrames_ = function(stack) {
  var frames = [];
  for (var i = 0; i < stack.length; i++) {
    var callSite = stack[i];
    var functionName = callSite.getFunctionName() || "unknown";
    var fileName = callSite.getFileName();
    var path = fileName ? fileName + ":" + callSite.getLineNumber() + ":" + callSite.getColumnNumber() : "unknown";
    frames.push(new goog.testing.stacktrace.Frame("", functionName, "", path));
  }
  return frames;
};
goog.exportSymbol("setDeobfuscateFunctionName", goog.testing.stacktrace.setDeobfuscateFunctionName);
goog.provide("goog.testing.JsUnitException");
goog.setTestOnly();
goog.require("goog.testing.stacktrace");
goog.testing.JsUnitException = function(comment, opt_message) {
  this.isJsUnitException = true;
  this.message = (comment ? comment : "") + (comment && opt_message ? "\n" : "") + (opt_message ? opt_message : "");
  this.stackTrace = goog.testing.stacktrace.get();
  this.comment = comment || null;
  this.jsUnitMessage = opt_message || "";
  if (Error.captureStackTrace) {
    Error.captureStackTrace(this, goog.testing.JsUnitException);
  } else {
    this.stack = (new Error).stack || "";
  }
};
goog.inherits(goog.testing.JsUnitException, Error);
goog.testing.JsUnitException.prototype.toString = function() {
  return this.message;
};
goog.provide("goog.testing.asserts");
goog.setTestOnly();
goog.require("goog.testing.JsUnitException");
var DOUBLE_EQUALITY_PREDICATE = function(var1, var2) {
  return var1 == var2;
};
var JSUNIT_UNDEFINED_VALUE = void 0;
var TO_STRING_EQUALITY_PREDICATE = function(var1, var2) {
  return var1.toString() === var2.toString();
};
var PredicateFunctionType;
var PRIMITIVE_EQUALITY_PREDICATES = {"String":DOUBLE_EQUALITY_PREDICATE, "Number":DOUBLE_EQUALITY_PREDICATE, "Boolean":DOUBLE_EQUALITY_PREDICATE, "Date":function(date1, date2) {
  return date1.getTime() == date2.getTime();
}, "RegExp":TO_STRING_EQUALITY_PREDICATE, "Function":TO_STRING_EQUALITY_PREDICATE};
goog.testing.asserts.numberRoughEqualityPredicate_ = function(var1, var2, tolerance) {
  return Math.abs(var1 - var2) <= tolerance;
};
goog.testing.asserts.primitiveRoughEqualityPredicates_ = {"Number":goog.testing.asserts.numberRoughEqualityPredicate_};
var _trueTypeOf = function(something) {
  var result = typeof something;
  try {
    switch(result) {
      case "string":
        break;
      case "boolean":
        break;
      case "number":
        break;
      case "object":
        if (something == null) {
          result = "null";
          break;
        }
      case "function":
        switch(something.constructor) {
          case (new String("")).constructor:
            result = "String";
            break;
          case (new Boolean(true)).constructor:
            result = "Boolean";
            break;
          case (new Number(0)).constructor:
            result = "Number";
            break;
          case (new Array).constructor:
            result = "Array";
            break;
          case (new RegExp).constructor:
            result = "RegExp";
            break;
          case (new Date).constructor:
            result = "Date";
            break;
          case Function:
            result = "Function";
            break;
          default:
            var m = something.constructor.toString().match(/function\s*([^( ]+)\(/);
            if (m) {
              result = m[1];
            } else {
              break;
            }
        }break;
    }
  } catch (e) {
  } finally {
    result = result.substr(0, 1).toUpperCase() + result.substr(1);
  }
  return result;
};
var _displayStringForValue = function(aVar) {
  var result;
  try {
    result = "<" + String(aVar) + ">";
  } catch (ex) {
    result = "<toString failed: " + ex.message + ">";
  }
  if (!(aVar === null || aVar === JSUNIT_UNDEFINED_VALUE)) {
    result += " (" + _trueTypeOf(aVar) + ")";
  }
  return result;
};
var fail = function(failureMessage) {
  goog.testing.asserts.raiseException("Call to fail()", failureMessage);
};
var argumentsIncludeComments = function(expectedNumberOfNonCommentArgs, args) {
  return args.length == expectedNumberOfNonCommentArgs + 1;
};
var commentArg = function(expectedNumberOfNonCommentArgs, args) {
  if (argumentsIncludeComments(expectedNumberOfNonCommentArgs, args)) {
    return args[0];
  }
  return null;
};
var nonCommentArg = function(desiredNonCommentArgIndex, expectedNumberOfNonCommentArgs, args) {
  return argumentsIncludeComments(expectedNumberOfNonCommentArgs, args) ? args[desiredNonCommentArgIndex] : args[desiredNonCommentArgIndex - 1];
};
var _validateArguments = function(expectedNumberOfNonCommentArgs, args) {
  var valid = args.length == expectedNumberOfNonCommentArgs || args.length == expectedNumberOfNonCommentArgs + 1 && goog.isString(args[0]);
  _assert(null, valid, "Incorrect arguments passed to assert function");
};
var _getCurrentTestCase = function() {
  var testRunner = goog.global["G_testRunner"];
  return testRunner ? testRunner.testCase : null;
};
var _assert = function(comment, booleanValue, failureMessage) {
  if (!booleanValue) {
    goog.testing.asserts.raiseException(comment, failureMessage);
  }
};
goog.testing.asserts.getDefaultErrorMsg_ = function(expected, actual) {
  var msg = "Expected " + _displayStringForValue(expected) + " but was " + _displayStringForValue(actual);
  if (typeof expected == "string" && typeof actual == "string") {
    var limit = Math.min(expected.length, actual.length);
    var commonPrefix = 0;
    while (commonPrefix < limit && expected.charAt(commonPrefix) == actual.charAt(commonPrefix)) {
      commonPrefix++;
    }
    var commonSuffix = 0;
    while (commonSuffix < limit && expected.charAt(expected.length - commonSuffix - 1) == actual.charAt(actual.length - commonSuffix - 1)) {
      commonSuffix++;
    }
    if (commonPrefix + commonSuffix > limit) {
      commonSuffix = 0;
    }
    if (commonPrefix > 2 || commonSuffix > 2) {
      var printString = function(str) {
        var startIndex = Math.max(0, commonPrefix - 2);
        var endIndex = Math.min(str.length, str.length - (commonSuffix - 2));
        return (startIndex > 0 ? "..." : "") + str.substring(startIndex, endIndex) + (endIndex < str.length ? "..." : "");
      };
      msg += "\nDifference was at position " + commonPrefix + ". Expected [" + printString(expected) + "] vs. actual [" + printString(actual) + "]";
    }
  }
  return msg;
};
var assert = function(a, opt_b) {
  _validateArguments(1, arguments);
  var comment = commentArg(1, arguments);
  var booleanValue = nonCommentArg(1, 1, arguments);
  _assert(comment, goog.isBoolean(booleanValue), "Bad argument to assert(boolean)");
  _assert(comment, booleanValue, "Call to assert(boolean) with false");
};
var assertThrows = function(a, opt_b) {
  _validateArguments(1, arguments);
  var func = nonCommentArg(1, 1, arguments);
  var comment = commentArg(1, arguments);
  _assert(comment, typeof func == "function", "Argument passed to assertThrows is not a function");
  try {
    func();
  } catch (e) {
    if (e && goog.isString(e["stacktrace"]) && goog.isString(e["message"])) {
      var startIndex = e["message"].length - e["stacktrace"].length;
      if (e["message"].indexOf(e["stacktrace"], startIndex) == startIndex) {
        e["message"] = e["message"].substr(0, startIndex - 14);
      }
    }
    var testCase = _getCurrentTestCase();
    if (e && e["isJsUnitException"] && testCase && testCase.failOnUnreportedAsserts) {
      goog.testing.asserts.raiseException(comment, "Function passed to assertThrows caught a JsUnitException (usually " + "from an assert or call to fail()). If this is expected, use " + "assertThrowsJsUnitException instead.");
    }
    return e;
  }
  goog.testing.asserts.raiseException(comment, "No exception thrown from function passed to assertThrows");
};
var assertNotThrows = function(a, opt_b) {
  _validateArguments(1, arguments);
  var comment = commentArg(1, arguments);
  var func = nonCommentArg(1, 1, arguments);
  _assert(comment, typeof func == "function", "Argument passed to assertNotThrows is not a function");
  try {
    return func();
  } catch (e) {
    comment = comment ? comment + "\n" : "";
    comment += "A non expected exception was thrown from function passed to " + "assertNotThrows";
    var stackTrace = e["stack"] || e["stacktrace"] || e.toString();
    goog.testing.asserts.raiseException(comment, stackTrace);
  }
};
var assertThrowsJsUnitException = function(callback, opt_expectedMessage) {
  try {
    goog.testing.asserts.callWithoutLogging(callback);
  } catch (e) {
    var testCase = _getCurrentTestCase();
    if (testCase) {
      testCase.invalidateAssertionException(e);
    } else {
      goog.global.console.error("Failed to remove expected exception: no test case is installed.");
    }
    if (!e.isJsUnitException) {
      fail("Expected a JsUnitException");
    }
    if (typeof opt_expectedMessage != "undefined" && e.message != opt_expectedMessage) {
      fail("Expected message [" + opt_expectedMessage + "] but got [" + e.message + "]");
    }
    return e;
  }
  var msg = "Expected a failure";
  if (typeof opt_expectedMessage != "undefined") {
    msg += ": " + opt_expectedMessage;
  }
  throw new goog.testing.JsUnitException(msg);
};
var assertTrue = function(a, opt_b) {
  _validateArguments(1, arguments);
  var comment = commentArg(1, arguments);
  var booleanValue = nonCommentArg(1, 1, arguments);
  _assert(comment, goog.isBoolean(booleanValue), "Bad argument to assertTrue(boolean)");
  _assert(comment, booleanValue, "Call to assertTrue(boolean) with false");
};
var assertFalse = function(a, opt_b) {
  _validateArguments(1, arguments);
  var comment = commentArg(1, arguments);
  var booleanValue = nonCommentArg(1, 1, arguments);
  _assert(comment, goog.isBoolean(booleanValue), "Bad argument to assertFalse(boolean)");
  _assert(comment, !booleanValue, "Call to assertFalse(boolean) with true");
};
var assertEquals = function(a, b, opt_c) {
  _validateArguments(2, arguments);
  var var1 = nonCommentArg(1, 2, arguments);
  var var2 = nonCommentArg(2, 2, arguments);
  _assert(commentArg(2, arguments), var1 === var2, goog.testing.asserts.getDefaultErrorMsg_(var1, var2));
};
var assertNotEquals = function(a, b, opt_c) {
  _validateArguments(2, arguments);
  var var1 = nonCommentArg(1, 2, arguments);
  var var2 = nonCommentArg(2, 2, arguments);
  _assert(commentArg(2, arguments), var1 !== var2, "Expected not to be " + _displayStringForValue(var2));
};
var assertNull = function(a, opt_b) {
  _validateArguments(1, arguments);
  var aVar = nonCommentArg(1, 1, arguments);
  _assert(commentArg(1, arguments), aVar === null, goog.testing.asserts.getDefaultErrorMsg_(null, aVar));
};
var assertNotNull = function(a, opt_b) {
  _validateArguments(1, arguments);
  var aVar = nonCommentArg(1, 1, arguments);
  _assert(commentArg(1, arguments), aVar !== null, "Expected not to be " + _displayStringForValue(null));
};
var assertUndefined = function(a, opt_b) {
  _validateArguments(1, arguments);
  var aVar = nonCommentArg(1, 1, arguments);
  _assert(commentArg(1, arguments), aVar === JSUNIT_UNDEFINED_VALUE, goog.testing.asserts.getDefaultErrorMsg_(JSUNIT_UNDEFINED_VALUE, aVar));
};
var assertNotUndefined = function(a, opt_b) {
  _validateArguments(1, arguments);
  var aVar = nonCommentArg(1, 1, arguments);
  _assert(commentArg(1, arguments), aVar !== JSUNIT_UNDEFINED_VALUE, "Expected not to be " + _displayStringForValue(JSUNIT_UNDEFINED_VALUE));
};
var assertNotNullNorUndefined = function(a, opt_b) {
  _validateArguments(1, arguments);
  assertNotNull.apply(null, arguments);
  assertNotUndefined.apply(null, arguments);
};
var assertNonEmptyString = function(a, opt_b) {
  _validateArguments(1, arguments);
  var aVar = nonCommentArg(1, 1, arguments);
  _assert(commentArg(1, arguments), aVar !== JSUNIT_UNDEFINED_VALUE && aVar !== null && typeof aVar == "string" && aVar !== "", "Expected non-empty string but was " + _displayStringForValue(aVar));
};
var assertNaN = function(a, opt_b) {
  _validateArguments(1, arguments);
  var aVar = nonCommentArg(1, 1, arguments);
  _assert(commentArg(1, arguments), isNaN(aVar), "Expected NaN");
};
var assertNotNaN = function(a, opt_b) {
  _validateArguments(1, arguments);
  var aVar = nonCommentArg(1, 1, arguments);
  _assert(commentArg(1, arguments), !isNaN(aVar), "Expected not NaN");
};
goog.testing.asserts.callWithoutLogging = function(fn) {
  var testRunner = goog.global["G_testRunner"];
  var oldLogTestFailure = testRunner["logTestFailure"];
  try {
    testRunner["logTestFailure"] = undefined;
    fn();
  } finally {
    testRunner["logTestFailure"] = oldLogTestFailure;
  }
};
goog.testing.asserts.EQUALITY_PREDICATE_CANT_PROCESS = null;
goog.testing.asserts.EQUALITY_PREDICATE_VARS_ARE_EQUAL = "";
goog.testing.asserts.findDifferences = function(expected, actual, opt_equalityPredicate) {
  var failures = [];
  var seen1 = [];
  var seen2 = [];
  function innerAssertWithCycleCheck(var1, var2, path) {
    for (var i = 0; i < seen1.length; ++i) {
      var match1 = seen1[i] === var1;
      var match2 = seen2[i] === var2;
      if (match1 || match2) {
        if (!match1 || !match2) {
          failures.push("Asymmetric cycle detected at " + path);
        }
        return;
      }
    }
    seen1.push(var1);
    seen2.push(var2);
    innerAssertImplementation(var1, var2, path);
    seen1.pop();
    seen2.pop();
  }
  var equalityPredicate = opt_equalityPredicate || function(type, var1, var2) {
    var typedPredicate = PRIMITIVE_EQUALITY_PREDICATES[type];
    if (!typedPredicate) {
      return goog.testing.asserts.EQUALITY_PREDICATE_CANT_PROCESS;
    }
    var equal = typedPredicate(var1, var2);
    return equal ? goog.testing.asserts.EQUALITY_PREDICATE_VARS_ARE_EQUAL : goog.testing.asserts.getDefaultErrorMsg_(var1, var2);
  };
  function innerAssertImplementation(var1, var2, path) {
    if (var1 === var2) {
      return;
    }
    var typeOfVar1 = _trueTypeOf(var1);
    var typeOfVar2 = _trueTypeOf(var2);
    if (typeOfVar1 == typeOfVar2) {
      var isArray = typeOfVar1 == "Array";
      var errorMessage = equalityPredicate(typeOfVar1, var1, var2);
      if (errorMessage != goog.testing.asserts.EQUALITY_PREDICATE_CANT_PROCESS) {
        if (errorMessage != goog.testing.asserts.EQUALITY_PREDICATE_VARS_ARE_EQUAL) {
          failures.push(path + ": " + errorMessage);
        }
      } else {
        if (isArray && var1.length != var2.length) {
          failures.push(path + ": Expected " + var1.length + "-element array " + "but got a " + var2.length + "-element array");
        } else {
          if (typeOfVar1 == "String") {
            if (var1 != var2) {
              failures.push(path + ': Expected String "' + var1 + '" ' + 'but got "' + var2 + '"');
            }
          } else {
            var childPath = path + (isArray ? "[%s]" : path ? ".%s" : "%s");
            if (typeof Map != "undefined" && var1 instanceof Map || typeof Set != "undefined" && var1 instanceof Set) {
              var1.forEach(function(value, key) {
                if (var2.has(key)) {
                  if (var2.get) {
                    innerAssertWithCycleCheck(value, var2.get(key), childPath.replace("%s", key));
                  }
                } else {
                  failures.push(key + " not present in actual " + (path || typeOfVar2));
                }
              });
              var2.forEach(function(value, key) {
                if (!var1.has(key)) {
                  failures.push(key + " not present in expected " + (path || typeOfVar1));
                }
              });
            } else {
              if (!var1["__iterator__"]) {
                for (var prop in var1) {
                  if (isArray && goog.testing.asserts.isArrayIndexProp_(prop)) {
                    continue;
                  }
                  if (prop in var2) {
                    innerAssertWithCycleCheck(var1[prop], var2[prop], childPath.replace("%s", prop));
                  } else {
                    failures.push("property " + prop + " not present in actual " + (path || typeOfVar2));
                  }
                }
                for (var prop in var2) {
                  if (isArray && goog.testing.asserts.isArrayIndexProp_(prop)) {
                    continue;
                  }
                  if (!(prop in var1)) {
                    failures.push("property " + prop + " not present in expected " + (path || typeOfVar1));
                  }
                }
                if (isArray) {
                  for (prop = 0; prop < var1.length; prop++) {
                    innerAssertWithCycleCheck(var1[prop], var2[prop], childPath.replace("%s", String(prop)));
                  }
                }
              } else {
                if (goog.isFunction(var1.equals)) {
                  if (!var1.equals(var2)) {
                    failures.push("equals() returned false for " + (path || typeOfVar1));
                  }
                } else {
                  if (var1.map_) {
                    innerAssertWithCycleCheck(var1.map_, var2.map_, childPath.replace("%s", "map_"));
                  } else {
                    failures.push("unable to check " + (path || typeOfVar1) + " for equality: it has an iterator we do not " + "know how to handle. please add an equals method");
                  }
                }
              }
            }
          }
        }
      }
    } else {
      failures.push(path + " " + goog.testing.asserts.getDefaultErrorMsg_(var1, var2));
    }
  }
  innerAssertWithCycleCheck(expected, actual, "");
  return failures.length == 0 ? null : goog.testing.asserts.getDefaultErrorMsg_(expected, actual) + "\n   " + failures.join("\n   ");
};
var assertObjectEquals = function(a, b, opt_c) {
  _validateArguments(2, arguments);
  var v1 = nonCommentArg(1, 2, arguments);
  var v2 = nonCommentArg(2, 2, arguments);
  var failureMessage = commentArg(2, arguments) ? commentArg(2, arguments) : "";
  var differences = goog.testing.asserts.findDifferences(v1, v2);
  _assert(failureMessage, !differences, differences);
};
var assertObjectRoughlyEquals = function(a, b, c, opt_d) {
  _validateArguments(3, arguments);
  var v1 = nonCommentArg(1, 3, arguments);
  var v2 = nonCommentArg(2, 3, arguments);
  var tolerance = nonCommentArg(3, 3, arguments);
  var failureMessage = commentArg(3, arguments) ? commentArg(3, arguments) : "";
  var equalityPredicate = function(type, var1, var2) {
    var typedPredicate = goog.testing.asserts.primitiveRoughEqualityPredicates_[type];
    if (!typedPredicate) {
      return goog.testing.asserts.EQUALITY_PREDICATE_CANT_PROCESS;
    }
    var equal = typedPredicate(var1, var2, tolerance);
    return equal ? goog.testing.asserts.EQUALITY_PREDICATE_VARS_ARE_EQUAL : goog.testing.asserts.getDefaultErrorMsg_(var1, var2) + " which was more than " + tolerance + " away";
  };
  var differences = goog.testing.asserts.findDifferences(v1, v2, equalityPredicate);
  _assert(failureMessage, !differences, differences);
};
var assertObjectNotEquals = function(a, b, opt_c) {
  _validateArguments(2, arguments);
  var v1 = nonCommentArg(1, 2, arguments);
  var v2 = nonCommentArg(2, 2, arguments);
  var failureMessage = commentArg(2, arguments) ? commentArg(2, arguments) : "";
  var differences = goog.testing.asserts.findDifferences(v1, v2);
  _assert(failureMessage, differences, "Objects should not be equal");
};
var assertArrayEquals = function(a, b, opt_c) {
  _validateArguments(2, arguments);
  var v1 = nonCommentArg(1, 2, arguments);
  var v2 = nonCommentArg(2, 2, arguments);
  var failureMessage = commentArg(2, arguments) ? commentArg(2, arguments) : "";
  var typeOfVar1 = _trueTypeOf(v1);
  _assert(failureMessage, typeOfVar1 == "Array", "Expected an array for assertArrayEquals but found a " + typeOfVar1);
  var typeOfVar2 = _trueTypeOf(v2);
  _assert(failureMessage, typeOfVar2 == "Array", "Expected an array for assertArrayEquals but found a " + typeOfVar2);
  assertObjectEquals(failureMessage, Array.prototype.concat.call(v1), Array.prototype.concat.call(v2));
};
var assertElementsEquals = function(a, b, opt_c) {
  _validateArguments(2, arguments);
  var v1 = nonCommentArg(1, 2, arguments);
  var v2 = nonCommentArg(2, 2, arguments);
  var failureMessage = commentArg(2, arguments) ? commentArg(2, arguments) : "";
  if (!v1) {
    assert(failureMessage, !v2);
  } else {
    assertEquals("length mismatch: " + failureMessage, v1.length, v2.length);
    for (var i = 0; i < v1.length; ++i) {
      assertEquals("mismatch at index " + i + ": " + failureMessage, v1[i], v2[i]);
    }
  }
};
var assertElementsRoughlyEqual = function(a, b, c, opt_d) {
  _validateArguments(3, arguments);
  var v1 = nonCommentArg(1, 3, arguments);
  var v2 = nonCommentArg(2, 3, arguments);
  var tolerance = nonCommentArg(3, 3, arguments);
  var failureMessage = commentArg(3, arguments) ? commentArg(3, arguments) : "";
  if (!v1) {
    assert(failureMessage, !v2);
  } else {
    assertEquals("length mismatch: " + failureMessage, v1.length, v2.length);
    for (var i = 0; i < v1.length; ++i) {
      assertRoughlyEquals(failureMessage, v1[i], v2[i], tolerance);
    }
  }
};
var assertSameElements = function(a, b, opt_c) {
  _validateArguments(2, arguments);
  var expected = nonCommentArg(1, 2, arguments);
  var actual = nonCommentArg(2, 2, arguments);
  var message = commentArg(2, arguments);
  assertTrue("Bad arguments to assertSameElements(opt_message, expected: " + "ArrayLike, actual: ArrayLike)", goog.isArrayLike(expected) && goog.isArrayLike(actual));
  expected = goog.testing.asserts.toArray_(expected);
  actual = goog.testing.asserts.toArray_(actual);
  _assert(message, expected.length == actual.length, "Expected " + expected.length + " elements: [" + expected + "], " + "got " + actual.length + " elements: [" + actual + "]");
  var toFind = goog.testing.asserts.toArray_(expected);
  for (var i = 0; i < actual.length; i++) {
    var index = goog.testing.asserts.indexOf_(toFind, actual[i]);
    _assert(message, index != -1, "Expected [" + expected + "], got [" + actual + "]");
    toFind.splice(index, 1);
  }
};
var assertEvaluatesToTrue = function(a, opt_b) {
  _validateArguments(1, arguments);
  var value = nonCommentArg(1, 1, arguments);
  if (!value) {
    _assert(commentArg(1, arguments), false, "Expected to evaluate to true");
  }
};
var assertEvaluatesToFalse = function(a, opt_b) {
  _validateArguments(1, arguments);
  var value = nonCommentArg(1, 1, arguments);
  if (value) {
    _assert(commentArg(1, arguments), false, "Expected to evaluate to false");
  }
};
var assertHTMLEquals = function(a, b, opt_c) {
  _validateArguments(2, arguments);
  var var1 = nonCommentArg(1, 2, arguments);
  var var2 = nonCommentArg(2, 2, arguments);
  var var1Standardized = standardizeHTML(var1);
  var var2Standardized = standardizeHTML(var2);
  _assert(commentArg(2, arguments), var1Standardized === var2Standardized, goog.testing.asserts.getDefaultErrorMsg_(var1Standardized, var2Standardized));
};
var assertCSSValueEquals = function(a, b, c, opt_d) {
  _validateArguments(3, arguments);
  var propertyName = nonCommentArg(1, 3, arguments);
  var expectedValue = nonCommentArg(2, 3, arguments);
  var actualValue = nonCommentArg(3, 3, arguments);
  var expectedValueStandardized = standardizeCSSValue(propertyName, expectedValue);
  var actualValueStandardized = standardizeCSSValue(propertyName, actualValue);
  _assert(commentArg(3, arguments), expectedValueStandardized == actualValueStandardized, goog.testing.asserts.getDefaultErrorMsg_(expectedValueStandardized, actualValueStandardized));
};
var assertHashEquals = function(a, b, opt_c) {
  _validateArguments(2, arguments);
  var var1 = nonCommentArg(1, 2, arguments);
  var var2 = nonCommentArg(2, 2, arguments);
  var message = commentArg(2, arguments);
  for (var key in var1) {
    _assert(message, key in var2, "Expected hash had key " + key + " that was not found");
    _assert(message, var1[key] == var2[key], "Value for key " + key + " mismatch - expected = " + var1[key] + ", actual = " + var2[key]);
  }
  for (var key in var2) {
    _assert(message, key in var1, "Actual hash had key " + key + " that was not expected");
  }
};
var assertRoughlyEquals = function(a, b, c, opt_d) {
  _validateArguments(3, arguments);
  var expected = nonCommentArg(1, 3, arguments);
  var actual = nonCommentArg(2, 3, arguments);
  var tolerance = nonCommentArg(3, 3, arguments);
  _assert(commentArg(3, arguments), goog.testing.asserts.numberRoughEqualityPredicate_(expected, actual, tolerance), "Expected " + expected + ", but got " + actual + " which was more than " + tolerance + " away");
};
var assertContains = function(a, b, opt_c) {
  _validateArguments(2, arguments);
  var contained = nonCommentArg(1, 2, arguments);
  var container = nonCommentArg(2, 2, arguments);
  _assert(commentArg(2, arguments), goog.testing.asserts.contains_(container, contained), "Expected '" + container + "' to contain '" + contained + "'");
};
var assertNotContains = function(a, b, opt_c) {
  _validateArguments(2, arguments);
  var contained = nonCommentArg(1, 2, arguments);
  var container = nonCommentArg(2, 2, arguments);
  _assert(commentArg(2, arguments), !goog.testing.asserts.contains_(container, contained), "Expected '" + container + "' not to contain '" + contained + "'");
};
var assertRegExp = function(a, b, opt_c) {
  _validateArguments(2, arguments);
  var regexp = nonCommentArg(1, 2, arguments);
  var string = nonCommentArg(2, 2, arguments);
  if (typeof regexp == "string") {
    regexp = new RegExp(regexp);
  }
  _assert(commentArg(2, arguments), regexp.test(string), "Expected '" + string + "' to match RegExp " + regexp.toString());
};
goog.testing.asserts.toArray_ = function(arrayLike) {
  var ret = [];
  for (var i = 0; i < arrayLike.length; i++) {
    ret[i] = arrayLike[i];
  }
  return ret;
};
goog.testing.asserts.indexOf_ = function(container, contained) {
  if (container.indexOf) {
    return container.indexOf(contained);
  } else {
    for (var i = 0; i < container.length; i++) {
      if (container[i] === contained) {
        return i;
      }
    }
    return -1;
  }
};
goog.testing.asserts.contains_ = function(container, contained) {
  return goog.testing.asserts.indexOf_(container, contained) != -1;
};
var standardizeHTML = function(html) {
  var translator = document.createElement("DIV");
  translator.innerHTML = html;
  return translator.innerHTML.replace(/^\s+|\s+$/g, "");
};
var standardizeCSSValue = function(propertyName, value) {
  var styleDeclaration = document.createElement("DIV").style;
  styleDeclaration[propertyName] = value;
  return styleDeclaration[propertyName];
};
goog.testing.asserts.raiseException = function(comment, opt_message) {
  var e = new goog.testing.JsUnitException(comment, opt_message);
  var testCase = _getCurrentTestCase();
  if (testCase) {
    testCase.raiseAssertionException(e);
  } else {
    goog.global.console.error("Failed to save thrown exception: no test case is installed.");
    throw e;
  }
};
goog.testing.asserts.isArrayIndexProp_ = function(prop) {
  return (prop | 0) == prop;
};
goog.exportSymbol("fail", fail);
goog.exportSymbol("assert", assert);
goog.exportSymbol("assertThrows", assertThrows);
goog.exportSymbol("assertNotThrows", assertNotThrows);
goog.exportSymbol("assertThrowsJsUnitException", assertThrowsJsUnitException);
goog.exportSymbol("assertTrue", assertTrue);
goog.exportSymbol("assertFalse", assertFalse);
goog.exportSymbol("assertEquals", assertEquals);
goog.exportSymbol("assertNotEquals", assertNotEquals);
goog.exportSymbol("assertNull", assertNull);
goog.exportSymbol("assertNotNull", assertNotNull);
goog.exportSymbol("assertUndefined", assertUndefined);
goog.exportSymbol("assertNotUndefined", assertNotUndefined);
goog.exportSymbol("assertNotNullNorUndefined", assertNotNullNorUndefined);
goog.exportSymbol("assertNonEmptyString", assertNonEmptyString);
goog.exportSymbol("assertNaN", assertNaN);
goog.exportSymbol("assertNotNaN", assertNotNaN);
goog.exportSymbol("assertObjectEquals", assertObjectEquals);
goog.exportSymbol("assertObjectRoughlyEquals", assertObjectRoughlyEquals);
goog.exportSymbol("assertObjectNotEquals", assertObjectNotEquals);
goog.exportSymbol("assertArrayEquals", assertArrayEquals);
goog.exportSymbol("assertElementsEquals", assertElementsEquals);
goog.exportSymbol("assertElementsRoughlyEqual", assertElementsRoughlyEqual);
goog.exportSymbol("assertSameElements", assertSameElements);
goog.exportSymbol("assertEvaluatesToTrue", assertEvaluatesToTrue);
goog.exportSymbol("assertEvaluatesToFalse", assertEvaluatesToFalse);
goog.exportSymbol("assertHTMLEquals", assertHTMLEquals);
goog.exportSymbol("assertHashEquals", assertHashEquals);
goog.exportSymbol("assertRoughlyEquals", assertRoughlyEquals);
goog.exportSymbol("assertContains", assertContains);
goog.exportSymbol("assertNotContains", assertNotContains);
goog.exportSymbol("assertRegExp", assertRegExp);
goog.setTestOnly("goog.testing.editor.dom");
goog.provide("goog.testing.editor.dom");
goog.require("goog.dom.NodeType");
goog.require("goog.dom.TagIterator");
goog.require("goog.dom.TagWalkType");
goog.require("goog.iter");
goog.require("goog.string");
goog.require("goog.testing.asserts");
goog.testing.editor.dom.getPreviousNonEmptyTextNode = function(node, opt_stopAt, opt_skipDescendants) {
  return goog.testing.editor.dom.getPreviousNextNonEmptyTextNodeHelper_(node, opt_stopAt, opt_skipDescendants, true);
};
goog.testing.editor.dom.getNextNonEmptyTextNode = function(node, opt_stopAt, opt_skipDescendants) {
  return goog.testing.editor.dom.getPreviousNextNonEmptyTextNodeHelper_(node, opt_stopAt, opt_skipDescendants, false);
};
goog.testing.editor.dom.getPreviousNextNonEmptyTextNodeHelper_ = function(node, opt_stopAt, opt_skipDescendants, opt_isPrevious) {
  opt_stopAt = opt_stopAt || node.ownerDocument.body;
  var iter = new goog.dom.TagIterator(opt_stopAt, opt_isPrevious);
  var walkType;
  var depth = goog.testing.editor.dom.getRelativeDepth_(node, opt_stopAt);
  if (depth == -1) {
    return null;
  }
  if (node.nodeType == goog.dom.NodeType.ELEMENT) {
    if (opt_skipDescendants) {
      walkType = opt_isPrevious ? goog.dom.TagWalkType.START_TAG : goog.dom.TagWalkType.END_TAG;
    } else {
      depth++;
    }
  }
  iter.setPosition(node, walkType, depth);
  try {
    iter.next();
  } catch (e) {
    return null;
  }
  var filter = goog.iter.filter(iter, goog.testing.editor.dom.isNonEmptyTextNode_);
  try {
    return filter.next();
  } catch (e$4) {
    return null;
  }
};
goog.testing.editor.dom.isNonEmptyTextNode_ = function(node) {
  return !!node && node.nodeType == goog.dom.NodeType.TEXT && node.length > 0;
};
goog.testing.editor.dom.getRelativeDepth_ = function(node, parentNode) {
  var depth = 0;
  while (node) {
    if (node == parentNode) {
      return depth;
    }
    node = node.parentNode;
    depth++;
  }
  return -1;
};
goog.testing.editor.dom.assertRangeBetweenText = function(before, after, range, opt_stopAt) {
  var previousText = goog.testing.editor.dom.getTextFollowingRange_(range, true, opt_stopAt);
  if (before == "") {
    assertNull("Expected nothing before range but found <" + previousText + ">", previousText);
  } else {
    assertNotNull("Expected <" + before + "> before range but found nothing", previousText);
    assertTrue("Expected <" + before + "> before range but found <" + previousText + ">", goog.string.endsWith(previousText, before));
  }
  var nextText = goog.testing.editor.dom.getTextFollowingRange_(range, false, opt_stopAt);
  if (after == "") {
    assertNull("Expected nothing after range but found <" + nextText + ">", nextText);
  } else {
    assertNotNull("Expected <" + after + "> after range but found nothing", nextText);
    assertTrue("Expected <" + after + "> after range but found <" + nextText + ">", goog.string.startsWith(nextText, after));
  }
};
goog.testing.editor.dom.getTextFollowingRange_ = function(range, isBefore, opt_stopAt) {
  var followingTextNode;
  var endpointNode = isBefore ? range.getStartNode() : range.getEndNode();
  var endpointOffset = isBefore ? range.getStartOffset() : range.getEndOffset();
  var getFollowingTextNode = isBefore ? goog.testing.editor.dom.getPreviousNonEmptyTextNode : goog.testing.editor.dom.getNextNonEmptyTextNode;
  if (endpointNode.nodeType == goog.dom.NodeType.TEXT) {
    var endText = endpointNode.nodeValue;
    if (isBefore ? endpointOffset > 0 : endpointOffset < endText.length) {
      return isBefore ? endText.substr(0, endpointOffset) : endText.substr(endpointOffset);
    } else {
      followingTextNode = getFollowingTextNode(endpointNode, opt_stopAt);
      return followingTextNode && followingTextNode.nodeValue;
    }
  } else {
    var numChildren = endpointNode.childNodes.length;
    if (isBefore ? endpointOffset > 0 : endpointOffset < numChildren) {
      var followingChild = endpointNode.childNodes[isBefore ? endpointOffset - 1 : endpointOffset];
      if (goog.testing.editor.dom.isNonEmptyTextNode_(followingChild)) {
        return followingChild.nodeValue;
      } else {
        followingTextNode = getFollowingTextNode(followingChild, opt_stopAt);
        return followingTextNode && followingTextNode.nodeValue;
      }
    } else {
      followingTextNode = getFollowingTextNode(endpointNode, opt_stopAt, true);
      return followingTextNode && followingTextNode.nodeValue;
    }
  }
};
goog.provide("uno.listeners.SelectionListener");
goog.require("goog.debug.Logger");
goog.require("goog.events.KeyCodes");
goog.require("goog.testing.editor.dom");
goog.require("uno.BasePlugin");
goog.require("uno.defs");
(function() {
  var util = uno.util;
  var log = goog.debug.Logger.getLogger("uno.listeners.SelectionListener");
  var ZWS = uno.defs.unicode.ZERO_WIDTH_SPACE;
  var SelectionListener = uno.listeners.SelectionListener = function() {
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(SelectionListener, uno.BasePlugin);
  function removeAllZWSsFromNode(node) {
    if (!util.dom.isTextNode(node)) {
      return node;
    }
    var idx = node.data.indexOf(ZWS);
    while (idx !== -1) {
      node.deleteData(idx, 1);
      idx = node.data.indexOf(ZWS);
    }
    return node;
  }
  SelectionListener.prototype.handleNativeSelectionChange = function() {
    var editor = this.editor;
    var range = editor.getRange();
    if (!range) {
      return;
    }
    var pendingNode = editor.context.style.pendingNode;
    var startNode = range.getStartNode();
    var endNode = range.getEndNode();
    var startOffset = range.getStartOffset();
    var endOffset = range.getEndOffset();
    var isZWSRange = util.dom.isTextNode(startNode) && startNode.length === 1 && startNode.data === ZWS;
    if (isZWSRange) {
      editor.context.style.pendingNode = startNode.parentNode;
    } else {
      if (pendingNode) {
        var firstChild = pendingNode.firstChild;
        if (util.dom.isTextNode(firstChild)) {
          removeAllZWSsFromNode(firstChild);
          pendingNode.normalize();
        }
        editor.context.style.pendingNode = null;
      }
    }
    if (editor.context.precopyRange) {
      var precopyRange = ed.context.precopyRange;
      if (precopyRange && ed.getRange().isCollapsed() && !precopyRange.isCollapsed()) {
        precopyRange.select();
        ed.context.precopyRange = undefined;
      }
    }
  };
  function setNormalizedRange(range) {
    var startNode = range.getStartNode();
    if (!util.dom.isLi(startNode) && !util.dom.isTd(startNode)) {
      return range;
    }
    var normalizedStartNode = util.range.normalize(range).getStartNode();
    if (startNode === normalizedStartNode) {
      return range;
    }
    var r = goog.dom.Range.createFromNodeContents(normalizedStartNode);
    r.collapse(false);
    r.select();
    return r;
  }
  SelectionListener.prototype.handleKeyDown = function(event) {
    var range = this.editor.getRange();
    if (!range || !range.isCollapsed()) {
      return;
    }
    range = setNormalizedRange(range);
    var startNode = range.getStartNode();
    var startOffset = range.getStartOffset();
    if ((event.keyCode === 37 || event.keyCode === 39) && startNode.nodeType === Node.TEXT_NODE) {
      var char;
      var newIndex;
      if (event.keyCode === 37) {
        if (startOffset === 0) {
          var prevSibling = goog.testing.editor.dom.getPreviousNonEmptyTextNode(startNode);
          if (prevSibling && prevSibling.nodeType === Node.TEXT_NODE) {
            char = prevSibling.textContent[prevSibling.length - 1];
            startNode = prevSibling;
            newIndex = prevSibling.length - 1;
          }
        } else {
          char = startNode.textContent[startOffset - 1];
          newIndex = startOffset - 1;
        }
      } else {
        if (event.keyCode === 39) {
          if (startOffset === startNode.length) {
            var nextSibling = goog.testing.editor.dom.getNextNonEmptyTextNode(startNode);
            if (nextSibling && nextSibling.nodeType === Node.TEXT_NODE) {
              char = nextSibling.textContent[0];
              startNode = nextSibling;
              newIndex = 1;
            }
          } else {
            char = startNode.textContent[startOffset];
            newIndex = startOffset + 1;
          }
        }
      }
      if (char === ZWS) {
        var newRange = goog.dom.Range.createFromNodes(startNode, newIndex, startNode, newIndex);
        newRange.select();
      }
    }
  };
  var compositionTextHolder = null;
  SelectionListener.prototype.handleBeforeInput = function(e) {
    var event = e.event_;
    var editor = this.editor;
    var range;
    var startNode;
    if (event.inputType === "deleteCompositionText") {
      range = editor.getRange();
      startNode = range.getStartNode();
      if (util.dom.isTextNode(startNode) && startNode === range.getEndNode() && range.getStartOffset() === 0 && range.getEndOffset() === startNode.length) {
        compositionTextHolder = goog.dom.createElement("span");
        goog.dom.replaceNode(compositionTextHolder, startNode);
        compositionTextHolder.appendChild(startNode);
        compositionTextHolder.appendChild(document.createTextNode(ZWS));
      }
    }
  };
  SelectionListener.prototype.handleInput = function(e) {
    var event = e.event_;
    var inputType = event.inputType;
    var editor = this.editor;
    var range;
    var info;
    var placeholderZWS;
    if (compositionTextHolder && (inputType === "insertReplacementText" || inputType === "insertFromComposition" || inputType === "insertText")) {
      compositionTextHolder.normalize();
      removeAllZWSsFromNode(compositionTextHolder.firstChild);
      goog.dom.flattenElement(compositionTextHolder);
      compositionTextHolder = null;
    }
    if (inputType === "insertReplacementText" || inputType === "insertFromComposition") {
      range = editor.getRange();
      if (range.isCollapsed()) {
        info = {container:range.getStartNode(), offset:range.getStartOffset()};
        setTimeout(function() {
          var newRange = editor.getRange();
          var normalizedRange = util.range.normalize(newRange);
          if (newRange.getStartNode() !== normalizedRange.getStartNode()) {
            uno.util.range.selectFromInfo(info);
          }
        });
      }
    } else {
      if (inputType === "deleteCompositionText") {
        if (compositionTextHolder) {
          placeholderZWS = document.createTextNode(ZWS);
          compositionTextHolder.appendChild(placeholderZWS);
          util.range.selectNode(placeholderZWS);
        }
      }
    }
  };
  SelectionListener.prototype.handleCompositionStart = function(e) {
    var range = this.editor.getRange();
    if (!range || !range.isCollapsed()) {
      return;
    }
    setNormalizedRange(range);
  };
  SelectionListener.prototype.handleTextInput = function(e) {
    var range = this.editor.getRange();
    if (!range || !range.isCollapsed()) {
      return;
    }
    setNormalizedRange(range);
  };
})();
goog.provide("uno.realtime.modules.AISuggest");
goog.require("goog.debug.Logger");
goog.require("uno.util.react");
(function() {
  var log = goog.debug.Logger.getLogger("uno.realtime.modules.AISuggest");
  var aisuggestAttr = "data-ai-autosuggest";
  var acceptedAttr = "data-ai-autosuggest-accepted";
  var AISuggest = uno.realtime.modules.AISuggest = function(editor, y) {
    this.editor = editor;
    this.y = y;
    this.mutationObserver = null;
    this.knownDoms = [];
    this.starData = [];
  };
  AISuggest.prototype.setupObservation = function() {
    var ennote = this.editor.field;
    var self = this;
    this.reactRender();
    this.mutationObserver = new MutationObserver(function(mutations) {
      mutations.forEach(function(mut, i) {
        self.mutationLogic(mut.target, i);
      });
    });
    this.mutationObserver.observe(ennote, {subtree:true, childList:true, attributes:true});
    this.y.once("synced", function() {
      ennote.querySelectorAll("[" + aisuggestAttr + "]").forEach(function(elem) {
        self.mutationLogic(elem);
      });
    });
  };
  AISuggest.prototype.reactRender = function() {
    uno.util.react.renderAISuggest({starData:this.starData.slice()});
  };
  AISuggest.prototype.mutationLogic = function(dom) {
    var self = this;
    var attrString = dom.getAttribute(aisuggestAttr);
    var offset = function(el) {
      var rect = el.getBoundingClientRect();
      var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
      var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
      return {top:rect.top + scrollTop, left:rect.left + scrollLeft};
    };
    if (attrString == null) {
      dom.querySelectorAll("[" + aisuggestAttr + "]").forEach(function(elem) {
        self.mutationLogic(elem);
      });
      return;
    }
    this.starData.forEach(function(data, index) {
      var box = offset(data.domTarget);
      if (box != null && box.top != null && box.top !== data.top) {
        self.starData[index] = Object.assign({}, self.starData[index], {top:box.top});
        self.reactRender();
      }
    });
    if (this.knownDoms.indexOf(dom) < 0 && attrString != null) {
      var json = JSON.parse(attrString);
      var accepted = dom.getAttribute(acceptedAttr);
      if (accepted === "true") {
        accepted = true;
      } else {
        if (accepted === "false") {
          accepted = false;
        } else {
          accepted = null;
        }
      }
      this.knownDoms.push(dom);
      this.starData.push({accepted:accepted, data:json, domTarget:dom, top:offset(dom).top});
      self.reactRender();
    }
  };
})();
goog.provide("uno.realtime.modules.Commenting");
goog.require("goog.debug.Logger");
goog.require("uno.util.commenting");
goog.require("uno.util.mutex");
(function() {
  var log = goog.debug.Logger.getLogger("uno.realtime.modules.Commenting");
  var util = uno.util;
  var Commenting = uno.realtime.modules.Commenting = function(editor, y) {
    this.editor = editor;
    this.y = y;
  };
  Commenting.prototype.setupObservation = function() {
    var self = this;
    var share = this.y.share;
    this.y.define("comments", Y.Map);
    this.y.define("metadata", Y.Map);
    var field = this.editor.field;
    var state = this.editor.context.commenting;
    util.commenting.initState(this.editor, this.editor.config.user.userID);
    setTimeout(function() {
      util.mutex.run("commenting", function() {
        util.commenting.updateMarkers(state, field);
        util.commenting.changeColumnPaddingIfNeeded(state, field);
      });
    }, 1000);
    share.comments.observeDeep(function(events) {
      util.mutex.run("commenting", function() {
        self.handleCommentEvent(events);
      });
    });
    share.content.observeDeep(function(event) {
      util.mutex.run("commenting", function() {
        util.commenting.updateMarkers(state, field);
        util.commenting.changeColumnPaddingIfNeeded(state, field);
      });
    });
    share.metadata.observeDeep(function() {
      util.commenting.updateCurrentUser(self.editor.context.commenting, self.editor.config.user.userID, share.metadata.get("Users"));
    });
  };
  Commenting.prototype.handleCommentEvent = function(events) {
    var field = this.editor.field;
    var state = this.editor.context.commenting;
    if (util.commenting.setState(this.editor, events)) {
      util.commenting.updateMarkers(state, field);
      util.commenting.changeColumnPaddingIfNeeded(state, field);
    }
  };
})();
goog.provide("uno.util.remoterange");
goog.require("goog.dom");
goog.require("uno.util.dom");
goog.require("uno.util.tools");
goog.require("uno.util.range");
(function() {
  var util = uno.util;
  var domToXPath = function(node) {
    var stopAt = "en-note";
    var path = "";
    while (util.dom.getTagName(node) !== stopAt) {
      if (node == null || node.parentNode == null || node.nodeType == null) {
        return null;
      }
      if (node.nodeType === 1) {
        path = "/" + util.dom.getTagName(node) + "[" + util.dom.index(node) + "]" + path;
      } else {
        if (node.nodeType === 3) {
          path = "/" + "#text" + "[" + util.dom.index(node) + "]" + path;
        }
      }
      node = node.parentNode;
    }
    return path === "" ? "/" : path;
  };
  var xpathToDom = function(xpath) {
    var startAt = document.querySelector("en-note");
    if (startAt == null) {
      return document.body;
    }
    var pathSegments = xpath.split("/").slice(1);
    var segment = null;
    while (segment = pathSegments.shift()) {
      var offsetSegment = segment.split("[");
      var tagname = offsetSegment[0];
      var offset = parseInt(offsetSegment[1], 10);
      if (startAt == null || startAt.childNodes == null) {
        return null;
      }
      startAt = startAt.childNodes[offset];
      if (startAt && (startAt.nodeType === 1 && util.dom.getTagName(startAt) !== tagname || startAt.nodeType === 3 && tagname !== "#text")) {
        console.warn("Couldnt restore cursor perfectly, nodes moved.");
        break;
      }
    }
    return startAt;
  };
  util.remoterange.isValidXPathRange = function(xpathRange) {
    return xpathRange && xpathRange.startNegativeOffset !== -1 && xpathRange.endNegativeOffset !== -1 && xpathRange.startPath != null && xpathRange.endPath != null && xpathRange.startPath.length != null && xpathRange.endPath.length != null && xpathRange.startPath.length > 0 && xpathRange.endPath.length > 0;
  };
  util.remoterange.saveUsingXPath = function(googRange) {
    if (googRange == null) {
      return null;
    }
    var startNode = googRange.getStartNode();
    var endNode = googRange.getEndNode();
    var startNodeLength;
    var endNodeLength;
    if (startNode.length != null) {
      startNodeLength = startNode.length;
    } else {
      startNodeLength = startNode.childNodes.length;
    }
    if (endNode.length != null) {
      endNodeLength = endNode.length;
    } else {
      endNodeLength = endNode.childNodes.length;
    }
    var startNegativeOffset = startNodeLength - googRange.getStartOffset();
    var endNegativeOffset = endNodeLength - googRange.getEndOffset();
    var startPath = domToXPath(startNode);
    var endPath = domToXPath(endNode);
    if (startPath == null || endPath == null) {
      return null;
    }
    return {startPath:startPath, endPath:endPath, startNegativeOffset:startNegativeOffset, endNegativeOffset:endNegativeOffset};
  };
  util.remoterange.restoreFromXPath = function(xpathRange) {
    if (xpathRange == null) {
      return null;
    }
    var startNode = xpathToDom(xpathRange.startPath);
    var endNode = xpathToDom(xpathRange.endPath);
    var startNodeLength;
    var endNodeLength;
    if (startNode == null || endNode == null) {
      return null;
    }
    if (startNode.length != null) {
      startNodeLength = startNode.length;
    } else {
      startNodeLength = startNode.childNodes.length;
    }
    if (endNode.length != null) {
      endNodeLength = endNode.length;
    } else {
      endNodeLength = endNode.childNodes.length;
    }
    var startOffset = startNodeLength - xpathRange.startNegativeOffset;
    var endOffset = endNodeLength - xpathRange.endNegativeOffset;
    return goog.dom.Range.createFromNodes(startNode, startOffset, endNode, endOffset);
  };
  var getToolsSection = function(section) {
    var specific = util.tools.query(".realtime-" + section);
    if (specific == null) {
      specific = document.createElement("div");
      specific.setAttribute("class", "realtime-" + section);
      util.tools.append(specific);
    }
    return specific;
  };
  util.remoterange.fakeRenderRange = function(range, color, user, prettyName, isActive) {
    color = color || "black";
    isActive = isActive || false;
    var tools = getToolsSection("selections");
    var clearFakeRangesForUser = function() {
      var userSels = tools.querySelectorAll('[data-user="' + user + '"]');
      for (var j = 0; j < userSels.length; j++) {
        goog.dom.removeNode(userSels[j]);
      }
    };
    if (range == null) {
      clearFakeRangesForUser();
      var cursors = tools.querySelectorAll('[data-cursor-user="' + user + '"]');
      for (var j = 0; j < cursors.length; j++) {
        goog.dom.removeNode(cursors[j]);
      }
      return;
    }
    if (range.getBrowserRangeObject != null) {
      try {
        range = range.getBrowserRangeObject();
      } catch (e) {
        console.warn("(weird) fake browser range out of sync for ", user);
        clearFakeRangesForUser();
        return;
      }
    }
    var clientrects = util.range.getBoundingBoxesFromTextSelection(range, true, true);
    if (clientrects == null) {
      clientrects = [];
    }
    if (clientrects.length === 0 && util.dom.isEmptyContent(range.startContainer) && !util.dom.isEnnote(range.startContainer)) {
      var nodeBox = util.dom.getBoundingBox(range.startContainer, true);
      if (nodeBox == null) {
        nodeBox = util.dom.getBoundingBox(range.startContainer.parentNode, true);
      }
      if (nodeBox) {
        nodeBox.width = 0;
        clientrects = [nodeBox];
      }
    }
    clearFakeRangesForUser();
    var bottomRightRect = clientrects.length > 0 ? clientrects[0] : null;
    for (var i = 0; i < clientrects.length; i++) {
      var clientrect = clientrects[i];
      if (clientrect.bottom > bottomRightRect.bottom || clientrect.bottom === bottomRightRect.bottom && clientrect.right > bottomRightRect.right) {
        bottomRightRect = clientrect;
      }
      var box = document.createElement("div");
      box.setAttribute("class", "rte-selection");
      box.setAttribute("data-user", user);
      box.style.backgroundColor = color;
      box.style.position = "absolute";
      box.style.top = clientrect.top + "px";
      box.style.left = clientrect.left + "px";
      box.style.height = clientrect.height + "px";
      box.style.width = clientrect.width + "px";
      tools.appendChild(box);
    }
    if (bottomRightRect !== null) {
      var cursorDiv = document.querySelector('.rte-cursor[data-cursor-user="' + user + '"]');
      if (!cursorDiv || isActive) {
        if (cursorDiv) {
          cursorDiv.parentElement.removeChild(cursorDiv);
        }
        cursorDiv = document.createElement("div");
        cursorDiv.classList.add("rte-cursor");
        cursorDiv.classList.add("active-user");
        cursorDiv.setAttribute("data-cursor-user", user);
        cursorDiv.style.backgroundColor = color;
        cursorDiv.style.position = "absolute";
        cursorDiv.style.width = "2px";
        if (prettyName != null) {
          var nameArea = document.createElement("div");
          nameArea.setAttribute("class", "name-area");
          nameArea.textContent = prettyName;
          nameArea.style.backgroundColor = color;
          cursorDiv.appendChild(nameArea);
        }
        tools.appendChild(cursorDiv);
      }
      cursorDiv.style.top = bottomRightRect.top - 2 + "px";
      cursorDiv.style.left = bottomRightRect.left + bottomRightRect.width + "px";
      cursorDiv.style.height = bottomRightRect.height + 2 + "px";
    }
  };
})();
goog.provide("uno.realtime.domfilter");
(function() {
  uno.realtime.domfilter = function(nodeName, attributes) {
    attributes.forEach(function(value, key) {
      if (key != null && key.substr(0, 2) === "on") {
        attributes.delete(key);
      }
    });
    switch(nodeName) {
      case "SCRIPT":
        return null;
      case "EN-ADORNMENTS":
        return null;
      case "CURSOR-PROXY":
        return null;
      case "MOBILE-CURSOR-PARKING":
        return null;
      case "EN-TABLE":
        attributes.delete("class");
        return attributes;
      case "EN-COMMENT":
        attributes.delete("style");
        attributes.delete("class");
        return attributes;
      case "SPAN":
        return (attributes.get("id") || "").substr(0, 5) === "goog_" ? null : attributes;
      case "TD":
        attributes.delete("class");
        return attributes;
      case "EMBED":
        attributes.delete("src");
        attributes.delete("style");
        attributes.delete("data-reference");
        return attributes;
      default:
        return (nodeName || "").substr(0, 3) === "UI-" ? null : attributes;
    }
  };
})();
goog.provide("uno.realtime.modules.Editing");
goog.require("goog.debug.Logger");
goog.require("uno.util.remoterange");
goog.require("uno.realtime.domfilter");
goog.require("uno.util.mutex");
goog.require("uno.util.table");
(function() {
  var util = uno.util;
  var log = goog.debug.Logger.getLogger("uno.realtime.modules.Editing");
  var Editing = uno.realtime.modules.Editing = function(editor, y) {
    this.editor = editor;
    this.y = y;
    this.editor.listen("delayedchange", this.onDelayedChange, false, this);
  };
  Editing.prototype.onDelayedChange = function() {
    this.y.connector.executeCommand("NoteDirtyIndicator", "");
  };
  Editing.prototype.setupObservation = function() {
    var self = this;
    var editor = this.editor;
    var y = this.y;
    var contentShare = y.define("content", Y.Map);
    util.mutex.run(this, function() {
      var savedRange = util.remoterange.saveUsingXPath(self.editor.getRange());
      var syncedPromise = y.when("synced");
      var deferred = {};
      var documentBoundPromise = new Promise(function(resolve) {
        deferred.resolve = resolve;
      });
      Promise.all([documentBoundPromise, syncedPromise]).then(function() {
        editor.execCommand("active", !editor.realtime.readOnly);
        self.editor.dispatchEvent({type:"realtimeSetupDone"});
      });
      function bindDocument() {
        var doc = contentShare.get("document");
        if (doc !== undefined) {
          self.snapToServerState(doc);
          deferred.resolve();
        }
      }
      bindDocument();
      contentShare.observe(bindDocument);
      if (savedRange) {
        var range = util.remoterange.restoreFromXPath(savedRange);
        if (util.remoterange.isValidXPathRange(range)) {
          range.select();
        }
      }
    });
  };
  Editing.prototype.snapToServerState = function(xmlFragment) {
    log.info("synchronizing editor content with content from rte server");
    var editor = this.editor;
    var editorElement = editor.field;
    if (this.y.domBinding != null) {
      try {
        this.y.domBinding.destroy();
      } catch (e) {
        console.error(e);
      }
    }
    var domBinding = new Y.DomBinding(xmlFragment, editorElement, {filter:uno.realtime.domfilter, hooks:this.editor.context.realtime.hooks, scrollingElement:document.scrollingElement});
    this.y.domBinding = domBinding;
    editor.updateEmpty(false);
    this.y.on("afterTransaction", function(y, t, remote) {
      if (t.changedTypes.size > 0) {
        editor.updateEmpty(false);
      }
      t.changedParentTypes.forEach(function(events, type) {
        if (type.nodeName === "EN-TABLE" && !type._deleted) {
          var enTable = domBinding.typeToDom.get(type);
          if (enTable) {
            util.table.layout(enTable, true);
          }
        }
      });
    });
    if (editor.config.realtime.undo) {
      console.info("Enabling Yjs based undo!");
      var undoManager = new Y.utils.UndoManager(xmlFragment, {captureTimeout:-1, bindings:[domBinding]});
      this.y.undoManager = undoManager;
      editor.listen(uno.Editor.EventType.DELAYEDCHANGE, function() {
        undoManager.flushChanges();
      });
    }
  };
})();
goog.provide("uno.realtime.modules.Selecting");
goog.require("uno.util.mutex");
goog.require("uno.util.user");
goog.require("uno.util.remoterange");
(function() {
  var util = uno.util;
  var DEJITTER_DURATION = 30;
  var Selecting = uno.realtime.modules.Selecting = function(editor, y) {
    this.editor = editor;
    this.y = y;
    this.localContentChangeDejitter = 0;
    this.transactionActive = false;
  };
  Selecting.prototype.setupObservation = function() {
    var self = this;
    var contentShare = this.y.define("content", Y.Map);
    var editor = this.editor;
    var sharedSelection = this.y.define("selection", Y.Map);
    var metadataSection = this.y.define("metadata", Y.Map);
    var myID = this.y.userID + "";
    this.y.when("synced").then(function() {
      self.getSelectionSection(myID, true);
      contentShare.observeDeep(function(events) {
        if (events.length === 0) {
          return;
        }
        setTimeout(function() {
          util.mutex.run(self, function() {
            var changedUsers = {};
            Array.from(events[0]._transaction.beforeState.keys()).forEach(function(user) {
              changedUsers[user] = true;
            });
            self.handleRemoteContentChange(changedUsers);
          });
          localUpdateHelper();
        }, 0);
      });
      var localUpdateHelper = function() {
        if (self.localContentChangeDejitter != null) {
          clearTimeout(self.localContentChangeDejitter);
        } else {
          util.mutex.run(self, function() {
            self.handleLocalSelectionChange();
          });
        }
        self.localContentChangeDejitter = setTimeout(function() {
          util.mutex.run(self, function() {
            self.handleLocalSelectionChange();
          });
          self.localContentChangeDejitter = null;
        }, DEJITTER_DURATION);
      };
      sharedSelection.observe(function(event) {
        event.keysChanged.forEach(function(userID) {
          if (!goog.isString(userID)) {
            console.warn("Invalid user id for selection change:", userID);
            return;
          }
          util.mutex.run(self, function() {
            self.renderRemoteUserSelection(userID, true);
          });
        });
      });
      metadataSection.get("Users").observe(function(event) {
        event.keysChanged.forEach(function(user) {
          if (user !== myID && !event.target.has(user)) {
            console.log("Saw User Left", user);
            util.remoterange.fakeRenderRange(null, "black", user);
          }
        });
      });
      window.addEventListener("resize", function() {
        util.mutex.run(self, function() {
          self.handleRemoteContentChange({});
        });
      });
      editor.listen("selectionchange", function() {
        util.mutex.run(self, function() {
          self.handleLocalSelectionChange();
        });
      });
      util.mutex.run(self, function() {
        self.handleRemoteContentChange({});
      });
    });
  };
  Selecting.prototype.getSelectionSection = function(userID) {
    var sharedSelection = this.y.share.selection;
    var clientSelection = sharedSelection.get(userID);
    if (clientSelection == null || clientSelection.start == null || clientSelection.end == null) {
      return null;
    } else {
      return clientSelection;
    }
  };
  Selecting.prototype.getRangeForUser = function(userID) {
    var clientSelection = this.getSelectionSection(userID);
    if (clientSelection != null) {
      var start = Y.utils.fromRelativePosition(this.y, clientSelection.start);
      var end = Y.utils.fromRelativePosition(this.y, clientSelection.end);
      var domBinding = this.y.domBinding;
      if (domBinding && domBinding.typeToDom && start && end && !start.type._deleted && !end.type._deleted) {
        var range = document.createRange();
        var startDom = domBinding.typeToDom.get(start.type);
        var endDom = domBinding.typeToDom.get(end.type);
        if (startDom != null && endDom != null) {
          var startLen = startDom.nodeType === document.TEXT_NODE ? startDom.length : startDom.childNodes.length;
          var endLen = endDom.nodeType === document.TEXT_NODE ? endDom.length : endDom.childNodes.length;
          range.setStart(startDom, Math.min(start.offset, startLen));
          range.setEnd(endDom, Math.min(end.offset, endLen));
          return range;
        }
      }
    }
    return null;
  };
  Selecting.prototype.handleRemoteContentChange = function(activeUsers) {
    var users = this.y.share.metadata.get("Users").keys() || [];
    for (var i = 0; i < users.length; i++) {
      var user = users[i];
      this.renderRemoteUserSelection(user, activeUsers[user]);
    }
  };
  Selecting.prototype.renderRemoteUserSelection = function(userID, isActive) {
    var self = this;
    var myID = this.y.userID + "";
    if (userID === myID) {
      return;
    }
    var range = self.getRangeForUser(userID);
    if (range != null) {
      var editorElement = this.editor.getElement();
      if (range.collapsed && range.startContainer === editorElement && editorElement.firstChild != null) {
        range.setStart(editorElement.firstChild, 0);
        range.setEnd(editorElement.firstChild, 0);
      }
      var user = util.user.read(this.y.share.metadata.get("Users"), userID);
      util.remoterange.fakeRenderRange(range, user.color, userID, user.name, isActive);
    } else {
      util.remoterange.fakeRenderRange(null, "black", userID);
    }
  };
  function comparePositions(a, b) {
    return a === b || a != null && b != null && a.length === b.length && a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];
  }
  Selecting.prototype.handleLocalSelectionChange = function() {
    var _range = this.editor.getRange();
    if (_range == null) {
      return;
    }
    var range = _range.getBrowserRangeObject();
    var sharedSelection = this.y.share.selection;
    var clientID = this.y.userID + "";
    var yStartContainer = this.y.domBinding.domToType.get(range.startContainer);
    var yEndContainer = this.y.domBinding.domToType.get(range.endContainer);
    if (yStartContainer != null && yEndContainer != null) {
      var start = Y.utils.getRelativePosition(yStartContainer, range.startOffset);
      var end = Y.utils.getRelativePosition(yEndContainer, range.endOffset);
      var originalLocation = sharedSelection.get(clientID);
      if (originalLocation == null || !comparePositions(originalLocation.start, start) || !comparePositions(originalLocation.end, end)) {
        sharedSelection.set(clientID, {start:start, end:end});
      }
    }
  };
})();
goog.provide("uno.realtime.modules.Status");
goog.require("uno.util.react");
goog.require("uno.util.user");
(function() {
  var util = uno.util;
  var Status = uno.realtime.modules.Status = function(editor, y) {
    this.editor = editor;
    this.y = y;
  };
  Status.prototype.setupObservation = function() {
    var self = this;
    this.y.when("synced").then(function() {
      self.y.define("metadata", Y.Map).observeDeep(self.metadataChanged.bind(self));
      self.metadataChanged();
    });
    this.y.define("content", Y.Map).observeDeep(this.contentChanged.bind(this));
  };
  Status.prototype.socketConnect = function(success, reason) {
    var state = this.editor.context.statusbar;
    this.editor.context.realtime.connected = !!success;
    this.editor.context.realtime.saved = true;
    if (state.loading || state.error) {
      this.updateStatusbar();
    }
  };
  Status.prototype.socketConnectError = function() {
    this.editor.context.realtime.connected = false;
    this.updateStatusbar();
  };
  Status.prototype.socketReconnect = function() {
    this.editor.context.realtime.connected = true;
    this.updateStatusbar();
  };
  Status.prototype.socketReconnectError = function() {
    this.editor.context.realtime.connected = false;
    this.updateStatusbar();
  };
  Status.prototype.socketDisconnect = function() {
    this.editor.context.realtime.connected = false;
    this.updateStatusbar();
  };
  Status.prototype.realtimeNoteSaved = function() {
    this.editor.context.realtime.saved = true;
    this.updateStatusbar();
  };
  Status.prototype.contentChanged = function(yevents) {
    if (yevents[0] != null && yevents[0].remote === false) {
      this.editor.context.realtime.saved = false;
      this.updateStatusbar();
    }
  };
  Status.prototype.metadataChanged = function() {
    var userId = this.editor.config.user.userID;
    var yUsers = this.y.define("metadata", Y.Map).get("Users");
    var users = Object.values(util.user.readMany(yUsers));
    var currentUser = users.splice(users.findIndex(function(u) {
      return u.id == userId;
    }), 1)[0];
    if (currentUser !== undefined) {
      users.push(currentUser);
    }
    var state = this.editor.context.statusbar;
    state.users = users.map(function(u, i) {
      if (!u.initial) {
        u.initial = users.length - i + "";
      }
      return u;
    });
    uno.util.react.renderStatusBar(state);
  };
  Status.prototype.updateStatusbar = function() {
    var state = this.editor.context.statusbar;
    state.error = !this.editor.context.realtime.connected;
    state.loading = !this.editor.context.realtime.saved;
    uno.util.react.renderStatusBar(state);
  };
})();
goog.provide("uno.util.userconnections");
goog.require("uno.util.string");
goog.require("uno.util.user");
(function() {
  var util = uno.util;
  util.userconnections.createUserConnections = function(state, businessID) {
    state.cacheKey = "userconnections_" + businessID;
    try {
      var obj = JSON.parse(localStorage.getItem(state.cacheKey));
      if (obj && obj.timestamp > -1 && obj.userConnections.length > 0) {
        util.userconnections.setUserConnections(state, obj.userConnections, obj.timestamp);
      }
    } catch (err) {
    }
  };
  util.userconnections.updateUserConnections = function(state, userConnections, timestamp) {
    if (!state.cacheKey) {
      throw new Error('cacheKey is missing to save provided "userConnections". ' + 'You probably forgot to call "createUserConnections" before requesting data ' + "from the RTE server.");
    }
    try {
      var cacheObj = JSON.stringify({userConnections:userConnections, timestamp:timestamp});
      localStorage.setItem(state.cacheKey, cacheObj);
    } finally {
      util.userconnections.setUserConnections(state, userConnections, timestamp);
    }
  };
  util.userconnections.setUserConnections = function(state, userConnections, timestamp) {
    state.cacheTimestamp = timestamp;
    state.items = [];
    state.itemsTrie = new Trie;
    state._match = match;
    userConnections.forEach(function(u) {
      state.items[u.id] = u;
      u.initial = util.user.getInitial(u.name);
      u.color = util.user.getColor(u.email);
      if (u.name) {
        var name = util.string.removeDiacritics(u.name.toLowerCase());
        var names = name.split(" ").reverse().reduce(function(acc, val) {
          return acc.concat(acc.length > 0 ? val + " " + acc[acc.length - 1] : val);
        }, []);
        names.forEach(function(val) {
          state.itemsTrie.insert(val, u);
        });
      }
      if (u.email) {
        state.itemsTrie.insert(u.email.toLowerCase(), u);
      }
      if (u.username) {
        state.itemsTrie.insert(u.username.toLowerCase(), u);
      }
    });
  };
  function match(value) {
    if (!this.itemsTrie) {
      return [];
    }
    var phrase = util.string.removeDiacritics(value.toLowerCase());
    return this.itemsTrie.find(phrase).slice(0, 25);
  }
  function Trie(parent, key, value) {
    if (parent && !parent.children) {
      parent.children = {};
    }
    if (key) {
      parent.children[key] = this;
      this.values = [value];
    }
  }
  Trie.prototype.insert = function(phrase, value) {
    var len = phrase.length;
    var t = this;
    var i = 0;
    var key = null;
    var child = null;
    while (t.children && i < len) {
      key = phrase[i++];
      child = t.children[key];
      if (child) {
        if (child.values.indexOf(value) === -1) {
          child.values.push(value);
        }
        t = child;
      } else {
        t = new Trie(t, key, value);
        break;
      }
    }
    for (; i < len; i++) {
      t = new Trie(t, phrase[i], value);
    }
  };
  Trie.prototype.find = function(phrase) {
    var len = phrase.length;
    var t = this;
    var i = 0;
    while (t && t.children && i < len) {
      t = t.children[phrase[i]];
      if (++i >= len && t) {
        return t.values;
      }
    }
    return [];
  };
})();
goog.provide("uno.realtime.modules.UserConnections");
goog.require("goog.debug.Logger");
goog.require("uno.util.userconnections");
(function() {
  var log = goog.debug.Logger.getLogger("uno.realtime.modules.UserConnections");
  var util = uno.util;
  var UserConnections = uno.realtime.modules.UserConnections = function(editor, y) {
    this.editor = editor;
    this.y = y;
  };
  UserConnections.prototype.handleUserConnections = function(connections, timestamp) {
    var state = this.editor.context.userConnections;
    util.userconnections.updateUserConnections(state, connections, timestamp);
  };
  UserConnections.prototype.socketConnect = function(success) {
    if (success) {
      var connector = this.y.connector;
      var state = this.editor.context.userConnections;
      var businessID = connector.businessID;
      if (businessID) {
        util.userconnections.createUserConnections(state, businessID);
        connector.updateUserConnectionsIfNeeded(state.cacheTimestamp);
      }
    }
  };
})();
goog.provide("uno.realtime.hooks.magicdrawinghook");
(function() {
  var magicdrawinghook = uno.realtime.hooks.magicdrawinghook;
  magicdrawinghook.register = function(editor) {
    editor.context.realtime.hooks["magic-drawing"] = {fillType:function(dom, type) {
      initDrawingBindings(type, dom);
    }, createDom:function(type) {
      var dom = document.createElement("magic-drawing");
      initDrawingBindings(type, dom);
      return dom;
    }};
  };
  function initDrawingBindings(type, dom) {
    var renderPath = d3.svg.line().x(function(d) {
      return d[0];
    }).y(function(d) {
      return d[1];
    }).interpolate("basis");
    dom.contentEditable = "false";
    dom.setAttribute("data-yjs-hook", "magic-drawing");
    var resizingToken = false;
    var domResizeObserver = new MutationObserver(function() {
      if (!resizingToken) {
        resizingToken = true;
        setTimeout(function() {
          resizingToken = false;
          if (dom.style.height !== type.get("height")) {
            type.set("height", dom.style.height);
          }
          if (dom.style.width !== type.get("width")) {
            type.set("width", dom.style.width);
          }
        }, 50);
      }
    });
    domResizeObserver.observe(dom, {attributes:true});
    type.observe(function() {
      dom.style.height = type.get("height");
      dom.style.width = type.get("width");
    });
    dom.style.height = type.get("height") || "300px";
    dom.style.width = type.get("width") || "300px";
    var drawing = type.get("drawing");
    if (drawing === undefined) {
      drawing = type.set("drawing", new Y.Array);
    }
    var canvas = dom.querySelector(".drawingCanvas");
    if (canvas == null) {
      canvas = document.createElementNS("http://www.w3.org/2000/svg", "svg");
      canvas.setAttribute("class", "drawingCanvas");
      canvas.setAttribute("viewbox", "0 0 100 100");
      dom.insertBefore(canvas, null);
    }
    var clearDrawingButton = dom.querySelector(".clearDrawingButton");
    if (clearDrawingButton == null) {
      clearDrawingButton = document.createElement("button");
      clearDrawingButton.setAttribute("type", "button");
      clearDrawingButton.setAttribute("class", "clearDrawingButton");
      clearDrawingButton.innerText = "Clear Drawing";
      dom.insertBefore(clearDrawingButton, null);
    }
    var svg = d3.select(canvas).call(d3.behavior.drag().on("dragstart", dragstart).on("drag", drag).on("dragend", dragend));
    function drawLine(yarray) {
      var line = svg.append("path").datum(yarray.toArray());
      yarray._line = line;
      line.attr("d", renderPath);
      yarray.observe(function(event) {
        line.remove();
        line = svg.append("path").datum(yarray.toArray());
        yarray._line = line;
        line.attr("d", renderPath);
      });
    }
    drawing.observe(function(event) {
      event.removedElements.forEach(function(array) {
        array._line.remove();
      });
      event.addedElements.forEach(function(path) {
        drawLine(path, svg);
      });
    });
    for (var i = 0; i < drawing.length; i++) {
      drawLine(drawing.get(i), svg);
    }
    clearDrawingButton.onclick = function() {
      drawing.delete(0, drawing.length);
    };
    var sharedLine = null;
    function dragstart() {
      drawing.insert(drawing.length, [Y.Array]);
      sharedLine = drawing.get(drawing.length - 1);
    }
    var ignoreDrag = null;
    function drag() {
      if (sharedLine != null && ignoreDrag == null) {
        ignoreDrag = window.setTimeout(function() {
          ignoreDrag = null;
        }, 10);
        sharedLine.push([d3.mouse(this)]);
      }
    }
    function dragend() {
      sharedLine = null;
      window.clearTimeout(ignoreDrag);
      ignoreDrag = null;
    }
  }
})();
goog.provide("uno.realtime.hooks.resourcehook");
goog.require("uno.util.resource");
(function() {
  var util = uno.util;
  var resourcehook = uno.realtime.hooks.resourcehook;
  resourcehook.register = function(editor) {
    editor.context.realtime.hooks["en-resource"] = {fillType:function(dom, type) {
      if (!dom.classList.contains("en-media")) {
        dom = dom.querySelector(".en-media");
      }
      var props = {hash:dom.getAttribute("data-hash"), type:dom.getAttribute("data-type"), width:dom.getAttribute("data-width"), height:dom.getAttribute("data-height"), style:dom.getAttribute("style")};
      if (props.hash == null || props.type == null) {
        return;
      }
      var propKeys = Object.keys(props);
      for (var i = 0; i < propKeys.length; i++) {
        type.set(propKeys[i], props[propKeys[i]]);
      }
    }, createDom:function(type) {
      var hash = type.get("hash");
      var known = false;
      var props = {};
      if (Object.keys(editor.context.resources).indexOf(hash) >= 0) {
        props = editor.context.resources[hash];
        known = true;
      }
      goog.object.extend(props, {hash:hash, mime:type.get("type"), width:type.get("width"), height:type.get("height"), style:type.get("style")});
      if (known === false && props.state == null) {
        props.state = "loading";
        props.progress = 0.05;
        setTimeout(function() {
          editor.dispatchEvent({type:"resourceNeedsUpdate", props:props});
        }, 50);
      }
      var media = util.resource.createMediaFromDict(props);
      var slug = util.resource.convertMediaToSlug(media, props, editor);
      return slug;
    }};
  };
})();
goog.provide("uno.realtime.Realtime");
goog.require("goog.debug.Logger");
goog.require("goog.string");
goog.require("uno.BasePlugin");
goog.require("uno.realtime.modules.AISuggest");
goog.require("uno.realtime.modules.Commenting");
goog.require("uno.realtime.modules.Editing");
goog.require("uno.realtime.modules.Selecting");
goog.require("uno.realtime.modules.Status");
goog.require("uno.realtime.modules.UserConnections");
goog.require("uno.realtime.hooks.magicdrawinghook");
goog.require("uno.realtime.hooks.resourcehook");
(function() {
  var util = uno.util;
  var log = goog.debug.Logger.getLogger("uno.realtime.Realtime");
  var ErrorCodes = {UNKNOWN:-1, SETUP_FAILURE:1};
  var Realtime = uno.realtime.Realtime = function() {
    this.yconfig = {connector:{name:"websockets-client", generateUserId:false, maxBufferLength:2000}};
    this.db = new Y.IndexedDB;
    this.y = null;
    this.modules = [];
    this.readOnly = true;
    uno.BasePlugin.call(this, log.getName());
  };
  goog.inherits(Realtime, uno.BasePlugin);
  Object.defineProperty(Realtime.prototype, "syncMetadata", {get:function() {
    return this.y && this.y.connector ? this.y.connector.syncMetadata : null;
  }});
  Realtime.prototype.init = function() {
    var self = this;
    if (!this.editor.config.realtime.enabled) {
      return;
    }
    uno.realtime.hooks.magicdrawinghook.register(this.editor);
    uno.realtime.hooks.resourcehook.register(this.editor);
    if (this.editor.config.note.guid) {
      this.yconfig.connector.room = this.editor.config.note.guid;
    } else {
      var letters = "0123456789ABCDEF";
      var roomname = "no-guid-";
      for (var i = 0; i < 6; i++) {
        roomname += letters[Math.floor(Math.random() * 16)];
      }
      this.yconfig.connector.room = roomname;
    }
    log.info("YJS Using Room: " + this.yconfig.connector.room);
    this.yconfig.connector.socketHandlers = {connect:function(success) {
      log.info("SOCKET EVENT: connect=" + success);
      if (success) {
        self.editor.dispatchEvent({type:"realtimeServerVersionUpdated"});
      }
      self.editor.dispatchEvent({type:"realtimeConnectStateChanged", connected:success});
      self.runModuleFunc("socketConnect", [success]);
    }, connectError:function() {
      log.info("SOCKET EVENT: connect_error");
      self.runModuleFunc("socketConnectError");
    }, reconnect:function(numAttempts) {
      log.info("SOCKET EVENT: reconnect(ed) " + numAttempts);
      self.runModuleFunc("socketReconnect", [numAttempts]);
    }, reconnectAttempt:function() {
      log.info("SOCKET EVENT: reconnect_attempt");
      self.runModuleFunc("socketReconnectAttempt");
    }, reconnectError:function(err) {
      log.info("SOCKET EVENT: reconnect_error: " + (typeof err === "object") ? err.message : err);
      self.runModuleFunc("socketReconnectError", [err]);
    }, disconnect:function() {
      log.info("SOCKET EVENT: disconnect");
      self.runModuleFunc("socketDisconnect");
    }};
    this.yconfig.connector.utilities = {noteSavedNotification:function(syncMetadata) {
      log.info("CE-YJS NOTIFICATION: note saved");
      self.editor.dispatchEvent({type:"realtimeNoteSavedNotification", syncMetadata:syncMetadata});
      self.runModuleFunc("realtimeNoteSaved");
    }, resetYjsModel:function() {
      if (window.YINFO != null) {
        self.db.removePersistedData(window.YINFO.guid);
      }
      log.info("CE-YJS NOTIFICATION: reload");
      self.editor.dispatchEvent({type:"reload"});
    }, errorHandler:function(error) {
      self.editor.dispatchEvent({type:"realtimeErrorHandler", error:error});
    }, permissionsHandler:function(readOnly) {
      log.info("CE-YJS Permissions: " + (readOnly ? "read" : "write"));
      self.readOnly = readOnly;
    }, userConnectionsHandler:function(connections, timestamp) {
      self.runModuleFunc("handleUserConnections", [connections, timestamp]);
    }};
    var context = this.editor.context;
    var config = this.editor.config;
    this.yconfig.connector.authToken = context.user.authToken;
    this.yconfig.connector.businessAuthToken = context.user.businessAuthToken;
    this.yconfig.connector.serviceHost = config.user.serviceHost;
    this.yconfig.connector.shardID = config.user.shardID;
    this.yconfig.connector.url = config.realtime.url;
    this.yconfig.connector.userName = config.user.displayName;
    this.yconfig.connector.newNote = config.note.newNote;
    this.yconfig.connector.noteTitle = config.note.title;
    this.yconfig.connector.notebookGuid = config.note.notebookGuid;
    this.yconfig.connector.dontWaitForServer = config.note.newNote;
    this.yconfig.connector.platform = config.client;
    var demopath = EN.getBuildPath() ? "http://localhost:8888/demo/" : "https://evernote.s3.amazonaws.com/ce/demo/latest/";
    window.YINFO = {guid:config.note.guid, name:config.user.displayName, authToken:context.user.authToken, businessAuthToken:context.user.businessAuthToken, serviceHost:config.user.serviceHost, shardID:config.user.shardID, url:this.yconfig.connector.url, debugURL:demopath + "index.html?client=" + config.client + "&realtimeURL=" + this.yconfig.connector.url + "&room=" + config.note.guid + "&userID=" + config.user.userID + "&authToken=" + context.user.authToken + "&businessAuthToken=" + context.user.businessAuthToken + 
    "&serviceHost=" + config.user.serviceHost + "&shardID=" + config.user.shardID + "&name=DBG-" + goog.string.urlEncode(config.user.displayName)};
    log.info("Launching YJS with config: " + JSON.stringify(EN.filterLogObject("yjs", this.yconfig), null, 2));
    this.y = new Y(this.yconfig.connector.room, this.yconfig, this.db, {gc:false});
    this.y.on("error", this.handleYjsError.bind(this));
    this.modules.push(new uno.realtime.modules.AISuggest(this.editor, this.y));
    this.modules.push(new uno.realtime.modules.UserConnections(this.editor, this.y));
    this.modules.push(new uno.realtime.modules.Editing(this.editor, this.y));
    this.modules.push(new uno.realtime.modules.Status(this.editor, this.y));
    if (this.editor.config.realtime.commenting === true) {
      this.modules.push(new uno.realtime.modules.Commenting(this.editor, this.y));
    }
    this.modules.push(new uno.realtime.modules.Selecting(this.editor, this.y));
    this.y.once("synced", function() {
      self.editor.dispatchEvent({type:"realtimeServerVersionUpdated"});
      self.editor.dispatchEvent({type:"realtimeSessionEstablished", syncMetadata:self.editor.realtime.syncMetadata});
    });
    Promise.race([this.y.when("synced").then(function() {
      return "synced";
    }), this.y.when("persistenceReady").then(function() {
      return "persistenceReady";
    })]).then(function(eventName) {
      log.info("Binding content based on yjs event: " + eventName);
      var delay = 0;
      if (context.realtime.delay) {
        delay = 10000;
        log.info("delaying realtime setup by " + delay / 1000 + " seconds");
      }
      return new Promise(function(resolve) {
        setTimeout(resolve(eventName), delay);
      });
    }).then(function(eventName) {
      var content = self.y.define("content", Y.Map);
      if (config.note.newNote && content.get("document") === undefined) {
        log.info("using editor content as initial state of yjs data");
        var model = content.set("document", Y.XmlFragment);
        model.insert(0, Y.DomBinding.domsToTypes(self.editor.field.childNodes, document, self.editor.context.realtime.hooks));
      }
      self.runModuleFunc("setupObservation");
    });
  };
  Realtime.prototype.handleYjsError = function(error) {
    log.error("There is a critical error has happened in YJS. Reload editor to reset y-model.");
    this.editor.dispatchEvent({type:"reload"});
  };
  Realtime.prototype.getRealtimeServerVersion = function() {
    if (!this.y || !this.y.connector) {
      return "";
    }
    return this.y.connector.serverVersion;
  };
  Realtime.prototype.runModuleFunc = function(funcName, args) {
    this.modules.forEach(function(module) {
      if (module[funcName]) {
        module[funcName].apply(module, args);
      }
    });
  };
})();
goog.provide("uno.util.analytics.tealium");
(function() {
  var tealium = uno.util.analytics.tealium;
  var commands = {bold:true};
  tealium.name = "tealium";
  tealium.dataForCommand = function(editor, command, value, success) {
    var config = editor.config;
    var operation = editor.context.operation;
    return commands[command] ? {subject:"note", operation:command, success:success ? "1" : "0", ce_version:config.version, is_clip:config.note.isWebclip || config.note.isEmail ? "1" : "0"} : undefined;
  };
  tealium.dataForEvent = function(editor, eventName, success) {
    var eventData = {subject:"note", operation:eventName, success:typeof success === "undefined" || success ? "1" : "0", ce_version:editor.config.version};
    return eventData;
  };
})();
goog.provide("uno.util.analytics");
goog.require("goog.debug.Logger");
goog.require("uno.util.analytics.tealium");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.analytics");
  var analytics = uno.util.analytics;
  var INTERVAL = 1000;
  var MAX_DELAY = 5000;
  var services = [uno.util.analytics.tealium];
  analytics.reportCommand = function(editor, command, value, success) {
    var buffer = editor.context.analytics.data;
    var shouldReport = false;
    services.forEach(function(service) {
      var data = service.dataForCommand(editor, command, value, success);
      if (data) {
        if (buffer[service.name] == null) {
          buffer[service.name] = [];
        }
        buffer[service.name].push(data);
        shouldReport = true;
      }
    });
    if (shouldReport) {
      queue(editor);
    }
  };
  analytics.reportEvent = function(editor, eventName, success) {
    var buffer = editor.context.analytics.data;
    var shouldReport = false;
    services.forEach(function(service) {
      var data = service.dataForEvent(editor, eventName, success);
      if (data) {
        if (buffer[service.name] == null) {
          buffer[service.name] = [];
        }
        buffer[service.name].push(data);
        shouldReport = true;
      }
    });
    if (shouldReport) {
      queue(editor);
    }
  };
  analytics.flush = function(editor) {
    var ctx = editor.context;
    if (ctx.analytics.timeoutId) {
      clearTimeout(ctx.analytics.timeoutId);
      ctx.analytics.waitUntil = 0;
      send(editor);
    }
  };
  function queue(editor) {
    var now = Date.now();
    var ctx = editor.context;
    ctx.analytics.waitUntil = now + INTERVAL;
    if (ctx.analytics.timeoutId == null) {
      ctx.analytics.startTime = now;
      ctx.analytics.timeoutId = setTimeout(send.bind(null, editor), INTERVAL);
    }
  }
  function send(editor) {
    if (!editor.isSetup || editor.isDisposed()) {
      return;
    }
    var ctx = editor.context;
    var now = Date.now();
    if (ctx.analytics.waitUntil <= now || ctx.analytics.waitUntil >= ctx.analytics.startTime + MAX_DELAY) {
      editor.dispatchEvent({type:"analytics", data:ctx.analytics.data});
      ctx.analytics.data = {};
      ctx.analytics.startTime = null;
      ctx.analytics.timeoutId = null;
      ctx.analytics.waitUntil = null;
    } else {
      var delay = Math.max(INTERVAL, ctx.analytics.startTime + MAX_DELAY - now);
      ctx.analytics.timeoutId = setTimeout(send.bind(null, editor), delay);
    }
  }
})();
goog.provide("uno.util.placeholder");
goog.require("goog.debug.Logger");
goog.require("uno.util.react");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.placeholder");
  var util = uno.util;
  var theEditor = null;
  util.placeholder.setup = function(editor) {
    theEditor = editor;
  };
  util.placeholder.show = function() {
    util.react.renderPlaceholder({visible:true, textStyles:getTextStyles(), isMobile:theEditor.config.client === "ios" || theEditor.config.client === "android", showTemplates:EN.isEnabled("templatemanager"), openTemplateManager:util.placeholder.openTemplateManager});
  };
  util.placeholder.hide = function() {
    util.react.renderPlaceholder({visible:false});
  };
  util.placeholder.openTemplateManager = EN.whenAppEnabled("templatemanager", function() {
    EN.activate("templatemanager");
  });
  function getTextStyles() {
    var styles = getComputedStyle(theEditor.field);
    var padding = styles.padding;
    if (theEditor.config.client === "android") {
      padding = [theEditor.field.offsetTop + parseInt(styles.paddingTop, 10), parseInt(styles.paddingRight, 10), parseInt(styles.paddingBottom, 10), theEditor.field.offsetLeft + parseInt(styles.paddingLeft, 10)].join("px ") + "px";
    }
    return {padding:padding, font:styles.font};
  }
})();
goog.provide("uno.util.http");
goog.require("goog.debug.Logger");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.http");
  var util = uno.util;
  util.http.fetchAsync = function(input, init) {
    log.fine("Fetching : " + (input.url || input));
    return fetch(input, init).then(function(response) {
      log.fine("Fetch response from : " + (input.url || input));
      log.fine(response);
      if (response.status >= 200 && response.status < 300) {
        return response;
      } else {
        var error = new Error(response.statusText);
        error.response = response;
        throw error;
      }
    });
  };
})();
goog.provide("uno.util.richlink.googledrive.android");
goog.require("uno.util.loc");
goog.require("uno.util.img.fixtures.android");
(function() {
  var android = uno.util.richlink.googledrive.android;
  var util = uno.util;
  android.getAccessRequestString = function() {
    return util.loc.t("Tap to request access");
  };
  android.getTapToConnectString = function() {
    return util.loc.t("Connect");
  };
  android.activateDrag = function(el) {
    return el;
  };
  android.getImagePath = function(editor) {
    return editor.config.images.path;
  };
  android.getImageDimensions = function() {
    return {width:320, height:60};
  };
  android.fixtures = uno.util.img.fixtures.android;
})();
goog.provide("uno.util.richlink.googledrive.generic");
goog.require("uno.util.loc");
(function() {
  var generic = uno.util.richlink.googledrive.generic;
  var util = uno.util;
  generic.getAccessRequestString = function() {
    return util.loc.t("Click to request access");
  };
  generic.getTapToConnectString = function() {
    return util.loc.t("Connect to see more");
  };
  generic.activateDrag = function(el) {
    return el;
  };
  generic.getImagePath = function(editor) {
    return editor.config.images.path;
  };
  generic.getImageDimensions = function() {
    return {width:380, height:55};
  };
})();
goog.provide("uno.util.richlink.googledrive.ios");
goog.require("uno.util.loc");
goog.require("uno.util.richlink.googledrive.generic");
(function() {
  var ios = uno.util.richlink.googledrive.ios;
  var util = uno.util;
  ios.getAccessRequestString = function() {
    return util.loc.t("Tap to request access");
  };
  ios.getTapToConnectString = function() {
    return util.loc.t("Connect");
  };
  ios.activateDrag = function(el) {
    return el;
  };
  ios.getImagePath = function(editor) {
    return util.richlink.googledrive.generic.getImagePath(editor);
  };
  ios.getImageDimensions = util.richlink.googledrive.generic.getImageDimensions;
})();
goog.provide("uno.util.img.fixtures.win");
goog.require("uno.util.img.fixtures.generic");
(function() {
  var util = uno.util;
  var generic = util.img.fixtures.generic;
  var fixtures = util.img.fixtures.win;
  fixtures.map = generic.map;
})();
goog.provide("uno.util.richlink.googledrive.win");
goog.require("uno.util.loc");
goog.require("uno.util.img.fixtures.win");
goog.require("uno.util.richlink.googledrive.generic");
(function() {
  var win = uno.util.richlink.googledrive.win;
  var util = uno.util;
  win.getAccessRequestString = function() {
    return util.loc.t("Click to request access");
  };
  win.getTapToConnectString = function() {
    return util.loc.t("Connect to see more");
  };
  win.activateDrag = function(el) {
    el.setAttribute("draggable", "false");
    return el;
  };
  win.getImagePath = function(editor) {
    return util.richlink.googledrive.generic.getImagePath(editor);
  };
  win.fixtures = uno.util.img.fixtures.win;
  win.getImageDimensions = util.richlink.googledrive.generic.getImageDimensions;
})();
goog.provide("uno.util.richlink.googledrive");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.editor.range");
goog.require("goog.string");
goog.require("uno.Auth");
goog.require("uno.defs");
goog.require("uno.util.canvas");
goog.require("uno.util.http");
goog.require("uno.util.img");
goog.require("uno.util.richlink");
goog.require("uno.util.richlink.googledrive.android");
goog.require("uno.util.richlink.googledrive.ios");
goog.require("uno.util.richlink.googledrive.generic");
goog.require("uno.util.richlink.googledrive.win");
goog.require("uno.util.attachment");
goog.require("uno.util.loc");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.richlink.googledrive");
  var defs = uno.defs;
  var util = uno.util;
  var googledrive = util.richlink.googledrive;
  var DRIVE_META_URL = "https://www.googleapis.com/drive/v2/files/";
  var DRIVE_LINK_RX = /https:\/\/(docs|drive).google.com\/[^\s"]+?[/=]([^\s/<#=%&@."?]{20,120})([^"<>\s&]*)/gi;
  var GOOGLE_DATE_RX = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.(\d{3})Z$/;
  var THUMBNAIL_RX = /s\d+$/g;
  var client = googledrive.generic;
  var imagePath = "images";
  googledrive.name = "google-drive";
  googledrive.lastInfo = {};
  googledrive.lastImageUrl = {};
  googledrive.uniqueIdCounter = 0;
  googledrive.setClient = function(clientName) {
    client = googledrive[clientName] || googledrive.generic;
  };
  googledrive.canDecorate = function(url) {
    DRIVE_LINK_RX.lastIndex = 0;
    return url && DRIVE_LINK_RX.test(url);
  };
  googledrive.decorate = function(el, editor) {
    imagePath = client.getImagePath(editor);
    var richlink = googledrive.convertAnchorToRichlink(el);
    var range = editor.getRange();
    if (range && range.isCollapsed() && editor.context.format === uno.defs.format.CLIPBOARD) {
      goog.editor.range.placeCursorNextTo(richlink);
    }
    googledrive.renderRichlinkAsync(richlink).then(function() {
      googledrive.updateRichlinkAsync(richlink, false, editor).catch(function(error) {
        if (error.refreshAuth) {
          return googledrive.updateRichlinkAsync(richlink, true, editor);
        }
      }).then(function() {
        var r = editor.getRange();
        if (r && r.isCollapsed && richlink.contains(r.getStartNode())) {
          goog.editor.range.placeCursorNextTo(richlink);
        }
      });
    });
    client.activateDrag(richlink);
  };
  googledrive.updateRichlinkAsync = function(richlink, refreshAuth, editor) {
    var cancelCachePromise = false;
    var cachedData = editor.cache.readMem(richlink.getAttribute("data-href"));
    if (cachedData) {
      googledrive.injectDataAsync(richlink, cachedData, editor);
    }
    editor.cache.readDiskAsync(richlink.getAttribute("data-href")).then(function(data) {
      if (!cancelCachePromise && data) {
        googledrive.injectDataAsync(richlink, data, editor);
        editor.cache.writeMem(richlink.getAttribute("data-href"), data);
      }
    });
    return editor.auth.getTokenAsync("google-drive", refreshAuth).then(function(token) {
      return googledrive.getDataFromProviderAsync(richlink, token, editor);
    }).then(function(data) {
      cancelCachePromise = true;
      return googledrive.injectDataAsync(richlink, data, editor);
    }).then(function() {
      editor.refreshUndoRedoState();
    }).catch(function(error) {
      return googledrive.injectErrorAsync(richlink, error, editor).then(function() {
        return editor.refreshUndoRedoState();
      });
    });
  };
  googledrive.undecorate = function(el) {
    var anchor = document.createElement("a");
    goog.array.forEach(el.attributes, function(attribute) {
      if (!/^(src|width|height)$/i.test(attribute.name)) {
        anchor.setAttribute(attribute.name, attribute.value);
      }
    });
    goog.dom.replaceNode(anchor, el);
    return anchor;
  };
  googledrive.getDataFromProviderAsync = function(el, token, editor) {
    DRIVE_LINK_RX.lastIndex = 0;
    var match = DRIVE_LINK_RX.exec(el.getAttribute("data-href"));
    var driveId = match[2];
    var url = DRIVE_META_URL + driveId;
    return util.http.fetchAsync(url, {headers:new Headers({Authorization:"Bearer " + token})}).then(function(response) {
      return response.json();
    }).then(function(data) {
      data.driveId = driveId;
      if (data.parents && data.parents.length > 0) {
        data.parentFolderLink = data.parents[0].parentLink;
      }
      el.setAttribute("data-parent-folder-link", data.parentFolderLink);
      if (data.mimeType) {
        el.setAttribute("data-type", data.mimeType);
      }
      if (data.title) {
        el.setAttribute("data-title", data.title);
      }
      el.setAttribute("data-alternate-link", data.alternateLink);
      editor.cache.write(el.getAttribute("data-href"), data);
      return data;
    }).catch(function(error) {
      if (error.response) {
        error.errorCode = error.errorCode || error.response.status;
      }
      throw error;
    });
  };
  googledrive.convertAnchorToRichlink = function(el) {
    var richlink = el;
    var displayType = util.richlink.getDisplayType(richlink);
    switch(displayType) {
      case util.richlink.DISPLAY_TYPE.MINIMAL:
        richlink = el;
        break;
      case util.richlink.DISPLAY_TYPE.SMALL:
      default:
        richlink = document.createElement("img");
        goog.array.forEach(el.attributes, function(attribute) {
          richlink.setAttribute(attribute.name, attribute.value);
        });
        goog.dom.replaceNode(richlink, el);
        break;
    }
    richlink.setAttribute("data-title", el.textContent);
    goog.dom.classlist.add(richlink, "en-richlink");
    return richlink;
  };
  googledrive.renderRichlinkAsync = function(richlink, iconSrc, line1, line2, connectText, thumbnailSrc, imageMeta, videoMeta) {
    richlink.setAttribute("data-icon", iconSrc || imagePath + "/loading_progress.svg");
    richlink.setAttribute("data-line1", line1 || richlink.getAttribute("data-line1") || richlink.getAttribute("data-title") || richlink.getAttribute("data-href"));
    richlink.setAttribute("data-line2", line2 || richlink.getAttribute("data-line2") || util.loc.t("Google Drive"));
    richlink.setAttribute("data-connect-text", connectText || "");
    richlink.setAttribute("data-connect-box", "");
    richlink.setAttribute("data-thumbnail", thumbnailSrc || "");
    switch(richlink.getAttribute("rev")) {
      case util.richlink.DISPLAY_TYPE.MINIMAL:
        return googledrive.renderMinimalRichlinkAsync(richlink, iconSrc, line1);
      case util.richlink.DISPLAY_TYPE.SMALL:
      default:
        return googledrive.renderSmallRichlinkAsync(richlink, iconSrc, line1, line2, connectText, thumbnailSrc, imageMeta, videoMeta);
    }
  };
  googledrive.renderMinimalRichlinkAsync = function(richlink, iconSrc, line1) {
    return Promise.try(function() {
      if (line1) {
        richlink.innerText = line1;
      }
      var mimeType = richlink.getAttribute("data-type") || googledrive.getMimeType(richlink.getAttribute("data-href"));
      var displayType = util.richlink.getDisplayType(richlink);
      var icon = util.attachment.getIconInfoFromFile(displayType, mimeType, line1 || richlink.getAttribute("data-title") || richlink.getAttribute("data-href"));
      goog.dom.classlist.removeAll(richlink, ["en-attach-icon-unknown", "en-attach-icon-generic"]);
      goog.dom.classlist.addAll(richlink, ["google-drive-minimal-title", icon]);
      return richlink;
    });
  };
  googledrive.renderSmallRichlinkAsync = function(richlink, iconSrc, line1, line2, connectText, thumbnailSrc, imageMeta, videoMeta) {
    var width = 380;
    var height = 55;
    var dimensions = client.getImageDimensions();
    if (dimensions) {
      width = dimensions.width;
      height = dimensions.height;
    }
    var canvas = util.canvas.create(width, height);
    var context = canvas.getContext("2d");
    var asyncRenderers;
    var showIconOverlay;
    richlink.setAttribute("width", width);
    richlink.style.minWidth = width + "px";
    richlink.setAttribute("height", height);
    showIconOverlay = richlink.getAttribute("data-icon") !== imagePath + "/loading_progress.svg";
    googledrive.renderMiddle(richlink.getAttribute("data-line1"), richlink.getAttribute("data-line2"), richlink.getAttribute("data-connect-text"), richlink, context);
    asyncRenderers = [googledrive.renderIconAsync(richlink.getAttribute("data-icon"), showIconOverlay, richlink, context), googledrive.renderMenuAsync(richlink, context)];
    if (thumbnailSrc) {
      asyncRenderers.push(googledrive.loadThumbnailAsync(richlink.getAttribute("data-thumbnail"), richlink, imageMeta, videoMeta));
    }
    return Promise.all(asyncRenderers.map(function(p) {
      return p.reflect();
    })).then(function(results) {
      if (thumbnailSrc) {
        var thumbnailPromise = results[2];
        if (thumbnailPromise.isFulfilled()) {
          canvas = googledrive.renderThumbnail(thumbnailPromise.value(), richlink, height, canvas);
        }
      }
      richlink.src = canvas.toDataURL();
      return richlink;
    });
  };
  googledrive.renderIconAsync = function(iconSrc, showOverlay, richlink, context) {
    var iconX;
    var iconY;
    var iconWidth;
    var iconHeight;
    var overlayPromise;
    var iconPromise = util.img.loadFromClientAsync(iconSrc, client);
    if (showOverlay) {
      overlayPromise = util.img.loadFromClientAsync(imagePath + "/att_src_icon_google_28.svg", client);
    } else {
      overlayPromise = Promise.resolve();
    }
    return iconPromise.then(function(img) {
      iconWidth = img.naturalWidth;
      iconHeight = img.naturalHeight;
      iconX = Math.floor((64 - iconWidth) / 2);
      iconY = Math.floor((richlink.getAttribute("height") - iconHeight) / 2) + 2;
      context.drawImage(img, iconX, iconY);
      return overlayPromise;
    }).then(function(img) {
      if (img) {
        var x = iconX + iconWidth - 20;
        var y = iconY + iconHeight - 20;
        context.drawImage(img, x, y, 20, 20);
      }
    });
  };
  googledrive.renderMiddle = function(line1, line2, connectText, richlink, context) {
    var line2width;
    context.save();
    context.fillStyle = "#2e2e2e";
    context.font = "500 14px sans-serif";
    var maxWidth = richlink.getAttribute("width");
    util.canvas.fillText(context, line1, 64, 25, maxWidth - 110);
    context.fillStyle = "#727272";
    context.font = "10px sans-serif";
    util.canvas.fillText(context, line2, 64, 43, maxWidth - 110);
    line2width = context.measureText(line2).width;
    context.restore();
    if (connectText) {
      googledrive.renderConnectText(connectText, line2width + 84, richlink, context);
    }
  };
  googledrive.renderConnectText = function(text, x, richlink, context) {
    var textWidth;
    context.save();
    context.fillStyle = "#37adfc";
    context.strokeStyle = "#37adfc";
    context.lineWidth = 1;
    context.font = "12px sans-serif";
    textWidth = context.measureText(text).width;
    util.canvas.fillText(context, text, x, 43, 270);
    context.beginPath();
    context.moveTo(x, 46);
    context.lineTo(x + textWidth, 46);
    context.stroke();
    context.restore();
    richlink.setAttribute("data-connect-box", JSON.stringify({left:x - 5, top:29, width:textWidth + 10, height:19}));
  };
  googledrive.renderMenuAsync = function(richlink, context) {
    return util.img.loadFromClientAsync(imagePath + "/overflow_menu.svg", client).then(function(img) {
      var x = richlink.width - 20 - 3;
      var y = Math.floor((richlink.getAttribute("height") - 12) / 2);
      context.drawImage(img, x, y);
    });
  };
  googledrive.loadThumbnailAsync = function(url, richlink, imageMeta, videoMeta) {
    var width = richlink.width;
    var height = 0;
    var ratio = -1;
    if (imageMeta && imageMeta.width && imageMeta.height) {
      ratio = imageMeta.height / imageMeta.width;
    }
    if (ratio < 0 || ratio > 0.62) {
      ratio = 0.62;
    }
    height = Math.round(ratio * width);
    var sizeString = "w" + width + (height > 0 ? "-h" + height : "") + "-p-k-nu";
    var thumbnailUrl = url.replace(THUMBNAIL_RX, sizeString);
    return util.img.loadFromClientAsync(thumbnailUrl, client);
  };
  googledrive.renderThumbnail = function(thumbnail, richlink, richlinkHeight, origCanvas) {
    var canvas = util.canvas.create(richlink.width, richlinkHeight + thumbnail.height);
    var context = canvas.getContext("2d");
    context.drawImage(origCanvas, 0, 0, util.canvas.width(origCanvas), util.canvas.height(origCanvas));
    context.drawImage(thumbnail, 0, richlinkHeight);
    richlink.src = "";
    richlink.width = util.canvas.width(canvas);
    richlink.height = util.canvas.height(canvas);
    return canvas;
  };
  googledrive.injectErrorAsync = function(el, error, editor) {
    var line2;
    var connectText;
    var displayType = util.richlink.getDisplayType(el);
    var lastErrorCode = editor.auth.getLastErrorCode(googledrive.name);
    if (displayType === util.richlink.DISPLAY_TYPE.MINIMAL) {
    } else {
      switch(error.errorCode) {
        case uno.Auth.ERROR_CODE_NO_AUTH:
        case uno.Auth.ERROR_CODE_INVALID_AUTH:
        case 401:
          if (lastErrorCode === uno.Auth.ERROR_CODE_NO_AUTH || lastErrorCode === uno.Auth.ERROR_CODE_INVALID_AUTH || lastErrorCode === 401) {
            line2 = util.loc.t("Google Drive");
            connectText = client.getTapToConnectString();
          } else {
            var authError = new Error;
            authError.refreshAuth = true;
            throw authError;
          }
          break;
        case uno.Auth.ERROR_CODE_NETWORK_ERROR:
        case 0:
          line2 = util.loc.t("Google Drive") + ": " + util.loc.t("Not available offline");
          break;
        case 403:
        case 404:
          line2 = client.getAccessRequestString();
          break;
        default:
          line2 = util.loc.t("Google Drive") + ": " + util.loc.t("Not available");
      }
    }
    var mimeType = googledrive.getMimeType(el.getAttribute("data-href"));
    var icon = imagePath + "/" + util.attachment.getIconInfoFromFile(displayType, mimeType, el.getAttribute("data-title") || el.getAttribute("data-href")) + ".svg";
    return googledrive.renderRichlinkAsync(el, icon, null, line2, connectText);
  };
  googledrive.getMimeType = function(url, data) {
    var mimeType = data ? data.mimeType : null;
    if (!mimeType) {
      if (url.indexOf("/document/") > -1) {
        mimeType = "application/vnd.google-apps.document";
      } else {
        if (url.indexOf("/spreadsheets/") > -1) {
          mimeType = "application/vnd.google-apps.spreadsheet";
        } else {
          if (url.indexOf("/presentation/") > -1) {
            mimeType = "application/vnd.google-apps.presentation";
          }
        }
      }
    }
    return mimeType;
  };
  googledrive.injectDataAsync = function(el, data) {
    if (!data) {
      return null;
    }
    var icon;
    var line1;
    var line2;
    var displayType = util.richlink.getDisplayType(el);
    var url = el.getAttribute("data-href");
    var title = data.title;
    var mimeType = googledrive.getMimeType(url, data);
    var thumbnail;
    var imageMeta;
    var videoMeta;
    if (title) {
      line1 = title;
    }
    if (displayType === util.richlink.DISPLAY_TYPE.SMALL) {
      var fileDescription = util.attachment.getFileTypeDescription(mimeType) || util.loc.t("Google Drive");
      var dateVal = googledrive.parseGoogleDate(data.modifiedDate);
      var dateString = dateVal && dateVal.toLocaleDateString();
      line2 = fileDescription;
      if (dateString) {
        line2 += ": " + util.loc.t("Modified") + " " + dateString;
      }
      icon = imagePath + "/" + uno.util.attachment.getIconInfoFromFile(displayType, mimeType, title || url) + ".svg";
      if (data.thumbnailLink && util.attachment.isThumbnailableMimeType(mimeType)) {
        thumbnail = data.thumbnailLink;
        imageMeta = data.imageMediaMetadata;
        videoMeta = data.videoMediaMetadata;
      }
    }
    return googledrive.renderRichlinkAsync(el, icon, line1, line2, null, thumbnail, imageMeta, videoMeta);
  };
  googledrive.parseGoogleDate = function(d) {
    try {
      var m = GOOGLE_DATE_RX.exec(d);
      var year = +m[1];
      var month = +m[2];
      var day = +m[3];
      var hour = +m[4];
      var minute = +m[5];
      var second = +m[6];
      var msec = +m[7];
      var tzOffset = (new Date).getTimezoneOffset();
      return new Date(year, month - 1, day, hour, minute - tzOffset, second, msec);
    } catch (exception) {
      log.info("error parsing date: " + (exception.stack || exception));
      return null;
    }
  };
  googledrive.reloadAsync = function(el, askUserForPermission, editor) {
    return editor.auth.getTokenAsync(googledrive.name, true, !!askUserForPermission).then(function(token) {
      return googledrive.getDataFromProviderAsync(el, token, editor);
    }).then(function(data) {
      googledrive.injectDataAsync(el, data, editor);
    }).catch(function(error) {
      googledrive.injectErrorAsync(el, error, editor);
    });
  };
  googledrive.openDoc = function(url, target, editor) {
    editor.dispatchEvent({type:"linkclick", target:target, data:{module:googledrive.name || "link", href:url}});
  };
  googledrive.buildOptions = function(el, optionsEl, editor) {
    var rect = optionsEl.getBoundingClientRect();
    var options = {href:el.getAttribute("data-href"), module:googledrive.name, ceOptions:{elementId:optionsEl.id, boundingbox:{left:rect.left, right:rect.right, top:rect.top, bottom:rect.bottom, height:rect.height, width:rect.width}, optionsArray:[{id:"open", text:util.loc.t("Open")}]}};
    var lastErrorCode = editor.auth.getLastErrorCode(googledrive.name);
    if (lastErrorCode === uno.Auth.ERROR_CODE_NO_AUTH || lastErrorCode === uno.Auth.ERROR_CODE_INVALID_AUTH || lastErrorCode === 401) {
      options.ceOptions.optionsArray.push({id:"connect", text:util.loc.t("Connect Google account")});
    }
    return options;
  };
  googledrive.isOverMenu = function(richlink, event) {
    var box = goog.style.getBounds(richlink);
    var overMenu = event.target === richlink && event.clientX > box.left + box.width - 46 && event.clientY <= box.top + 55;
    return overMenu;
  };
  googledrive.isOverConnectText = function(richlink, event) {
    var box = goog.style.getBounds(richlink);
    var overConnectText = false;
    if (!richlink.getAttribute("data-connect-box")) {
      return false;
    }
    try {
      var connectBox = JSON.parse(richlink.getAttribute("data-connect-box"));
      overConnectText = event.clientX > box.left + connectBox.left && event.clientX < box.left + connectBox.left + connectBox.width && event.clientY > box.top + connectBox.top && event.clientY < box.top + connectBox.top + connectBox.height;
    } catch (ex) {
      log.info(ex.stack || ex);
    }
    return overConnectText;
  };
  googledrive.handleClick = function(el, event, editor) {
    if (util.richlink.getDisplayType(el) === util.richlink.DISPLAY_TYPE.MINIMAL) {
      return false;
    }
    if (googledrive.isOverMenu(el, event)) {
      var options = googledrive.buildOptions(el, el, editor);
      editor.router.toHostAsync("showOptions", options).then(function(response) {
        if (response.selectedOptionId === "open") {
          googledrive.openDoc(el.getAttribute("data-href") || el.getAttribute("data-alternate-link"), el, editor);
        } else {
          if (response.selectedOptionId === "folder" && el.getAttribute("data-parent-folder-link")) {
            googledrive.openDoc(el.getAttribute("data-parent-folder-link"), el, editor);
          } else {
            if (response.selectedOptionId === "connect") {
              googledrive.reloadAsync(el, true, editor);
            }
          }
        }
      });
      event.preventDefault();
    } else {
      if (googledrive.isOverConnectText(el, event)) {
        googledrive.reloadAsync(el, true, editor);
        event.preventDefault();
      } else {
        googledrive.openDoc(el.getAttribute("data-href") || el.getAttribute("data-alternate-link"), el, editor);
      }
    }
    return true;
  };
  googledrive.handleMouseMove = function(el, event, editor) {
    if (util.richlink.getDisplayType(el) === util.richlink.DISPLAY_TYPE.MINIMAL) {
      return;
    }
    if (googledrive.isOverMenu(el, event)) {
      goog.dom.classlist.add(el, "google-drive-menu-hover");
    } else {
      goog.dom.classlist.remove(el, "google-drive-menu-hover");
    }
  };
  googledrive.handleMouseOut = function(el, event, editor) {
    if (util.richlink.getDisplayType(el) === util.richlink.DISPLAY_TYPE.MINIMAL) {
      return;
    }
    goog.dom.classlist.remove(el, "google-drive-menu-hover");
  };
})();
goog.provide("uno.util.touch");
(function() {
  var util = uno.util;
  var timer = 0;
  var pressure = 0;
  var longTouch = false;
  var multiTouch = 0;
  var scrolling = false;
  var x, y;
  var cx, cy;
  function handleTouch(e, editor) {
    multiTouch = Math.max(multiTouch, e.event_.touches && e.event_.touches.length || 1);
    timer = window.setTimeout(function() {
      pressure++;
      if (pressure > 5) {
        if (Math.abs(x - e.clientX) < 5 && Math.abs(x - cx) < 5 && Math.abs(y - e.clientY) < 5 && Math.abs(y - cy) < 5) {
          if (multiTouch <= 1 && !scrolling) {
            sendEvent(e, "longtouch");
            longTouch = true;
          }
        }
      } else {
        handleTouch(e, editor);
      }
    }, 100);
  }
  function handleTouchEnd() {
    window.clearTimeout(timer);
    pressure = 0;
    longTouch = false;
    multiTouch = 0;
    x = null;
    y = null;
    setTimeout(function() {
      scrolling = false;
    }, 150);
  }
  function handleScroll() {
    scrolling = true;
  }
  function sendEvent(e, eventName) {
    if (e.touches && e.touches.length) {
      e = e.touches[0];
    }
    var event = new MouseEvent(eventName, {target:e.target, touch:true, view:window, bubbles:true, cancelable:true, clientX:e.clientX, clientY:e.clientY});
    var preventDefault = event.preventDefault.bind(event);
    event.preventDefault = function() {
      e.preventDefault();
      preventDefault();
    };
    var target = e.target;
    target.dispatchEvent(event);
  }
  util.touch.init = function(editor) {
    editor.addListener("touchstart", function(e) {
      scrolling = false;
      x = cx = e.clientX;
      y = cy = e.clientY;
      handleTouch(e, editor);
    }, false, editor);
    editor.addListener("touchmove", function(e) {
      cx = e.clientX;
      cy = e.clientY;
    });
    editor.addListener("touchend", function(e) {
      if (x == null || y == null) {
        handleTouchEnd();
        return;
      }
      if (Math.abs(x - e.clientX) < 5 && Math.abs(y - e.clientY) < 5) {
        if (editor.inEditMode() && !longTouch) {
          sendEvent(e, "click");
        }
      }
      handleTouchEnd();
    }, false, editor);
    editor.addListener("touchcancel", function() {
      handleTouchEnd();
    }, false, editor);
    goog.events.listen(document, "selectstart", function(e) {
      if (util.resource.isResource(e.target)) {
        e.preventDefault();
      }
    });
    var win = editor.field.ownerDocument.defaultView;
    win.addEventListener("scroll", handleScroll, false, editor);
  };
  util.touch.touching = function() {
    return multiTouch > 0;
  };
})();
goog.provide("uno.Editor");
goog.require("goog.array");
goog.require("goog.debug.Logger");
goog.require("goog.dom.classes");
goog.require("goog.dom.Range");
goog.require("goog.editor.Field.EventType");
goog.require("goog.editor.SeamlessField");
goog.require("goog.editor.Plugin");
goog.require("goog.editor.plugins.BasicTextFormatter");
goog.require("goog.editor.plugins.EnterHandler");
goog.require("goog.editor.plugins.RemoveFormatting");
goog.require("goog.editor.plugins.SpacesTabHandler");
goog.require("goog.editor.plugins.TableEditor");
goog.require("uno.defs");
goog.require("uno.env");
goog.require("uno.featureflags");
goog.require("uno.EditorMultiRange");
goog.require("uno.EditorSelection");
goog.require("uno.commands.Accentuate");
goog.require("uno.commands.Active");
goog.require("uno.commands.ApplyTemplate");
goog.require("uno.commands.BasicTextFormatter");
goog.require("uno.commands.Bounds");
goog.require("uno.commands.Capitalize");
goog.require("uno.commands.CaretLocation");
goog.require("uno.commands.Changes");
goog.require("uno.commands.CodeBlock");
goog.require("uno.commands.Comment");
goog.require("uno.commands.Connection");
goog.require("uno.commands.Content");
goog.require("uno.commands.ControlTodos");
goog.require("uno.commands.Copy");
goog.require("uno.commands.Count");
goog.require("uno.commands.CreateLink");
goog.require("uno.commands.CreateTemplate");
goog.require("uno.commands.Crypt");
goog.require("uno.commands.Cut");
goog.require("uno.commands.Delete");
goog.require("uno.commands.DeleteNote");
goog.require("uno.commands.DeleteTable");
goog.require("uno.commands.DeleteTableCol");
goog.require("uno.commands.DeleteTableRow");
goog.require("uno.commands.Editable");
goog.require("uno.commands.Find");
goog.require("uno.commands.Focus");
goog.require("uno.commands.FontSize");
goog.require("uno.commands.ForeColor");
goog.require("uno.commands.ForwardDelete");
goog.require("uno.commands.Highlight");
goog.require("uno.commands.InsertHorizontalRule");
goog.require("uno.commands.InsertHtml");
goog.require("uno.commands.InsertText");
goog.require("uno.commands.InsertParagraph");
goog.require("uno.commands.InsertTable");
goog.require("uno.commands.InsertTableCol");
goog.require("uno.commands.InsertTableRow");
goog.require("uno.commands.FullSize");
goog.require("uno.commands.List");
goog.require("uno.commands.MergeCells");
goog.require("uno.commands.MigrateTable");
goog.require("uno.commands.SetNoteGuid");
goog.require("uno.commands.SyncMetadata");
goog.require("uno.commands.Shutdown");
goog.require("uno.commands.TableAlign");
goog.require("uno.commands.TableBorderColor");
goog.require("uno.commands.TableBorderWidth");
goog.require("uno.commands.TableCellColor");
goog.require("uno.commands.TableEqualCol");
goog.require("uno.commands.TableFitNote");
goog.require("uno.commands.TableVerticalAlign");
goog.require("uno.commands.Indent");
goog.require("uno.commands.InsertTodo");
goog.require("uno.commands.InsertDrawing");
goog.require("uno.commands.Lowercase");
goog.require("uno.commands.Margin");
goog.require("uno.commands.Outdent");
goog.require("uno.commands.Paste");
goog.require("uno.commands.PlainText");
goog.require("uno.commands.PrintPreview");
goog.require("uno.commands.Redo");
goog.require("uno.commands.RemoveFormat");
goog.require("uno.commands.Resources");
goog.require("uno.commands.RichlinksConvert");
goog.require("uno.commands.RichlinksRefresh");
goog.require("uno.commands.Search");
goog.require("uno.commands.SelectAll");
goog.require("uno.commands.Selection");
goog.require("uno.commands.SimpleText");
goog.require("uno.commands.Stats");
goog.require("uno.commands.Strikethrough");
goog.require("uno.commands.Tab");
goog.require("uno.commands.Underline");
goog.require("uno.commands.Undo");
goog.require("uno.commands.UndoRedo");
goog.require("uno.commands.Unlink");
goog.require("uno.commands.UpdateToken");
goog.require("uno.commands.Uppercase");
goog.require("uno.commands.ZoomScale");
goog.require("uno.filters.All");
goog.require("uno.listeners.AccentuateListener");
goog.require("uno.listeners.AttachmentListener");
goog.require("uno.listeners.AutoCorrectListener");
goog.require("uno.listeners.ChangeListener");
goog.require("uno.listeners.ClipboardListener");
goog.require("uno.listeners.CodeBlockListener");
goog.require("uno.listeners.CommentListener");
goog.require("uno.listeners.CryptListener");
goog.require("uno.listeners.DeleteListener");
goog.require("uno.listeners.DragDropListener");
goog.require("uno.listeners.EnterListener");
goog.require("uno.listeners.NoteListener");
goog.require("uno.listeners.ForwardDeleteListener");
goog.require("uno.listeners.HighlightListener");
goog.require("uno.listeners.ImgListener");
goog.require("uno.listeners.LinkListener");
goog.require("uno.listeners.ListListener");
goog.require("uno.listeners.RichlinkListener");
goog.require("uno.listeners.SearchResizeListener");
goog.require("uno.listeners.ShortcutListener");
goog.require("uno.listeners.SmartScrollListener");
goog.require("uno.listeners.TableListener");
goog.require("uno.listeners.TextInputListener");
goog.require("uno.listeners.TodoListener");
goog.require("uno.listeners.TodoListListener");
goog.require("uno.listeners.TypeBehindListener");
goog.require("uno.listeners.SelectionListener");
goog.require("uno.realtime.Realtime");
goog.require("uno.util.analytics");
goog.require("uno.util.canvas");
goog.require("uno.util.dom");
goog.require("uno.util.font");
goog.require("uno.util.img");
goog.require("uno.util.loc");
goog.require("uno.util.objects");
goog.require("uno.util.placeholder");
goog.require("uno.util.popovermenu");
goog.require("uno.util.resource");
goog.require("uno.util.richlink.googledrive");
goog.require("uno.util.touch");
goog.require("uno.util.todo");
goog.require("uno.util.tools");
(function() {
  var Field = goog.editor.Field;
  var log = goog.debug.Logger.getLogger("uno.Editor");
  var SeamlessField = goog.editor.SeamlessField;
  var Plugin = goog.editor.Plugin;
  var util = uno.util;
  var dispatchStyleChangeTimer = 0;
  if (goog.userAgent.GECKO) {
    goog.editor.BrowserFeature.HAS_CONTENT_EDITABLE = true;
  }
  var Editor = uno.Editor = function(id, options) {
    SeamlessField.call(this, id || "editor");
    options = this.initRequiredOptions(options);
    this.initConfig(options);
    this.initContext(options);
    this.realtime = null;
    this.cache = options.cache;
    this.auth = options.auth;
    this.router = options.router;
    this.dirty = false;
    this.empty = true;
    this.focused = false;
    this.isSetup = false;
    this.readOnly = options.rte.active === false || options.realtime.enabled;
    this.multirange = new uno.EditorMultiRange(this);
    this.lastCommand = null;
    this.cleanupListeners = [];
    this.showVirtualKeyboardOnFocus = true;
    this.isGeckoResizerEnabled = true;
    goog.dom.classes.add(document.body, this.config.client);
    this.config.defaults.foreColor = getComputedStyle(document.body).color;
    util.font.setClient(this.config.client);
    util.resource.setClient(this.config.client);
    util.todo.setClient(this.config.client);
    util.richlink.googledrive.setClient(this.config.client);
    this.listeners = {};
    this.handlers = [{name:"click", handler:"handleClick"}, {name:"longtouch", handler:"handleLongTouch"}, {name:"dblclick", handler:"handleDoubleClick"}, {name:"mousedown", handler:"handleMouseDown"}, {name:"mouseup", handler:"handleMouseUp"}, {name:"mouseover", handler:"handleMouseOver"}, {name:"mouseout", handler:"handleMouseOut"}, {name:"mousemove", handler:"handleMouseMove"}, {name:"dragstart", handler:"handleDragStart"}, {name:"dragover", handler:"handleDragOver"}, {name:"dragenter", handler:"handleDragEnter"}, 
    {name:"dragleave", handler:"handleDragLeave"}, {name:"dragexit", handler:"handleDragExit"}, {name:"drop", handler:"handleDrop"}, {name:"dragend", handler:"handleDragEnd"}, {name:"textInput", handler:"handleTextInput"}, {name:"input", handler:"handleInput"}, {name:"beforeinput", handler:"handleBeforeInput"}, {name:"compositionstart", handler:"handleCompositionStart"}, {name:"copy", handler:"handleCopy"}, {name:"cut", handler:"handleCut"}, {name:"paste", handler:"handlePaste"}, {name:"domupdate", 
    target:this, handler:"handleDomUpdate"}, {name:"beforeexeccommand", target:this, handler:"handleBeforeExecCommand"}, {name:"afterexeccommand", target:this, handler:"handleAfterExecCommand"}, {name:"delayedchange", target:this, handler:"handleDelayedChange"}, {name:"selectionchange", target:document, handler:"handleNativeSelectionChange"}, {name:"selectstart", target:document, handler:"handleSelectStart"}, {name:"resize", target:window, handler:"handleWindowResize"}, {name:"scroll", target:window, 
    handler:"handleScroll", capture:true}, {name:"contextmenu", target:window, handler:"handleContextMenu"}, {name:"winmouseup", eventname:"mouseup", target:window, handler:"handleWindowMouseUp"}, {name:"winmousedown", eventname:"mousedown", target:window, handler:"handleWindowMouseDown"}, {name:"winmousemove", eventname:"mousemove", target:window, handler:"handleWindowMouseMove"}, {name:"blur", target:window, handler:"handleBlur"}];
    this.handlers.forEach(function(property) {
      this.listeners[property.name] = [];
    }.bind(this));
    this.importDomFilters = [];
    this.allPluginsInOrder = [];
    this.queryCommandEnabledPlugins = [];
    this.richlinkProviders = [uno.util.richlink.googledrive];
    this.setFollowLinkInNewWindow(false);
    util.loc.init(this.config.locale);
    util.tools.preloadImages();
    util.img.preloadTools(this);
    util.popovermenu.setupPopoverMenus();
    util.placeholder.setup(this);
    if (uno.featureflags.read("templates") || options.templates && options.templates.enabled) {
      EN.enableApp("templatemanager");
    }
    this.initEvents();
    this.initPlugins();
    if (this.config.richlinks.cacheSupported) {
      this.cache.enableDisk();
    } else {
      this.cache.disableDisk();
    }
  };
  goog.inherits(Editor, SeamlessField);
  uno.EditorSelection(Editor);
  Editor.EventType = {ANALYTICS:"analytics", PRINT_READY:"printReady", IMAGE_CLICK:"imageclick", RESOURCE_DOUBLECLICK:"resourcedoubleclick", IMAGE_DOUBLECLICK:"imagedoubleclick", IMAGE_ANNOTATE:"annotate", IMAGE_PREVIEW:"preview", IMAGE_ROTATE:"rotate", CONTENT_LOADED:"contentloaded", LINK_CLICK:"linkclick", OPEN_LINK:"openLink", ENCRYPT:"encrypt", DECRYPT:"decrypt", CRYPT_DOUBLECLICK:"cryptdoubleclick", STYLE_CHANGED:"stylechanged", EDIT_MODE_CHANGED:"editmodechanged", CONTENT_CHANGED:"contentchanged", 
  ACTION_DENIED:"actiondenied", DOM_UPDATE:"domupdate", SHUTDOWN_COMPLETE:"shutdownComplete", RESOURCES_CHANGED:"resourcesChanged"};
  Object.keys(Field.EventType).forEach(function(key) {
    if (Field.EventType.hasOwnProperty(key)) {
      Editor.EventType[key] = Field.EventType[key];
    }
  });
  Editor.prototype.setup = function() {
    var options = {type:this.config.initialContentFormat, content:this.config.initialContent || this.config.defaults.html};
    this.makeEditable();
    if (this.config.realtime.enabled) {
      this.realtime.init();
    }
    if (this.readOnly) {
      this.leaveEditMode();
    }
    this.field.removeAttribute("role");
    this.execCommand("margin", this.config.margin);
    this.multirange.clear();
    if (goog.isDef(this.config.initialContent)) {
      this.execCommand("content", options);
    } else {
      this.setHtml(false, this.config.defaults.html, true);
    }
    this.updateEmpty();
    this.isSetup = true;
    if (!util.dom.isEmpty(this.field)) {
      setTimeout(function() {
        if (!util.dom.isEmpty(this.field)) {
          util.analytics.reportEvent(this, "view", true);
        }
      }.bind(this), 1000);
    }
  };
  Editor.prototype.makeEditable = function() {
    SeamlessField.prototype.makeEditable.call(this);
  };
  Editor.prototype.initEvents = function() {
    this.listen(Editor.EventType.DELAYEDCHANGE, this.onDelayedChange);
    this.listen(Editor.EventType.CONTENT_LOADED, this.onContentLoaded);
    this.listen(Editor.EventType.LOAD, this.onLoad);
    this.listen(Editor.EventType.UNLOAD, this.onUnload);
    this.listen(Editor.EventType.FOCUS, this.onFocus);
    this.listen(Editor.EventType.BLUR, this.onBlur);
    this.listen(Editor.EventType.BEFORESELECTIONCHANGE, this.onBeforeSelectionChange);
    this.listen(Editor.EventType.SELECTIONCHANGE, this.onSelectionChange);
    this.eventRegister.listen(document, "selectionchange", this.onSelectionChange);
    this.eventRegister.listenWithScope(document.body, "textInput", this.onTextInput, false, this);
    this.eventRegister.listenWithScope(document.body, "input", this.onInput, false, this);
  };
  Editor.prototype.registerPlugin = function(plugin) {
    SeamlessField.prototype.registerPlugin.call(this, plugin);
    this.handlers.forEach(function(property) {
      if (plugin[property.handler]) {
        this.listeners[property.name].push(plugin);
      }
    }, this);
    this.allPluginsInOrder.push(plugin);
    if (plugin.prepareContentsDom) {
      this.importDomFilters.push(plugin);
    }
    if (plugin.queryCommandEnabled) {
      this.queryCommandEnabledPlugins.push(plugin);
    }
  };
  Editor.prototype.unregisterPlugin = function(plugin) {
    SeamlessField.prototype.unregisterPlugin.call(this, plugin);
    this.handlers.forEach(function(property) {
      goog.array.remove(this.listeners[property.name], plugin);
    }, this);
    goog.array.remove(this.allPluginsInOrder, plugin);
    if (plugin.prepareContentsDom) {
      goog.array.remove(this.importDomFilters, plugin);
    }
    if (plugin.queryCommandEnabled) {
      goog.array.remove(this.queryCommandEnabledPlugins, plugin);
    }
  };
  Editor.prototype.initPlugins = function() {
    this.registerPlugin(new uno.listeners.ShortcutListener);
    this.registerPlugin(new goog.editor.plugins.BasicTextFormatter);
    this.registerPlugin(new goog.editor.plugins.RemoveFormatting);
    this.registerPlugin(new goog.editor.plugins.TableEditor);
    if (this.config.realtime.enabled) {
      this.realtime = new uno.realtime.Realtime;
      this.registerPlugin(this.realtime);
      if (this.config.realtime.commenting) {
        this.registerPlugin(new uno.commands.Comment);
      }
      this.registerPlugin(new uno.commands.Connection);
      this.registerPlugin(new uno.commands.DeleteNote);
      this.registerPlugin(new uno.commands.SyncMetadata);
      this.registerPlugin(new uno.commands.UpdateToken);
    }
    this.registerPlugin(new uno.commands.Shutdown);
    this.registerPlugin(new uno.commands.Accentuate);
    this.registerPlugin(new uno.commands.Active);
    this.registerPlugin(new uno.commands.ApplyTemplate);
    this.registerPlugin(new uno.commands.BasicTextFormatter);
    this.registerPlugin(new uno.commands.Bounds);
    this.registerPlugin(new uno.commands.Capitalize);
    this.registerPlugin(new uno.commands.CaretLocation);
    this.registerPlugin(new uno.commands.Changes);
    this.registerPlugin(new uno.commands.CodeBlock);
    this.registerPlugin(new uno.commands.Content);
    this.registerPlugin(new uno.commands.ControlTodos);
    this.registerPlugin(new uno.commands.Copy);
    this.registerPlugin(new uno.commands.Count);
    this.registerPlugin(new uno.commands.CreateLink);
    this.registerPlugin(new uno.commands.CreateTemplate);
    this.registerPlugin(new uno.commands.Crypt);
    this.registerPlugin(new uno.commands.Cut);
    this.registerPlugin(new uno.commands.Delete);
    this.registerPlugin(new uno.commands.DeleteTable);
    this.registerPlugin(new uno.commands.DeleteTableCol);
    this.registerPlugin(new uno.commands.DeleteTableRow);
    this.registerPlugin(new uno.commands.Editable);
    this.registerPlugin(new uno.commands.Find(this.config));
    this.registerPlugin(new uno.commands.Focus);
    this.registerPlugin(new uno.commands.FontSize);
    this.registerPlugin(new uno.commands.ForeColor);
    this.registerPlugin(new uno.commands.ForwardDelete);
    this.registerPlugin(new uno.commands.Highlight);
    this.registerPlugin(new uno.commands.InsertHorizontalRule);
    this.registerPlugin(new uno.commands.InsertHtml);
    this.registerPlugin(new uno.commands.InsertText);
    this.registerPlugin(new uno.commands.InsertParagraph);
    this.registerPlugin(new uno.commands.InsertTable);
    this.registerPlugin(new uno.commands.InsertTableCol);
    this.registerPlugin(new uno.commands.InsertTableRow);
    this.registerPlugin(new uno.commands.List);
    this.registerPlugin(new uno.commands.MergeCells);
    this.registerPlugin(new uno.commands.MigrateTable);
    this.registerPlugin(new uno.commands.FullSize);
    this.registerPlugin(new uno.commands.TableAlign);
    this.registerPlugin(new uno.commands.TableBorderColor);
    this.registerPlugin(new uno.commands.TableBorderWidth);
    this.registerPlugin(new uno.commands.TableCellColor);
    this.registerPlugin(new uno.commands.TableEqualCol);
    this.registerPlugin(new uno.commands.TableFitNote);
    this.registerPlugin(new uno.commands.TableVerticalAlign);
    this.registerPlugin(new uno.commands.Indent);
    this.registerPlugin(new uno.commands.InsertTodo);
    this.registerPlugin(new uno.commands.InsertDrawing);
    this.registerPlugin(new uno.commands.Lowercase);
    this.registerPlugin(new uno.commands.Margin);
    this.registerPlugin(new uno.commands.Outdent);
    this.registerPlugin(new uno.commands.Paste(this.config));
    this.registerPlugin(new uno.commands.PlainText);
    this.registerPlugin(new uno.commands.PrintPreview);
    this.registerPlugin(new uno.commands.Redo);
    this.registerPlugin(new uno.commands.RemoveFormat);
    this.registerPlugin(new uno.commands.Resources);
    this.registerPlugin(new uno.commands.RichlinksConvert);
    this.registerPlugin(new uno.commands.RichlinksRefresh);
    this.registerPlugin(new uno.commands.Search);
    this.registerPlugin(new uno.commands.SelectAll);
    this.registerPlugin(new uno.commands.Selection);
    this.registerPlugin(new uno.commands.SetNoteGuid);
    this.registerPlugin(new uno.commands.SimpleText);
    this.registerPlugin(new uno.commands.Stats);
    this.registerPlugin(new uno.commands.Strikethrough);
    this.registerPlugin(new uno.commands.Tab);
    this.registerPlugin(new uno.commands.Underline);
    this.registerPlugin(new uno.commands.Undo);
    this.registerPlugin(new uno.commands.UndoRedo);
    this.registerPlugin(new uno.commands.Unlink);
    this.registerPlugin(new uno.commands.Uppercase);
    this.registerPlugin(new uno.commands.ZoomScale);
    var allFiltersPM = uno.filters.All();
    var self = this;
    allFiltersPM.forEach(function(plugin) {
      self.registerPlugin(plugin);
    });
    this.registerPlugin(new uno.listeners.ClipboardListener);
    this.registerPlugin(new uno.listeners.DragDropListener);
    this.registerPlugin(new uno.listeners.TableListener);
    this.registerPlugin(new goog.editor.plugins.EnterHandler);
    this.registerPlugin(new uno.listeners.AccentuateListener);
    this.registerPlugin(new uno.listeners.AttachmentListener);
    this.registerPlugin(new uno.listeners.AutoCorrectListener);
    this.registerPlugin(new uno.listeners.ChangeListener);
    this.registerPlugin(new uno.listeners.CodeBlockListener);
    this.registerPlugin(new uno.listeners.CryptListener);
    if (this.config.realtime.commenting) {
      this.registerPlugin(new uno.listeners.CommentListener);
    }
    this.registerPlugin(new uno.listeners.TypeBehindListener);
    this.registerPlugin(new uno.listeners.DeleteListener);
    this.registerPlugin(new uno.listeners.EnterListener);
    this.registerPlugin(new uno.listeners.ForwardDeleteListener);
    this.registerPlugin(new uno.listeners.HighlightListener);
    this.registerPlugin(new uno.listeners.RichlinkListener);
    this.registerPlugin(new uno.listeners.TodoListener);
    this.registerPlugin(new uno.listeners.LinkListener);
    this.registerPlugin(new uno.listeners.ImgListener);
    this.registerPlugin(new uno.listeners.ListListener);
    this.registerPlugin(new goog.editor.plugins.SpacesTabHandler);
    this.registerPlugin(new uno.listeners.TextInputListener);
    this.registerPlugin(new uno.listeners.TodoListListener);
    this.registerPlugin(new uno.listeners.NoteListener);
    this.registerPlugin(new uno.listeners.SearchResizeListener);
    this.registerPlugin(new uno.listeners.SmartScrollListener);
    this.registerPlugin(new uno.listeners.SelectionListener);
  };
  Editor.prototype.initRequiredOptions = function(opt) {
    var options = opt || {};
    options.clipboard = options.clipboard || {};
    options.env = options.env || {};
    options.env.margin = options.env.margin || {};
    options.env.margin.scroll = options.env.margin.scroll || {};
    options.env.margin.offset = options.env.margin.offset || {};
    options.note = options.note || {};
    options.realtime = options.realtime || {};
    options.rte = options.rte || {};
    options.rte.imageConfig = options.rte.imageConfig || {};
    options.rte.layoutManager = options.rte.layoutManager || {};
    options.rte.locale = options.rte.locale || "en_US";
    options.rte.resourceConfig = options.rte.resourceConfig || {};
    options.rte.typebehind = options.rte.typebehind || {};
    options.user = options.user || {};
    return options;
  };
  Editor.prototype.initContext = function(options) {
    this.context = {analytics:{data:{}, startTime:null, timeoutId:null, waitUntil:null}, commenting:{skipSelection:false, comments:{}, threads:{}, threadPlaceholders:{}, ui:{}}, copyPaste:{}, crypt:{uniqueIdCounter:0, incrementUniqueId:function() {
      return ++this.uniqueIdCounter;
    }}, dragState:{dragStartedInNote:false, nativeDrag:false, selection:null, dataTransfer:null, dataTransferContent:{}, handleOutsideDrop:null, dropTarget:null, dropline:null, dragType:"", target:null, dragging:false, hintKeyPressed:false, mousedown:false, preventDrag:false, dragContentTypes:[], draggedNodes:[], scrolling:false, position:{}, scrollId:0, ghost:null, copiedContent:null, initialCoordinates:{}}, format:uno.defs.format.CLIENT_HTML, hasTempStyles:false, images:{annotateButton:null, annotateHoverButton:null, 
    previewButton:null, previewHoverButton:null, rotateButton:null, rotateHoverButton:null, popoverMenu:uno.featureflags.read("imagepopovermenu") || false}, inNormalizedRegion:null, layoutManager:{list:options.rte.layoutManager.list == null ? true : options.rte.layoutManger.list, table:options.rte.layoutManager.table == null ? true : options.rte.layoutManger.table, todo:options.rte.layoutManager.todo == null ? true : options.rte.layoutManger.todo}, statusbar:{version:EN.getVersion(), actions:{debug:options.realtime.enabled && 
    options.debug ? function() {
      if (this.config.client === "web") {
        window.open(window.YINFO.debugURL, "_blank");
      } else {
        EN.notifyAsync("openLink", {href:window.YINFO.debugURL, kind:"debug", sharing:false});
      }
    }.bind(this) : null, archive:options.realtime.enabled && options.realtime.commenting ? function() {
      EN.execCommand("comment", {action:"openarchive"});
    } : null}, users:[], features:[{name:"Backspace Undo Typebehind", checked:uno.featureflags.read("undotypebehind"), handler:function(checked) {
      ed.context.typebehind.undo = checked;
      ed.context.statusbar.features[0].checked = checked;
      uno.featureflags.save("undotypebehind", checked);
    }}, {name:"Image Popover Menu", checked:uno.featureflags.read("imagepopovermenu"), handler:function(checked) {
      ed.context.images.popoverMenu = checked;
      ed.context.statusbar.features[1].checked = checked;
      uno.featureflags.save("imagepopovermenu", checked);
    }}, {name:"Templates", checked:uno.featureflags.read("templates"), handler:function(checked) {
      ed.context.statusbar.features[2].checked = checked;
      uno.featureflags.save("templates", checked);
      if (checked || options.templates && options.templates.enabled) {
        EN.enableApp("templatemanager");
      } else {
        EN.disableApp("templatemanager");
      }
      ed.updateEmpty();
    }}, options.realtime.enabled ? {name:"RTE Artificial Delay", checked:uno.featureflags.read("realtimedelay"), handler:function(checked) {
      ed.context.realtime.delay = checked;
      ed.context.statusbar.features[3].checked = checked;
      uno.featureflags.save("realtimedelay", checked);
    }} : null, options.realtime.enabled ? {name:"RTE Undo/Redo", checked:uno.featureflags.read("realtimeundo"), handler:function(checked) {
      ed.config.realtime.undo = checked;
      ed.context.statusbar.features[4].checked = checked;
      uno.featureflags.save("realtimeundo", checked);
    }} : null].filter(Boolean), realtime:!!options.realtime.enabled, loading:!!options.realtime.enabled, error:false, readonly:options.rte.active === false || options.realtime.enabled, dirty:false, focus:false}, operation:{inNormalizedRegion:null, structures:[]}, pendingTodo:false, realtime:{connected:false, delay:uno.featureflags.read("realtimedelay") || false, saved:true, hooks:{}}, resources:options.rte.resources || {}, savedRanges:[], style:{state:{}, value:{}, enabled:{}}, typebehind:{undo:uno.featureflags.read("undotypebehind") || 
    false}, user:{authToken:options.user.authToken, businessAuthToken:options.user.businessAuthToken}, userConnections:{cacheTimestamp:-1, cacheKey:null, items:[], match:function(query) {
      var state = this.context.userConnections;
      return state._match ? state._match(query) : [];
    }.bind(this)}};
  };
  Editor.prototype.initConfig = function(options) {
    this.config = {accentuate:options.accentuate || {clearOnClickSelector:"en-note"}, client:options.env.client || uno.env.getClient(), clipboard:{intercept:options.clipboard.intercept || false}, crypt:{unveilCryptElementOnClick:false, readOnly:options.rte.cryptReadOnly || false}, debug:!!options.debug, defaults:{html:"<div><br></div>", plainTextFont:options.env.defaultPlainTextFont || "Courier New", richTextFont:options.env.defaultNoteFont || "sans-serif", selectionColor:"rgb(178, 215, 255)", fontSize:"", 
    fontFamily:"", foreColor:"rgb(0, 0, 0)"}, disableBackgroundPrint:!!options.disableBackgroundPrint, find:options.find || {}, images:{path:options.rte.imageConfig.path || "images", annotate:!!options.rte.imageConfig.annotate, preview:!!options.rte.imageConfig.preview, resize:!options.realtime.enabled && (!!options.rte.imageConfig.resize || !!options.rte.imageResizing), rotate:!!options.rte.imageConfig.rotate, horizontalThreshold:options.rte.smartMarginThreshold || 0, androidPath:"http://android.local/images"}, 
    initialContent:options.rte.enml || options.rte.html, initialContentFormat:options.rte.enml ? uno.defs.format.ENML : uno.defs.format.CLIENT_HTML, locale:options.rte.locale || "en_US", margin:{note:options.env.margin.note, scroll:{top:options.env.margin.scroll.top || 0, left:options.env.margin.scroll.left || 0, bottom:options.env.margin.scroll.bottom || 0, right:options.env.margin.scroll.right || 0}, offset:{height:options.env.margin.offset.height || 0, width:options.env.margin.offset.width || 
    0}}, multirange:true, noNormalize:options.noNormalize, note:{contentClass:options.note.contentClass, guid:options.note.guid, notebookGuid:options.note.notebookGuid, newNote:options.note.newNote || false, source:options.note.source, sourceURL:options.note.sourceURL, sourceApplication:options.note.sourceApplication, title:options.note.title, isWebclip:["Clearly", "External", "web.clip", "web.clip7"].indexOf(options.note.source) > -1, isEmail:/^e?mail/i.test(options.note.source), isNormalized:null}, 
    realtime:{commenting:!!options.realtime.commenting, enabled:options.realtime.enabled || false, undo:uno.featureflags.read("realtimeundo") || false, url:options.realtime.url || "https://rte.www.evernote.com"}, resourceConfig:{openLinkNotifications:!!options.rte.resourceConfig.openLinkNotifications}, richlinks:{enabled:options.rte.richLinks && !options.realtime.enabled || false, cacheSupported:options.rte.richLinkCaching || false}, smartScrollEnabled:options.rte.smartScroll, stayInEditMode:options.stayInEditMode !== 
    false, style:{table:{borderCollapse:"collapse", tableLayout:"fixed", cell:{width:264, borderWidth:1, borderColor:"#d3d3d3", borderStyle:"solid", padding:"10px", margin:"0px"}}}, trackchanges:{state:options.rte.trackStateChanges || [], value:options.rte.trackValueChanges || [], enabled:options.rte.trackEnabledChanges || []}, typebehind:{code:options.rte.typebehind.code || false, email:options.rte.typebehind.email || false, emoticon:options.rte.typebehind.emoticon || false, horizontalrule:options.rte.typebehind.horizontalrule || 
    false, inline:options.rte.typebehind.inline || false, list:options.rte.typebehind.list || false, phone:options.rte.typebehind.phone || false, table:options.rte.typebehind.table || false, todo:options.rte.typebehind.todo || false, url:options.rte.typebehind.url || false}, version:options.version, user:{displayName:options.user.displayName, serviceHost:options.user.serviceHost, shardID:options.user.shardID, userID:options.user.userID}};
  };
  Editor.prototype.onLoad = function() {
    var el = this.getElement();
    var me = this;
    me.handlers.forEach(function(property) {
      var src = property.target || me.field;
      var type = property.eventname || property.name;
      var capture = property.capture === true;
      var handler = function(event) {
        me.listeners[property.name].some(function(plugin) {
          if (property.name === "selectionchange" && me.multirange.isInvoking()) {
            return false;
          }
          return plugin.isEnabled(me) && plugin[property.handler](event);
        });
      };
      me.eventRegister.listenWithScope(src, type, handler, capture, me);
    });
    uno.util.touch.init(this);
    this.updateEmpty();
    var computedStyle = window.getComputedStyle(el);
    this.config.defaults.fontSize = computedStyle.fontSize;
    this.config.defaults.fontFamily = computedStyle.fontFamily.replace(/["']/g, "");
    setTimeout(function() {
      me.leaveEditMode();
    });
  };
  Editor.prototype.onUnload = function() {
    this.isSetup = false;
  };
  Editor.prototype.isFocused = function() {
    return this.focused;
  };
  Editor.prototype.suppressFocusDuring = function(fn) {
    function focusListener(e) {
      e.stopPropagation();
      this.blur();
    }
    this.listen(Editor.EventType.FOCUS, focusListener, true, this);
    try {
      return fn.apply(this);
    } finally {
      this.unlisten(Editor.EventType.FOCUS, focusListener, true, this);
    }
  };
  Editor.prototype.inEditMode = function() {
    return this.field && this.field.getAttribute("contenteditable") === "true";
  };
  Editor.prototype.enablePlugins = function() {
    var editor = this;
    editor.allPluginsInOrder.forEach(function(plugin) {
      plugin.enable(editor);
    });
  };
  Editor.prototype.disablePlugins = function() {
    var editor = this;
    editor.allPluginsInOrder.forEach(function(plugin) {
      if (!plugin.activeOnUneditableFields()) {
        plugin.disable(editor);
      }
    });
  };
  Editor.prototype.hasProtectedContent = function(frag) {
    var node = frag || this.field;
    var source = this.config.note.source;
    var hasContentClass = !!this.config.note.contentClass;
    var hasWebclipSource = this.config.note.isWebclip;
    var hasEmailSource = this.config.note.isEmail;
    var hasMarxicoSource = /maxiang/i.test(source);
    var hasPostboxSourceUrl = /postbox/i.test(this.config.note.sourceURL);
    var hasBlockSpans = !!node && !!node.querySelector('span[style*="display: block"],span[style*="display:block"]');
    return hasContentClass || hasWebclipSource || hasEmailSource || hasMarxicoSource || hasPostboxSourceUrl || hasBlockSpans;
  };
  Editor.prototype.hasForeignSource = function() {
    var source = this.config.note.source;
    var hasContentClass = !!this.config.note.contentClass;
    var hasWebclipSource = this.config.note.isWebclip;
    var hasEmailSource = this.config.note.isEmail;
    var hasMarxicoSource = /maxiang/i.test(source);
    var hasPostboxSourceUrl = /postbox/i.test(this.config.note.sourceURL);
    return hasContentClass || hasWebclipSource || hasEmailSource || hasMarxicoSource || hasPostboxSourceUrl;
  };
  Editor.prototype.enterEditMode = function(options) {
    if (this.readOnly) {
      return;
    }
    options = Object.assign({range:null, focus:true}, options);
    var range = options.range;
    var focus = options.focus;
    var changed = false;
    if (this.isGeckoResizerEnabled) {
      this.disableGeckoResizer();
    }
    if (!this.inEditMode()) {
      this.field.setAttribute("contenteditable", "true");
      goog.dom.classlist.add(this.field, "editmode");
      goog.dom.classlist.remove(this.field, "viewmode");
      this.enablePlugins();
      if (range) {
        this.restoreRange(range);
      }
      changed = true;
    }
    if (focus) {
      this.focus();
      this.updateUndoCursorPosition();
    }
    if (changed) {
      this.dispatchEvent(Editor.EventType.EDIT_MODE_CHANGED);
    }
  };
  Editor.prototype.disableGeckoResizer = function() {
    if (goog.userAgent.GECKO) {
      document.execCommand("enableInlineTableEditing", null, false);
      document.execCommand("enableObjectResizing", null, false);
    }
    this.isGeckoResizerEnabled = false;
  };
  Editor.prototype.setHtml = function() {
    SeamlessField.prototype.setHtml.apply(this, arguments);
    var note = this.field;
    var startNode = note.firstChild || note;
    var startOffset = 0;
    var endNode = note.lastChild || note;
    var endOffset = note.lastChild ? note.lastChild.childNodes.length : 0;
    var range = goog.dom.Range.createFromNodes(startNode, startOffset, endNode, endOffset);
    this.dispatchEvent({type:Editor.EventType.DOM_UPDATE, range:range, paste:false});
  };
  Editor.prototype.leaveEditMode = function(force) {
    if (!this.readOnly && force !== true) {
      if (!this.inEditMode() || this.config.stayInEditMode) {
        return;
      }
    }
    if (this.field) {
      this.field.removeAttribute("contenteditable");
      goog.dom.classlist.add(this.field, "viewmode");
      goog.dom.classlist.remove(this.field, "editmode");
      this.disablePlugins();
      this.field.blur();
    }
    this.dispatchEvent(Editor.EventType.EDIT_MODE_CHANGED);
  };
  Editor.prototype.openFullSize = function(sender, opt) {
    var state = this.context.fullsize;
    if (state && state.enabled) {
      log.warning("Fullsize mode is already opened, blocking redundant request.");
      return;
    } else {
      if (state && state.pending) {
        log.warning("Fullsize request is pending, blocking redundant request.");
        return;
      }
    }
    this.context.fullsize = {scrollY:window.scrollY, enabled:false, pending:true, owner:sender};
    EN.notifyAsync("fullsize", Object.assign(opt || {}, {action:"open", sender:sender}));
  };
  Editor.prototype.closeFullSize = function(sender) {
    var state = this.context.fullsize;
    if (!state || state && !state.enabled) {
      log.warning("Fullsize mode is not enabled, blocking wrong request.");
      return;
    } else {
      if (state && state.pending) {
        log.warning("Fullsize request is pending, blocking redundant request.");
        return;
      }
    }
    this.context.fullsize.pending = true;
    EN.notifyAsync("fullsize", {action:"close", sender:sender});
  };
  Editor.prototype.onFocus = function() {
    this.enterEditMode({focus:false});
    this.focused = true;
    this.dispatchStyleChange();
    var range = this.getRange();
    if (range && range.getStartNode() === this.field && range.getStartOffset() === 0) {
      if (!this.field.firstChild) {
        this.field.innerHTML = this.config.defaults.html;
      }
      goog.dom.Range.createCaret(this.field.firstChild, 0).select();
    }
  };
  Editor.prototype.onBlur = function() {
    this.leaveEditMode();
    this.focused = false;
  };
  Editor.prototype.blur = function() {
    var range = this.saveRange();
    if (this.field) {
      this.field.blur();
    }
    if (range) {
      range.select();
    }
  };
  Editor.prototype.saveRange = function(forceRange) {
    var range = forceRange || this.getRange();
    if (range) {
      this.savedRange = range.saveUsingDom();
      this.currentRange = range;
    }
    return range;
  };
  Editor.prototype.restoreRange = function(range) {
    if (goog.isObject(range)) {
      range.select();
    } else {
      var didSetSelection = false;
      if (this.savedRange != null && this.savedRange.isDisposed && !this.savedRange.isDisposed()) {
        try {
          var restoredRange = this.savedRange.restore();
          restoredRange.select();
          didSetSelection = true;
        } catch (err) {
          log.fine(err.stack || err);
        }
      }
      if (!didSetSelection) {
        this.placeCursorAtEnd();
      }
      this.savedRange = null;
    }
  };
  Editor.prototype.saveRangeWithCarets = function(range) {
    this.context.savedRanges.push(range.saveUsingCarets());
  };
  Editor.prototype.restoreRangeWithCarets = function() {
    var savedRange = this.context.savedRanges.pop();
    if (!savedRange) {
      throw new Error("no saved range found in Editor.restoreRangeWithCarets");
    }
    var range = savedRange.restore();
    if (range) {
      var container = range.getContainer();
      if (util.dom.isElementNode(container)) {
        container.normalize();
      }
    }
    return this.getRange();
  };
  Editor.prototype.cleanup = function() {
    if (this.isSetup) {
      util.analytics.flush(this);
      this.cleanupListeners.forEach(function(listener) {
        try {
          listener(this);
        } catch (err) {
          log.warning("Cleanup listener error: ", err);
        }
      });
      var field = this.field;
      this.makeUneditable(true);
      while (field.firstChild) {
        field.removeChild(field.firstChild);
      }
      this.dispose();
      window.ed = null;
    }
  };
  Editor.prototype.listenForCleanup = function(f) {
    this.cleanupListeners.push(f);
  };
  Editor.prototype.onBeforeSelectionChange = function() {
    this.updateUndoCursorPosition();
  };
  Editor.prototype.onDelayedChange = function() {
    this.dirty = true;
    this.context.isLargeNote = this.field.getElementsByTagName("*").length > 1e4;
  };
  Editor.prototype.onContentLoaded = function() {
    this.context.isLargeNote = this.field.getElementsByTagName("*").length > 1e4;
  };
  function shouldCalculateStyleChange(currentRange, newRange) {
    if (currentRange && newRange) {
      var startNode = newRange.getStartNode();
      var newStartNode = currentRange.getStartNode();
      var endNode = newRange.getEndNode();
      var newEndNode = currentRange.getEndNode();
      if (startNode !== newStartNode || endNode !== newEndNode || util.dom.isElementNode(startNode) || util.dom.isElementNode(endNode)) {
        return true;
      }
    }
    return false;
  }
  function calculateNewStyle(trackchanges, currentStyle) {
    var hasChanges = false;
    var ed = this;
    var newStyle = {state:{}, value:{}, enabled:{}};
    trackchanges.state.forEach(function(command) {
      var result = ed.queryCommandState(command);
      if (currentStyle.state[command] !== result) {
        newStyle.state[command] = result;
        hasChanges = true;
      }
    });
    trackchanges.value.forEach(function(command) {
      var result = ed.queryCommandValue(command);
      if (currentStyle.value[command] !== result) {
        newStyle.value[command] = result;
        hasChanges = true;
      }
    });
    trackchanges.enabled.forEach(function(command) {
      var result = ed.queryCommandEnabled(command);
      if (currentStyle.enabled[command] !== result) {
        newStyle.enabled[command] = result;
        hasChanges = true;
      }
    });
    return {style:newStyle, hasChanges:hasChanges};
  }
  Editor.prototype.dispatchStyleChange = function(style, force) {
    if (!this.multirange.isEmpty() && !force) {
      return;
    }
    if (force || !style || shouldCalculateStyleChange(this.getRange(), this.currentRange)) {
      var result = calculateNewStyle.call(this, this.config.trackchanges, this.context.style);
      if (result.hasChanges) {
        style = result.style;
      } else {
        return;
      }
    }
    goog.object.extend(this.context.style.enabled, style.enabled);
    goog.object.extend(this.context.style.value, style.value);
    goog.object.extend(this.context.style.state, style.state);
    this.context.style.hasChanges = true;
    clearTimeout(dispatchStyleChangeTimer);
    var editor = this;
    dispatchStyleChangeTimer = setTimeout(function() {
      if (editor.context.style.hasChanges) {
        editor.dispatchEvent({type:uno.Editor.EventType.STYLE_CHANGED, style:editor.context.style});
        editor.context.style.hasChanges = false;
      }
    });
  };
  Editor.prototype.onSelectionChange = function() {
    this.updateEmpty();
    if (!this.readOnly) {
      this.dispatchStyleChange();
    }
    this.saveRange();
  };
  Editor.prototype.onTextInput = function(event) {
    if (event.target !== this.field) {
      return;
    }
    this.dispatchChange();
  };
  Editor.prototype.emitKeyboardEvent = function(type, char) {
    var code = char.charCodeAt();
    if (code === 10) {
      code = 13;
    }
    var e = new KeyboardEvent(type, {bubble:true, cancelable:true, key:char, keyCode:code, which:code});
    Object.defineProperty(e, "keyCode", {get:function() {
      return code;
    }});
    Object.defineProperty(e, "which", {get:function() {
      return code;
    }});
    this.field.dispatchEvent(e);
    return e.defaultPrevented;
  };
  Editor.prototype.onInput = function(event) {
    if (event.target !== this.field) {
      return;
    }
    this.updateEmpty();
    var _this = this;
    setTimeout(function() {
      _this.dispatchChange();
    });
  };
  Editor.prototype.updateEmpty = function(setContentIfEmpty) {
    if (this.field == null) {
      return;
    }
    var empty = util.dom.isEmpty(this.field, {root:this.field});
    if (setContentIfEmpty === undefined) {
      setContentIfEmpty = true;
    }
    if (empty && this.field.innerHTML !== this.config.defaults.html && setContentIfEmpty) {
      this.context.format = uno.defs.format.CLIENT_HTML;
      this.setHtml(false, this.config.defaults.html, true);
      util.dom.scrollLeft(document.body, 0);
      util.dom.scrollTop(document.body, 0);
      util.styles.clearPendingStyles(this);
    }
    if (empty && !this.readOnly) {
      util.placeholder.show();
    } else {
      util.placeholder.hide();
    }
    this.empty = empty;
  };
  function activeInRange(plugin, editor) {
    return !plugin.activeOnRangeOutsideOfEditor || util.range.isInNote(editor, editor.getRange()) || plugin.activeOnRangeOutsideOfEditor();
  }
  Editor.prototype.queryCommandValueInternal_ = function(command, isLoaded, opt, isTopLevelCall) {
    var editor = this;
    var logic = function() {
      var plugins = this.indexedPlugins_[Plugin.Op.QUERY_COMMAND];
      for (var i = 0; i < plugins.length; ++i) {
        var plugin = plugins[i];
        if (plugin.isEnabled(this) && plugin.isSupportedCommand(command) && (isLoaded || plugin.activeOnUneditableFields())) {
          return plugin.queryCommandValue(command, opt);
        }
      }
      return isLoaded ? null : false;
    }.bind(this);
    return logic();
  };
  Editor.prototype.queryCommandValue = function(command, options, isTopLevelCall) {
    if (this.context.isLargeNote) {
      options = options || {};
      options.quickAndDirty = true;
    }
    return this.queryCommandValueInternal_(command, this.isLoaded(), options, isTopLevelCall);
  };
  Editor.prototype.queryCommandState = function(command, options) {
    if (this.context.isLargeNote) {
      options = options || {};
      options.quickAndDirty = true;
    }
    var result = this.queryCommandValue(command, options);
    if (result === "true") {
      result = true;
    }
    if (result === "false") {
      result = false;
    }
    if (command === "justifyleft") {
      result = result === "left";
    } else {
      if (command === "justifycenter") {
        result = result === "center";
      } else {
        if (command === "justifyright") {
          result = result === "right";
        } else {
          if (command === "justifyfull") {
            result = result === "justify";
          } else {
            if (command === "insertorderedlist") {
              result = result === "ol";
            } else {
              if (command === "insertunorderedlist") {
                result = result === "ul";
              }
            }
          }
        }
      }
    }
    return !!result;
  };
  Editor.prototype.queryCommandEnabledInternal_ = function(command, isLoaded, opt, isTopLevelCall) {
    var mode = isTopLevelCall ? uno.EditorMultiRange.Mode.FIRST : uno.EditorMultiRange.Mode.NONE;
    var editor = this;
    return this.multirange.invoke(mode, function() {
      var plugins = this.queryCommandEnabledPlugins;
      for (var i = 0; i < plugins.length; ++i) {
        var plugin = plugins[i];
        if (plugin.isEnabled(this) && plugin.isSupportedCommand(command) && (isLoaded || plugin.activeOnUneditableFields())) {
          return plugin.queryCommandEnabled(command, opt);
        }
      }
      return true;
    });
  };
  Editor.prototype.queryCommandEnabled = function(command, options, isTopLevelCall) {
    if (this.context.isLargeNote) {
      options = options || {};
      options.quickAndDirty = true;
    }
    return !!this.queryCommandEnabledInternal_(command, this.isLoaded(), options, isTopLevelCall);
  };
  Editor.prototype.execCommand = function(command, value, options, isTopLevelCall) {
    if (isTopLevelCall == null) {
      isTopLevelCall = false;
    }
    var plugins = this.indexedPlugins_[Plugin.Op.EXEC_COMMAND];
    var targetPlugin = null;
    for (var i = 0; i < plugins.length && targetPlugin == null; ++i) {
      if (plugins[i].isEnabled(this) && plugins[i].isSupportedCommand(command) && (this.isLoaded() || plugins[i].activeOnUneditableFields()) && activeInRange(plugins[i], this)) {
        targetPlugin = plugins[i];
      }
    }
    if (!targetPlugin || !goog.isFunction(targetPlugin.execCommand)) {
      return false;
    }
    if (goog.isFunction(targetPlugin.queryCommandEnabled) && targetPlugin.queryCommandEnabled(command, value) === false) {
      return false;
    }
    var mode = uno.EditorMultiRange.Mode.NONE;
    if (isTopLevelCall && targetPlugin.multiRangeMode === uno.EditorMultiRange.Mode.ALL) {
      mode = uno.EditorMultiRange.Mode.ALL;
    }
    var finalResult = this.multirange.invoke(mode, function() {
      var result = null;
      var format = this.context.format;
      this.dispatchEvent({type:"beforeexeccommand", command:command});
      result = targetPlugin.execCommand.call(targetPlugin, command, value, options);
      this.updateUndoCursorPosition();
      this.dispatchEvent({type:"afterexeccommand", command:command});
      this.context.format = format;
      return result;
    });
    this.lastCommand = command;
    if (isTopLevelCall) {
      util.analytics.reportCommand(this, command, value, finalResult);
    }
    return finalResult;
  };
  Editor.prototype.isSupportedCommand = function(command) {
    if (!this.isLoaded()) {
      return false;
    }
    return this.allPluginsInOrder.some(function(plugin) {
      return plugin.isSupportedCommand(command);
    });
  };
  Editor.prototype.invokeOp_ = function(op) {
    if (op === Plugin.Op.CLEAN_CONTENTS_DOM) {
      return this.invokeOpRight_.apply(this, arguments);
    }
    return SeamlessField.prototype.apply.invokeOp_.apply(this, arguments);
  };
  Editor.prototype.invokeOpRight_ = function(op) {
    var plugins = this.indexedPlugins_[op];
    var argList = goog.array.slice(arguments, 1);
    for (var i = plugins.length - 1; i >= 0; i--) {
      var plugin = plugins[i];
      plugin[Plugin.OPCODE[op]].apply(plugin, argList);
    }
  };
  Editor.prototype.reduceOp_ = function(op, arg, varArgs) {
    var result;
    if (op === Plugin.Op.CLEAN_CONTENTS_DOM || op === Plugin.Op.CLEAN_CONTENTS_HTML) {
      result = this.reduceOpRight_(op, arg, varArgs);
    } else {
      result = SeamlessField.prototype.reduceOp_.apply(this, arguments);
    }
    if (op === Plugin.Op.PREPARE_CONTENTS_HTML) {
      result = this.prepareContentsDom(result);
    }
    return result;
  };
  Editor.prototype.reduceOpRight_ = function(op) {
    var plugins = this.indexedPlugins_[op];
    var argList = goog.array.slice(arguments, 1);
    for (var i = plugins.length - 1; i >= 0; i--) {
      var plugin = plugins[i];
      argList[0] = plugin[Plugin.OPCODE[op]].apply(plugin, argList);
    }
    return argList[0];
  };
  Editor.prototype.prepareContentsHtml = function(html) {
    var styles = {};
    return this.reduceOp_(goog.editor.Plugin.Op.PREPARE_CONTENTS_HTML, html || "", styles);
  };
  Editor.prototype.prepareContentsDom = function(html) {
    if (!html) {
      return "";
    }
    var frag = util.dom.fragFromString(html);
    this.importDomFilters.forEach(function(filter) {
      filter.prepareContentsDom(frag);
    });
    return util.dom.stringFromFrag(frag);
  };
  Editor.prototype.getFormField = function() {
    var target = document.activeElement;
    if (target && ["TEXTAREA", "INPUT"].indexOf(target.nodeName) > -1) {
      return target;
    }
    return null;
  };
  Editor.prototype.getAllPluginsInOrder = function() {
    return this.allPluginsInOrder;
  };
  Editor.prototype.getClipboardContent = function(frag) {
    this.context.format = uno.defs.format.CLIPBOARD;
    this.invokeOp_(goog.editor.Plugin.Op.CLEAN_CONTENTS_DOM, frag);
    return this.reduceOp_(goog.editor.Plugin.Op.CLEAN_CONTENTS_HTML, frag.innerHTML);
  };
  Editor.prototype.updateUndoCursorPosition = function() {
    var undoPlugin = this.plugins_.UndoRedo;
    var current = undoPlugin.currentStates_[this.getHashCode()];
    var previous = undoPlugin.undoManager_.undoPeek();
    if (current && this.field && current.undoContent_ === this.field.innerHTML) {
      current.undoCursorPosition_ = undoPlugin.getCursorPosition_(this);
      if (previous) {
        previous.redoCursorPosition_ = current.undoCursorPosition_;
      }
    }
  };
  Editor.prototype.refreshUndoRedoState = function() {
    var undoPlugin = this.plugins_.UndoRedo;
    undoPlugin.refreshCurrentState(this);
    var current = undoPlugin.currentStates_[this.getHashCode()];
    var previous = undoPlugin.undoManager_.undoPeek();
    if (previous) {
      previous.redoContent_ = current.undoContent_;
      previous.redoCursorPosition_ = current.undoCursorPosition_;
    }
  };
  Editor.prototype.getRealtimeServerVersion = function() {
    if (!this.config.realtime.enabled || !this.realtime) {
      return "";
    }
    return this.realtime.getRealtimeServerVersion();
  };
})();
goog.provide("uno.template.util");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.array");
goog.require("uno.util.string");
goog.require("uno.util.dom");
goog.require("uno.util.styles");
(function() {
  var log = goog.debug.Logger.getLogger("uno.template.util");
  var util = uno.util;
  var tmpl = uno.template.util;
  tmpl.TEMPLATE_STYLE_ATTR_CONTEXT_NAME = "-evernote-context-name";
  tmpl.FIELD_TYPES = ["title", "field", "textarea", "phone", "email", "twitter", "linkedin", "facebook", "weibo", "address", "profile-image"];
  tmpl.valueDidChangeForFieldInfo = function(fieldInfo) {
    fieldInfo.opt.fieldLastChanged = fieldInfo.name;
    fieldInfo.template.execCommand("changes", true);
  };
  tmpl.normalizeEditableTextElement = function(fieldInfo) {
    var element = fieldInfo.node;
    var text = tmpl.plainTextHTMLFromElement(element, fieldInfo.isMultiline);
    element.innerHTML = text;
    if (util.string.isEmpty(text) || text === "<div><br></div>") {
      goog.dom.classes.add(element, "en-editable-placeholder");
    } else {
      goog.dom.classes.remove(element, "en-editable-placeholder");
    }
    fieldInfo.html = element.innerHTML;
    return element;
  };
  tmpl.plainTextHTMLFromElement = function(element, wrapLines) {
    if (document.activeElement !== element) {
      element.innerHTML = element.innerHTML.replace(/(<\/div>)/gi, "\n$1");
    }
    var text = element.innerText.trim();
    var html;
    if (!wrapLines && util.string.isEmpty(text)) {
      html = "";
    } else {
      if (wrapLines) {
        var lines = text.split("\n");
        lines = lines.map(function(v) {
          if (util.string.isEmpty(v)) {
            return "<div><br></div>";
          }
          return "<div>" + goog.string.htmlEscape(v) + "</div>";
        });
        html = lines.join("");
      } else {
        html = goog.string.htmlEscape(text.replace(/\n/g, " "));
      }
    }
    return html;
  };
  tmpl.iterateFields = function(root) {
    var selector = "*[style*='-evernote-editable:']";
    var elements = goog.array.toArray(root.querySelectorAll(selector));
    return elements.map(function(el) {
      var fieldType = util.styles.getStyle(el, "-evernote-editable");
      if (!goog.array.contains(tmpl.FIELD_TYPES, fieldType)) {
        log.severe("Invalid -evernote-editable field mode! " + fieldType);
        return null;
      }
      var fieldName = util.styles.getStyle(el, "x-evernote");
      return {node:el, name:fieldName, type:fieldType};
    }, this).filter(function(el) {
      return el && el.node;
    });
  };
  tmpl.findSubElementByName = function(given, name) {
    var elements = given.querySelectorAll("*[style*='x-evernote:']");
    var found = null;
    goog.array.forEach(elements, function(node) {
      if (util.styles.getStyle(node, "x-evernote") === name) {
        found = node;
      }
    });
    return found;
  };
  tmpl.setupPlainTextFieldFormFieldInfo = function(fieldInfo) {
    var editorNode = fieldInfo.node;
    if (editorNode == null) {
      log.error("node missing in fieldinfo: " + JSON.stringify(fieldInfo));
    }
    var title = (fieldInfo.opt.localization[fieldInfo.name + "-placeholder-title"] || "...") + "\u00a0\u00a0\u00a0";
    editorNode.setAttribute("title", title);
    goog.dom.classes.add(editorNode, "en-editable");
    goog.dom.classes.add(editorNode, "en-editable-" + fieldInfo.type);
    if (!fieldInfo.template.config.readOnly) {
      editorNode.setAttribute("contenteditable", true);
    }
    tmpl.normalizeEditableTextElement(fieldInfo);
    if (fieldInfo.opt.stripStyle) {
      editorNode.removeAttribute("style");
    }
    var oldValue = null;
    var context = tmpl.findSubElementByName(fieldInfo.container, "context");
    if (context) {
      var contextName = context.getAttribute("data" + tmpl.TEMPLATE_STYLE_ATTR_CONTEXT_NAME);
      var localized = fieldInfo.opt.localization[contextName + "-label"];
      if (context && localized) {
        goog.dom.removeChildren(context);
        context.textContent = localized;
      }
    }
    if (!context) {
      var fieldTitle = fieldInfo.opt.localization[fieldInfo.name + "-label"];
      if (fieldTitle) {
        context.textContent = fieldTitle;
      }
    }
    if (!fieldInfo.template.config.readOnly) {
      editorNode.addEventListener("focus", function() {
        oldValue = fieldInfo.object.getHTML();
        setTimeout(function() {
          var sel = window.getSelection();
          sel.selectAllChildren(editorNode);
        }, 0);
        EN.notifyAsync("focusChanged", {focus:true, module:"content"});
      });
      editorNode.addEventListener("input", function() {
        fieldInfo.template.execCommand("changes", true);
      });
      editorNode.addEventListener("blur", function() {
        window.getSelection().removeAllRanges();
        tmpl.normalizeEditableTextElement(fieldInfo);
        var newValue = fieldInfo.object.getHTML();
        if (oldValue !== newValue) {
          tmpl.valueDidChangeForFieldInfo(fieldInfo);
        }
        EN.notifyAsync("focusChanged", {focus:false, module:"content"});
      });
      editorNode.addEventListener("keydown", function(event) {
        var handled = false;
        if (event.keyCode === 13) {
          if (!fieldInfo.isMultiline) {
            editorNode.blur();
            handled = true;
          }
        } else {
          if (event.keyCode === 8) {
            document.execCommand("delete");
            handled = true;
          }
        }
        if (handled) {
          event.preventDefault();
          event.stopPropagation();
          return false;
        }
        return false;
      });
    }
  };
  tmpl.setupContextFieldFromFieldInfo = function(fieldInfo, options) {
    fieldInfo.contextNode = tmpl.findSubElementByName(fieldInfo.container, "context");
    var node = fieldInfo.contextNode;
    var contextName = util.styles.getStyle(node, tmpl.TEMPLATE_STYLE_ATTR_CONTEXT_NAME);
    if (node && !contextName) {
      contextName = node.getAttribute("data" + tmpl.TEMPLATE_STYLE_ATTR_CONTEXT_NAME);
    }
    goog.dom.classes.add(node, "en-editable-context");
    goog.dom.removeChildren(node);
    var titleNode = goog.dom.createElement("span");
    node.appendChild(titleNode);
    if (contextName === "fax") {
      contextName = "work-fax";
    }
    var localizedTitle = fieldInfo.opt.localization[contextName + "-label"];
    if (!localizedTitle) {
      log.warning("No l18n option for template " + contextName + "-label");
      localizedTitle = contextName;
    }
    titleNode.textContent = localizedTitle;
    var optionElements = [];
    for (var i = 0; i < options.length; i++) {
      var optionName = options[i];
      var title = fieldInfo.opt.localization[optionName + "-label"];
      if (!title) {
        log.warning("No l18n option for template " + optionName + "-label");
        title = optionName;
      }
      var elem = goog.dom.createDom("option", {value:optionName}, document.createTextNode(title));
      if (optionName === contextName) {
        elem.setAttribute("selected", "selected");
      }
      optionElements.push(elem);
    }
    var selectField = goog.dom.createDom.bind(this, "select", {class:"en-editable-select-context", tabindex:"-1"}).apply(this, optionElements);
    node.insertBefore(selectField, null);
    selectField.addEventListener("change", function() {
      var newName = selectField.value;
      util.styles.setStyle(node, tmpl.TEMPLATE_STYLE_ATTR_CONTEXT_NAME, newName);
      titleNode.textContent = fieldInfo.opt.localization[newName + "-label"] || newName;
      tmpl.valueDidChangeForFieldInfo(fieldInfo);
    });
    node.parentElement.style.textDecoration = "none";
  };
})();
goog.provide("uno.template.Field");
goog.require("goog.debug.Logger");
goog.require("uno.template.util");
goog.require("uno.util.dom");
goog.require("uno.util.styles");
(function() {
  var log = goog.debug.Logger.getLogger("uno.template.Field");
  var tmpl = uno.template.util;
  var util = uno.util;
  var Field = uno.template.Field = function(fieldInfo) {
    this.fieldInfo = fieldInfo;
    this.setup();
  };
  Field.prototype.setup = function() {
  };
  Field.prototype.copyCurrentValueToDom = function(frag) {
    var allFields = tmpl.iterateFields(frag);
    var matchingContainer = null;
    if (allFields && allFields.length > this.fieldInfo.index) {
      var indexMatch = allFields[this.fieldInfo.index].node;
      var type = util.styles.getStyle(indexMatch, "-evernote-editable");
      if (indexMatch == null || type !== this.fieldInfo.type) {
        log.severe("Wrong field type at correct field index! " + this.fieldInfo.type + " @ index " + this.fieldInfo.index);
      }
      matchingContainer = indexMatch;
    }
    if (matchingContainer == null) {
      log.severe("No matching container found for " + this.fieldInfo.name + " @ index " + this.fieldInfo.index);
      return;
    }
    if (this.fieldInfo.contextNode && matchingContainer) {
      var contextName = util.styles.getStyle(this.fieldInfo.contextNode, tmpl.TEMPLATE_STYLE_ATTR_CONTEXT_NAME);
      if (contextName) {
        var contextSelector = "*[style*='x-evernote:context']";
        var matchingNode = matchingContainer.querySelector(contextSelector);
        if (matchingNode) {
          var label = contextName + "-label";
          var localization = this.fieldInfo.opt.localization[label];
          util.styles.setStyle(matchingNode, tmpl.TEMPLATE_STYLE_ATTR_CONTEXT_NAME, contextName);
          matchingNode.textContent = localization || contextName;
        } else {
          log.severe("No matching context node for " + contextName);
        }
      }
    }
    var neverUpdatedFields = ["card-image", "profile-image"];
    var updateable = neverUpdatedFields.indexOf(this.fieldInfo.name) < 0;
    if (matchingContainer && updateable) {
      var valueNodeSelector = "*[style*='x-evernote:value']";
      var matchingValueNode = matchingContainer.querySelector(valueNodeSelector);
      if (matchingValueNode == null) {
        matchingValueNode = matchingContainer;
      }
      matchingValueNode.innerHTML = this.getHTML() || "&nbsp;";
    }
  };
  Field.prototype.getHTML = function() {
    return this.fieldInfo.node.innerHTML;
  };
})();
goog.provide("uno.template.NoopField");
goog.require("uno.template.Field");
(function() {
  var NoopField = uno.template.NoopField = function(fieldInfo) {
    goog.base(this, fieldInfo);
  };
  goog.inherits(NoopField, uno.template.Field);
})();
goog.provide("uno.template.TitleField");
goog.require("uno.template.util");
goog.require("uno.template.Field");
(function() {
  var tmpl = uno.template.util;
  var TitleField = uno.template.TitleField = function(fieldInfo) {
    goog.base(this, fieldInfo);
  };
  goog.inherits(TitleField, uno.template.Field);
  TitleField.prototype.getHTML = function() {
    return tmpl.plainTextHTMLFromElement(this.fieldInfo.node);
  };
})();
goog.provide("uno.template.LinkField");
goog.require("uno.template.Field");
goog.require("uno.template.util");
goog.require("uno.util.string");
goog.require("goog.debug.Logger");
(function() {
  var log = goog.debug.Logger.getLogger("uno.template.LinkField");
  var tmpl = uno.template.util;
  var util = uno.util;
  var LinkField = uno.template.LinkField = function(fieldInfo) {
    goog.base(this, fieldInfo);
  };
  goog.inherits(LinkField, uno.template.Field);
  LinkField.prototype.createRepresentationElement = function(value, attrs) {
    attrs.href = value;
    var link = goog.dom.createDom("a", attrs, document.createTextNode(value));
    return link;
  };
  LinkField.prototype.getValue = function() {
    var node = this.fieldInfo.node;
    if (node == null) {
      log.severe("couldnt get node of linkfield");
      return "";
    }
    var value = node.textContent;
    if (!value || util.string.isEmpty(value)) {
      return "";
    }
    return value.trim();
  };
  LinkField.prototype.setup = function() {
    var self = this;
    this.fieldInfo.node = tmpl.findSubElementByName(this.fieldInfo.container, "value");
    var node = this.fieldInfo.node;
    var value = this.getValue();
    node.style.textDecoration = "";
    goog.dom.removeChildren(node);
    var editable = goog.dom.createDom("div");
    node.appendChild(editable);
    editable.textContent = value;
    this.fieldInfo.node = editable;
    tmpl.setupPlainTextFieldFormFieldInfo(this.fieldInfo);
    var content = goog.dom.createDom("span");
    var preview = goog.dom.createDom("div", {class:"en-editable-preview"}, content);
    node.appendChild(preview);
    var updateEditableFieldVisibilityForStandby = function() {
      goog.dom.classes.remove(preview, "en-editable-hidden");
      goog.dom.classes.add(editable, "en-editable-hidden");
      goog.dom.removeChildren(content);
      var text = self.getValue();
      if (!util.string.isEmpty(text)) {
        content.appendChild(self.createRepresentationElement(text, {tabindex:"-1"}));
      } else {
        goog.dom.classes.remove(editable, "en-editable-hidden");
        goog.dom.classes.add(preview, "en-editable-hidden");
      }
      editable.textContent = text;
    };
    updateEditableFieldVisibilityForStandby();
    if (!this.fieldInfo.template.config.readOnly) {
      preview.addEventListener("click", function(e) {
        if (e.target && e.target.tagName.toLowerCase() === "a") {
          var href = e.target.getAttribute("href");
          EN.notifyAsync("openLink", {href:href, module:"template"});
        } else {
          editable.focus();
        }
      });
      editable.addEventListener("focus", function() {
        goog.dom.classes.remove(editable, "en-editable-hidden");
        goog.dom.classes.add(preview, "en-editable-hidden");
      });
      editable.addEventListener("blur", function() {
        updateEditableFieldVisibilityForStandby();
      });
    } else {
      preview.addEventListener("click", function(e) {
        var href = e.target.getAttribute("href");
        EN.notifyAsync("openLink", {href:href, module:"template"});
      });
    }
    goog.dom.classes.add(this.fieldInfo.container, "en-editable-container");
  };
  LinkField.prototype.getHTML = function() {
    var text = this.fieldInfo.node.textContent;
    return util.string.isEmpty(text) ? uno.defs.nbsp.CHARACTER_SEQUENCE : util.dom.toHTML(this.createRepresentationElement(text, {}));
  };
})();
goog.provide("uno.template.AddressField");
goog.require("uno.template.LinkField");
goog.require("uno.util.string");
(function() {
  var AddressField = uno.template.AddressField = function(fieldInfo) {
    goog.base(this, fieldInfo);
  };
  goog.inherits(AddressField, uno.template.LinkField);
  AddressField.prototype.createRepresentationElement = function(value, attrs) {
    value = value.trim();
    attrs.href = "http://maps.google.com/?q=" + encodeURIComponent(value);
    return goog.dom.createDom("a", attrs, document.createTextNode(value));
  };
})();
goog.provide("uno.template.PlainTextField");
goog.require("uno.template.util");
goog.require("uno.template.Field");
(function() {
  var tmpl = uno.template.util;
  var PlainTextField = uno.template.PlainTextField = function(fieldInfo) {
    goog.base(this, fieldInfo);
  };
  goog.inherits(PlainTextField, uno.template.Field);
  PlainTextField.prototype.setup = function() {
    tmpl.setupPlainTextFieldFormFieldInfo(this.fieldInfo);
  };
  PlainTextField.prototype.getHTML = function() {
    return tmpl.plainTextHTMLFromElement(this.fieldInfo.node);
  };
})();
goog.provide("uno.template.PlainTextArea");
goog.require("goog.debug.Logger");
goog.require("uno.template.PlainTextField");
goog.require("uno.template.util");
(function() {
  var log = goog.debug.Logger.getLogger("uno.template.PlainTextArea");
  var tmpl = uno.template.util;
  var PlainTextArea = uno.template.PlainTextArea = function(fieldInfo) {
    fieldInfo.isMultiline = true;
    goog.base(this, fieldInfo);
  };
  goog.inherits(PlainTextArea, uno.template.PlainTextField);
  PlainTextArea.prototype.setup = function() {
    tmpl.setupPlainTextFieldFormFieldInfo(this.fieldInfo);
  };
  PlainTextArea.prototype.getHTML = function() {
    try {
      return tmpl.plainTextHTMLFromElement(this.fieldInfo.node, true);
    } catch (ex) {
      log.fine("getHTML 'PlainTextArea.prototype.getHTML' failed " + ex.stack);
    }
    return null;
  };
})();
goog.provide("uno.template.PhoneField");
goog.require("uno.template.util");
goog.require("uno.template.LinkField");
(function() {
  var tmpl = uno.template.util;
  var PhoneField = uno.template.PhoneField = function(fieldInfo) {
    goog.base(this, fieldInfo);
  };
  goog.inherits(PhoneField, uno.template.LinkField);
  PhoneField.prototype.setup = function() {
    goog.base(this, "setup");
    tmpl.setupContextFieldFromFieldInfo(this.fieldInfo, ["phone", "home", "work", "mobile", "main", "home-fax", "work-fax", "other"]);
  };
  PhoneField.prototype.createRepresentationElement = function(value, attrs) {
    value = value.trim().replace(/^tel:/, "");
    attrs.href = "tel:" + encodeURIComponent(value);
    return goog.dom.createDom("a", attrs, document.createTextNode(value));
  };
  PhoneField.prototype.getHTML = function() {
    return tmpl.plainTextHTMLFromElement(this.fieldInfo.node);
  };
})();
goog.provide("uno.template.EmailField");
goog.require("uno.template.LinkField");
goog.require("uno.template.util");
(function() {
  var tmpl = uno.template.util;
  var EmailField = uno.template.EmailField = function(fieldInfo) {
    goog.base(this, fieldInfo);
  };
  goog.inherits(EmailField, uno.template.LinkField);
  EmailField.prototype.setup = function() {
    goog.base(this, "setup");
    tmpl.setupContextFieldFromFieldInfo(this.fieldInfo, ["email", "home", "work", "other"]);
  };
  EmailField.prototype.createRepresentationElement = function(value, attrs) {
    value = value.trim().replace(/^mailto:/, "");
    attrs.href = "mailto:" + value;
    return goog.dom.createDom("a", attrs, document.createTextNode(value));
  };
})();
goog.provide("uno.template.TwitterField");
goog.require("uno.template.LinkField");
goog.require("uno.util.string");
(function() {
  var util = uno.util;
  var TwitterField = uno.template.TwitterField = function(fieldInfo) {
    goog.base(this, fieldInfo);
  };
  goog.inherits(TwitterField, uno.template.LinkField);
  TwitterField.prototype.getValue = function() {
    var node = this.fieldInfo.node;
    var value = node.textContent;
    if (!value) {
      return "";
    }
    value = value.trim().replace(/^\@/, "");
    if (util.string.isEmpty(value)) {
      return "";
    }
    return value;
  };
  TwitterField.prototype.createRepresentationElement = function(value, attrs) {
    attrs.href = "http://twitter.com/" + encodeURIComponent(value);
    return goog.dom.createDom("a", attrs, document.createTextNode("@" + value));
  };
})();
goog.provide("uno.template.FacebookField");
goog.require("uno.template.LinkField");
(function() {
  var FacebookField = uno.template.FacebookField = function(fieldInfo) {
    goog.base(this, fieldInfo);
  };
  goog.inherits(FacebookField, uno.template.LinkField);
})();
goog.provide("uno.template.LinkedInField");
goog.require("uno.template.LinkField");
(function() {
  var LinkedInField = uno.template.LinkedInField = function(fieldInfo) {
    var hrefElement = fieldInfo.node.querySelector("a[href]");
    this.originalHref = null;
    this.originalText = null;
    if (hrefElement != null) {
      this.originalHref = hrefElement.getAttribute("href");
      this.originalText = hrefElement.textContent;
    }
    goog.base(this, fieldInfo);
  };
  goog.inherits(LinkedInField, uno.template.LinkField);
  LinkedInField.prototype.createRepresentationElement = function(value, attrs) {
    attrs.href = null;
    if (this.getValue() === this.originalText) {
      attrs.href = this.originalHref;
    }
    if (attrs.href == null) {
      attrs.href = "http://www.linkedin.com/in/" + encodeURIComponent(value);
    }
    return goog.dom.createDom("a", attrs, document.createTextNode(value));
  };
})();
goog.provide("uno.template.WeiboField");
goog.require("uno.template.LinkField");
goog.require("uno.util.string");
(function() {
  var util = uno.util;
  var WeiboField = uno.template.WeiboField = function(fieldInfo) {
    goog.base(this, fieldInfo);
  };
  goog.inherits(WeiboField, uno.template.LinkField);
  WeiboField.prototype.getValue = function() {
    var node = this.fieldInfo.node;
    var value = node.textContent;
    if (!value) {
      return "";
    }
    value = value.trim().replace(/^\@/, "");
    if (util.string.isEmpty(value)) {
      return "";
    }
    return value;
  };
  WeiboField.prototype.createRepresentationElement = function(value) {
    return document.createTextNode("@" + value);
  };
})();
goog.provide("uno.template.Plugin");
goog.require("goog.editor.Plugin");
(function() {
  var TemplatePlugin = uno.template.Plugin = function(template) {
    goog.editor.Plugin.call(this);
    this.template = template;
  };
  goog.inherits(TemplatePlugin, goog.editor.Plugin);
  TemplatePlugin.prototype.getElement = function() {
    return this.template.templateElement;
  };
})();
goog.provide("uno.template.commands.Changes");
goog.require("goog.debug.Logger");
goog.require("uno.template.Plugin");
goog.require("uno.util.dom");
goog.require("uno.template.util");
(function() {
  var dirty = false;
  var debounceTimer = 0;
  var Changes = uno.template.commands.Changes = function(template) {
    uno.template.Plugin.call(this, template);
  };
  goog.inherits(Changes, uno.template.Plugin);
  Changes.prototype.isSupportedCommand = function(command) {
    return command === "changes" || command === "rte.changes";
  };
  var sendContentChangedNotificationDebounce = function() {
    clearTimeout(debounceTimer);
    debounceTimer = setTimeout(function() {
      window.EN.notifyAsync("contentChanged", {module:"content"});
    }, 1000);
  };
  Changes.prototype.execCommandInternal = function(command, value) {
    dirty = !!value;
    if (dirty) {
      sendContentChangedNotificationDebounce();
    }
    return true;
  };
  Changes.prototype.queryCommandValue = function() {
    return dirty;
  };
  Changes.prototype.queryCommandEnabled = function() {
    return true;
  };
})();
goog.provide("uno.template.commands.Content");
goog.require("goog.debug.Logger");
goog.require("goog.array");
goog.require("goog.object");
goog.require("uno.template.Plugin");
goog.require("uno.template.util");
goog.require("uno.util.dom");
goog.require("uno.util.string");
goog.require("uno.defs");
(function() {
  var log = goog.debug.Logger.getLogger("uno.template.commands.Content");
  var util = uno.util;
  var Content = uno.template.commands.Content = function(template) {
    uno.template.Plugin.call(this, template);
  };
  goog.inherits(Content, uno.template.Plugin);
  Content.prototype.isSupportedCommand = function(command) {
    return command === "content";
  };
  Content.prototype.loadContent = function(opt) {
    if (opt.type === "enml" && opt.content) {
      window.ed.context.format = uno.defs.format.ENML;
    } else {
      if (opt.type === "html" && opt.content) {
        window.ed.context.format = uno.defs.format.CLIENT_HTML;
      } else {
        return false;
      }
    }
    var content = opt.content;
    goog.object.forEach(ed.getAllPluginsInOrder(), function(plugin) {
      if (plugin.prepareContentsHtml && plugin.trogClassId !== "uno.filters.NormalizeFilter") {
        content = plugin.prepareContentsHtml(content);
      }
    });
    var frag = util.dom.fragFromString(content);
    goog.object.forEach(ed.getAllPluginsInOrder(), function(plugin) {
      if (plugin.prepareContentsDom && plugin.trogClassId !== "uno.filters.NormalizeFilter") {
        plugin.prepareContentsDom(frag);
      }
    });
    this.template.templateElement.innerHTML = "";
    while (frag.childNodes && frag.childNodes[0]) {
      this.template.templateElement.appendChild(frag.childNodes[0]);
    }
    return true;
  };
  Content.prototype.getContent = function(opt) {
    if (!opt) {
      opt = {};
    }
    opt = {html:opt.html || false, cleanup:opt.cleanup || false, stripNS:opt.stripNS || false, trim:opt.trim || true, withInsertionPoint:opt.withInsertionPoint || false, hiddenCryptoData:opt.hiddenCryptoData || null, resetChangesState:opt.resetChangesState || false, wrap:opt.wrap || false, type:opt.type || uno.defs.format.ENML};
    if (opt.type !== uno.defs.format.CLIENT_HTML && opt.type !== uno.defs.format.ENML) {
      opt.type = uno.defs.format.ENML;
    }
    var failure = {success:false, value:"", type:opt.type};
    if (opt.resetChangesState) {
      this.template.execCommand("changes", false);
    }
    var enmlFilterPlugin = null;
    goog.object.forEach(ed.getAllPluginsInOrder(), function(plugin) {
      if (plugin instanceof uno.filters.EnmlFilter) {
        enmlFilterPlugin = plugin;
      }
    });
    if (!enmlFilterPlugin) {
      log.severe("Template couldnt necessary plugins from Editor!");
      return failure;
    }
    var startingDocument = this.template.originalDocument || "";
    startingDocument = enmlFilterPlugin.prepareContentsHtml(startingDocument);
    var frag = util.dom.fragFromString(startingDocument);
    goog.array.forEach(this.template.fields, function(fieldInfo) {
      var instance = fieldInfo.object;
      if (instance == null) {
        log.severe("No template fieldInfo.object in " + fieldInfo);
      }
      instance.copyCurrentValueToDom(frag);
    });
    goog.array.forEach(frag.querySelectorAll("en-media"), function(enmedia) {
      enmedia.innerHTML = "";
    });
    var content = (new XMLSerializer).serializeToString(frag).trim();
    content = enmlFilterPlugin.cleanContentsHtml(content);
    var template = this.template;
    return {success:!util.string.isEmpty(content.trim()), value:content.trim(), type:opt.type};
  };
  Content.prototype.execCommandInternal = function(command, value) {
    if (value.scrollToTop === true) {
      window.scrollTo(0, 0);
    }
    if (!goog.object.isEmpty(value.resources)) {
      ed.context.resources = value.resources;
    }
    this.template.originalDocument = value.content;
    var contentResult = this.loadContent(value);
    if (contentResult) {
      this.template.setupFields();
      EN.notifyAsync("contentLoaded");
    } else {
      log.severe("Template failed to load content", value);
    }
    return contentResult;
  };
  Content.prototype.queryCommandValue = function(command, value) {
    return this.getContent(value);
  };
  Content.prototype.queryCommandEnabled = function() {
    return true;
  };
})();
goog.provide("uno.template.commands.Copy");
goog.require("goog.debug.Logger");
goog.require("uno.template.Plugin");
goog.require("uno.util.dom");
goog.require("uno.template.util");
(function() {
  var util = uno.util;
  var Copy = uno.template.commands.Copy = function(template) {
    uno.template.Plugin.call(this, template);
  };
  goog.inherits(Copy, uno.template.Plugin);
  Copy.prototype.isSupportedCommand = function(command) {
    return command === "copy";
  };
  Copy.prototype.execCommandInternal = function() {
    return false;
  };
  Copy.prototype.queryCommandValue = function() {
    var range = window.getSelection().getRangeAt(0);
    if (!range || range.collapsed) {
      return "";
    }
    var result = {};
    var frag = range.cloneContents();
    var child = document.createElement("div");
    child.appendChild(frag);
    util.dom.workOnTemporaryDOMNode(child, function(node) {
      result.plain = node.innerText;
    });
    return JSON.stringify(result);
  };
  Copy.prototype.queryCommandEnabled = function() {
    return true;
  };
})();
goog.provide("uno.template.commands.Focus");
goog.require("goog.debug.Logger");
goog.require("uno.template.Plugin");
goog.require("uno.util.dom");
(function() {
  var util = uno.util;
  var Focus = uno.template.commands.Focus = function(template) {
    uno.template.Plugin.call(this, template);
  };
  goog.inherits(Focus, uno.template.Plugin);
  Focus.prototype.isSupportedCommand = function(command) {
    return command === "focus";
  };
  Focus.prototype.execCommandInternal = function(command, value) {
    if (this.template.fields && this.template.fields.length > 0) {
      this.template.fields[0].focus();
    }
  };
  Focus.prototype.queryCommandValue = function() {
    var selection = window.getSelection();
    if (!selection) {
      return false;
    }
    if (selection.rangeCount > 0) {
      var range = window.getSelection().getRangeAt(0);
      var ancestors = util.dom.ancestors(range.startContainer);
      for (var i = 0; i < ancestors.length; i++) {
        if (ancestors[i].contentEditable === "true") {
          return true;
        }
      }
    }
    return false;
  };
  Focus.prototype.queryCommandEnabled = function() {
    return true;
  };
})();
goog.provide("uno.template.commands.Margin");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.template.Plugin");
(function() {
  var Margin = uno.template.commands.Margin = function(template) {
    uno.template.Plugin.call(this, template);
  };
  goog.inherits(Margin, uno.template.Plugin);
  Margin.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Margin.prototype.isSupportedCommand = function(command) {
    return command === "margin";
  };
  Margin.prototype.execCommand = function(command, value) {
    if (value == null) {
      return false;
    }
    if (this.template.templateElement == null) {
      return false;
    }
    var container = this.template.templateElement;
    if (value.note) {
      container.style.paddingTop = toCssValue(value.note.top, "px");
      container.style.paddingBottom = toCssValue(value.note.bottom, "px");
      container.style.paddingLeft = toCssValue(value.note.left, "px");
      container.style.paddingRight = toCssValue(value.note.right, "px");
    }
    if (value.scroll) {
      window.ed.config.margin.scroll = {top:value.scroll.top || 0, left:value.scroll.left || 0, bottom:value.scroll.bottom || 0, right:value.scroll.right || 0};
    }
    if (value.offset) {
      window.ed.config.margin.offset = {height:value.offset.height || 0, width:value.offset.width || 0};
    }
    return true;
  };
  var toCssValue = function(value, unit) {
    var result;
    switch(typeof value) {
      case "number":
        result = value + unit;
        break;
      case "string":
        if (value.indexOf(unit) > -1) {
          result = value;
        } else {
          result = value + unit;
        }
        break;
      case "undefined":
        result = null;
        break;
      default:
        result = value;
    }
    return result;
  };
})();
goog.provide("uno.template.commands.PassThrough");
goog.require("goog.debug.Logger");
goog.require("uno.template.Plugin");
goog.require("uno.util.dom");
(function() {
  var commands = ["delete", "forwarddelete"];
  var PassThrough = uno.template.commands.PassThrough = function(template) {
    uno.template.Plugin.call(this, template);
  };
  goog.inherits(PassThrough, uno.template.Plugin);
  PassThrough.prototype.isSupportedCommand = function(command) {
    return commands.indexOf(command) >= 0;
  };
  PassThrough.prototype.execCommandInternal = function(command, value) {
    return document.execCommand(command, value);
  };
  PassThrough.prototype.queryCommandValue = function(command, value) {
    return document.queryCommandValue(command, value);
  };
  PassThrough.prototype.queryCommandEnabled = function(command, value) {
    return document.queryCommandEnabled(command, value);
  };
})();
goog.provide("uno.template.commands.Paste");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("uno.template.Plugin");
goog.require("uno.util.dom");
goog.require("uno.template.util");
(function() {
  var log = goog.debug.Logger.getLogger("uno.template.commands.Paste");
  var util = uno.util;
  var Paste = uno.template.commands.Paste = function(template) {
    uno.template.Plugin.call(this, template);
  };
  goog.inherits(Paste, uno.template.Plugin);
  Paste.prototype.isSupportedCommand = function(command) {
    return command === "paste" || command === "pasteplain";
  };
  Paste.prototype.execCommandInternal = function(command, value) {
    var type = "plain";
    var val = "";
    if (command === "pasteplain") {
      type = "plain";
    } else {
      if (value.type === "html") {
        type = "html";
      }
    }
    if (value.value) {
      val = value.value;
    } else {
      if (value.values) {
        var htmlValues = value.values.filter(function(item) {
          return item.type.indexOf("html") >= 0 && item.value;
        });
        var plainValues = value.values.filter(function(item) {
          return item.type.indexOf("plain") >= 0 && item.value;
        });
        if (htmlValues.length) {
          type = "html";
          val = htmlValues[0].value;
        } else {
          if (plainValues.length) {
            type = "plain";
            val = plainValues[0].value;
          }
        }
      }
    }
    return pasteAction({type:type, value:val});
  };
  Paste.prototype.queryCommandValue = function() {
    return "";
  };
  Paste.prototype.queryCommandEnabled = function() {
    return true;
  };
  var pasteAction = function(opt) {
    var content = opt.value;
    if (opt.type === "html") {
      var frag = util.dom.fragFromString(content);
      content = frag.textContent;
    }
    try {
      return document.execCommand("inserttext", false, content.replace(/\s+/gi, " "));
    } catch (ex) {
      log.severe("Error with document inserttext" + ex.stack);
    }
    return true;
  };
})();
goog.provide("uno.template.commands.Resources");
goog.require("goog.debug.Logger");
goog.require("goog.functions");
goog.require("uno.template.Plugin");
goog.require("uno.util.resource");
(function() {
  var log = goog.debug.Logger.getLogger("uno.template.commands.Resources");
  var util = uno.util;
  var Resources = uno.template.commands.Resources = function(template) {
    uno.template.Plugin.call(this, template);
  };
  goog.inherits(Resources, uno.template.Plugin);
  Resources.prototype.activeOnUneditableFields = goog.functions.TRUE;
  Resources.prototype.queryCommandEnabled = goog.functions.TRUE;
  Resources.prototype.isSupportedCommand = function(command) {
    return command === "resources";
  };
  Resources.prototype.execCommand = function() {
    return false;
  };
  Resources.prototype.queryCommandValue = function(command, opt) {
    var templateRoot = this.template.getElement();
    var list = goog.array.map(util.resource.all(templateRoot), function(el) {
      var dict = util.resource.toDict(el);
      if (opt === "neighbors") {
        log.warning("opt.neighbors not supported for template resources");
      }
      return dict;
    });
    return list;
  };
})();
goog.provide("uno.template.Template");
goog.require("goog.array");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.dom.classes");
goog.require("goog.string");
goog.require("goog.functions");
goog.require("uno.defs");
goog.require("uno.filters.EnmlFilter");
goog.require("uno.filters.ResourceFilter");
goog.require("uno.util.string");
goog.require("uno.util.dom");
goog.require("uno.util.objects");
goog.require("uno.PluginManager");
goog.require("uno.util.placeholder");
goog.require("uno.template.util");
goog.require("uno.template.Field");
goog.require("uno.template.NoopField");
goog.require("uno.template.TitleField");
goog.require("uno.template.AddressField");
goog.require("uno.template.PlainTextField");
goog.require("uno.template.PlainTextArea");
goog.require("uno.template.PhoneField");
goog.require("uno.template.LinkField");
goog.require("uno.template.EmailField");
goog.require("uno.template.TwitterField");
goog.require("uno.template.FacebookField");
goog.require("uno.template.LinkedInField");
goog.require("uno.template.WeiboField");
goog.require("uno.template.commands.Changes");
goog.require("uno.template.commands.Content");
goog.require("uno.template.commands.Copy");
goog.require("uno.template.commands.Focus");
goog.require("uno.template.commands.Margin");
goog.require("uno.template.commands.PassThrough");
goog.require("uno.template.commands.Paste");
goog.require("uno.template.commands.Resources");
(function() {
  var log = goog.debug.Logger.getLogger("uno.api.ce");
  var util = uno.util;
  var tmpl = uno.template.util;
  var TEMPLATE_ROOT_TAG = "en-template";
  var fieldTypeMap = {title:uno.template.TitleField, field:uno.template.PlainTextField, textarea:uno.template.PlainTextArea, phone:uno.template.PhoneField, email:uno.template.EmailField, twitter:uno.template.TwitterField, linkedin:uno.template.LinkedInField, facebook:uno.template.FacebookField, weibo:uno.template.WeiboField, address:uno.template.AddressField, "profile-image":uno.template.NoopField};
  var Template = uno.template.Template = function(rteID, options) {
    this.templateElement = document.querySelector(TEMPLATE_ROOT_TAG);
    this.initConfig(options);
    if (this.templateElement == null) {
      var rteElement = document.querySelector("#" + rteID);
      if (rteElement == null) {
        log.severe("Fatal: Couldn't find rte element " + rteID);
        return;
      }
      this.templateElement = goog.dom.createDom(TEMPLATE_ROOT_TAG);
      goog.dom.insertSiblingAfter(this.templateElement, rteElement);
    }
    this.PM = new uno.PluginManager;
    this.PM.add(new uno.template.commands.Changes(this));
    this.PM.add(new uno.template.commands.Content(this));
    this.PM.add(new uno.template.commands.Copy(this));
    this.PM.add(new uno.template.commands.Focus(this));
    this.PM.add(new uno.template.commands.Margin(this));
    this.PM.add(new uno.template.commands.PassThrough(this));
    this.PM.add(new uno.template.commands.Paste(this));
    this.PM.add(new uno.template.commands.Resources(this));
    this.execCommand = this.PM.execCommand.bind(this.PM);
    this.queryCommandEnabled = this.PM.queryCommandEnabled.bind(this.PM);
    this.queryCommandValue = this.PM.queryCommandValue.bind(this.PM);
  };
  Template.prototype.opt = {};
  Template.prototype.originalDocument = "";
  Template.prototype.fields = [];
  Template.prototype.PM = null;
  Template.prototype.templateElement = null;
  Template.prototype.contentCssClass = null;
  Template.prototype.isSetup = false;
  Template.prototype.setup = function(opt) {
    var contentClass = opt.template.contentClass;
    this.opt = opt;
    this.opt.localization = opt.template.localization || opt.localization || {"display-as-placeholder-title":"Add Name...", "contact-title-placeholder-title":"Add Title...", "contact-org-placeholder-title":"Add Company...", "note-body-placeholder-title":"Add Notes...", "linkedin-placeholder-title":"Add LinkedIn URL...", "facebook-placeholder-title":"Add Facebook URL...", "twitter-placeholder-title":"Add Twitter Name...", "weibo-placeholder-title":"Add Weibo Name...", "phone-placeholder-title":"Add Phone...", 
    "email-placeholder-title":"Add Email...", "address-placeholder-title":"Add Address...", "email-label":"Email", "home-label":"Home", "work-label":"Work", "other-label":"Other", "phone-label":"Phone", "mobile-label":"Mobile", "main-label":"Main", "home-fax-label":"Home Fax", "work-fax-label":"Work Fax", "twitter-label":"Twitter", "facebook-label":"Facebook", "weibo-label":"Weibo", "linkedin-label":"LinkedIn", "address-label":"Address"};
    this.isSetup = true;
    util.placeholder.hide();
    if (contentClass) {
      this.contentCssClass = contentClass.replace(/[^\w]+/gi, "-");
      this.templateElement.setAttribute("class", "");
      goog.dom.classes.add(this.templateElement, this.contentCssClass);
      if (!this.config.readOnly) {
        goog.dom.classes.add(this.templateElement, "editable");
      }
    } else {
      log.warning("Unnecessary setup of Template w/o contentClass");
      return;
    }
    if (!util.string.isEmpty(opt.template.html)) {
      this.originalDocument = opt.template.html;
      this.execCommand("content", {type:"html", content:opt.template.html});
      return;
    }
    if (!util.string.isEmpty(opt.template.enml)) {
      this.originalDocument = opt.template.enml;
      this.execCommand("content", {type:"enml", content:opt.template.enml});
      return;
    }
  };
  Template.prototype.isSupportedCommand = function(command) {
    return this.isSetup && !!this.PM.firstSupportedCommand(command);
  };
  this.execCommand = goog.functions.NULL;
  this.queryCommandEnabled = goog.functions.NULL;
  this.queryCommandValue = goog.functions.NULL;
  Template.prototype.setupFields = function() {
    var foundFields = tmpl.iterateFields(this.templateElement);
    this.fields = [];
    for (var i = 0; i < foundFields.length; i++) {
      var fieldInfo = foundFields[i];
      fieldInfo.index = i;
      fieldInfo.opt = this.opt;
      fieldInfo.template = this;
      fieldInfo.container = fieldInfo.node;
      if (Object.keys(fieldTypeMap).indexOf(fieldInfo.type) >= 0) {
        fieldInfo.object = new fieldTypeMap[fieldInfo.type](fieldInfo);
      } else {
        log.severe("Tmpl found invalid field type: " + fieldInfo.type);
      }
      this.fields.push(fieldInfo);
    }
  };
  Template.prototype.getElement = function() {
    return this.templateElement;
  };
  Template.prototype.initConfig = function(opt) {
    var options = opt || {};
    this.config = {crypt:{unveilCryptElementOnClick:false, readOnly:options.rte.cryptReadOnly || false}, readOnly:options.rte && typeof options.rte.active === "boolean" && options.rte.active === false};
  };
  Template.prototype.cleanup = function() {
    if (this.isSetup) {
      this.getElement().remove();
    }
  };
})();
goog.provide("uno.Router");
goog.require("goog.debug.Logger");
(function() {
  var log = goog.debug.Logger.getLogger("uno.Router");
  var Router = uno.Router = function(options) {
    this.messages = {};
    this.routesToHost = options.routesToHost;
    this.routesFromHost = options.routesFromHost;
    this.sendMessage = options.sendMessage;
  };
  Router.correlationId = 0;
  Router.getCorrelationId = function() {
    return ++Router.correlationId;
  };
  Router.prototype.toHostAsync = function(name, data) {
    var deferred;
    var me = this;
    var route = this.routesToHost[name];
    var correlationId = data[route.identifier];
    if (!correlationId && !route.oneway) {
      correlationId = Router.getCorrelationId();
      data[route.identifier] = correlationId;
    }
    deferred = new Deferred(function() {
      me.sendMessage(name, data);
    });
    if (route.oneway) {
      deferred.resolve();
    } else {
      this.messages[correlationId] = deferred;
    }
    return deferred.promise;
  };
  Router.prototype.fromHost = function(name, data) {
    var correlationId;
    var deferred;
    if (this.routesFromHost[name]) {
      correlationId = goog.getObjectByName(this.routesFromHost[name].identifier, data);
      deferred = this.messages[correlationId];
      delete this.messages[correlationId];
      deferred.resolve(data);
      return true;
    }
    return false;
  };
  var Deferred = function(fn) {
    var me = this;
    this.promise = new Promise(function(resolve, reject) {
      me.resolve = resolve;
      me.reject = reject;
      fn();
    });
  };
})();
goog.provide("uno.context.Context");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.functions");
goog.require("goog.object");
goog.require("goog.string");
goog.require("goog.style");
goog.require("uno.util.dom");
goog.require("uno.util.zoomscale");
(function() {
  var log = goog.debug.Logger.getLogger("uno.context.Context");
  var util = uno.util;
  var moduleName = "context";
  var CLICK_EVENT_FLE_KIND = "firstLaunch";
  var CLICK_EVENT_FLE_BUTTON_HREF = "dismiss";
  var CLICK_EVENT_FLE_LEARN_MORE_HREF = "learnMore";
  var TITLE_CLASSNAME = "en-context-item-title";
  var WIDE_CLASSNAME = "en-context-wide";
  var BODY_ITALICS_CLASSNAME = "en-context-body-italics";
  var ITEM_BODY_CLASSNAME = "en-context-item-body";
  var ITEM_BODY_ONE_LINE_CLASSNAME = "en-context-item-body-one";
  var ITEM_BODY_TWO_LINE_CLASSNAME = "en-context-item-body-two";
  var ITEM_CLASSNAME = "en-context-item";
  var CONTEXT_LABEL_CLASSNAME = "en-context-label";
  var HIDE_CLASSNAME = "en-context-hide-label";
  var SHOW_CLASSNAME = "en-context-show-label";
  var MAIN_CONTAINER_CLASSNAME = "en-context";
  var CARD_HOLDER_CLASSNAME = "en-context-card-holder";
  var IMAGE_CLIPPER_CLASSNAME = "en-context-graphic-clipper";
  var IMAGE_CLASSNAME = "en-context-graphic";
  var IMAGE_BLUR_CLASSNAME = "en-context-graphic-blur";
  var IMAGE_HOVER_CLASSNAME = "en-context-graphic-hover";
  var IMAGE_HOVER_SOLID_CLASSNAME = "en-context-graphic-hover-solid";
  var IMAGE_HOVER_MESSAGE_ICON_CLASSNAME = "en-context-workchat";
  var IMAGE_HOVER_TEXT_CLASSNAME = "en-context-share-text";
  var NEWS_SOURCE_CONTAINER_CLASSNAME = "en-context-source";
  var NEWS_SOURCE_IMAGE_CLASSNAME = "en-context-source-img";
  var NEWS_SOURCE_TEXT_CLASSNAME = "en-context-source-text";
  var NEWS_SOURCE_TEXT_BLUE_CLASSNAME = "en-context-source-text-blue";
  var AUTHOR_CLASSNAME = "en-context-author";
  var SEPARATOR_CLASSNAME = "en-context-separator";
  var NOTE_DATE_CLASSNAME = "en-context-note-date";
  var NEWS_DATE_CLASSNAME = "en-context-news-date";
  var POPUP_CLASSNAME = "en-context-popup";
  var POPUP_WRAPPER_CLASSNAME = "en-context-popup-wrapper";
  var POPUP_HEADER_CLASSNAME = "en-context-popup-header";
  var POPUP_BODY_CLASSNAME = "en-context-popup-body";
  var POPUP_FOOTER_CLASSNAME = "en-context-popup-footer";
  var POPUP_ARROW_CLASSNAME = "en-context-popup-down-arrow";
  var POPUP_VISIBLE_CLASSNAME = "en-context-popup-visible";
  var FLE_CONTAINER_CLASSNAME = "en-context-fle-container";
  var FLE_HEADER_CLASSNAME = "en-context-fle-header";
  var FLE_BODY_CLASSNAME = "en-context-fle-body";
  var FLE_DISMISS_BUTTON_CLASSNAME = "en-context-fle-dismiss-button";
  var FLE_SUBHEADER_CLASSNAME = "en-context-fle-subheader";
  var FLE_LEARN_MORE_CLASSNAME = "en-context-fle-learn-more";
  var POPUP_DURATION = 5500;
  var POPUP_FADE_DURATION = 250;
  var POPUP_INITIAL_DELAY = 1500;
  var SCROLL_SPEED = 240;
  var EXPECTED_CARD_HEIGHT = 139;
  var EXPECTED_HEADER_HEIGHT = 32;
  var CONTEXT_KIND_NOTE = "note";
  var CONTEXT_KIND_NEWS = "news";
  var CONTEXT_KIND_PEOPLE = "people";
  var CONTEXT_KIND_COMPANY = "company";
  var SOURCEID_WSJ = "dowjones.wsj";
  var SOURCEID_LINKEDIN = "profile.linkedin";
  var SOURCEID_FACTIVA = "profile.factiva";
  var SOURCEID_EB_PEOPLE = "profile.evernote.business";
  var SOURCEID_EB_NOTE = "evernote.business";
  var SOURCEID_NIKKEI_BUSINESS_ONLINE = "nikkei.bp.business";
  var SOURCEID_NIKKEI_ITPRO = "nikkei.bp.itpro";
  var SOURCEID_NIKKEI_KEN_PLATZ = "nikkei.bp.kenplatz";
  var SOURCEID_NIKKEI_TECHON = "nikkei.bp.tech";
  var BUILT_IN_SOURCE_ICONS = ["factiva", "fastcompany", "inc", "lifehacker", "linkedin", "pandodaily", "techcrunch", "theverge", "evernote-business", "wsj", "forbes", "nikkei", "nikkeibp", "techon", "itpro", "kenplatz"];
  var TITLE_FALLBACK_STRING = "Untitled";
  var CONTEXT_LABEL_FALLBACK_STRING = "Context";
  var settings;
  var container = null;
  var popup = null;
  var popupTimerID;
  var contextSeen = false;
  var contextViewDeJitterTimeoutRef;
  var Context = uno.context.Context = function(opt) {
    if (!document.querySelector("." + MAIN_CONTAINER_CLASSNAME)) {
      container = goog.dom.createDom("div", {class:MAIN_CONTAINER_CLASSNAME, id:MAIN_CONTAINER_CLASSNAME, style:"display:none;"});
      document.body.insertBefore(container, null);
      window.addEventListener("scroll", contextOnScreenHandler);
      window.addEventListener("resize", contextOnScreenHandler);
      window.addEventListener("resize", centerCards);
    }
    contextOnScreenHandler(true);
    goog.object.extend(opt, {showPopup:true, maxRows:9999});
    settings = opt;
  };
  Context.prototype.isSupportedCommand = function(command) {
    return command === "context";
  };
  Context.prototype.execCommandInternal = function(command, value) {
    if (value == null || goog.isString(value) && value === "" || goog.isObject(value) && Object.keys(value).length === 0) {
      log.warning("Context called without data");
      return;
    }
    var opt = value;
    var visible = opt.visible;
    var expanded = opt.expanded;
    var hideLabelText = opt.hideIndicatorLabelWhenExpanded;
    var showLabelText = opt.hideIndicatorLabelWhenCollapsed;
    var chatLabelText = opt.chatButtonLabel || "Chat";
    var shareLabelText = opt.shareButtonLabel || "Share";
    var items = opt.items;
    var contextSectionLabel = opt.contextSectionLabel;
    var firstLaunchInfo = opt.firstLaunchInfo;
    contextSeen = false;
    if (visible != null) {
      goog.style.setElementShown(container, !!visible);
    }
    if (!items || items.length <= 0) {
      return;
    }
    goog.dom.removeChildren(container);
    var contextLabelNode = goog.dom.createDom("div", {class:CONTEXT_LABEL_CLASSNAME});
    contextLabelNode.textContent = contextSectionLabel || CONTEXT_LABEL_FALLBACK_STRING;
    container.appendChild(contextLabelNode);
    var showHideNode = goog.dom.createDom("div", {class:expanded ? HIDE_CLASSNAME : SHOW_CLASSNAME});
    container.appendChild(showHideNode);
    fleAction(firstLaunchInfo);
    var cardHolder = goog.dom.createDom("div", {class:CARD_HOLDER_CLASSNAME});
    container.appendChild(cardHolder);
    for (var i = 0; i < items.length; i++) {
      cardHolder.appendChild(makeCard(items[i], shareLabelText, chatLabelText));
    }
    container.style.maxHeight = EXPECTED_CARD_HEIGHT * settings.maxRows + EXPECTED_HEADER_HEIGHT + "px";
    if (expanded) {
      show(showHideNode, hideLabelText);
    } else {
      hide(showHideNode, showLabelText);
    }
    addShowHideClickHandler(showHideNode, hideLabelText, showLabelText);
    centerCards();
    setTimeout(centerCards, 500);
    contextOnScreenHandler(true);
    if (visible === true && expanded === true && items.length > 0) {
      setTimeout(function() {
        contextPopup(opt);
      }, POPUP_INITIAL_DELAY);
    }
  };
  Context.prototype.queryCommandValue = goog.functions.TRUE;
  var makeCard = function(data, shareLabelText, chatLabelText) {
    var link = data.link || "#";
    var kind = data.kind || "undefined";
    var text = document.createTextNode(goog.string.unescapeEntities(data.text || ""));
    var imgSrc = data.thumbnail || "";
    var hasImage = imgSrc !== "";
    var titleStr = goog.string.unescapeEntities(data.title || TITLE_FALLBACK_STRING);
    var sourceName = data.sourceName || "";
    var sourceId = data.sourceId || "";
    var date = data.date || "";
    var author = data.author || "";
    var canShare = data.canShare;
    var title = goog.dom.createDom("div", {class:hasImage ? TITLE_CLASSNAME : TITLE_CLASSNAME + " " + WIDE_CLASSNAME});
    title.setAttribute("href", link);
    title.setAttribute("name", kind);
    title.textContent = titleStr;
    var authorNode = goog.dom.createDom("span", {class:AUTHOR_CLASSNAME});
    if (author !== "") {
      authorNode.textContent = author;
    }
    var separator = goog.dom.createDom("span", {class:SEPARATOR_CLASSNAME});
    separator.textContent = "|";
    var dateNode = goog.dom.createDom("span", {class:kind === CONTEXT_KIND_NOTE ? NOTE_DATE_CLASSNAME : NEWS_DATE_CLASSNAME});
    if (date !== "") {
      dateNode.textContent = date;
    }
    var bodyContents = [];
    if (kind === CONTEXT_KIND_NEWS) {
      if (date !== "") {
        bodyContents.push(dateNode);
        if (author !== "") {
          bodyContents.push(separator);
          bodyContents.push(authorNode);
        }
      } else {
        if (author !== "") {
          bodyContents.push(authorNode);
        }
      }
    } else {
      if (date !== "") {
        bodyContents.push(dateNode);
      }
      bodyContents.push(text);
    }
    var bodyClasses = ITEM_BODY_CLASSNAME;
    if (!hasImage) {
      bodyClasses += " " + WIDE_CLASSNAME;
    }
    if (kind === CONTEXT_KIND_NEWS) {
      bodyClasses += " " + ITEM_BODY_ONE_LINE_CLASSNAME;
    } else {
      if (kind === CONTEXT_KIND_NOTE && sourceId === SOURCEID_EB_NOTE) {
        bodyClasses += " " + ITEM_BODY_TWO_LINE_CLASSNAME;
      } else {
        if (kind === CONTEXT_KIND_PEOPLE) {
          bodyClasses += " " + BODY_ITALICS_CLASSNAME;
        }
      }
    }
    var body = goog.dom.createDom("div", {class:bodyClasses}, bodyContents);
    var graphicClipper = goog.dom.createDom("div", {class:IMAGE_CLIPPER_CLASSNAME});
    var graphicClasses = IMAGE_CLASSNAME;
    if (canShare) {
      graphicClasses += " " + IMAGE_BLUR_CLASSNAME;
    }
    var graphic = goog.dom.createDom("img", {class:graphicClasses, alt:"graphic", src:imgSrc});
    var graphicOverlayClasses = IMAGE_HOVER_CLASSNAME;
    if (!hasImage) {
      graphicOverlayClasses += " " + IMAGE_HOVER_SOLID_CLASSNAME;
    }
    var graphicOverlay = goog.dom.createDom("div", {class:graphicOverlayClasses}, [goog.dom.createDom("div", {class:IMAGE_HOVER_MESSAGE_ICON_CLASSNAME}), goog.dom.createDom("div", {class:IMAGE_HOVER_TEXT_CLASSNAME}, [kind === CONTEXT_KIND_PEOPLE ? chatLabelText : shareLabelText])]);
    if (hasImage) {
      graphicClipper.appendChild(graphic);
    }
    if (canShare) {
      graphicClipper.appendChild(graphicOverlay);
      graphicClipper.addEventListener("click", function(e) {
        EN.notifyAsync("openLink", {href:title.getAttribute("href"), module:moduleName, kind:title.getAttribute("name"), sharing:true});
        e.stopPropagation();
      });
    }
    var sourceIconName = sourceId;
    if (sourceIconName === SOURCEID_WSJ) {
      sourceIconName = "wsj";
    }
    if (sourceIconName === SOURCEID_LINKEDIN) {
      sourceIconName = "linkedin";
    }
    if (sourceIconName === SOURCEID_EB_PEOPLE || sourceIconName === SOURCEID_EB_NOTE) {
      sourceIconName = "evernote-business";
    }
    if (sourceIconName === SOURCEID_FACTIVA) {
      sourceIconName = "factiva";
    }
    if (sourceIconName === SOURCEID_NIKKEI_BUSINESS_ONLINE) {
      sourceIconName = "nikkeibp";
    }
    if (sourceIconName === SOURCEID_NIKKEI_ITPRO) {
      sourceIconName = "itpro";
    }
    if (sourceIconName === SOURCEID_NIKKEI_KEN_PLATZ) {
      sourceIconName = "kenplatz";
    }
    if (sourceIconName === SOURCEID_NIKKEI_TECHON) {
      sourceIconName = "techon";
    }
    var sourceTextClasses = "";
    if (sourceId === SOURCEID_EB_PEOPLE || sourceId === SOURCEID_EB_NOTE) {
      sourceTextClasses = NEWS_SOURCE_TEXT_BLUE_CLASSNAME;
    }
    var sourceNameIcon = goog.dom.createDom("div", {class:NEWS_SOURCE_IMAGE_CLASSNAME + " " + sourceIconName});
    var sourceNameNode = goog.dom.createDom("div", {class:NEWS_SOURCE_TEXT_CLASSNAME + " " + sourceTextClasses});
    if (sourceId === SOURCEID_WSJ) {
      sourceNameNode.textContent = "";
    } else {
      if (sourceId === SOURCEID_EB_NOTE) {
        sourceNameNode.textContent = author;
      } else {
        sourceNameNode.textContent = sourceName;
      }
    }
    var sourceInfo = goog.dom.createDom("div", {class:NEWS_SOURCE_CONTAINER_CLASSNAME});
    if (BUILT_IN_SOURCE_ICONS.indexOf(sourceIconName) !== -1) {
      sourceInfo.appendChild(sourceNameIcon);
    }
    sourceInfo.appendChild(sourceNameNode);
    var cardContent = [title, body];
    cardContent.push(graphicClipper);
    if (kind === CONTEXT_KIND_NEWS || kind === CONTEXT_KIND_PEOPLE || kind === CONTEXT_KIND_COMPANY || kind === CONTEXT_KIND_NOTE && sourceId === SOURCEID_EB_NOTE) {
      cardContent.push(sourceInfo);
    }
    var card = goog.dom.createDom("div", {class:ITEM_CLASSNAME}, cardContent);
    card.addEventListener("click", function(e) {
      EN.notifyAsync("openLink", {href:title.getAttribute("href"), module:moduleName, kind:title.getAttribute("name"), sharing:false});
      e.preventDefault();
    });
    return card;
  };
  var contextOnScreenHandler = function(immediate) {
    if (immediate == null) {
      immediate = false;
    }
    var logic = function() {
      var firstCard = container.querySelector("." + ITEM_CLASSNAME);
      if (firstCard == null) {
        return;
      }
      if (util.dom.isOnScreen(firstCard, 100)) {
        if (contextSeen === false) {
          contextSeen = true;
          EN.notifyAsync("contextVisible", {module:moduleName});
        }
      }
    };
    if (immediate) {
      logic();
    } else {
      contextViewDeJitterTimeoutRef = setTimeout(logic, 100, contextViewDeJitterTimeoutRef);
    }
  };
  var hide = function(labelNode, showText) {
    var cardHolder = container.querySelector("." + CARD_HOLDER_CLASSNAME);
    var fle = container.querySelector("." + FLE_CONTAINER_CLASSNAME);
    if (cardHolder == null) {
      log.severe("Couldnt find card holder?!");
      return;
    }
    labelNode.textContent = showText;
    goog.dom.classes.remove(labelNode, HIDE_CLASSNAME);
    goog.dom.classes.add(labelNode, SHOW_CLASSNAME);
    cardHolder.style.display = "none";
    if (fle != null && fle.length === 1) {
      fle[0].style.display = "none";
    }
  };
  var show = function(labelNode, hideText) {
    var cardHolder = container.querySelector("." + CARD_HOLDER_CLASSNAME);
    var fle = container.querySelector("." + FLE_CONTAINER_CLASSNAME);
    if (cardHolder == null) {
      log.severe("Couldnt find card holder?!");
      return;
    }
    labelNode.textContent = hideText;
    goog.dom.classes.remove(labelNode, SHOW_CLASSNAME);
    goog.dom.classes.add(labelNode, HIDE_CLASSNAME);
    cardHolder.style.display = "";
    centerCards();
    if (fle != null && fle.length === 1) {
      fle[0].style.display = "";
    }
  };
  var addShowHideClickHandler = function(node, hideText, showText) {
    node.addEventListener("click", function() {
      if (node.textContent === hideText) {
        hide(node, showText);
        EN.notifyAsync("contextExpanded", {module:moduleName, expanded:false});
      } else {
        if (node.textContent === showText) {
          show(node, hideText);
          EN.notifyAsync("contextExpanded", {module:moduleName, expanded:true});
        }
      }
      contextOnScreenHandler(true);
    });
  };
  var contextPopup = function(opt) {
    if (contextSeen === true || settings.showPopup === false || popup != null || container == null || opt == null || opt.items == null || opt.items.length === 0) {
      return;
    }
    var items = opt.items;
    var headerLabel = opt.toastNotificationHeaderLabel || "FIX HEADER";
    var footerLabel = opt.toastNotificationFooterLabel || "FIX FOOTER";
    var titleStr = goog.string.unescapeEntities(items[0].title || TITLE_FALLBACK_STRING);
    var popupHeader = goog.dom.createDom("div", {class:POPUP_HEADER_CLASSNAME});
    popupHeader.textContent = headerLabel;
    var bodyClasses = POPUP_BODY_CLASSNAME;
    if (items[0].kind != null) {
      bodyClasses += " " + items[0].kind;
    }
    var popupBody = goog.dom.createDom("div", {class:bodyClasses});
    popupBody.textContent = titleStr;
    var popupFooter = goog.dom.createDom("div", {class:POPUP_FOOTER_CLASSNAME});
    popupFooter.textContent = footerLabel;
    popupFooter.appendChild(goog.dom.createDom("div", {class:POPUP_ARROW_CLASSNAME}));
    popup = goog.dom.createDom("div", {class:POPUP_CLASSNAME}, [goog.dom.createDom("div", {class:POPUP_WRAPPER_CLASSNAME}, [popupHeader, popupBody, popupFooter])]);
    goog.dom.insertSiblingAfter(popup, container);
    setTimeout(function() {
      goog.dom.classes.add(popup, POPUP_VISIBLE_CLASSNAME);
    }, 1);
    popup.addEventListener("mousedown", function() {
      clearTimeout(popupTimerID);
    });
    popup.addEventListener("mouseup", function() {
      var bounds = getBounds(container);
      util.dom.scrollTo(bounds.top - 15, SCROLL_SPEED);
      goog.dom.classes.remove(popup, POPUP_VISIBLE_CLASSNAME);
      popup.pointerEvents = "none";
    });
    popupTimerID = setTimeout(function() {
      goog.dom.classes.remove(popup, POPUP_VISIBLE_CLASSNAME);
      popup.pointerEvents = "none";
      setTimeout(function() {
        popup.style.display = "none";
      }, POPUP_FADE_DURATION);
    }, POPUP_DURATION, popupTimerID);
  };
  var getBounds = function(node) {
    return util.zoomscale.normalizeRect(goog.style.getBounds(node));
  };
  var getCardLayoutInfo = function() {
    var cardHolder = document.querySelector("." + CARD_HOLDER_CLASSNAME);
    var allCards = document.querySelectorAll("." + ITEM_CLASSNAME);
    var numCards = allCards.length || 0;
    var sampleCard = document.querySelector("." + ITEM_CLASSNAME);
    if (cardHolder == null || sampleCard == null) {
      return null;
    }
    var availableSpace = Math.round(getBounds(cardHolder).width);
    var compStyle = window.getComputedStyle(sampleCard);
    var cardMarginX = parseInt(compStyle["margin-left"], 10) + parseInt(compStyle["margin-right"], 10);
    var cardMarginY = parseInt(compStyle["margin-top"], 10) + parseInt(compStyle["margin-bottom"], 10);
    var cardWidth = Math.round(sampleCard.offsetWidth + cardMarginX);
    var cardHeight = Math.round(sampleCard.offsetHeight + cardMarginY);
    return {availableSpace:availableSpace, numCards:numCards, cardWidth:cardWidth, cardHeight:cardHeight, cardsPerRow:Math.floor(availableSpace / cardWidth)};
  };
  var centerCards = function() {
    var layoutInfo = getCardLayoutInfo();
    var cardHolder = document.querySelector("." + CARD_HOLDER_CLASSNAME);
    if (layoutInfo == null || cardHolder == null) {
      return;
    }
    var realNumCardsPerRow = Math.min(layoutInfo.numCards, layoutInfo.cardsPerRow);
    if (realNumCardsPerRow <= 0) {
      cardHolder.style.left = "0px";
      return;
    }
    var remainder = layoutInfo.availableSpace - layoutInfo.cardWidth * realNumCardsPerRow;
    cardHolder.style.left = remainder / 2 + "px";
  };
  var fleAction = function(firstLaunchInfo) {
    if (firstLaunchInfo == null || firstLaunchInfo.headline == null || firstLaunchInfo.subHeadline == null || firstLaunchInfo.learnMoreLinkLabel == null || firstLaunchInfo.dismissButtonLabel == null) {
      return;
    }
    log.warning("The FLE functionality has been merged into " + "the context-info command. Please switch " + "to that API.");
    var headline = firstLaunchInfo.headline;
    var subHeadline = firstLaunchInfo.subHeadline;
    var learnMoreLinkLabel = firstLaunchInfo.learnMoreLinkLabel;
    var dismissButtonLabel = firstLaunchInfo.dismissButtonLabel;
    var FLEContainer = goog.dom.createDom("div", {class:FLE_CONTAINER_CLASSNAME});
    container.appendChild(FLEContainer);
    var FLEHeader = goog.dom.createDom("div", {class:FLE_HEADER_CLASSNAME});
    FLEHeader.textContent = headline;
    FLEContainer.appendChild(FLEHeader);
    var FLEBody = goog.dom.createDom("div", {class:FLE_BODY_CLASSNAME});
    FLEContainer.appendChild(FLEBody);
    var FLESubHeader = goog.dom.createDom("span", {class:FLE_SUBHEADER_CLASSNAME});
    FLESubHeader.textContent = subHeadline + " ";
    FLEBody.appendChild(FLESubHeader);
    var FLELearnMore = goog.dom.createDom("span", {class:FLE_LEARN_MORE_CLASSNAME});
    FLELearnMore.textContent = learnMoreLinkLabel;
    FLEBody.appendChild(FLELearnMore);
    FLELearnMore.addEventListener("click", function(e) {
      EN.notifyAsync("openLink", {href:CLICK_EVENT_FLE_LEARN_MORE_HREF, module:moduleName, kind:CLICK_EVENT_FLE_KIND, sharing:false});
      e.preventDefault();
      e.stopPropagation();
      return false;
    });
    var FLEDismissButton = goog.dom.createDom("div", {class:FLE_DISMISS_BUTTON_CLASSNAME});
    FLEDismissButton.textContent = dismissButtonLabel;
    FLEContainer.appendChild(FLEDismissButton);
    FLEDismissButton.addEventListener("click", function(e) {
      EN.notifyAsync("openLink", {href:CLICK_EVENT_FLE_BUTTON_HREF, module:moduleName, kind:CLICK_EVENT_FLE_KIND, sharing:false});
      goog.dom.removeNode(FLEContainer);
      e.stopPropagation();
    });
  };
})();
goog.provide("uno.context.Info");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.functions");
goog.require("goog.style");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.context.Info");
  var util = uno.util;
  var moduleName = "context-info";
  var MAIN_CONTAINER_CLASSNAME = "en-context-info";
  var BODY_CONTAINER_CLASSNAME = "en-context-info-body";
  var CONTEXT_LOGO_CLASSNAME = "en-context-info-logo";
  var HEADLINE_CLASSNAME = "en-context-info-headline";
  var BUTTON_CLASSNAME = "en-context-info-button";
  var SECTION_CLASSNAME = "en-context-info-section";
  var SECTION_IMAGE_CLASSNAME = "en-context-info-section-image";
  var SECTION_TITLE_CLASSNAME = "en-context-info-section-title";
  var SECTION_TEXT_CLASSNAME = "en-context-info-section-text";
  var STRETCHER_CLASSNAME = "en-context-info-stretcher";
  var NUM_INFO_SECTIONS = 3;
  var ALLOWED_SECTION_TYPES = ["note", "article", "person"];
  var container = null;
  var bodyContainer = null;
  var contextSeen = false;
  var contextViewDeJitterTimeoutRef;
  var ContextInfo = uno.context.Info = function() {
    if (!document.querySelector("." + MAIN_CONTAINER_CLASSNAME)) {
      container = goog.dom.createDom("div", {class:MAIN_CONTAINER_CLASSNAME, style:"display:none;"});
      document.body.insertBefore(container, null);
      window.addEventListener("scroll", onScreenHandler);
      window.addEventListener("resize", onScreenHandler);
    }
    onScreenHandler(true);
  };
  ContextInfo.prototype.isSupportedCommand = function(command) {
    return command === "context-info";
  };
  ContextInfo.prototype.queryCommandEnabled = goog.functions.TRUE;
  ContextInfo.prototype.execCommandInternal = function(command, value) {
    if (value == null || goog.isString(value) && value === "" || goog.isObject(value) && Object.keys(value).length === 0) {
      return false;
    }
    var opt = value;
    var showLogo = opt.showLogo || false;
    var headline = opt.headline || "HEADLINE";
    var infoSections = opt.infoSections || [];
    var buttonLabel = opt.buttonLabel || "BUTTONLABEL";
    var hideOnButtonClick = opt.hideOnButtonClick || false;
    goog.dom.removeChildren(container);
    container.style.display = "";
    contextSeen = false;
    var logo = goog.dom.createDom("div", {class:CONTEXT_LOGO_CLASSNAME});
    if (showLogo) {
      container.appendChild(logo);
    }
    var headlineNode = goog.dom.createDom("div", {class:HEADLINE_CLASSNAME});
    headlineNode.textContent = headline;
    container.appendChild(headlineNode);
    bodyContainer = goog.dom.createDom("div", {id:BODY_CONTAINER_CLASSNAME});
    container.appendChild(bodyContainer);
    if (infoSections.length === NUM_INFO_SECTIONS) {
      for (var i = 0; i < infoSections.length; i++) {
        bodyContainer.appendChild(createSection(infoSections[i]));
        bodyContainer.appendChild(document.createTextNode(" "));
      }
      var stretcher = goog.dom.createDom("div", {class:STRETCHER_CLASSNAME});
      bodyContainer.appendChild(stretcher);
    }
    var buttonNode = goog.dom.createDom("div", {class:BUTTON_CLASSNAME});
    buttonNode.textContent = buttonLabel;
    container.appendChild(buttonNode);
    buttonNode.addEventListener("click", function(e) {
      EN.notifyAsync("openLink", {href:"http://evernote.com", module:moduleName, kind:"info", sharing:true});
      if (hideOnButtonClick) {
        container.style.display = "none";
      }
      e.preventDefault();
      e.stopPropagation();
      return false;
    });
    onScreenHandler(true);
    return true;
  };
  var onScreenHandler = function(immediate) {
    immediate = immediate === true;
    var logic = function() {
      var isOnScreen = container.style.display === "none" ? false : util.dom.isOnScreen(container, 75);
      if (isOnScreen) {
        if (contextSeen === false) {
          contextSeen = true;
          EN.notifyAsync("contextVisible", {module:moduleName});
        }
      }
    };
    if (immediate) {
      logic();
    } else {
      clearTimeout(contextViewDeJitterTimeoutRef);
      contextViewDeJitterTimeoutRef = setTimeout(logic, 250);
    }
  };
  var createSection = function(info) {
    if (info == null || !goog.isString(info.type) || !goog.isString(info.title) || !goog.isString(info.text)) {
      log.severe("Incomplete section info for context-info!");
    }
    var found = false;
    for (var i = 0; i < ALLOWED_SECTION_TYPES.length; i++) {
      if (info.type === ALLOWED_SECTION_TYPES[i]) {
        found = true;
      }
    }
    if (found === false) {
      log.severe("Invalid type given for context-info: " + info.type);
    }
    var section = goog.dom.createDom("div", {class:SECTION_CLASSNAME});
    var image = goog.dom.createDom("div", {class:SECTION_IMAGE_CLASSNAME + " " + info.type});
    section.appendChild(image);
    var title = goog.dom.createDom("div", {class:SECTION_TITLE_CLASSNAME});
    title.textContent = info.title;
    section.appendChild(title);
    var text = goog.dom.createDom("div", {class:SECTION_TEXT_CLASSNAME});
    text.textContent = info.text;
    section.appendChild(text);
    return section;
  };
})();
goog.provide("uno.context.Upsell");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.functions");
goog.require("goog.style");
goog.require("uno.util.dom");
(function() {
  var log = goog.debug.Logger.getLogger("uno.context.Upsell");
  var util = uno.util;
  var moduleName = "context-upsell";
  var MAIN_CONTAINER_CLASSNAME = "en-context-upsell";
  var BODY_CONTAINER_CLASSNAME = "en-context-upsell-body";
  var HIDE_CLASSNAME = "en-context-upsell-hide-label";
  var SHOW_CLASSNAME = "en-context-upsell-show-label";
  var HEADLINE_CLASSNAME = "en-context-upsell-headline";
  var SUBHEADLINE_CLASSNAME = "en-context-upsell-subheadline";
  var GO_PREMIUM_CLASSNAME = "en-context-upsell-go-premium";
  var HEADLINE_FALLBACK = "Get more Context with Premium";
  var SUBHEADLINE_FALLBACK = "Go Premium to view notes," + " articles, and people related to what you're working on.";
  var PREMIUM_FALLBACK = "Go Premium";
  var HIDE_FALLBACK = "Hide";
  var SHOW_FALLBACK = "Show";
  var container = null;
  var bodyContainer = null;
  var contextSeen = false;
  var contextViewDeJitterTimeoutRef;
  var ContextUpsell = uno.context.Upsell = function() {
    if (!document.querySelector("." + MAIN_CONTAINER_CLASSNAME)) {
      container = goog.dom.createDom("div", {class:MAIN_CONTAINER_CLASSNAME, id:MAIN_CONTAINER_CLASSNAME, style:"display:none;"});
      document.body.insertBefore(container, null);
      window.addEventListener("scroll", onScreenHandler);
      window.addEventListener("resize", onScreenHandler);
    }
    onScreenHandler(true);
  };
  ContextUpsell.prototype.isSupportedCommand = function(command) {
    return command === "context-upsell";
  };
  ContextUpsell.prototype.queryCommandEnabled = goog.functions.TRUE;
  ContextUpsell.prototype.execCommandInternal = function(command, value) {
    if (value == null || goog.isString(value) && value === "" || goog.isObject(value) && Object.keys(value).length === 0) {
      return false;
    }
    log.warning("The FLE functionality has been merged into " + "the context-info command. Please switch " + "to that API.");
    var opt = value;
    var expanded = opt.expanded;
    if (expanded == null) {
      expanded = false;
    }
    var headline = opt.headline || HEADLINE_FALLBACK;
    var subHeadline = opt.subHeadline || SUBHEADLINE_FALLBACK;
    var goPremium = opt.goPremiumLabel || PREMIUM_FALLBACK;
    var hideLabel = opt.hideIndicatorLabelWhenExpanded || HIDE_FALLBACK;
    var showLabel = opt.hideIndicatorLabelWhenCollapsed || SHOW_FALLBACK;
    goog.dom.removeChildren(container);
    container.style.display = "";
    contextSeen = false;
    bodyContainer = goog.dom.createDom("div", {class:BODY_CONTAINER_CLASSNAME});
    container.appendChild(bodyContainer);
    var showHideNode = goog.dom.createDom("div", {class:expanded ? HIDE_CLASSNAME : SHOW_CLASSNAME});
    container.appendChild(showHideNode);
    if (expanded) {
      show(showHideNode, hideLabel);
    } else {
      hide(showHideNode, showLabel);
    }
    addShowHideClickHandler(showHideNode, hideLabel, showLabel);
    var headlineNode = goog.dom.createDom("div", {class:HEADLINE_CLASSNAME});
    headlineNode.textContent = headline;
    bodyContainer.appendChild(headlineNode);
    var subheadlineNode = goog.dom.createDom("div", {class:SUBHEADLINE_CLASSNAME});
    subheadlineNode.textContent = subHeadline;
    bodyContainer.appendChild(subheadlineNode);
    var goPremiumNode = goog.dom.createDom("div", {class:GO_PREMIUM_CLASSNAME});
    goPremiumNode.textContent = goPremium;
    bodyContainer.appendChild(goPremiumNode);
    goPremiumNode.addEventListener("click", function(e) {
      EN.notifyAsync("openLink", {href:"http://evernote.com", module:moduleName, kind:"upsell", sharing:true});
      e.preventDefault();
      e.stopPropagation();
      return false;
    });
    onScreenHandler(true);
    return true;
  };
  var onScreenHandler = function(immediate) {
    immediate = immediate === true;
    var logic = function() {
      var isOnScreen = container.style.display === "none" ? false : util.dom.isOnScreen(container, 75);
      if (isOnScreen) {
        if (contextSeen === false) {
          contextSeen = true;
          EN.notifyAsync("contextVisible", {module:moduleName});
        }
      }
    };
    if (immediate) {
      logic();
    } else {
      clearTimeout(contextViewDeJitterTimeoutRef);
      contextViewDeJitterTimeoutRef = setTimeout(logic, 250);
    }
  };
  var hide = function(labelNode, showText) {
    if (bodyContainer == null) {
      return;
    }
    labelNode.textContent = showText;
    goog.dom.classes.remove(labelNode, HIDE_CLASSNAME);
    goog.dom.classes.add(labelNode, SHOW_CLASSNAME);
    bodyContainer.style.display = "none";
  };
  var show = function(labelNode, hideText) {
    if (bodyContainer == null) {
      return;
    }
    labelNode.textContent = hideText;
    goog.dom.classes.remove(labelNode, SHOW_CLASSNAME);
    goog.dom.classes.add(labelNode, HIDE_CLASSNAME);
    bodyContainer.style.display = "";
  };
  var addShowHideClickHandler = function(node, hideText, showText) {
    node.addEventListener("click", function() {
      if (node.textContent === hideText) {
        hide(node, showText);
        EN.notifyAsync("contextExpanded", {module:moduleName, expanded:false});
      } else {
        if (node.textContent === showText) {
          show(node, hideText);
          EN.notifyAsync("contextExpanded", {module:moduleName, expanded:true});
        }
      }
      onScreenHandler(true);
    });
  };
})();
goog.provide("uno.polyfill");
goog.require("goog.object");
if (!goog.isDef(Object.assign)) {
  Object.assign = function(target, source1, source2) {
    if (arguments.length < 2) {
      return target;
    }
    var args = Array.prototype.slice.call(arguments).filter(function(arg) {
      return goog.isObject(arg);
    });
    goog.object.extend.apply(goog.object, args);
    return target;
  };
}
if (!Array.from) {
  Array.from = function(val) {
    return [].slice.call(val);
  };
}
if (!Array.prototype.includes) {
  Object.defineProperty(Array.prototype, "includes", {value:function(searchElement, fromIndex) {
    if (this == null) {
      throw new TypeError('"this" is null or not defined');
    }
    var o = Object(this);
    var len = o.length >>> 0;
    if (len === 0) {
      return false;
    }
    var n = fromIndex | 0;
    var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
    function sameValueZero(x, y) {
      return x === y || typeof x === "number" && typeof y === "number" && isNaN(x) && isNaN(y);
    }
    while (k < len) {
      if (sameValueZero(o[k], searchElement)) {
        return true;
      }
      k++;
    }
    return false;
  }});
}
;goog.provide("uno.util.toast");
goog.require("goog.debug.Logger");
goog.require("uno.util.react");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.toast");
  var util = uno.util;
  util.toast.show = function(params) {
    params = params || {};
    params.type = params.type || "" + Math.random();
    params.messageText = params.messageText || "";
    EN.query("platform-version-for", "actionNotification").then(function(version) {
      if (version === "1") {
        EN.run("platform-use", {type:"actionNotification", payload:{type:params.type, messageText:params.messageText, actionText:params.actionText, timeout:params.timeout}, callback:function(data) {
          data = data || {};
          if (data.result === "action" && typeof params.actionCallback === "function") {
            params.actionCallback();
          }
        }});
      } else {
        uno.util.react.toastNotification({type:params.type, messageText:params.messageText, actionText:params.actionText, actionCallback:params.actionCallback, timeout:params.timeout});
      }
    });
  };
})();
goog.provide("uno.util.templates");
goog.require("goog.debug.Logger");
goog.require("uno.util.react");
(function() {
  var log = goog.debug.Logger.getLogger("uno.util.templates");
  var util = uno.util;
  util.templates.showTemplateDialog = EN.whenAppEnabled("templatemanager", function(editor, type, templateInfo) {
    templateInfo = templateInfo || {};
    var range = editor.getRange();
    util.react.renderTemplateDialog({active:false});
    setTimeout(function() {
      var title = templateInfo.title || (type === "create" ? editor.config.note.title : uno.util.loc.t("New Template"));
      util.react.renderTemplateDialog({type:type, active:true, title:title, access:templateInfo.access, hasResources:type === "create" && util.resource.all(editor.field).length > 0, closeDialog:util.templates.closeTemplateDialog, doAction:function(responses) {
        responses = responses || {};
        switch(type) {
          case "create":
            util.templates.createFromNote(editor, responses.title, responses.access);
            break;
          case "update":
            if (responses.title !== title || responses.access !== templateInfo.access) {
              EN.run("template-update", {template:{guid:templateInfo.guid, description:responses.title || "", access:responses.access || "private"}});
            }
            break;
          case "delete":
            EN.run("template-remove", {guid:templateInfo.guid});
            break;
          default:
        }
      }, restoreRange:function() {
        if (range) {
          editor.restoreRange(range);
        }
      }});
    });
  });
  util.templates.closeTemplateDialog = function() {
    util.react.renderTemplateDialog({active:false});
  };
  util.templates.createFromNote = EN.whenAppEnabled("templatemanager", function(editor, title, access) {
    var templateTitle = title || editor.config.note.title || "New Template";
    var templateAccess = access || "private";
    EN.run("template-create", {title:templateTitle, access:templateAccess});
  });
})();
goog.provide("uno.api.ce");
goog.require("goog.debug.Logger");
goog.require("goog.dom");
goog.require("goog.dom.classlist");
goog.require("goog.style");
goog.require("goog.editor.Command");
goog.require("goog.events");
goog.require("goog.object");
goog.require("uno.ConsoleLogger");
goog.require("uno.NetworkLogger");
goog.require("uno.Auth");
goog.require("uno.Cache");
goog.require("uno.debug");
goog.require("uno.Editor");
goog.require("uno.featureflags");
goog.require("uno.template.Template");
goog.require("uno.Router");
goog.require("uno.context.Context");
goog.require("uno.context.Info");
goog.require("uno.context.Upsell");
goog.require("uno.PluginManager");
goog.require("uno.polyfill");
goog.require("uno.util.dom");
goog.require("uno.util.toast");
goog.require("uno.util.templates");
(function() {
  var ce = uno.api.ce;
  ce.version = "53.2.6641";
  var options;
  var log = goog.debug.Logger.getLogger("uno.api.ce");
  var util = uno.util;
  var ted = null;
  window.DEBUG = false;
  window.onerror = function(error) {
    log.severe("Unhandled error: " + (error.stack || error));
    return false;
  };
  var consoleLogger = new uno.ConsoleLogger({cachingEnabled:true});
  consoleLogger.setCapturing(true);
  var networkLogger = new uno.NetworkLogger;
  var purgeLogsOnSetup = false;
  var Editor = uno.Editor;
  var Template = uno.template.Template;
  var rxRedundantPrefixes = /^(?:rte|content|richlinks)\./;
  var router = new uno.Router({sendMessage:function(name, info) {
    return ce.notifyAsync(name, info);
  }, routesToHost:{requestAuth:{identifier:"serviceName"}, showOptions:{identifier:"correlationId"}, getFromCache:{identifier:"correlationId"}, saveInCache:{identifier:"correlationId", oneway:true}}, routesFromHost:{authtoken:{identifier:"service"}, optionselected:{identifier:"showEvent.correlationId"}, cacheddata:{identifier:"cacheRequest.correlationId"}}});
  var cache = new uno.Cache({router:router});
  var auth = new uno.Auth({router:router});
  var PM = new uno.PluginManager;
  ce.logs = consoleLogger;
  ce.getLogs = function() {
    return ce.logs.cache.map(function(record) {
      return record.formattedText;
    }).join("\n");
  };
  ce.setup = function(opt) {
    opt = opt || {};
    options = goog.isObject(opt) ? opt : JSON.parse(opt);
    options.version = ce.version;
    DEBUG = options.debug === true;
    start("EN.setup");
    stubLocalStorage();
    ce.cleanupInternal_();
    var id;
    configLogging(options);
    cache.diskEnabled = options.rte && options.rte.richLink && options.rte.richLinksCaching;
    goog.object.extend(options, {cache:cache, auth:auth, router:router});
    id = options.id || "en-note";
    window.ed = new Editor(id, options);
    ted = new Template(id, options);
    if (DEBUG) {
      swizzleSelection();
    }
    ed.listen(Editor.EventType.ANALYTICS, onAnalyticsEvent);
    ed.listen(Editor.EventType.DELAYEDCHANGE, onEditorDelayedChange);
    ed.listen(Editor.EventType.FOCUS, onEditorFocus);
    ed.listen(Editor.EventType.BLUR, onEditorBlur);
    ed.listen(Editor.EventType.STYLE_CHANGED, onEditorStyleChanged);
    ed.listen(Editor.EventType.PRINT_READY, onPrintReady);
    ed.listen(Editor.EventType.ENCRYPT, onEncrypt);
    ed.listen(Editor.EventType.DECRYPT, onDecrypt);
    ed.listen(Editor.EventType.CONTENT_LOADED, onEditorContentLoaded);
    ed.listen(Editor.EventType.ACTION_DENIED, onActionDenied);
    ed.listen(Editor.EventType.SHUTDOWN_COMPLETE, onShutdownComplete);
    ed.listen(Editor.EventType.RESOURCES_CHANGED, onResourcesChanged);
    ed.listen(Editor.EventType.EDIT_MODE_CHANGED, onEditorEditModeChanged);
    if (options.rte != null) {
      options.rte = options.rte || {};
      options.rte.imageConfig = options.rte.imageConfig || {};
      if (options.rte.imageConfig.imageClickEvents) {
        ed.listen(Editor.EventType.IMAGE_CLICK, onImageClick);
        ed.listen(Editor.EventType.IMAGE_DOUBLECLICK, onImageDoubleClick);
      }
      if (options.rte.imageConfig.annotate) {
        ed.listen(Editor.EventType.IMAGE_ANNOTATE, onImageEvent);
      }
      if (options.rte.imageConfig.preview) {
        ed.listen(Editor.EventType.IMAGE_PREVIEW, onImageEvent);
      }
      if (options.rte.imageConfig.rotate) {
        ed.listen(Editor.EventType.IMAGE_ROTATE, onImageEvent);
      }
      ed.listen(Editor.EventType.LINK_CLICK, onLinkClick);
      ed.listen(Editor.EventType.CRYPT_DOUBLECLICK, onCryptDoubleClick);
      ed.listen(Editor.EventType.RESOURCE_DOUBLECLICK, onResourceDoubleClick);
    }
    options.rte.trackStateChanges = (options.rte.trackStateChanges || []).concat(["bold", "italic", "underline", "highlight", "strikethrough", "subscript", "superscript"]);
    options.rte.trackValueChanges = (options.rte.trackValueChanges || []).concat(["justifyleft", "justifyright", "justifycenter", "fontsize", "fontname", "forecolor"]);
    goog.array.removeDuplicates(options.rte.trackStateChanges);
    goog.array.removeDuplicates(options.rte.trackValueChanges);
    ed.suppressFocusDuring(ed.setup);
    var rteElement = ed.getElement();
    var templateElement = ted.getElement();
    var hasTemplate = options.template || options.note.contentClass === "evernote.contact.1";
    if (hasTemplate) {
      options.template = options.template || {};
      if (!options.template.contentClass) {
        options.template.contentClass = options.note.contentClass;
      }
      if (!options.template.html && !options.template.enml && options.rte) {
        options.template.html = options.html || options.rte.html || "";
        options.template.enml = options.enml || options.rte.enml || "";
      }
      ed.clearListeners();
      ted.setup(options);
      if (rteElement) {
        rteElement.style.display = "none";
      }
      if (templateElement) {
        templateElement.style.display = "";
      }
    } else {
      if (rteElement) {
        rteElement.style.display = "";
      }
      if (templateElement) {
        templateElement.style.display = "none";
      }
    }
    start("Setup Context");
    PM.add(new uno.context.Context(options.context || {}));
    stop("Setup Context");
    start("Setup Context Upsell");
    PM.add(new uno.context.Upsell(options["context-upsell"] || {}));
    stop("Setup Context Upsell");
    start("Setup Context Info");
    PM.add(new uno.context.Info(options["context-info"] || {}));
    stop("Setup Context Info");
    if (options.realtime != null && !!options.realtime.enabled) {
      ce.setupRealtime(options);
    }
    PM.add(ted);
    PM.add(ed);
    if (DEBUG) {
      ed.context.statusbar.version = ce.getVersion();
      uno.util.react.renderStatusBar(ed.context.statusbar);
    }
    stop("EN.setup");
    return true;
  };
  ce.setupRealtime = function(opt) {
    var ed = window.ed;
    if (!options || !ed || !ed.isSetup) {
      return;
    }
    ce.cleanupRealtime();
    ed.listen("realtimeSetupDone", onRealtimeSetupDone);
    ed.listen("realtimeConnectStateChanged", onRealtimeConnectStateChanged);
    ed.listen("realtimeServerVersionUpdated", onRealtimeServerVersionUpdated);
    ed.listen("realtimeNoteSavedNotification", onRealtimeNoteSavedNotification);
    ed.listen("realtimeSessionEstablished", onRealtimeSessionEstablished);
    ed.listen("realtimeErrorHandler", onRealtimeErrorHandler);
    ed.listen("reload", onReload);
    ed.listen("resourceNeedsUpdate", onResourceNeedsUpdate);
  };
  ce.cleanupRealtime = function() {
    var ed = window.ed;
    ed.unlisten("realtimeSetupDone");
    ed.unlisten("realtimeConnectStateChanged");
    ed.unlisten("realtimeServerVersionUpdated");
    ed.unlisten("realtimeErrorHandler");
    ed.unlisten("reload");
    ed.unlisten("resourceNeedsUpdate");
  };
  ce.cleanup = function() {
    start("EN.cleanup");
    var result = ce.cleanupInternal_();
    ce.notifyAsync("cleanupDone");
    stop("EN.cleanup");
    return result;
  };
  ce.cleanupInternal_ = function() {
    if (window.ed && goog.isFunction(window.ed.cleanup)) {
      window.ed.cleanup();
    }
    if (ted && goog.isFunction(ted.cleanup)) {
      ted.cleanup();
    }
    if (PM) {
      PM.clear();
    }
    util.dom.scrollLeft(document.body, 0);
    util.dom.scrollTop(document.body, 0);
    return true;
  };
  function setLogLevel(level) {
    var rootLogger = goog.debug.Logger.getLogger(goog.debug.Logger.ROOT_LOGGER_NAME);
    var googLevel = goog.debug.Logger.Level.getPredefinedLevel(level || "ALL");
    rootLogger.setLevel(googLevel);
  }
  ce.setLogLevel = setLogLevel;
  ce.getLogLevel = function() {
    var rootLogger = goog.debug.Logger.getLogger(goog.debug.Logger.ROOT_LOGGER_NAME);
    return rootLogger.getLevel().name;
  };
  function configLogging(opt) {
    opt.logging = opt.logging || {};
    opt.logging.level = localStorage.ce_logLevel || opt.logging.level || "CONFIG";
    EN.setLogLevel(opt.logging.level);
    consoleLogger.configure({cachingEnabled:opt.logging.cachingEnabled != null ? opt.logging.cachingEnabled : DEBUG, maxEntries:typeof opt.logging.maxEntries !== "undefined" ? opt.logging.maxEntries : 1000});
    if (opt.realtime && opt.realtime.enabled) {
      opt.env = opt.env || {};
      networkLogger.configure({url:(opt.realtime.url || "https://rte.www.evernote.com") + "/logger", whitelist:["resources"]});
      networkLogger.setCapturing(true);
    }
    purgeLogsOnSetup = opt.logging.purgeLogsOnSetup != null ? opt.logging.purgeLogsOnSetup : true;
  }
  ce.execCommand = function(command, value, opt) {
    var normalizedCommand = filterCommandPrefix(command);
    if (router.fromHost(normalizedCommand, value)) {
      return true;
    }
    return PM.execCommand(normalizedCommand, value, opt, true);
  };
  ce.queryCommandEnabled = function(command, opt) {
    return PM.queryCommandEnabled(filterCommandPrefix(command), opt, true);
  };
  ce.queryCommandValue = function(command, opt) {
    var normalizedCommand = filterCommandPrefix(command);
    var result = PM.queryCommandValue(normalizedCommand, opt, true);
    updateDebugState("dirty");
    return result;
  };
  ce.queryCommandState = function(command, opt) {
    var normalizedCommand = filterCommandPrefix(command);
    var result = PM.queryCommandValue(normalizedCommand, opt || null);
    if (result === "true") {
      result = true;
    }
    if (result === "false") {
      result = false;
    }
    if (command === "justifyleft") {
      result = result === "left";
    } else {
      if (command === "justifycenter") {
        result = result === "center";
      } else {
        if (command === "justifyright") {
          result = result === "right";
        } else {
          if (command === "justifyfull") {
            result = result === "justify";
          } else {
            if (command === "insertorderedlist") {
              result = result === "ol";
            } else {
              if (command === "insertunorderedlist") {
                result = result === "ul";
              }
            }
          }
        }
      }
    }
    return !!result;
  };
  ce.enablePrint = function(localization, opt) {
    ed.execCommand("printpreview", localization, opt);
  };
  ce.disablePrint = function() {
    ed.execCommand("printpreview", null, {disable:true});
  };
  ce.getVersion = function() {
    var prefix = DEBUG ? "CE " : "";
    var version = ce.version;
    if (window.ed && window.ed.config.realtime.enabled) {
      version += " " + ce.getRealtimeServerVersion();
      prefix = "CE ";
    }
    version = prefix + version;
    return version;
  };
  ce.getRealtimeServerVersion = function() {
    if (!window.ed) {
      return "";
    }
    return window.ed.getRealtimeServerVersion();
  };
  ce.getBuildPath = function() {
    var scripts = document.querySelectorAll('script[src*="/deps.js"]');
    var depsScript = Array.from(scripts).find(function(s) {
      return /goog\/deps.js/.test(s.getAttribute("src")) === false;
    });
    return depsScript ? depsScript.getAttribute("src").replace(/\/deps.js$/, "") + "/" : "";
  };
  function filterCommandPrefix(command) {
    return command.replace(rxRedundantPrefixes, "");
  }
  function onAnalyticsEvent(evt) {
    ce.notify("analytics", evt.data);
  }
  function onEditorDelayedChange() {
    ce.notifyAsync("contentChanged", {module:"content", isEmpty:util.dom.isEmpty(ed.field), canCreateTemplate:ed.queryCommandEnabled("createtemplate")});
    updateDebugState("dirty");
  }
  function onEditorFocus() {
    ce.notifyAsync("focusChanged", {focus:true, module:"content", showInput:ed.showVirtualKeyboardOnFocus});
    updateDebugState("focus");
  }
  function onEditorBlur() {
    ce.notifyAsync("focusChanged", {focus:false, module:"content"});
    updateDebugState("focus");
  }
  function onEditorStyleChanged(e) {
    e.style.module = "content";
    ce.notifyAsync("styleChanged", e.style);
  }
  function onPrintReady() {
    ce.notifyAsync("printReady", {module:"print"});
  }
  function onEncrypt(e) {
    ce.notifyAsync("encrypt", e.cryptInfo);
  }
  function onDecrypt(e) {
    ce.notifyAsync("decrypt", e.cryptInfo);
  }
  function onEditorContentLoaded() {
    ce.notifyAsync("contentLoaded", {module:"content"});
  }
  function onEditorEditModeChanged() {
    updateDebugState("readonly");
  }
  function onActionDenied(e) {
    ce.notifyAsync("actionDenied", e.reason);
  }
  function onImageClick(e) {
    ce.notifyAsync("clicked", {name:e.name, src:e.src, tagname:e.tagname, reference:e.reference});
  }
  function onImageDoubleClick(e) {
    ce.notifyAsync("doubleClicked", {name:e.name, src:e.src, tagname:e.tagname, reference:e.reference});
  }
  function onImageEvent(e) {
    ce.notifyAsync(e.type, {module:e.module, src:e.src, tagname:e.tagname});
  }
  function onLinkClick(e) {
    ce.notifyAsync("openLink", e.data);
  }
  function onRealtimeSetupDone(e) {
    ce.notifyAsync("realtimeSetupDone");
  }
  function onRealtimeConnectStateChanged(e) {
    ce.notifyAsync("realtimeConnectStateChanged", {connected:e.connected});
  }
  function onRealtimeServerVersionUpdated() {
    updateDebugState("version");
  }
  function onRealtimeNoteSavedNotification(e) {
    ce.notifyAsync("realtimeNoteSavedNotification", e.syncMetadata);
  }
  function onRealtimeSessionEstablished(e) {
    ce.notifyAsync("realtimeSessionEstablished", e.syncMetadata);
  }
  function onRealtimeErrorHandler(e) {
    ce.notifyAsync("realtimeErrorHandler", e.error);
  }
  function onReload(e) {
    ce.notifyAsync("reload");
  }
  function onShutdownComplete(e) {
    ce.notifyAsync("shutdownComplete", {code:e.code, syncMetadata:e.syncMetadata});
  }
  function onCryptDoubleClick(e) {
    ce.notifyAsync("doubleClicked", {id:e.id, src:e.src});
  }
  function onResourcesChanged(e) {
    ce.notifyAsync("resourcesChanged");
  }
  function onResourceNeedsUpdate(e) {
    ce.notifyAsync("resourceNeedsUpdate", {props:e.props});
  }
  function onResourceDoubleClick(e) {
    ce.notifyAsync("doubleClicked", {src:e.src});
  }
  function updateStyleChanges(styleOverrides) {
    var rte = options.rte;
    var style = ed.context.style;
    var hasChanges = false;
    styleOverrides = styleOverrides || {state:{}, value:{}, enabled:{}};
    if (rte && goog.isArray(rte.trackStateChanges)) {
      rte.trackStateChanges.map(filterCommandPrefix).forEach(function(command) {
        var result = typeof styleOverrides.state[command] !== "undefined" ? styleOverrides.state[command] : ed.queryCommandState(command);
        if (style.state[command] !== result) {
          style.state[command] = result;
          hasChanges = true;
        }
      });
    }
    if (rte && goog.isArray(rte.trackValueChanges)) {
      rte.trackValueChanges.map(filterCommandPrefix).forEach(function(command) {
        var result = typeof styleOverrides.value[command] !== "undefined" ? styleOverrides.value[command] : ed.queryCommandValue(command);
        if (style.value[command] !== result) {
          style.value[command] = result;
          hasChanges = true;
        }
      });
    }
    if (rte && goog.isArray(rte.trackEnabledChanges)) {
      rte.trackEnabledChanges.map(filterCommandPrefix).forEach(function(command) {
        var result = typeof styleOverrides.enabled[command] !== "undefined" ? styleOverrides.enabled[command] : ed.queryCommandEnabled(command);
        if (style.enabled[command] !== result) {
          style.enabled[command] = result;
          hasChanges = true;
        }
      });
    }
    if (hasChanges) {
      style.module = "content";
      ce.notifyAsync("styleChanged", style);
    }
  }
  function stubLocalStorage() {
    if (window.localStorage === null) {
      delete window.localStorage;
      var s = {};
      window.localStorage = sessionStorage;
    }
  }
  function swizzleSelection() {
    if (localStorage.ce_trackRange && !Selection.prototype.addRange_) {
      Selection.prototype.addRange_ = Selection.prototype.addRange;
      Selection.prototype.addRange = function(range) {
        log.warning("selection set to " + util.range.print_(range.startContainer, range.startOffset, range.endContainer, range.endOffset));
        return this.addRange_(range);
      };
      Selection.prototype.setBaseAndExtent_ = Selection.prototype.setBaseAndExtent;
      Selection.prototype.setBaseAndExtent = function(a, b, c, d) {
        log.warning("selection set to " + util.range.print_(a, b, c, d));
        return this.setBaseAndExtent_(a, b, c, d);
      };
    }
  }
  function updateDebugState(key) {
    if (!DEBUG && !(window.ed && window.ed.config.realtime.enabled)) {
      return;
    }
    var oldValue = ed.context.statusbar[key];
    var newValue = null;
    if (key === "dirty") {
      newValue = ed.dirty;
    } else {
      if (key === "focus") {
        newValue = ed.isFocused();
      } else {
        if (key === "readonly") {
          newValue = ed.readOnly;
        } else {
          if (key === "version") {
            newValue = ce.getVersion();
          } else {
            throw new Error("Invalid debug state " + key + ", please update editor.context.statusbar.STATE and StatusBar component accordingly.");
          }
        }
      }
    }
    if (newValue !== oldValue) {
      ed.context.statusbar[key] = newValue;
      uno.util.react.renderStatusBar(ed.context.statusbar);
    }
  }
  function wrapToEnable(obj, field) {
    var enabled = true;
    var f = obj[field];
    obj[field] = function() {
      return enabled && f.apply(obj, arguments);
    };
    return function(v) {
      enabled = v;
    };
  }
  var enableGoogEvents = wrapToEnable(goog.events, "fireListener");
  ce.activate = function() {
    document.body.classList.toggle("ce-deactivated", false);
    enableGoogEvents(true);
  };
  ce.deactivate = function() {
    document.body.classList.toggle("ce-deactivated", true);
    enableGoogEvents(false);
  };
  ce.run = function(cmd, params) {
    switch(cmd) {
      case "toast":
        return uno.util.toast.show(params);
      case "menu":
        return uno.util.react.showMenu(params);
      case "templatedialog":
        return uno.util.templates.showTemplateDialog.apply(null, [ed].concat(Array.prototype.slice.call(arguments, 1)));
      default:
        return Promise.reject("unknown command " + cmd);
    }
  };
  ce.query = function() {
  };
  ce.runCommands = ["toast", "menu", "templatedialog"];
  ce.queries = [];
  ce.init = function(callbacks) {
    ce.notify = callbacks.notify;
    ce.notifyAsync = callbacks.notifyAsync;
  };
  (function() {
    var setup = ce.setup;
    ce.setup = function(opt) {
      if (purgeLogsOnSetup) {
        consoleLogger.clear();
      }
      return setup(opt);
    };
  })();
  window.enLoadState = "didLoad";
})();

