28421 lines
1 MiB
28421 lines
1 MiB
<html><head><meta charset="UTF-8"><!--
|
||
@license
|
||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
|
||
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
||
Code distributed by Google as part of the polymer project is also
|
||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
|
||
--><!--
|
||
@license
|
||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||
Code distributed by Google as part of the polymer project is also
|
||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||
--><!--
|
||
@license
|
||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||
Code distributed by Google as part of the polymer project is also
|
||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||
--><script>(function () {
|
||
function resolve() {
|
||
document.body.removeAttribute('unresolved');
|
||
}
|
||
if (window.WebComponents) {
|
||
addEventListener('WebComponentsReady', resolve);
|
||
} else {
|
||
if (document.readyState === 'interactive' || document.readyState === 'complete') {
|
||
resolve();
|
||
} else {
|
||
addEventListener('DOMContentLoaded', resolve);
|
||
}
|
||
}
|
||
}());
|
||
Polymer = {
|
||
Settings: function () {
|
||
var user = window.Polymer || {};
|
||
location.search.slice(1).split('&').forEach(function (o) {
|
||
o = o.split('=');
|
||
o[0] && (user[o[0]] = o[1] || true);
|
||
});
|
||
var wantShadow = user.dom === 'shadow';
|
||
var hasShadow = Boolean(Element.prototype.createShadowRoot);
|
||
var nativeShadow = hasShadow && !window.ShadowDOMPolyfill;
|
||
var useShadow = wantShadow && hasShadow;
|
||
var hasNativeImports = Boolean('import' in document.createElement('link'));
|
||
var useNativeImports = hasNativeImports;
|
||
var useNativeCustomElements = !window.CustomElements || window.CustomElements.useNative;
|
||
return {
|
||
wantShadow: wantShadow,
|
||
hasShadow: hasShadow,
|
||
nativeShadow: nativeShadow,
|
||
useShadow: useShadow,
|
||
useNativeShadow: useShadow && nativeShadow,
|
||
useNativeImports: useNativeImports,
|
||
useNativeCustomElements: useNativeCustomElements
|
||
};
|
||
}()
|
||
};
|
||
(function () {
|
||
var userPolymer = window.Polymer;
|
||
window.Polymer = function (prototype) {
|
||
var ctor = desugar(prototype);
|
||
prototype = ctor.prototype;
|
||
var options = { prototype: prototype };
|
||
if (prototype.extends) {
|
||
options.extends = prototype.extends;
|
||
}
|
||
Polymer.telemetry._registrate(prototype);
|
||
document.registerElement(prototype.is, options);
|
||
return ctor;
|
||
};
|
||
var desugar = function (prototype) {
|
||
prototype = Polymer.Base.chainObject(prototype, Polymer.Base);
|
||
prototype.registerCallback();
|
||
return prototype.constructor;
|
||
};
|
||
window.Polymer = Polymer;
|
||
if (userPolymer) {
|
||
for (var i in userPolymer) {
|
||
Polymer[i] = userPolymer[i];
|
||
}
|
||
}
|
||
Polymer.Class = desugar;
|
||
}());
|
||
Polymer.telemetry = {
|
||
registrations: [],
|
||
_regLog: function (prototype) {
|
||
console.log('[' + prototype.is + ']: registered');
|
||
},
|
||
_registrate: function (prototype) {
|
||
this.registrations.push(prototype);
|
||
Polymer.log && this._regLog(prototype);
|
||
},
|
||
dumpRegistrations: function () {
|
||
this.registrations.forEach(this._regLog);
|
||
}
|
||
};
|
||
Object.defineProperty(window, 'currentImport', {
|
||
enumerable: true,
|
||
configurable: true,
|
||
get: function () {
|
||
return (document._currentScript || document.currentScript).ownerDocument;
|
||
}
|
||
});
|
||
Polymer.Base = {
|
||
_addFeature: function (feature) {
|
||
this.extend(this, feature);
|
||
},
|
||
registerCallback: function () {
|
||
this._registerFeatures();
|
||
this._doBehavior('registered');
|
||
},
|
||
createdCallback: function () {
|
||
Polymer.telemetry.instanceCount++;
|
||
this.root = this;
|
||
this._doBehavior('created');
|
||
this._initFeatures();
|
||
},
|
||
attachedCallback: function () {
|
||
this.isAttached = true;
|
||
this._doBehavior('attached');
|
||
},
|
||
detachedCallback: function () {
|
||
this.isAttached = false;
|
||
this._doBehavior('detached');
|
||
},
|
||
attributeChangedCallback: function (name) {
|
||
this._setAttributeToProperty(this, name);
|
||
this._doBehavior('attributeChanged', arguments);
|
||
},
|
||
extend: function (prototype, api) {
|
||
if (prototype && api) {
|
||
Object.getOwnPropertyNames(api).forEach(function (n) {
|
||
this.copyOwnProperty(n, api, prototype);
|
||
}, this);
|
||
}
|
||
return prototype || api;
|
||
},
|
||
copyOwnProperty: function (name, source, target) {
|
||
var pd = Object.getOwnPropertyDescriptor(source, name);
|
||
if (pd) {
|
||
Object.defineProperty(target, name, pd);
|
||
}
|
||
},
|
||
_log: console.log.apply.bind(console.log, console),
|
||
_warn: console.warn.apply.bind(console.warn, console),
|
||
_error: console.error.apply.bind(console.error, console),
|
||
_logf: function () {
|
||
return this._logPrefix.concat([this.is]).concat(Array.prototype.slice.call(arguments, 0));
|
||
}
|
||
};
|
||
Polymer.Base._logPrefix = function () {
|
||
var color = window.chrome || /firefox/i.test(navigator.userAgent);
|
||
return color ? [
|
||
'%c[%s::%s]:',
|
||
'font-weight: bold; background-color:#EEEE00;'
|
||
] : ['[%s::%s]:'];
|
||
}();
|
||
Polymer.Base.chainObject = function (object, inherited) {
|
||
if (object && inherited && object !== inherited) {
|
||
if (!Object.__proto__) {
|
||
object = Polymer.Base.extend(Object.create(inherited), object);
|
||
}
|
||
object.__proto__ = inherited;
|
||
}
|
||
return object;
|
||
};
|
||
Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
|
||
Polymer.telemetry.instanceCount = 0;
|
||
(function () {
|
||
var modules = {};
|
||
var DomModule = function () {
|
||
return document.createElement('dom-module');
|
||
};
|
||
DomModule.prototype = Object.create(HTMLElement.prototype);
|
||
DomModule.prototype.constructor = DomModule;
|
||
DomModule.prototype.createdCallback = function () {
|
||
var id = this.id || this.getAttribute('name') || this.getAttribute('is');
|
||
if (id) {
|
||
this.id = id;
|
||
modules[id] = this;
|
||
}
|
||
};
|
||
DomModule.prototype.import = function (id, slctr) {
|
||
var m = modules[id];
|
||
if (!m) {
|
||
forceDocumentUpgrade();
|
||
m = modules[id];
|
||
}
|
||
if (m && slctr) {
|
||
m = m.querySelector(slctr);
|
||
}
|
||
return m;
|
||
};
|
||
var cePolyfill = window.CustomElements && !CustomElements.useNative;
|
||
if (cePolyfill) {
|
||
var ready = CustomElements.ready;
|
||
CustomElements.ready = true;
|
||
}
|
||
document.registerElement('dom-module', DomModule);
|
||
if (cePolyfill) {
|
||
CustomElements.ready = ready;
|
||
}
|
||
function forceDocumentUpgrade() {
|
||
if (cePolyfill) {
|
||
var script = document._currentScript || document.currentScript;
|
||
if (script) {
|
||
CustomElements.upgradeAll(script.ownerDocument);
|
||
}
|
||
}
|
||
}
|
||
}());
|
||
Polymer.Base._addFeature({
|
||
_prepIs: function () {
|
||
if (!this.is) {
|
||
var module = (document._currentScript || document.currentScript).parentNode;
|
||
if (module.localName === 'dom-module') {
|
||
var id = module.id || module.getAttribute('name') || module.getAttribute('is');
|
||
this.is = id;
|
||
}
|
||
}
|
||
}
|
||
});
|
||
Polymer.Base._addFeature({
|
||
behaviors: [],
|
||
_prepBehaviors: function () {
|
||
if (this.behaviors.length) {
|
||
this.behaviors = this._flattenBehaviorsList(this.behaviors);
|
||
}
|
||
this._prepAllBehaviors(this.behaviors);
|
||
},
|
||
_flattenBehaviorsList: function (behaviors) {
|
||
var flat = [];
|
||
behaviors.forEach(function (b) {
|
||
if (b instanceof Array) {
|
||
flat = flat.concat(this._flattenBehaviorsList(b));
|
||
} else if (b) {
|
||
flat.push(b);
|
||
} else {
|
||
this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for missing or 404 import'));
|
||
}
|
||
}, this);
|
||
return flat;
|
||
},
|
||
_prepAllBehaviors: function (behaviors) {
|
||
for (var i = behaviors.length - 1; i >= 0; i--) {
|
||
this._mixinBehavior(behaviors[i]);
|
||
}
|
||
for (var i = 0, l = behaviors.length; i < l; i++) {
|
||
this._prepBehavior(behaviors[i]);
|
||
}
|
||
this._prepBehavior(this);
|
||
},
|
||
_mixinBehavior: function (b) {
|
||
Object.getOwnPropertyNames(b).forEach(function (n) {
|
||
switch (n) {
|
||
case 'hostAttributes':
|
||
case 'registered':
|
||
case 'properties':
|
||
case 'observers':
|
||
case 'listeners':
|
||
case 'created':
|
||
case 'attached':
|
||
case 'detached':
|
||
case 'attributeChanged':
|
||
case 'configure':
|
||
case 'ready':
|
||
break;
|
||
default:
|
||
if (!this.hasOwnProperty(n)) {
|
||
this.copyOwnProperty(n, b, this);
|
||
}
|
||
break;
|
||
}
|
||
}, this);
|
||
},
|
||
_doBehavior: function (name, args) {
|
||
this.behaviors.forEach(function (b) {
|
||
this._invokeBehavior(b, name, args);
|
||
}, this);
|
||
this._invokeBehavior(this, name, args);
|
||
},
|
||
_invokeBehavior: function (b, name, args) {
|
||
var fn = b[name];
|
||
if (fn) {
|
||
fn.apply(this, args || Polymer.nar);
|
||
}
|
||
},
|
||
_marshalBehaviors: function () {
|
||
this.behaviors.forEach(function (b) {
|
||
this._marshalBehavior(b);
|
||
}, this);
|
||
this._marshalBehavior(this);
|
||
}
|
||
});
|
||
Polymer.Base._addFeature({
|
||
_prepExtends: function () {
|
||
if (this.extends) {
|
||
this.__proto__ = this._getExtendedPrototype(this.extends);
|
||
}
|
||
},
|
||
_getExtendedPrototype: function (tag) {
|
||
return this._getExtendedNativePrototype(tag);
|
||
},
|
||
_nativePrototypes: {},
|
||
_getExtendedNativePrototype: function (tag) {
|
||
var p = this._nativePrototypes[tag];
|
||
if (!p) {
|
||
var np = this.getNativePrototype(tag);
|
||
p = this.extend(Object.create(np), Polymer.Base);
|
||
this._nativePrototypes[tag] = p;
|
||
}
|
||
return p;
|
||
},
|
||
getNativePrototype: function (tag) {
|
||
return Object.getPrototypeOf(document.createElement(tag));
|
||
}
|
||
});
|
||
Polymer.Base._addFeature({
|
||
_prepConstructor: function () {
|
||
this._factoryArgs = this.extends ? [
|
||
this.extends,
|
||
this.is
|
||
] : [this.is];
|
||
var ctor = function () {
|
||
return this._factory(arguments);
|
||
};
|
||
if (this.hasOwnProperty('extends')) {
|
||
ctor.extends = this.extends;
|
||
}
|
||
Object.defineProperty(this, 'constructor', {
|
||
value: ctor,
|
||
writable: true,
|
||
configurable: true
|
||
});
|
||
ctor.prototype = this;
|
||
},
|
||
_factory: function (args) {
|
||
var elt = document.createElement.apply(document, this._factoryArgs);
|
||
if (this.factoryImpl) {
|
||
this.factoryImpl.apply(elt, args);
|
||
}
|
||
return elt;
|
||
}
|
||
});
|
||
Polymer.nob = Object.create(null);
|
||
Polymer.Base._addFeature({
|
||
properties: {},
|
||
getPropertyInfo: function (property) {
|
||
var info = this._getPropertyInfo(property, this.properties);
|
||
if (!info) {
|
||
this.behaviors.some(function (b) {
|
||
return info = this._getPropertyInfo(property, b.properties);
|
||
}, this);
|
||
}
|
||
return info || Polymer.nob;
|
||
},
|
||
_getPropertyInfo: function (property, properties) {
|
||
var p = properties && properties[property];
|
||
if (typeof p === 'function') {
|
||
p = properties[property] = { type: p };
|
||
}
|
||
if (p) {
|
||
p.defined = true;
|
||
}
|
||
return p;
|
||
}
|
||
});
|
||
Polymer.CaseMap = {
|
||
_caseMap: {},
|
||
dashToCamelCase: function (dash) {
|
||
var mapped = Polymer.CaseMap._caseMap[dash];
|
||
if (mapped) {
|
||
return mapped;
|
||
}
|
||
if (dash.indexOf('-') < 0) {
|
||
return Polymer.CaseMap._caseMap[dash] = dash;
|
||
}
|
||
return Polymer.CaseMap._caseMap[dash] = dash.replace(/-([a-z])/g, function (m) {
|
||
return m[1].toUpperCase();
|
||
});
|
||
},
|
||
camelToDashCase: function (camel) {
|
||
var mapped = Polymer.CaseMap._caseMap[camel];
|
||
if (mapped) {
|
||
return mapped;
|
||
}
|
||
return Polymer.CaseMap._caseMap[camel] = camel.replace(/([a-z][A-Z])/g, function (g) {
|
||
return g[0] + '-' + g[1].toLowerCase();
|
||
});
|
||
}
|
||
};
|
||
Polymer.Base._addFeature({
|
||
_prepAttributes: function () {
|
||
this._aggregatedAttributes = {};
|
||
},
|
||
_addHostAttributes: function (attributes) {
|
||
if (attributes) {
|
||
this.mixin(this._aggregatedAttributes, attributes);
|
||
}
|
||
},
|
||
_marshalHostAttributes: function () {
|
||
this._applyAttributes(this, this._aggregatedAttributes);
|
||
},
|
||
_applyAttributes: function (node, attr$) {
|
||
for (var n in attr$) {
|
||
if (!this.hasAttribute(n) && n !== 'class') {
|
||
this.serializeValueToAttribute(attr$[n], n, this);
|
||
}
|
||
}
|
||
},
|
||
_marshalAttributes: function () {
|
||
this._takeAttributesToModel(this);
|
||
},
|
||
_takeAttributesToModel: function (model) {
|
||
for (var i = 0, l = this.attributes.length; i < l; i++) {
|
||
this._setAttributeToProperty(model, this.attributes[i].name);
|
||
}
|
||
},
|
||
_setAttributeToProperty: function (model, attrName) {
|
||
if (!this._serializing) {
|
||
var propName = Polymer.CaseMap.dashToCamelCase(attrName);
|
||
var info = this.getPropertyInfo(propName);
|
||
if (info.defined || this._propertyEffects && this._propertyEffects[propName]) {
|
||
var val = this.getAttribute(attrName);
|
||
model[propName] = this.deserialize(val, info.type);
|
||
}
|
||
}
|
||
},
|
||
_serializing: false,
|
||
reflectPropertyToAttribute: function (name) {
|
||
this._serializing = true;
|
||
this.serializeValueToAttribute(this[name], Polymer.CaseMap.camelToDashCase(name));
|
||
this._serializing = false;
|
||
},
|
||
serializeValueToAttribute: function (value, attribute, node) {
|
||
var str = this.serialize(value);
|
||
(node || this)[str === undefined ? 'removeAttribute' : 'setAttribute'](attribute, str);
|
||
},
|
||
deserialize: function (value, type) {
|
||
switch (type) {
|
||
case Number:
|
||
value = Number(value);
|
||
break;
|
||
case Boolean:
|
||
value = value !== null;
|
||
break;
|
||
case Object:
|
||
try {
|
||
value = JSON.parse(value);
|
||
} catch (x) {
|
||
}
|
||
break;
|
||
case Array:
|
||
try {
|
||
value = JSON.parse(value);
|
||
} catch (x) {
|
||
value = null;
|
||
console.warn('Polymer::Attributes: couldn`t decode Array as JSON');
|
||
}
|
||
break;
|
||
case Date:
|
||
value = new Date(value);
|
||
break;
|
||
case String:
|
||
default:
|
||
break;
|
||
}
|
||
return value;
|
||
},
|
||
serialize: function (value) {
|
||
switch (typeof value) {
|
||
case 'boolean':
|
||
return value ? '' : undefined;
|
||
case 'object':
|
||
if (value instanceof Date) {
|
||
return value;
|
||
} else if (value) {
|
||
try {
|
||
return JSON.stringify(value);
|
||
} catch (x) {
|
||
return '';
|
||
}
|
||
}
|
||
default:
|
||
return value != null ? value : undefined;
|
||
}
|
||
}
|
||
});
|
||
Polymer.Base._addFeature({
|
||
_setupDebouncers: function () {
|
||
this._debouncers = {};
|
||
},
|
||
debounce: function (jobName, callback, wait) {
|
||
this._debouncers[jobName] = Polymer.Debounce.call(this, this._debouncers[jobName], callback, wait);
|
||
},
|
||
isDebouncerActive: function (jobName) {
|
||
var debouncer = this._debouncers[jobName];
|
||
return debouncer && debouncer.finish;
|
||
},
|
||
flushDebouncer: function (jobName) {
|
||
var debouncer = this._debouncers[jobName];
|
||
if (debouncer) {
|
||
debouncer.complete();
|
||
}
|
||
},
|
||
cancelDebouncer: function (jobName) {
|
||
var debouncer = this._debouncers[jobName];
|
||
if (debouncer) {
|
||
debouncer.stop();
|
||
}
|
||
}
|
||
});
|
||
Polymer.version = '1.0.3';
|
||
Polymer.Base._addFeature({
|
||
_registerFeatures: function () {
|
||
this._prepIs();
|
||
this._prepAttributes();
|
||
this._prepBehaviors();
|
||
this._prepExtends();
|
||
this._prepConstructor();
|
||
},
|
||
_prepBehavior: function (b) {
|
||
this._addHostAttributes(b.hostAttributes);
|
||
},
|
||
_marshalBehavior: function (b) {
|
||
},
|
||
_initFeatures: function () {
|
||
this._marshalHostAttributes();
|
||
this._setupDebouncers();
|
||
this._marshalBehaviors();
|
||
}
|
||
});</script>
|
||
|
||
<script>Polymer.Base._addFeature({
|
||
_prepTemplate: function () {
|
||
this._template = this._template || Polymer.DomModule.import(this.is, 'template');
|
||
if (!this._template) {
|
||
var script = document._currentScript || document.currentScript;
|
||
var prev = script && script.previousElementSibling;
|
||
if (prev && prev.localName === 'template') {
|
||
this._template = prev;
|
||
}
|
||
}
|
||
if (this._template && this._template.hasAttribute('is')) {
|
||
this._warn(this._logf('_prepTemplate', 'top-level Polymer template ' + 'must not be a type-extension, found', this._template, 'Move inside simple <template>.'));
|
||
}
|
||
},
|
||
_stampTemplate: function () {
|
||
if (this._template) {
|
||
this.root = this.instanceTemplate(this._template);
|
||
}
|
||
},
|
||
instanceTemplate: function (template) {
|
||
var dom = document.importNode(template._content || template.content, true);
|
||
return dom;
|
||
}
|
||
});
|
||
(function () {
|
||
var baseAttachedCallback = Polymer.Base.attachedCallback;
|
||
Polymer.Base._addFeature({
|
||
_hostStack: [],
|
||
ready: function () {
|
||
},
|
||
_pushHost: function (host) {
|
||
this.dataHost = host = host || Polymer.Base._hostStack[Polymer.Base._hostStack.length - 1];
|
||
if (host && host._clients) {
|
||
host._clients.push(this);
|
||
}
|
||
this._beginHost();
|
||
},
|
||
_beginHost: function () {
|
||
Polymer.Base._hostStack.push(this);
|
||
if (!this._clients) {
|
||
this._clients = [];
|
||
}
|
||
},
|
||
_popHost: function () {
|
||
Polymer.Base._hostStack.pop();
|
||
},
|
||
_tryReady: function () {
|
||
if (this._canReady()) {
|
||
this._ready();
|
||
}
|
||
},
|
||
_canReady: function () {
|
||
return !this.dataHost || this.dataHost._clientsReadied;
|
||
},
|
||
_ready: function () {
|
||
this._beforeClientsReady();
|
||
this._setupRoot();
|
||
this._readyClients();
|
||
this._afterClientsReady();
|
||
this._readySelf();
|
||
},
|
||
_readyClients: function () {
|
||
this._beginDistribute();
|
||
var c$ = this._clients;
|
||
for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
|
||
c._ready();
|
||
}
|
||
this._finishDistribute();
|
||
this._clientsReadied = true;
|
||
this._clients = null;
|
||
},
|
||
_readySelf: function () {
|
||
this._doBehavior('ready');
|
||
this._readied = true;
|
||
if (this._attachedPending) {
|
||
this._attachedPending = false;
|
||
this.attachedCallback();
|
||
}
|
||
},
|
||
_beforeClientsReady: function () {
|
||
},
|
||
_afterClientsReady: function () {
|
||
},
|
||
_beforeAttached: function () {
|
||
},
|
||
attachedCallback: function () {
|
||
if (this._readied) {
|
||
this._beforeAttached();
|
||
baseAttachedCallback.call(this);
|
||
} else {
|
||
this._attachedPending = true;
|
||
}
|
||
}
|
||
});
|
||
}());
|
||
Polymer.ArraySplice = function () {
|
||
function newSplice(index, removed, addedCount) {
|
||
return {
|
||
index: index,
|
||
removed: removed,
|
||
addedCount: addedCount
|
||
};
|
||
}
|
||
var EDIT_LEAVE = 0;
|
||
var EDIT_UPDATE = 1;
|
||
var EDIT_ADD = 2;
|
||
var EDIT_DELETE = 3;
|
||
function ArraySplice() {
|
||
}
|
||
ArraySplice.prototype = {
|
||
calcEditDistances: function (current, currentStart, currentEnd, old, oldStart, oldEnd) {
|
||
var rowCount = oldEnd - oldStart + 1;
|
||
var columnCount = currentEnd - currentStart + 1;
|
||
var distances = new Array(rowCount);
|
||
for (var i = 0; i < rowCount; i++) {
|
||
distances[i] = new Array(columnCount);
|
||
distances[i][0] = i;
|
||
}
|
||
for (var j = 0; j < columnCount; j++)
|
||
distances[0][j] = j;
|
||
for (var i = 1; i < rowCount; i++) {
|
||
for (var j = 1; j < columnCount; j++) {
|
||
if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1]))
|
||
distances[i][j] = distances[i - 1][j - 1];
|
||
else {
|
||
var north = distances[i - 1][j] + 1;
|
||
var west = distances[i][j - 1] + 1;
|
||
distances[i][j] = north < west ? north : west;
|
||
}
|
||
}
|
||
}
|
||
return distances;
|
||
},
|
||
spliceOperationsFromEditDistances: function (distances) {
|
||
var i = distances.length - 1;
|
||
var j = distances[0].length - 1;
|
||
var current = distances[i][j];
|
||
var edits = [];
|
||
while (i > 0 || j > 0) {
|
||
if (i == 0) {
|
||
edits.push(EDIT_ADD);
|
||
j--;
|
||
continue;
|
||
}
|
||
if (j == 0) {
|
||
edits.push(EDIT_DELETE);
|
||
i--;
|
||
continue;
|
||
}
|
||
var northWest = distances[i - 1][j - 1];
|
||
var west = distances[i - 1][j];
|
||
var north = distances[i][j - 1];
|
||
var min;
|
||
if (west < north)
|
||
min = west < northWest ? west : northWest;
|
||
else
|
||
min = north < northWest ? north : northWest;
|
||
if (min == northWest) {
|
||
if (northWest == current) {
|
||
edits.push(EDIT_LEAVE);
|
||
} else {
|
||
edits.push(EDIT_UPDATE);
|
||
current = northWest;
|
||
}
|
||
i--;
|
||
j--;
|
||
} else if (min == west) {
|
||
edits.push(EDIT_DELETE);
|
||
i--;
|
||
current = west;
|
||
} else {
|
||
edits.push(EDIT_ADD);
|
||
j--;
|
||
current = north;
|
||
}
|
||
}
|
||
edits.reverse();
|
||
return edits;
|
||
},
|
||
calcSplices: function (current, currentStart, currentEnd, old, oldStart, oldEnd) {
|
||
var prefixCount = 0;
|
||
var suffixCount = 0;
|
||
var minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
|
||
if (currentStart == 0 && oldStart == 0)
|
||
prefixCount = this.sharedPrefix(current, old, minLength);
|
||
if (currentEnd == current.length && oldEnd == old.length)
|
||
suffixCount = this.sharedSuffix(current, old, minLength - prefixCount);
|
||
currentStart += prefixCount;
|
||
oldStart += prefixCount;
|
||
currentEnd -= suffixCount;
|
||
oldEnd -= suffixCount;
|
||
if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0)
|
||
return [];
|
||
if (currentStart == currentEnd) {
|
||
var splice = newSplice(currentStart, [], 0);
|
||
while (oldStart < oldEnd)
|
||
splice.removed.push(old[oldStart++]);
|
||
return [splice];
|
||
} else if (oldStart == oldEnd)
|
||
return [newSplice(currentStart, [], currentEnd - currentStart)];
|
||
var ops = this.spliceOperationsFromEditDistances(this.calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd));
|
||
var splice = undefined;
|
||
var splices = [];
|
||
var index = currentStart;
|
||
var oldIndex = oldStart;
|
||
for (var i = 0; i < ops.length; i++) {
|
||
switch (ops[i]) {
|
||
case EDIT_LEAVE:
|
||
if (splice) {
|
||
splices.push(splice);
|
||
splice = undefined;
|
||
}
|
||
index++;
|
||
oldIndex++;
|
||
break;
|
||
case EDIT_UPDATE:
|
||
if (!splice)
|
||
splice = newSplice(index, [], 0);
|
||
splice.addedCount++;
|
||
index++;
|
||
splice.removed.push(old[oldIndex]);
|
||
oldIndex++;
|
||
break;
|
||
case EDIT_ADD:
|
||
if (!splice)
|
||
splice = newSplice(index, [], 0);
|
||
splice.addedCount++;
|
||
index++;
|
||
break;
|
||
case EDIT_DELETE:
|
||
if (!splice)
|
||
splice = newSplice(index, [], 0);
|
||
splice.removed.push(old[oldIndex]);
|
||
oldIndex++;
|
||
break;
|
||
}
|
||
}
|
||
if (splice) {
|
||
splices.push(splice);
|
||
}
|
||
return splices;
|
||
},
|
||
sharedPrefix: function (current, old, searchLength) {
|
||
for (var i = 0; i < searchLength; i++)
|
||
if (!this.equals(current[i], old[i]))
|
||
return i;
|
||
return searchLength;
|
||
},
|
||
sharedSuffix: function (current, old, searchLength) {
|
||
var index1 = current.length;
|
||
var index2 = old.length;
|
||
var count = 0;
|
||
while (count < searchLength && this.equals(current[--index1], old[--index2]))
|
||
count++;
|
||
return count;
|
||
},
|
||
calculateSplices: function (current, previous) {
|
||
return this.calcSplices(current, 0, current.length, previous, 0, previous.length);
|
||
},
|
||
equals: function (currentValue, previousValue) {
|
||
return currentValue === previousValue;
|
||
}
|
||
};
|
||
return new ArraySplice();
|
||
}();
|
||
Polymer.EventApi = function () {
|
||
var Settings = Polymer.Settings;
|
||
var EventApi = function (event) {
|
||
this.event = event;
|
||
};
|
||
if (Settings.useShadow) {
|
||
EventApi.prototype = {
|
||
get rootTarget() {
|
||
return this.event.path[0];
|
||
},
|
||
get localTarget() {
|
||
return this.event.target;
|
||
},
|
||
get path() {
|
||
return this.event.path;
|
||
}
|
||
};
|
||
} else {
|
||
EventApi.prototype = {
|
||
get rootTarget() {
|
||
return this.event.target;
|
||
},
|
||
get localTarget() {
|
||
var current = this.event.currentTarget;
|
||
var currentRoot = current && Polymer.dom(current).getOwnerRoot();
|
||
var p$ = this.path;
|
||
for (var i = 0; i < p$.length; i++) {
|
||
if (Polymer.dom(p$[i]).getOwnerRoot() === currentRoot) {
|
||
return p$[i];
|
||
}
|
||
}
|
||
},
|
||
get path() {
|
||
if (!this.event._path) {
|
||
var path = [];
|
||
var o = this.rootTarget;
|
||
while (o) {
|
||
path.push(o);
|
||
o = Polymer.dom(o).parentNode || o.host;
|
||
}
|
||
path.push(window);
|
||
this.event._path = path;
|
||
}
|
||
return this.event._path;
|
||
}
|
||
};
|
||
}
|
||
var factory = function (event) {
|
||
if (!event.__eventApi) {
|
||
event.__eventApi = new EventApi(event);
|
||
}
|
||
return event.__eventApi;
|
||
};
|
||
return { factory: factory };
|
||
}();
|
||
Polymer.domInnerHTML = function () {
|
||
var escapeAttrRegExp = /[&\u00A0"]/g;
|
||
var escapeDataRegExp = /[&\u00A0<>]/g;
|
||
function escapeReplace(c) {
|
||
switch (c) {
|
||
case '&':
|
||
return '&';
|
||
case '<':
|
||
return '<';
|
||
case '>':
|
||
return '>';
|
||
case '"':
|
||
return '"';
|
||
case '\xA0':
|
||
return ' ';
|
||
}
|
||
}
|
||
function escapeAttr(s) {
|
||
return s.replace(escapeAttrRegExp, escapeReplace);
|
||
}
|
||
function escapeData(s) {
|
||
return s.replace(escapeDataRegExp, escapeReplace);
|
||
}
|
||
function makeSet(arr) {
|
||
var set = {};
|
||
for (var i = 0; i < arr.length; i++) {
|
||
set[arr[i]] = true;
|
||
}
|
||
return set;
|
||
}
|
||
var voidElements = makeSet([
|
||
'area',
|
||
'base',
|
||
'br',
|
||
'col',
|
||
'command',
|
||
'embed',
|
||
'hr',
|
||
'img',
|
||
'input',
|
||
'keygen',
|
||
'link',
|
||
'meta',
|
||
'param',
|
||
'source',
|
||
'track',
|
||
'wbr'
|
||
]);
|
||
var plaintextParents = makeSet([
|
||
'style',
|
||
'script',
|
||
'xmp',
|
||
'iframe',
|
||
'noembed',
|
||
'noframes',
|
||
'plaintext',
|
||
'noscript'
|
||
]);
|
||
function getOuterHTML(node, parentNode, composed) {
|
||
switch (node.nodeType) {
|
||
case Node.ELEMENT_NODE:
|
||
var tagName = node.localName;
|
||
var s = '<' + tagName;
|
||
var attrs = node.attributes;
|
||
for (var i = 0, attr; attr = attrs[i]; i++) {
|
||
s += ' ' + attr.name + '="' + escapeAttr(attr.value) + '"';
|
||
}
|
||
s += '>';
|
||
if (voidElements[tagName]) {
|
||
return s;
|
||
}
|
||
return s + getInnerHTML(node, composed) + '</' + tagName + '>';
|
||
case Node.TEXT_NODE:
|
||
var data = node.data;
|
||
if (parentNode && plaintextParents[parentNode.localName]) {
|
||
return data;
|
||
}
|
||
return escapeData(data);
|
||
case Node.COMMENT_NODE:
|
||
return '<!--' + node.data + '-->';
|
||
default:
|
||
console.error(node);
|
||
throw new Error('not implemented');
|
||
}
|
||
}
|
||
function getInnerHTML(node, composed) {
|
||
if (node instanceof HTMLTemplateElement)
|
||
node = node.content;
|
||
var s = '';
|
||
var c$ = Polymer.dom(node).childNodes;
|
||
c$ = composed ? node._composedChildren : c$;
|
||
for (var i = 0, l = c$.length, child; i < l && (child = c$[i]); i++) {
|
||
s += getOuterHTML(child, node, composed);
|
||
}
|
||
return s;
|
||
}
|
||
return { getInnerHTML: getInnerHTML };
|
||
}();
|
||
Polymer.DomApi = function () {
|
||
'use strict';
|
||
var Settings = Polymer.Settings;
|
||
var getInnerHTML = Polymer.domInnerHTML.getInnerHTML;
|
||
var nativeInsertBefore = Element.prototype.insertBefore;
|
||
var nativeRemoveChild = Element.prototype.removeChild;
|
||
var nativeAppendChild = Element.prototype.appendChild;
|
||
var dirtyRoots = [];
|
||
var DomApi = function (node) {
|
||
this.node = node;
|
||
if (this.patch) {
|
||
this.patch();
|
||
}
|
||
};
|
||
DomApi.prototype = {
|
||
flush: function () {
|
||
for (var i = 0, host; i < dirtyRoots.length; i++) {
|
||
host = dirtyRoots[i];
|
||
host.flushDebouncer('_distribute');
|
||
}
|
||
dirtyRoots = [];
|
||
},
|
||
_lazyDistribute: function (host) {
|
||
if (host.shadyRoot && host.shadyRoot._distributionClean) {
|
||
host.shadyRoot._distributionClean = false;
|
||
host.debounce('_distribute', host._distributeContent);
|
||
dirtyRoots.push(host);
|
||
}
|
||
},
|
||
appendChild: function (node) {
|
||
var distributed;
|
||
this._removeNodeFromHost(node);
|
||
if (this._nodeIsInLogicalTree(this.node)) {
|
||
var host = this._hostForNode(this.node);
|
||
this._addLogicalInfo(node, this.node, host && host.shadyRoot);
|
||
this._addNodeToHost(node);
|
||
if (host) {
|
||
distributed = this._maybeDistribute(node, this.node, host);
|
||
}
|
||
}
|
||
if (!distributed && !this._tryRemoveUndistributedNode(node)) {
|
||
var container = this.node._isShadyRoot ? this.node.host : this.node;
|
||
nativeAppendChild.call(container, node);
|
||
addToComposedParent(container, node);
|
||
}
|
||
return node;
|
||
},
|
||
insertBefore: function (node, ref_node) {
|
||
if (!ref_node) {
|
||
return this.appendChild(node);
|
||
}
|
||
var distributed;
|
||
this._removeNodeFromHost(node);
|
||
if (this._nodeIsInLogicalTree(this.node)) {
|
||
saveLightChildrenIfNeeded(this.node);
|
||
var children = this.childNodes;
|
||
var index = children.indexOf(ref_node);
|
||
if (index < 0) {
|
||
throw Error('The ref_node to be inserted before is not a child ' + 'of this node');
|
||
}
|
||
var host = this._hostForNode(this.node);
|
||
this._addLogicalInfo(node, this.node, host && host.shadyRoot, index);
|
||
this._addNodeToHost(node);
|
||
if (host) {
|
||
distributed = this._maybeDistribute(node, this.node, host);
|
||
}
|
||
}
|
||
if (!distributed && !this._tryRemoveUndistributedNode(node)) {
|
||
ref_node = ref_node.localName === CONTENT ? this._firstComposedNode(ref_node) : ref_node;
|
||
var container = this.node._isShadyRoot ? this.node.host : this.node;
|
||
nativeInsertBefore.call(container, node, ref_node);
|
||
addToComposedParent(container, node, ref_node);
|
||
}
|
||
return node;
|
||
},
|
||
removeChild: function (node) {
|
||
if (factory(node).parentNode !== this.node) {
|
||
console.warn('The node to be removed is not a child of this node', node);
|
||
}
|
||
var distributed;
|
||
if (this._nodeIsInLogicalTree(this.node)) {
|
||
var host = this._hostForNode(this.node);
|
||
distributed = this._maybeDistribute(node, this.node, host);
|
||
this._removeNodeFromHost(node);
|
||
}
|
||
if (!distributed) {
|
||
var container = this.node._isShadyRoot ? this.node.host : this.node;
|
||
if (container === node.parentNode) {
|
||
nativeRemoveChild.call(container, node);
|
||
removeFromComposedParent(container, node);
|
||
}
|
||
}
|
||
return node;
|
||
},
|
||
replaceChild: function (node, ref_node) {
|
||
this.insertBefore(node, ref_node);
|
||
this.removeChild(ref_node);
|
||
return node;
|
||
},
|
||
getOwnerRoot: function () {
|
||
return this._ownerShadyRootForNode(this.node);
|
||
},
|
||
_ownerShadyRootForNode: function (node) {
|
||
if (!node) {
|
||
return;
|
||
}
|
||
if (node._ownerShadyRoot === undefined) {
|
||
var root;
|
||
if (node._isShadyRoot) {
|
||
root = node;
|
||
} else {
|
||
var parent = Polymer.dom(node).parentNode;
|
||
if (parent) {
|
||
root = parent._isShadyRoot ? parent : this._ownerShadyRootForNode(parent);
|
||
} else {
|
||
root = null;
|
||
}
|
||
}
|
||
node._ownerShadyRoot = root;
|
||
}
|
||
return node._ownerShadyRoot;
|
||
},
|
||
_maybeDistribute: function (node, parent, host) {
|
||
var nodeNeedsDistribute = this._nodeNeedsDistribution(node);
|
||
var distribute = this._parentNeedsDistribution(parent) || nodeNeedsDistribute;
|
||
if (nodeNeedsDistribute) {
|
||
this._updateInsertionPoints(host);
|
||
}
|
||
if (distribute) {
|
||
this._lazyDistribute(host);
|
||
}
|
||
return distribute;
|
||
},
|
||
_tryRemoveUndistributedNode: function (node) {
|
||
if (this.node.shadyRoot) {
|
||
if (node.parentNode) {
|
||
nativeRemoveChild.call(node.parentNode, node);
|
||
}
|
||
return true;
|
||
}
|
||
},
|
||
_updateInsertionPoints: function (host) {
|
||
host.shadyRoot._insertionPoints = factory(host.shadyRoot).querySelectorAll(CONTENT);
|
||
},
|
||
_nodeIsInLogicalTree: function (node) {
|
||
return Boolean(node._lightParent || node._isShadyRoot || this._ownerShadyRootForNode(node) || node.shadyRoot);
|
||
},
|
||
_hostForNode: function (node) {
|
||
var root = node.shadyRoot || (node._isShadyRoot ? node : this._ownerShadyRootForNode(node));
|
||
return root && root.host;
|
||
},
|
||
_parentNeedsDistribution: function (parent) {
|
||
return parent && parent.shadyRoot && hasInsertionPoint(parent.shadyRoot);
|
||
},
|
||
_nodeNeedsDistribution: function (node) {
|
||
return node.localName === CONTENT || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE && node.querySelector(CONTENT);
|
||
},
|
||
_removeNodeFromHost: function (node) {
|
||
if (node._lightParent) {
|
||
var root = this._ownerShadyRootForNode(node);
|
||
if (root) {
|
||
root.host._elementRemove(node);
|
||
}
|
||
this._removeLogicalInfo(node, node._lightParent);
|
||
}
|
||
this._removeOwnerShadyRoot(node);
|
||
},
|
||
_addNodeToHost: function (node) {
|
||
var checkNode = node.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? node.firstChild : node;
|
||
var root = this._ownerShadyRootForNode(checkNode);
|
||
if (root) {
|
||
root.host._elementAdd(node);
|
||
}
|
||
},
|
||
_addLogicalInfo: function (node, container, root, index) {
|
||
saveLightChildrenIfNeeded(container);
|
||
var children = factory(container).childNodes;
|
||
index = index === undefined ? children.length : index;
|
||
if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
||
var c$ = Array.prototype.slice.call(node.childNodes);
|
||
for (var i = 0, n; i < c$.length && (n = c$[i]); i++) {
|
||
children.splice(index++, 0, n);
|
||
n._lightParent = container;
|
||
}
|
||
} else {
|
||
children.splice(index, 0, node);
|
||
node._lightParent = container;
|
||
}
|
||
},
|
||
_removeLogicalInfo: function (node, container) {
|
||
var children = factory(container).childNodes;
|
||
var index = children.indexOf(node);
|
||
if (index < 0 || container !== node._lightParent) {
|
||
throw Error('The node to be removed is not a child of this node');
|
||
}
|
||
children.splice(index, 1);
|
||
node._lightParent = null;
|
||
},
|
||
_removeOwnerShadyRoot: function (node) {
|
||
var hasCachedRoot = factory(node).getOwnerRoot() !== undefined;
|
||
if (hasCachedRoot) {
|
||
var c$ = factory(node).childNodes;
|
||
for (var i = 0, l = c$.length, n; i < l && (n = c$[i]); i++) {
|
||
this._removeOwnerShadyRoot(n);
|
||
}
|
||
}
|
||
node._ownerShadyRoot = undefined;
|
||
},
|
||
_firstComposedNode: function (content) {
|
||
var n$ = factory(content).getDistributedNodes();
|
||
for (var i = 0, l = n$.length, n, p$; i < l && (n = n$[i]); i++) {
|
||
p$ = factory(n).getDestinationInsertionPoints();
|
||
if (p$[p$.length - 1] === content) {
|
||
return n;
|
||
}
|
||
}
|
||
},
|
||
querySelector: function (selector) {
|
||
return this.querySelectorAll(selector)[0];
|
||
},
|
||
querySelectorAll: function (selector) {
|
||
return this._query(function (n) {
|
||
return matchesSelector.call(n, selector);
|
||
}, this.node);
|
||
},
|
||
_query: function (matcher, node) {
|
||
node = node || this.node;
|
||
var list = [];
|
||
this._queryElements(factory(node).childNodes, matcher, list);
|
||
return list;
|
||
},
|
||
_queryElements: function (elements, matcher, list) {
|
||
for (var i = 0, l = elements.length, c; i < l && (c = elements[i]); i++) {
|
||
if (c.nodeType === Node.ELEMENT_NODE) {
|
||
this._queryElement(c, matcher, list);
|
||
}
|
||
}
|
||
},
|
||
_queryElement: function (node, matcher, list) {
|
||
if (matcher(node)) {
|
||
list.push(node);
|
||
}
|
||
this._queryElements(factory(node).childNodes, matcher, list);
|
||
},
|
||
getDestinationInsertionPoints: function () {
|
||
return this.node._destinationInsertionPoints || [];
|
||
},
|
||
getDistributedNodes: function () {
|
||
return this.node._distributedNodes || [];
|
||
},
|
||
queryDistributedElements: function (selector) {
|
||
var c$ = this.childNodes;
|
||
var list = [];
|
||
this._distributedFilter(selector, c$, list);
|
||
for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
|
||
if (c.localName === CONTENT) {
|
||
this._distributedFilter(selector, factory(c).getDistributedNodes(), list);
|
||
}
|
||
}
|
||
return list;
|
||
},
|
||
_distributedFilter: function (selector, list, results) {
|
||
results = results || [];
|
||
for (var i = 0, l = list.length, d; i < l && (d = list[i]); i++) {
|
||
if (d.nodeType === Node.ELEMENT_NODE && d.localName !== CONTENT && matchesSelector.call(d, selector)) {
|
||
results.push(d);
|
||
}
|
||
}
|
||
return results;
|
||
},
|
||
_clear: function () {
|
||
while (this.childNodes.length) {
|
||
this.removeChild(this.childNodes[0]);
|
||
}
|
||
},
|
||
setAttribute: function (name, value) {
|
||
this.node.setAttribute(name, value);
|
||
this._distributeParent();
|
||
},
|
||
removeAttribute: function (name) {
|
||
this.node.removeAttribute(name);
|
||
this._distributeParent();
|
||
},
|
||
_distributeParent: function () {
|
||
if (this._parentNeedsDistribution(this.parentNode)) {
|
||
this._lazyDistribute(this.parentNode);
|
||
}
|
||
}
|
||
};
|
||
Object.defineProperty(DomApi.prototype, 'classList', {
|
||
get: function () {
|
||
if (!this._classList) {
|
||
this._classList = new DomApi.ClassList(this);
|
||
}
|
||
return this._classList;
|
||
},
|
||
configurable: true
|
||
});
|
||
DomApi.ClassList = function (host) {
|
||
this.domApi = host;
|
||
this.node = host.node;
|
||
};
|
||
DomApi.ClassList.prototype = {
|
||
add: function () {
|
||
this.node.classList.add.apply(this.node.classList, arguments);
|
||
this.domApi._distributeParent();
|
||
},
|
||
remove: function () {
|
||
this.node.classList.remove.apply(this.node.classList, arguments);
|
||
this.domApi._distributeParent();
|
||
},
|
||
toggle: function () {
|
||
this.node.classList.toggle.apply(this.node.classList, arguments);
|
||
this.domApi._distributeParent();
|
||
}
|
||
};
|
||
if (!Settings.useShadow) {
|
||
Object.defineProperties(DomApi.prototype, {
|
||
childNodes: {
|
||
get: function () {
|
||
var c$ = getLightChildren(this.node);
|
||
return Array.isArray(c$) ? c$ : Array.prototype.slice.call(c$);
|
||
},
|
||
configurable: true
|
||
},
|
||
children: {
|
||
get: function () {
|
||
return Array.prototype.filter.call(this.childNodes, function (n) {
|
||
return n.nodeType === Node.ELEMENT_NODE;
|
||
});
|
||
},
|
||
configurable: true
|
||
},
|
||
parentNode: {
|
||
get: function () {
|
||
return this.node._lightParent || (this.node.__patched ? this.node._composedParent : this.node.parentNode);
|
||
},
|
||
configurable: true
|
||
},
|
||
firstChild: {
|
||
get: function () {
|
||
return this.childNodes[0];
|
||
},
|
||
configurable: true
|
||
},
|
||
lastChild: {
|
||
get: function () {
|
||
var c$ = this.childNodes;
|
||
return c$[c$.length - 1];
|
||
},
|
||
configurable: true
|
||
},
|
||
nextSibling: {
|
||
get: function () {
|
||
var c$ = this.parentNode && factory(this.parentNode).childNodes;
|
||
if (c$) {
|
||
return c$[Array.prototype.indexOf.call(c$, this.node) + 1];
|
||
}
|
||
},
|
||
configurable: true
|
||
},
|
||
previousSibling: {
|
||
get: function () {
|
||
var c$ = this.parentNode && factory(this.parentNode).childNodes;
|
||
if (c$) {
|
||
return c$[Array.prototype.indexOf.call(c$, this.node) - 1];
|
||
}
|
||
},
|
||
configurable: true
|
||
},
|
||
firstElementChild: {
|
||
get: function () {
|
||
return this.children[0];
|
||
},
|
||
configurable: true
|
||
},
|
||
lastElementChild: {
|
||
get: function () {
|
||
var c$ = this.children;
|
||
return c$[c$.length - 1];
|
||
},
|
||
configurable: true
|
||
},
|
||
nextElementSibling: {
|
||
get: function () {
|
||
var c$ = this.parentNode && factory(this.parentNode).children;
|
||
if (c$) {
|
||
return c$[Array.prototype.indexOf.call(c$, this.node) + 1];
|
||
}
|
||
},
|
||
configurable: true
|
||
},
|
||
previousElementSibling: {
|
||
get: function () {
|
||
var c$ = this.parentNode && factory(this.parentNode).children;
|
||
if (c$) {
|
||
return c$[Array.prototype.indexOf.call(c$, this.node) - 1];
|
||
}
|
||
},
|
||
configurable: true
|
||
},
|
||
textContent: {
|
||
get: function () {
|
||
if (this.node.nodeType === Node.TEXT_NODE) {
|
||
return this.node.textContent;
|
||
} else {
|
||
return Array.prototype.map.call(this.childNodes, function (c) {
|
||
return c.textContent;
|
||
}).join('');
|
||
}
|
||
},
|
||
set: function (text) {
|
||
this._clear();
|
||
if (text) {
|
||
this.appendChild(document.createTextNode(text));
|
||
}
|
||
},
|
||
configurable: true
|
||
},
|
||
innerHTML: {
|
||
get: function () {
|
||
if (this.node.nodeType === Node.TEXT_NODE) {
|
||
return null;
|
||
} else {
|
||
return getInnerHTML(this.node);
|
||
}
|
||
},
|
||
set: function (text) {
|
||
if (this.node.nodeType !== Node.TEXT_NODE) {
|
||
this._clear();
|
||
var d = document.createElement('div');
|
||
d.innerHTML = text;
|
||
for (var e = d.firstChild; e; e = e.nextSibling) {
|
||
this.appendChild(e);
|
||
}
|
||
}
|
||
},
|
||
configurable: true
|
||
}
|
||
});
|
||
DomApi.prototype._getComposedInnerHTML = function () {
|
||
return getInnerHTML(this.node, true);
|
||
};
|
||
} else {
|
||
DomApi.prototype.querySelectorAll = function (selector) {
|
||
return Array.prototype.slice.call(this.node.querySelectorAll(selector));
|
||
};
|
||
DomApi.prototype.getOwnerRoot = function () {
|
||
var n = this.node;
|
||
while (n) {
|
||
if (n.nodeType === Node.DOCUMENT_FRAGMENT_NODE && n.host) {
|
||
return n;
|
||
}
|
||
n = n.parentNode;
|
||
}
|
||
};
|
||
DomApi.prototype.getDestinationInsertionPoints = function () {
|
||
var n$ = this.node.getDestinationInsertionPoints();
|
||
return n$ ? Array.prototype.slice.call(n$) : [];
|
||
};
|
||
DomApi.prototype.getDistributedNodes = function () {
|
||
var n$ = this.node.getDistributedNodes();
|
||
return n$ ? Array.prototype.slice.call(n$) : [];
|
||
};
|
||
DomApi.prototype._distributeParent = function () {
|
||
};
|
||
Object.defineProperties(DomApi.prototype, {
|
||
childNodes: {
|
||
get: function () {
|
||
return Array.prototype.slice.call(this.node.childNodes);
|
||
},
|
||
configurable: true
|
||
},
|
||
children: {
|
||
get: function () {
|
||
return Array.prototype.slice.call(this.node.children);
|
||
},
|
||
configurable: true
|
||
},
|
||
textContent: {
|
||
get: function () {
|
||
return this.node.textContent;
|
||
},
|
||
set: function (value) {
|
||
return this.node.textContent = value;
|
||
},
|
||
configurable: true
|
||
},
|
||
innerHTML: {
|
||
get: function () {
|
||
return this.node.innerHTML;
|
||
},
|
||
set: function (value) {
|
||
return this.node.innerHTML = value;
|
||
},
|
||
configurable: true
|
||
}
|
||
});
|
||
var forwards = [
|
||
'parentNode',
|
||
'firstChild',
|
||
'lastChild',
|
||
'nextSibling',
|
||
'previousSibling',
|
||
'firstElementChild',
|
||
'lastElementChild',
|
||
'nextElementSibling',
|
||
'previousElementSibling'
|
||
];
|
||
forwards.forEach(function (name) {
|
||
Object.defineProperty(DomApi.prototype, name, {
|
||
get: function () {
|
||
return this.node[name];
|
||
},
|
||
configurable: true
|
||
});
|
||
});
|
||
}
|
||
var CONTENT = 'content';
|
||
var factory = function (node, patch) {
|
||
node = node || document;
|
||
if (!node.__domApi) {
|
||
node.__domApi = new DomApi(node, patch);
|
||
}
|
||
return node.__domApi;
|
||
};
|
||
Polymer.dom = function (obj, patch) {
|
||
if (obj instanceof Event) {
|
||
return Polymer.EventApi.factory(obj);
|
||
} else {
|
||
return factory(obj, patch);
|
||
}
|
||
};
|
||
Polymer.dom.flush = DomApi.prototype.flush;
|
||
function getLightChildren(node) {
|
||
var children = node._lightChildren;
|
||
return children ? children : node.childNodes;
|
||
}
|
||
function getComposedChildren(node) {
|
||
if (!node._composedChildren) {
|
||
node._composedChildren = Array.prototype.slice.call(node.childNodes);
|
||
}
|
||
return node._composedChildren;
|
||
}
|
||
function addToComposedParent(parent, node, ref_node) {
|
||
var children = getComposedChildren(parent);
|
||
var i = ref_node ? children.indexOf(ref_node) : -1;
|
||
if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
||
var fragChildren = getComposedChildren(node);
|
||
fragChildren.forEach(function (c) {
|
||
addNodeToComposedChildren(c, parent, children, i);
|
||
});
|
||
} else {
|
||
addNodeToComposedChildren(node, parent, children, i);
|
||
}
|
||
}
|
||
function addNodeToComposedChildren(node, parent, children, i) {
|
||
node._composedParent = parent;
|
||
if (i >= 0) {
|
||
children.splice(i, 0, node);
|
||
} else {
|
||
children.push(node);
|
||
}
|
||
}
|
||
function removeFromComposedParent(parent, node) {
|
||
node._composedParent = null;
|
||
if (parent) {
|
||
var children = getComposedChildren(parent);
|
||
var i = children.indexOf(node);
|
||
if (i >= 0) {
|
||
children.splice(i, 1);
|
||
}
|
||
}
|
||
}
|
||
function saveLightChildrenIfNeeded(node) {
|
||
if (!node._lightChildren) {
|
||
var c$ = Array.prototype.slice.call(node.childNodes);
|
||
for (var i = 0, l = c$.length, child; i < l && (child = c$[i]); i++) {
|
||
child._lightParent = child._lightParent || node;
|
||
}
|
||
node._lightChildren = c$;
|
||
}
|
||
}
|
||
function hasInsertionPoint(root) {
|
||
return Boolean(root._insertionPoints.length);
|
||
}
|
||
var p = Element.prototype;
|
||
var matchesSelector = p.matches || p.matchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector || p.webkitMatchesSelector;
|
||
return {
|
||
getLightChildren: getLightChildren,
|
||
getComposedChildren: getComposedChildren,
|
||
removeFromComposedParent: removeFromComposedParent,
|
||
saveLightChildrenIfNeeded: saveLightChildrenIfNeeded,
|
||
matchesSelector: matchesSelector,
|
||
hasInsertionPoint: hasInsertionPoint,
|
||
ctor: DomApi,
|
||
factory: factory
|
||
};
|
||
}();
|
||
(function () {
|
||
Polymer.Base._addFeature({
|
||
_prepShady: function () {
|
||
this._useContent = this._useContent || Boolean(this._template);
|
||
if (this._useContent) {
|
||
this._template._hasInsertionPoint = this._template.content.querySelector('content');
|
||
}
|
||
},
|
||
_poolContent: function () {
|
||
if (this._useContent) {
|
||
saveLightChildrenIfNeeded(this);
|
||
}
|
||
},
|
||
_setupRoot: function () {
|
||
if (this._useContent) {
|
||
this._createLocalRoot();
|
||
if (!this.dataHost) {
|
||
upgradeLightChildren(this._lightChildren);
|
||
}
|
||
}
|
||
},
|
||
_createLocalRoot: function () {
|
||
this.shadyRoot = this.root;
|
||
this.shadyRoot._distributionClean = false;
|
||
this.shadyRoot._isShadyRoot = true;
|
||
this.shadyRoot._dirtyRoots = [];
|
||
this.shadyRoot._insertionPoints = this._template._hasInsertionPoint ? this.shadyRoot.querySelectorAll('content') : [];
|
||
saveLightChildrenIfNeeded(this.shadyRoot);
|
||
this.shadyRoot.host = this;
|
||
},
|
||
get domHost() {
|
||
var root = Polymer.dom(this).getOwnerRoot();
|
||
return root && root.host;
|
||
},
|
||
distributeContent: function () {
|
||
if (this.shadyRoot) {
|
||
var host = getTopDistributingHost(this);
|
||
Polymer.dom(this)._lazyDistribute(host);
|
||
}
|
||
},
|
||
_distributeContent: function () {
|
||
if (this._useContent && !this.shadyRoot._distributionClean) {
|
||
this._beginDistribute();
|
||
this._distributeDirtyRoots();
|
||
this._finishDistribute();
|
||
}
|
||
},
|
||
_beginDistribute: function () {
|
||
if (this._useContent && hasInsertionPoint(this.shadyRoot)) {
|
||
this._resetDistribution();
|
||
this._distributePool(this.shadyRoot, this._collectPool());
|
||
}
|
||
},
|
||
_distributeDirtyRoots: function () {
|
||
var c$ = this.shadyRoot._dirtyRoots;
|
||
for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
|
||
c._distributeContent();
|
||
}
|
||
this.shadyRoot._dirtyRoots = [];
|
||
},
|
||
_finishDistribute: function () {
|
||
if (this._useContent) {
|
||
if (hasInsertionPoint(this.shadyRoot)) {
|
||
this._composeTree();
|
||
} else {
|
||
if (!this.shadyRoot._hasDistributed) {
|
||
this.textContent = '';
|
||
this.appendChild(this.shadyRoot);
|
||
} else {
|
||
var children = this._composeNode(this);
|
||
this._updateChildNodes(this, children);
|
||
}
|
||
}
|
||
this.shadyRoot._hasDistributed = true;
|
||
this.shadyRoot._distributionClean = true;
|
||
}
|
||
},
|
||
elementMatches: function (selector, node) {
|
||
node = node || this;
|
||
return matchesSelector.call(node, selector);
|
||
},
|
||
_resetDistribution: function () {
|
||
var children = getLightChildren(this);
|
||
for (var i = 0; i < children.length; i++) {
|
||
var child = children[i];
|
||
if (child._destinationInsertionPoints) {
|
||
child._destinationInsertionPoints = undefined;
|
||
}
|
||
if (isInsertionPoint(child)) {
|
||
clearDistributedDestinationInsertionPoints(child);
|
||
}
|
||
}
|
||
var root = this.shadyRoot;
|
||
var p$ = root._insertionPoints;
|
||
for (var j = 0; j < p$.length; j++) {
|
||
p$[j]._distributedNodes = [];
|
||
}
|
||
},
|
||
_collectPool: function () {
|
||
var pool = [];
|
||
var children = getLightChildren(this);
|
||
for (var i = 0; i < children.length; i++) {
|
||
var child = children[i];
|
||
if (isInsertionPoint(child)) {
|
||
pool.push.apply(pool, child._distributedNodes);
|
||
} else {
|
||
pool.push(child);
|
||
}
|
||
}
|
||
return pool;
|
||
},
|
||
_distributePool: function (node, pool) {
|
||
var p$ = node._insertionPoints;
|
||
for (var i = 0, l = p$.length, p; i < l && (p = p$[i]); i++) {
|
||
this._distributeInsertionPoint(p, pool);
|
||
maybeRedistributeParent(p, this);
|
||
}
|
||
},
|
||
_distributeInsertionPoint: function (content, pool) {
|
||
var anyDistributed = false;
|
||
for (var i = 0, l = pool.length, node; i < l; i++) {
|
||
node = pool[i];
|
||
if (!node) {
|
||
continue;
|
||
}
|
||
if (this._matchesContentSelect(node, content)) {
|
||
distributeNodeInto(node, content);
|
||
pool[i] = undefined;
|
||
anyDistributed = true;
|
||
}
|
||
}
|
||
if (!anyDistributed) {
|
||
var children = getLightChildren(content);
|
||
for (var j = 0; j < children.length; j++) {
|
||
distributeNodeInto(children[j], content);
|
||
}
|
||
}
|
||
},
|
||
_composeTree: function () {
|
||
this._updateChildNodes(this, this._composeNode(this));
|
||
var p$ = this.shadyRoot._insertionPoints;
|
||
for (var i = 0, l = p$.length, p, parent; i < l && (p = p$[i]); i++) {
|
||
parent = p._lightParent || p.parentNode;
|
||
if (!parent._useContent && parent !== this && parent !== this.shadyRoot) {
|
||
this._updateChildNodes(parent, this._composeNode(parent));
|
||
}
|
||
}
|
||
},
|
||
_composeNode: function (node) {
|
||
var children = [];
|
||
var c$ = getLightChildren(node.shadyRoot || node);
|
||
for (var i = 0; i < c$.length; i++) {
|
||
var child = c$[i];
|
||
if (isInsertionPoint(child)) {
|
||
var distributedNodes = child._distributedNodes;
|
||
for (var j = 0; j < distributedNodes.length; j++) {
|
||
var distributedNode = distributedNodes[j];
|
||
if (isFinalDestination(child, distributedNode)) {
|
||
children.push(distributedNode);
|
||
}
|
||
}
|
||
} else {
|
||
children.push(child);
|
||
}
|
||
}
|
||
return children;
|
||
},
|
||
_updateChildNodes: function (container, children) {
|
||
var composed = getComposedChildren(container);
|
||
var splices = Polymer.ArraySplice.calculateSplices(children, composed);
|
||
for (var i = 0, d = 0, s; i < splices.length && (s = splices[i]); i++) {
|
||
for (var j = 0, n; j < s.removed.length && (n = s.removed[j]); j++) {
|
||
remove(n);
|
||
composed.splice(s.index + d, 1);
|
||
}
|
||
d -= s.addedCount;
|
||
}
|
||
for (var i = 0, s, next; i < splices.length && (s = splices[i]); i++) {
|
||
next = composed[s.index];
|
||
for (var j = s.index, n; j < s.index + s.addedCount; j++) {
|
||
n = children[j];
|
||
insertBefore(container, n, next);
|
||
composed.splice(j, 0, n);
|
||
}
|
||
}
|
||
},
|
||
_matchesContentSelect: function (node, contentElement) {
|
||
var select = contentElement.getAttribute('select');
|
||
if (!select) {
|
||
return true;
|
||
}
|
||
select = select.trim();
|
||
if (!select) {
|
||
return true;
|
||
}
|
||
if (!(node instanceof Element)) {
|
||
return false;
|
||
}
|
||
var validSelectors = /^(:not\()?[*.#[a-zA-Z_|]/;
|
||
if (!validSelectors.test(select)) {
|
||
return false;
|
||
}
|
||
return this.elementMatches(select, node);
|
||
},
|
||
_elementAdd: function () {
|
||
},
|
||
_elementRemove: function () {
|
||
}
|
||
});
|
||
var saveLightChildrenIfNeeded = Polymer.DomApi.saveLightChildrenIfNeeded;
|
||
var getLightChildren = Polymer.DomApi.getLightChildren;
|
||
var matchesSelector = Polymer.DomApi.matchesSelector;
|
||
var hasInsertionPoint = Polymer.DomApi.hasInsertionPoint;
|
||
var getComposedChildren = Polymer.DomApi.getComposedChildren;
|
||
var removeFromComposedParent = Polymer.DomApi.removeFromComposedParent;
|
||
function distributeNodeInto(child, insertionPoint) {
|
||
insertionPoint._distributedNodes.push(child);
|
||
var points = child._destinationInsertionPoints;
|
||
if (!points) {
|
||
child._destinationInsertionPoints = [insertionPoint];
|
||
} else {
|
||
points.push(insertionPoint);
|
||
}
|
||
}
|
||
function clearDistributedDestinationInsertionPoints(content) {
|
||
var e$ = content._distributedNodes;
|
||
for (var i = 0; i < e$.length; i++) {
|
||
var d = e$[i]._destinationInsertionPoints;
|
||
if (d) {
|
||
d.splice(d.indexOf(content) + 1, d.length);
|
||
}
|
||
}
|
||
}
|
||
function maybeRedistributeParent(content, host) {
|
||
var parent = content._lightParent;
|
||
if (parent && parent.shadyRoot && hasInsertionPoint(parent.shadyRoot) && parent.shadyRoot._distributionClean) {
|
||
parent.shadyRoot._distributionClean = false;
|
||
host.shadyRoot._dirtyRoots.push(parent);
|
||
}
|
||
}
|
||
function isFinalDestination(insertionPoint, node) {
|
||
var points = node._destinationInsertionPoints;
|
||
return points && points[points.length - 1] === insertionPoint;
|
||
}
|
||
function isInsertionPoint(node) {
|
||
return node.localName == 'content';
|
||
}
|
||
var nativeInsertBefore = Element.prototype.insertBefore;
|
||
var nativeRemoveChild = Element.prototype.removeChild;
|
||
function insertBefore(parentNode, newChild, refChild) {
|
||
var newChildParent = getComposedParent(newChild);
|
||
if (newChildParent !== parentNode) {
|
||
removeFromComposedParent(newChildParent, newChild);
|
||
}
|
||
remove(newChild);
|
||
saveLightChildrenIfNeeded(parentNode);
|
||
nativeInsertBefore.call(parentNode, newChild, refChild || null);
|
||
newChild._composedParent = parentNode;
|
||
}
|
||
function remove(node) {
|
||
var parentNode = getComposedParent(node);
|
||
if (parentNode) {
|
||
saveLightChildrenIfNeeded(parentNode);
|
||
node._composedParent = null;
|
||
nativeRemoveChild.call(parentNode, node);
|
||
}
|
||
}
|
||
function getComposedParent(node) {
|
||
return node.__patched ? node._composedParent : node.parentNode;
|
||
}
|
||
function getTopDistributingHost(host) {
|
||
while (host && hostNeedsRedistribution(host)) {
|
||
host = host.domHost;
|
||
}
|
||
return host;
|
||
}
|
||
function hostNeedsRedistribution(host) {
|
||
var c$ = Polymer.dom(host).children;
|
||
for (var i = 0, c; i < c$.length; i++) {
|
||
c = c$[i];
|
||
if (c.localName === 'content') {
|
||
return host.domHost;
|
||
}
|
||
}
|
||
}
|
||
var needsUpgrade = window.CustomElements && !CustomElements.useNative;
|
||
function upgradeLightChildren(children) {
|
||
if (needsUpgrade && children) {
|
||
for (var i = 0; i < children.length; i++) {
|
||
CustomElements.upgrade(children[i]);
|
||
}
|
||
}
|
||
}
|
||
}());
|
||
if (Polymer.Settings.useShadow) {
|
||
Polymer.Base._addFeature({
|
||
_poolContent: function () {
|
||
},
|
||
_beginDistribute: function () {
|
||
},
|
||
distributeContent: function () {
|
||
},
|
||
_distributeContent: function () {
|
||
},
|
||
_finishDistribute: function () {
|
||
},
|
||
_createLocalRoot: function () {
|
||
this.createShadowRoot();
|
||
this.shadowRoot.appendChild(this.root);
|
||
this.root = this.shadowRoot;
|
||
}
|
||
});
|
||
}
|
||
Polymer.DomModule = document.createElement('dom-module');
|
||
Polymer.Base._addFeature({
|
||
_registerFeatures: function () {
|
||
this._prepIs();
|
||
this._prepAttributes();
|
||
this._prepBehaviors();
|
||
this._prepExtends();
|
||
this._prepConstructor();
|
||
this._prepTemplate();
|
||
this._prepShady();
|
||
},
|
||
_prepBehavior: function (b) {
|
||
this._addHostAttributes(b.hostAttributes);
|
||
},
|
||
_initFeatures: function () {
|
||
this._poolContent();
|
||
this._pushHost();
|
||
this._stampTemplate();
|
||
this._popHost();
|
||
this._marshalHostAttributes();
|
||
this._setupDebouncers();
|
||
this._marshalBehaviors();
|
||
this._tryReady();
|
||
},
|
||
_marshalBehavior: function (b) {
|
||
}
|
||
});</script>
|
||
|
||
<script>Polymer.nar = [];
|
||
Polymer.Annotations = {
|
||
parseAnnotations: function (template) {
|
||
var list = [];
|
||
var content = template._content || template.content;
|
||
this._parseNodeAnnotations(content, list);
|
||
return list;
|
||
},
|
||
_parseNodeAnnotations: function (node, list) {
|
||
return node.nodeType === Node.TEXT_NODE ? this._parseTextNodeAnnotation(node, list) : this._parseElementAnnotations(node, list);
|
||
},
|
||
_testEscape: function (value) {
|
||
var escape = value.slice(0, 2);
|
||
if (escape === '{{' || escape === '[[') {
|
||
return escape;
|
||
}
|
||
},
|
||
_parseTextNodeAnnotation: function (node, list) {
|
||
var v = node.textContent;
|
||
var escape = this._testEscape(v);
|
||
if (escape) {
|
||
node.textContent = ' ';
|
||
var annote = {
|
||
bindings: [{
|
||
kind: 'text',
|
||
mode: escape[0],
|
||
value: v.slice(2, -2).trim()
|
||
}]
|
||
};
|
||
list.push(annote);
|
||
return annote;
|
||
}
|
||
},
|
||
_parseElementAnnotations: function (element, list) {
|
||
var annote = {
|
||
bindings: [],
|
||
events: []
|
||
};
|
||
this._parseChildNodesAnnotations(element, annote, list);
|
||
if (element.attributes) {
|
||
this._parseNodeAttributeAnnotations(element, annote, list);
|
||
if (this.prepElement) {
|
||
this.prepElement(element);
|
||
}
|
||
}
|
||
if (annote.bindings.length || annote.events.length || annote.id) {
|
||
list.push(annote);
|
||
}
|
||
return annote;
|
||
},
|
||
_parseChildNodesAnnotations: function (root, annote, list, callback) {
|
||
if (root.firstChild) {
|
||
for (var i = 0, node = root.firstChild; node; node = node.nextSibling, i++) {
|
||
if (node.localName === 'template' && !node.hasAttribute('preserve-content')) {
|
||
this._parseTemplate(node, i, list, annote);
|
||
}
|
||
var childAnnotation = this._parseNodeAnnotations(node, list, callback);
|
||
if (childAnnotation) {
|
||
childAnnotation.parent = annote;
|
||
childAnnotation.index = i;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
_parseTemplate: function (node, index, list, parent) {
|
||
var content = document.createDocumentFragment();
|
||
content._notes = this.parseAnnotations(node);
|
||
content.appendChild(node.content);
|
||
list.push({
|
||
bindings: Polymer.nar,
|
||
events: Polymer.nar,
|
||
templateContent: content,
|
||
parent: parent,
|
||
index: index
|
||
});
|
||
},
|
||
_parseNodeAttributeAnnotations: function (node, annotation) {
|
||
for (var i = node.attributes.length - 1, a; a = node.attributes[i]; i--) {
|
||
var n = a.name, v = a.value;
|
||
if (n === 'id' && !this._testEscape(v)) {
|
||
annotation.id = v;
|
||
} else if (n.slice(0, 3) === 'on-') {
|
||
node.removeAttribute(n);
|
||
annotation.events.push({
|
||
name: n.slice(3),
|
||
value: v
|
||
});
|
||
} else {
|
||
var b = this._parseNodeAttributeAnnotation(node, n, v);
|
||
if (b) {
|
||
annotation.bindings.push(b);
|
||
}
|
||
}
|
||
}
|
||
},
|
||
_parseNodeAttributeAnnotation: function (node, n, v) {
|
||
var escape = this._testEscape(v);
|
||
if (escape) {
|
||
var customEvent;
|
||
var name = n;
|
||
var mode = escape[0];
|
||
v = v.slice(2, -2).trim();
|
||
var not = false;
|
||
if (v[0] == '!') {
|
||
v = v.substring(1);
|
||
not = true;
|
||
}
|
||
var kind = 'property';
|
||
if (n[n.length - 1] == '$') {
|
||
name = n.slice(0, -1);
|
||
kind = 'attribute';
|
||
}
|
||
var notifyEvent, colon;
|
||
if (mode == '{' && (colon = v.indexOf('::')) > 0) {
|
||
notifyEvent = v.substring(colon + 2);
|
||
v = v.substring(0, colon);
|
||
customEvent = true;
|
||
}
|
||
if (node.localName == 'input' && n == 'value') {
|
||
node.setAttribute(n, '');
|
||
}
|
||
node.removeAttribute(n);
|
||
if (kind === 'property') {
|
||
name = Polymer.CaseMap.dashToCamelCase(name);
|
||
}
|
||
return {
|
||
kind: kind,
|
||
mode: mode,
|
||
name: name,
|
||
value: v,
|
||
negate: not,
|
||
event: notifyEvent,
|
||
customEvent: customEvent
|
||
};
|
||
}
|
||
},
|
||
_localSubTree: function (node, host) {
|
||
return node === host ? node.childNodes : node._lightChildren || node.childNodes;
|
||
},
|
||
findAnnotatedNode: function (root, annote) {
|
||
var parent = annote.parent && Polymer.Annotations.findAnnotatedNode(root, annote.parent);
|
||
return !parent ? root : Polymer.Annotations._localSubTree(parent, root)[annote.index];
|
||
}
|
||
};
|
||
(function () {
|
||
function resolveCss(cssText, ownerDocument) {
|
||
return cssText.replace(CSS_URL_RX, function (m, pre, url, post) {
|
||
return pre + '\'' + resolve(url.replace(/["']/g, ''), ownerDocument) + '\'' + post;
|
||
});
|
||
}
|
||
function resolveAttrs(element, ownerDocument) {
|
||
for (var name in URL_ATTRS) {
|
||
var a$ = URL_ATTRS[name];
|
||
for (var i = 0, l = a$.length, a, at, v; i < l && (a = a$[i]); i++) {
|
||
if (name === '*' || element.localName === name) {
|
||
at = element.attributes[a];
|
||
v = at && at.value;
|
||
if (v && v.search(BINDING_RX) < 0) {
|
||
at.value = a === 'style' ? resolveCss(v, ownerDocument) : resolve(v, ownerDocument);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
function resolve(url, ownerDocument) {
|
||
var resolver = getUrlResolver(ownerDocument);
|
||
resolver.href = url;
|
||
return resolver.href || url;
|
||
}
|
||
var tempDoc;
|
||
var tempDocBase;
|
||
function resolveUrl(url, baseUri) {
|
||
if (!tempDoc) {
|
||
tempDoc = document.implementation.createHTMLDocument('temp');
|
||
tempDocBase = tempDoc.createElement('base');
|
||
tempDoc.head.appendChild(tempDocBase);
|
||
}
|
||
tempDocBase.href = baseUri;
|
||
return resolve(url, tempDoc);
|
||
}
|
||
function getUrlResolver(ownerDocument) {
|
||
return ownerDocument.__urlResolver || (ownerDocument.__urlResolver = ownerDocument.createElement('a'));
|
||
}
|
||
var CSS_URL_RX = /(url\()([^)]*)(\))/g;
|
||
var URL_ATTRS = {
|
||
'*': [
|
||
'href',
|
||
'src',
|
||
'style',
|
||
'url'
|
||
],
|
||
form: ['action']
|
||
};
|
||
var BINDING_RX = /\{\{|\[\[/;
|
||
Polymer.ResolveUrl = {
|
||
resolveCss: resolveCss,
|
||
resolveAttrs: resolveAttrs,
|
||
resolveUrl: resolveUrl
|
||
};
|
||
}());
|
||
Polymer.Base._addFeature({
|
||
_prepAnnotations: function () {
|
||
if (!this._template) {
|
||
this._notes = [];
|
||
} else {
|
||
Polymer.Annotations.prepElement = this._prepElement.bind(this);
|
||
this._notes = Polymer.Annotations.parseAnnotations(this._template);
|
||
this._processAnnotations(this._notes);
|
||
Polymer.Annotations.prepElement = null;
|
||
}
|
||
},
|
||
_processAnnotations: function (notes) {
|
||
for (var i = 0; i < notes.length; i++) {
|
||
var note = notes[i];
|
||
for (var j = 0; j < note.bindings.length; j++) {
|
||
var b = note.bindings[j];
|
||
b.signature = this._parseMethod(b.value);
|
||
if (!b.signature) {
|
||
b.model = this._modelForPath(b.value);
|
||
}
|
||
}
|
||
if (note.templateContent) {
|
||
this._processAnnotations(note.templateContent._notes);
|
||
var pp = note.templateContent._parentProps = this._discoverTemplateParentProps(note.templateContent._notes);
|
||
var bindings = [];
|
||
for (var prop in pp) {
|
||
bindings.push({
|
||
index: note.index,
|
||
kind: 'property',
|
||
mode: '{',
|
||
name: '_parent_' + prop,
|
||
model: prop,
|
||
value: prop
|
||
});
|
||
}
|
||
note.bindings = note.bindings.concat(bindings);
|
||
}
|
||
}
|
||
},
|
||
_discoverTemplateParentProps: function (notes) {
|
||
var pp = {};
|
||
notes.forEach(function (n) {
|
||
n.bindings.forEach(function (b) {
|
||
if (b.signature) {
|
||
var args = b.signature.args;
|
||
for (var k = 0; k < args.length; k++) {
|
||
pp[args[k].model] = true;
|
||
}
|
||
} else {
|
||
pp[b.model] = true;
|
||
}
|
||
});
|
||
if (n.templateContent) {
|
||
var tpp = n.templateContent._parentProps;
|
||
Polymer.Base.mixin(pp, tpp);
|
||
}
|
||
});
|
||
return pp;
|
||
},
|
||
_prepElement: function (element) {
|
||
Polymer.ResolveUrl.resolveAttrs(element, this._template.ownerDocument);
|
||
},
|
||
_findAnnotatedNode: Polymer.Annotations.findAnnotatedNode,
|
||
_marshalAnnotationReferences: function () {
|
||
if (this._template) {
|
||
this._marshalIdNodes();
|
||
this._marshalAnnotatedNodes();
|
||
this._marshalAnnotatedListeners();
|
||
}
|
||
},
|
||
_configureAnnotationReferences: function () {
|
||
this._configureTemplateContent();
|
||
},
|
||
_configureTemplateContent: function () {
|
||
this._notes.forEach(function (note, i) {
|
||
if (note.templateContent) {
|
||
this._nodes[i]._content = note.templateContent;
|
||
}
|
||
}, this);
|
||
},
|
||
_marshalIdNodes: function () {
|
||
this.$ = {};
|
||
this._notes.forEach(function (a) {
|
||
if (a.id) {
|
||
this.$[a.id] = this._findAnnotatedNode(this.root, a);
|
||
}
|
||
}, this);
|
||
},
|
||
_marshalAnnotatedNodes: function () {
|
||
if (this._nodes) {
|
||
this._nodes = this._nodes.map(function (a) {
|
||
return this._findAnnotatedNode(this.root, a);
|
||
}, this);
|
||
}
|
||
},
|
||
_marshalAnnotatedListeners: function () {
|
||
this._notes.forEach(function (a) {
|
||
if (a.events && a.events.length) {
|
||
var node = this._findAnnotatedNode(this.root, a);
|
||
a.events.forEach(function (e) {
|
||
this.listen(node, e.name, e.value);
|
||
}, this);
|
||
}
|
||
}, this);
|
||
}
|
||
});
|
||
Polymer.Base._addFeature({
|
||
listeners: {},
|
||
_listenListeners: function (listeners) {
|
||
var node, name, key;
|
||
for (key in listeners) {
|
||
if (key.indexOf('.') < 0) {
|
||
node = this;
|
||
name = key;
|
||
} else {
|
||
name = key.split('.');
|
||
node = this.$[name[0]];
|
||
name = name[1];
|
||
}
|
||
this.listen(node, name, listeners[key]);
|
||
}
|
||
},
|
||
listen: function (node, eventName, methodName) {
|
||
this._listen(node, eventName, this._createEventHandler(node, eventName, methodName));
|
||
},
|
||
_createEventHandler: function (node, eventName, methodName) {
|
||
var host = this;
|
||
return function (e) {
|
||
if (host[methodName]) {
|
||
host[methodName](e, e.detail);
|
||
} else {
|
||
host._warn(host._logf('_createEventHandler', 'listener method `' + methodName + '` not defined'));
|
||
}
|
||
};
|
||
},
|
||
_listen: function (node, eventName, handler) {
|
||
node.addEventListener(eventName, handler);
|
||
}
|
||
});
|
||
(function () {
|
||
'use strict';
|
||
var HAS_NATIVE_TA = typeof document.head.style.touchAction === 'string';
|
||
var GESTURE_KEY = '__polymerGestures';
|
||
var HANDLED_OBJ = '__polymerGesturesHandled';
|
||
var TOUCH_ACTION = '__polymerGesturesTouchAction';
|
||
var TAP_DISTANCE = 25;
|
||
var TRACK_DISTANCE = 5;
|
||
var TRACK_LENGTH = 2;
|
||
var MOUSE_TIMEOUT = 2500;
|
||
var MOUSE_EVENTS = [
|
||
'mousedown',
|
||
'mousemove',
|
||
'mouseup',
|
||
'click'
|
||
];
|
||
var mouseCanceller = function (mouseEvent) {
|
||
mouseEvent[HANDLED_OBJ] = { skip: true };
|
||
if (mouseEvent.type === 'click') {
|
||
var path = Polymer.dom(mouseEvent).path;
|
||
for (var i = 0; i < path.length; i++) {
|
||
if (path[i] === POINTERSTATE.mouse.target) {
|
||
return;
|
||
}
|
||
}
|
||
mouseEvent.preventDefault();
|
||
mouseEvent.stopPropagation();
|
||
}
|
||
};
|
||
function setupTeardownMouseCanceller(setup) {
|
||
for (var i = 0, en; i < MOUSE_EVENTS.length; i++) {
|
||
en = MOUSE_EVENTS[i];
|
||
if (setup) {
|
||
document.addEventListener(en, mouseCanceller, true);
|
||
} else {
|
||
document.removeEventListener(en, mouseCanceller, true);
|
||
}
|
||
}
|
||
}
|
||
function ignoreMouse() {
|
||
if (!POINTERSTATE.mouse.mouseIgnoreJob) {
|
||
setupTeardownMouseCanceller(true);
|
||
}
|
||
var unset = function () {
|
||
setupTeardownMouseCanceller();
|
||
POINTERSTATE.mouse.target = null;
|
||
POINTERSTATE.mouse.mouseIgnoreJob = null;
|
||
};
|
||
POINTERSTATE.mouse.mouseIgnoreJob = Polymer.Debounce(POINTERSTATE.mouse.mouseIgnoreJob, unset, MOUSE_TIMEOUT);
|
||
}
|
||
var POINTERSTATE = {
|
||
tapPrevented: false,
|
||
mouse: {
|
||
target: null,
|
||
mouseIgnoreJob: null
|
||
},
|
||
touch: {
|
||
x: 0,
|
||
y: 0,
|
||
id: -1,
|
||
scrollDecided: false
|
||
}
|
||
};
|
||
function firstTouchAction(ev) {
|
||
var path = Polymer.dom(ev).path;
|
||
var ta = 'auto';
|
||
for (var i = 0, n; i < path.length; i++) {
|
||
n = path[i];
|
||
if (n[TOUCH_ACTION]) {
|
||
ta = n[TOUCH_ACTION];
|
||
break;
|
||
}
|
||
}
|
||
return ta;
|
||
}
|
||
var Gestures = {
|
||
gestures: {},
|
||
recognizers: [],
|
||
deepTargetFind: function (x, y) {
|
||
var node = document.elementFromPoint(x, y);
|
||
var next = node;
|
||
while (next && next.shadowRoot) {
|
||
next = next.shadowRoot.elementFromPoint(x, y);
|
||
if (next) {
|
||
node = next;
|
||
}
|
||
}
|
||
return node;
|
||
},
|
||
handleNative: function (ev) {
|
||
var handled;
|
||
var type = ev.type;
|
||
var node = ev.currentTarget;
|
||
var gobj = node[GESTURE_KEY];
|
||
var gs = gobj[type];
|
||
if (!gs) {
|
||
return;
|
||
}
|
||
if (!ev[HANDLED_OBJ]) {
|
||
ev[HANDLED_OBJ] = {};
|
||
if (type.slice(0, 5) === 'touch') {
|
||
var t = ev.changedTouches[0];
|
||
if (type === 'touchstart') {
|
||
if (ev.touches.length === 1) {
|
||
POINTERSTATE.touch.id = t.identifier;
|
||
}
|
||
}
|
||
if (POINTERSTATE.touch.id !== t.identifier) {
|
||
return;
|
||
}
|
||
if (!HAS_NATIVE_TA) {
|
||
if (type === 'touchstart' || type === 'touchmove') {
|
||
Gestures.handleTouchAction(ev);
|
||
}
|
||
}
|
||
if (type === 'touchend') {
|
||
POINTERSTATE.mouse.target = Polymer.dom(ev).rootTarget;
|
||
ignoreMouse(true);
|
||
}
|
||
}
|
||
}
|
||
handled = ev[HANDLED_OBJ];
|
||
if (handled.skip) {
|
||
return;
|
||
}
|
||
var recognizers = Gestures.recognizers;
|
||
for (var i = 0, r; i < recognizers.length; i++) {
|
||
r = recognizers[i];
|
||
if (gs[r.name] && !handled[r.name]) {
|
||
handled[r.name] = true;
|
||
r[type](ev);
|
||
}
|
||
}
|
||
},
|
||
handleTouchAction: function (ev) {
|
||
var t = ev.changedTouches[0];
|
||
var type = ev.type;
|
||
if (type === 'touchstart') {
|
||
POINTERSTATE.touch.x = t.clientX;
|
||
POINTERSTATE.touch.y = t.clientY;
|
||
POINTERSTATE.touch.scrollDecided = false;
|
||
} else if (type === 'touchmove') {
|
||
if (POINTERSTATE.touch.scrollDecided) {
|
||
return;
|
||
}
|
||
POINTERSTATE.touch.scrollDecided = true;
|
||
var ta = firstTouchAction(ev);
|
||
var prevent = false;
|
||
var dx = Math.abs(POINTERSTATE.touch.x - t.clientX);
|
||
var dy = Math.abs(POINTERSTATE.touch.y - t.clientY);
|
||
if (!ev.cancelable) {
|
||
} else if (ta === 'none') {
|
||
prevent = true;
|
||
} else if (ta === 'pan-x') {
|
||
prevent = dy > dx;
|
||
} else if (ta === 'pan-y') {
|
||
prevent = dx > dy;
|
||
}
|
||
if (prevent) {
|
||
ev.preventDefault();
|
||
}
|
||
}
|
||
},
|
||
add: function (node, evType, handler) {
|
||
var recognizer = this.gestures[evType];
|
||
var deps = recognizer.deps;
|
||
var name = recognizer.name;
|
||
var gobj = node[GESTURE_KEY];
|
||
if (!gobj) {
|
||
node[GESTURE_KEY] = gobj = {};
|
||
}
|
||
for (var i = 0, dep, gd; i < deps.length; i++) {
|
||
dep = deps[i];
|
||
gd = gobj[dep];
|
||
if (!gd) {
|
||
gobj[dep] = gd = {};
|
||
node.addEventListener(dep, this.handleNative);
|
||
}
|
||
gd[name] = (gd[name] || 0) + 1;
|
||
}
|
||
node.addEventListener(evType, handler);
|
||
if (recognizer.touchAction) {
|
||
this.setTouchAction(node, recognizer.touchAction);
|
||
}
|
||
},
|
||
register: function (recog) {
|
||
this.recognizers.push(recog);
|
||
for (var i = 0; i < recog.emits.length; i++) {
|
||
this.gestures[recog.emits[i]] = recog;
|
||
}
|
||
},
|
||
setTouchAction: function (node, value) {
|
||
if (HAS_NATIVE_TA) {
|
||
node.style.touchAction = value;
|
||
}
|
||
node[TOUCH_ACTION] = value;
|
||
},
|
||
fire: function (target, type, detail) {
|
||
var ev = new CustomEvent(type, {
|
||
detail: detail,
|
||
bubbles: true,
|
||
cancelable: true
|
||
});
|
||
target.dispatchEvent(ev);
|
||
}
|
||
};
|
||
Gestures.register({
|
||
name: 'downup',
|
||
deps: [
|
||
'mousedown',
|
||
'touchstart',
|
||
'touchend'
|
||
],
|
||
emits: [
|
||
'down',
|
||
'up'
|
||
],
|
||
mousedown: function (e) {
|
||
var t = e.currentTarget;
|
||
var self = this;
|
||
var upfn = function upfn(e) {
|
||
self.fire('up', t, e);
|
||
document.removeEventListener('mouseup', upfn);
|
||
};
|
||
document.addEventListener('mouseup', upfn);
|
||
this.fire('down', t, e);
|
||
},
|
||
touchstart: function (e) {
|
||
this.fire('down', e.currentTarget, e.changedTouches[0]);
|
||
},
|
||
touchend: function (e) {
|
||
this.fire('up', e.currentTarget, e.changedTouches[0]);
|
||
},
|
||
fire: function (type, target, event) {
|
||
Gestures.fire(target, type, {
|
||
x: event.clientX,
|
||
y: event.clientY,
|
||
sourceEvent: event
|
||
});
|
||
}
|
||
});
|
||
Gestures.register({
|
||
name: 'track',
|
||
touchAction: 'none',
|
||
deps: [
|
||
'mousedown',
|
||
'touchstart',
|
||
'touchmove',
|
||
'touchend'
|
||
],
|
||
emits: ['track'],
|
||
info: {
|
||
x: 0,
|
||
y: 0,
|
||
state: 'start',
|
||
started: false,
|
||
moves: [],
|
||
addMove: function (move) {
|
||
if (this.moves.length > TRACK_LENGTH) {
|
||
this.moves.shift();
|
||
}
|
||
this.moves.push(move);
|
||
}
|
||
},
|
||
clearInfo: function () {
|
||
this.info.state = 'start';
|
||
this.info.started = false;
|
||
this.info.moves = [];
|
||
this.info.x = 0;
|
||
this.info.y = 0;
|
||
},
|
||
hasMovedEnough: function (x, y) {
|
||
if (this.info.started) {
|
||
return true;
|
||
}
|
||
var dx = Math.abs(this.info.x - x);
|
||
var dy = Math.abs(this.info.y - y);
|
||
return dx >= TRACK_DISTANCE || dy >= TRACK_DISTANCE;
|
||
},
|
||
mousedown: function (e) {
|
||
var t = e.currentTarget;
|
||
var self = this;
|
||
var movefn = function movefn(e) {
|
||
var x = e.clientX, y = e.clientY;
|
||
if (self.hasMovedEnough(x, y)) {
|
||
self.info.state = self.info.started ? e.type === 'mouseup' ? 'end' : 'track' : 'start';
|
||
self.info.addMove({
|
||
x: x,
|
||
y: y
|
||
});
|
||
self.fire(t, e);
|
||
e.preventDefault();
|
||
self.info.started = true;
|
||
}
|
||
};
|
||
var upfn = function upfn(e) {
|
||
if (self.info.started) {
|
||
POINTERSTATE.tapPrevented = true;
|
||
movefn(e);
|
||
}
|
||
self.clearInfo();
|
||
document.removeEventListener('mousemove', movefn);
|
||
document.removeEventListener('mouseup', upfn);
|
||
};
|
||
document.addEventListener('mousemove', movefn);
|
||
document.addEventListener('mouseup', upfn);
|
||
this.info.x = e.clientX;
|
||
this.info.y = e.clientY;
|
||
},
|
||
touchstart: function (e) {
|
||
var ct = e.changedTouches[0];
|
||
this.info.x = ct.clientX;
|
||
this.info.y = ct.clientY;
|
||
},
|
||
touchmove: function (e) {
|
||
var t = e.currentTarget;
|
||
var ct = e.changedTouches[0];
|
||
var x = ct.clientX, y = ct.clientY;
|
||
if (this.hasMovedEnough(x, y)) {
|
||
this.info.addMove({
|
||
x: x,
|
||
y: y
|
||
});
|
||
this.fire(t, ct);
|
||
this.info.state = 'track';
|
||
this.info.started = true;
|
||
}
|
||
},
|
||
touchend: function (e) {
|
||
var t = e.currentTarget;
|
||
var ct = e.changedTouches[0];
|
||
if (this.info.started) {
|
||
POINTERSTATE.tapPrevented = true;
|
||
this.info.state = 'end';
|
||
this.info.addMove({
|
||
x: ct.clientX,
|
||
y: ct.clientY
|
||
});
|
||
this.fire(t, ct);
|
||
}
|
||
this.clearInfo();
|
||
},
|
||
fire: function (target, touch) {
|
||
var secondlast = this.info.moves[this.info.moves.length - 2];
|
||
var lastmove = this.info.moves[this.info.moves.length - 1];
|
||
var dx = lastmove.x - this.info.x;
|
||
var dy = lastmove.y - this.info.y;
|
||
var ddx, ddy = 0;
|
||
if (secondlast) {
|
||
ddx = lastmove.x - secondlast.x;
|
||
ddy = lastmove.y - secondlast.y;
|
||
}
|
||
return Gestures.fire(target, 'track', {
|
||
state: this.info.state,
|
||
x: touch.clientX,
|
||
y: touch.clientY,
|
||
dx: dx,
|
||
dy: dy,
|
||
ddx: ddx,
|
||
ddy: ddy,
|
||
sourceEvent: touch,
|
||
hover: function () {
|
||
return Gestures.deepTargetFind(touch.clientX, touch.clientY);
|
||
}
|
||
});
|
||
}
|
||
});
|
||
Gestures.register({
|
||
name: 'tap',
|
||
deps: [
|
||
'mousedown',
|
||
'click',
|
||
'touchstart',
|
||
'touchend'
|
||
],
|
||
emits: ['tap'],
|
||
start: {
|
||
x: NaN,
|
||
y: NaN
|
||
},
|
||
reset: function () {
|
||
this.start.x = NaN;
|
||
this.start.y = NaN;
|
||
},
|
||
save: function (e) {
|
||
this.start.x = e.clientX;
|
||
this.start.y = e.clientY;
|
||
},
|
||
mousedown: function (e) {
|
||
POINTERSTATE.tapPrevented = false;
|
||
this.save(e);
|
||
},
|
||
click: function (e) {
|
||
this.forward(e);
|
||
},
|
||
touchstart: function (e) {
|
||
POINTERSTATE.tapPrevented = false;
|
||
this.save(e.changedTouches[0]);
|
||
},
|
||
touchend: function (e) {
|
||
this.forward(e.changedTouches[0]);
|
||
},
|
||
forward: function (e) {
|
||
var dx = Math.abs(e.clientX - this.start.x);
|
||
var dy = Math.abs(e.clientY - this.start.y);
|
||
if (isNaN(dx) || isNaN(dy) || dx <= TAP_DISTANCE && dy <= TAP_DISTANCE) {
|
||
if (!POINTERSTATE.tapPrevented) {
|
||
Gestures.fire(e.target, 'tap', {
|
||
x: e.clientX,
|
||
y: e.clientY,
|
||
sourceEvent: e
|
||
});
|
||
}
|
||
}
|
||
this.reset();
|
||
}
|
||
});
|
||
var DIRECTION_MAP = {
|
||
x: 'pan-x',
|
||
y: 'pan-y',
|
||
none: 'none',
|
||
all: 'auto'
|
||
};
|
||
Polymer.Base._addFeature({
|
||
_listen: function (node, eventName, handler) {
|
||
if (Gestures.gestures[eventName]) {
|
||
Gestures.add(node, eventName, handler);
|
||
} else {
|
||
node.addEventListener(eventName, handler);
|
||
}
|
||
},
|
||
setScrollDirection: function (direction, node) {
|
||
node = node || this;
|
||
Gestures.setTouchAction(node, DIRECTION_MAP[direction] || 'auto');
|
||
}
|
||
});
|
||
Polymer.Gestures = Gestures;
|
||
}());
|
||
Polymer.Async = function () {
|
||
var currVal = 0;
|
||
var lastVal = 0;
|
||
var callbacks = [];
|
||
var twiddle = document.createTextNode('');
|
||
function runAsync(callback, waitTime) {
|
||
if (waitTime > 0) {
|
||
return ~setTimeout(callback, waitTime);
|
||
} else {
|
||
twiddle.textContent = currVal++;
|
||
callbacks.push(callback);
|
||
return currVal - 1;
|
||
}
|
||
}
|
||
function cancelAsync(handle) {
|
||
if (handle < 0) {
|
||
clearTimeout(~handle);
|
||
} else {
|
||
var idx = handle - lastVal;
|
||
if (idx >= 0) {
|
||
if (!callbacks[idx]) {
|
||
throw 'invalid async handle: ' + handle;
|
||
}
|
||
callbacks[idx] = null;
|
||
}
|
||
}
|
||
}
|
||
function atEndOfMicrotask() {
|
||
var len = callbacks.length;
|
||
for (var i = 0; i < len; i++) {
|
||
var cb = callbacks[i];
|
||
if (cb) {
|
||
cb();
|
||
}
|
||
}
|
||
callbacks.splice(0, len);
|
||
lastVal += len;
|
||
}
|
||
new (window.MutationObserver || JsMutationObserver)(atEndOfMicrotask).observe(twiddle, { characterData: true });
|
||
return {
|
||
run: runAsync,
|
||
cancel: cancelAsync
|
||
};
|
||
}();
|
||
Polymer.Debounce = function () {
|
||
var Async = Polymer.Async;
|
||
var Debouncer = function (context) {
|
||
this.context = context;
|
||
this.boundComplete = this.complete.bind(this);
|
||
};
|
||
Debouncer.prototype = {
|
||
go: function (callback, wait) {
|
||
var h;
|
||
this.finish = function () {
|
||
Async.cancel(h);
|
||
};
|
||
h = Async.run(this.boundComplete, wait);
|
||
this.callback = callback;
|
||
},
|
||
stop: function () {
|
||
if (this.finish) {
|
||
this.finish();
|
||
this.finish = null;
|
||
}
|
||
},
|
||
complete: function () {
|
||
if (this.finish) {
|
||
this.stop();
|
||
this.callback.call(this.context);
|
||
}
|
||
}
|
||
};
|
||
function debounce(debouncer, callback, wait) {
|
||
if (debouncer) {
|
||
debouncer.stop();
|
||
} else {
|
||
debouncer = new Debouncer(this);
|
||
}
|
||
debouncer.go(callback, wait);
|
||
return debouncer;
|
||
}
|
||
return debounce;
|
||
}();
|
||
Polymer.Base._addFeature({
|
||
$$: function (slctr) {
|
||
return Polymer.dom(this.root).querySelector(slctr);
|
||
},
|
||
toggleClass: function (name, bool, node) {
|
||
node = node || this;
|
||
if (arguments.length == 1) {
|
||
bool = !node.classList.contains(name);
|
||
}
|
||
if (bool) {
|
||
Polymer.dom(node).classList.add(name);
|
||
} else {
|
||
Polymer.dom(node).classList.remove(name);
|
||
}
|
||
},
|
||
toggleAttribute: function (name, bool, node) {
|
||
node = node || this;
|
||
if (arguments.length == 1) {
|
||
bool = !node.hasAttribute(name);
|
||
}
|
||
if (bool) {
|
||
Polymer.dom(node).setAttribute(name, '');
|
||
} else {
|
||
Polymer.dom(node).removeAttribute(name);
|
||
}
|
||
},
|
||
classFollows: function (name, toElement, fromElement) {
|
||
if (fromElement) {
|
||
Polymer.dom(fromElement).classList.remove(name);
|
||
}
|
||
if (toElement) {
|
||
Polymer.dom(toElement).classList.add(name);
|
||
}
|
||
},
|
||
attributeFollows: function (name, toElement, fromElement) {
|
||
if (fromElement) {
|
||
Polymer.dom(fromElement).removeAttribute(name);
|
||
}
|
||
if (toElement) {
|
||
Polymer.dom(toElement).setAttribute(name, '');
|
||
}
|
||
},
|
||
getContentChildNodes: function (slctr) {
|
||
return Polymer.dom(Polymer.dom(this.root).querySelector(slctr || 'content')).getDistributedNodes();
|
||
},
|
||
getContentChildren: function (slctr) {
|
||
return this.getContentChildNodes(slctr).filter(function (n) {
|
||
return n.nodeType === Node.ELEMENT_NODE;
|
||
});
|
||
},
|
||
fire: function (type, detail, options) {
|
||
options = options || Polymer.nob;
|
||
var node = options.node || this;
|
||
var detail = detail === null || detail === undefined ? Polymer.nob : detail;
|
||
var bubbles = options.bubbles === undefined ? true : options.bubbles;
|
||
var event = new CustomEvent(type, {
|
||
bubbles: Boolean(bubbles),
|
||
cancelable: Boolean(options.cancelable),
|
||
detail: detail
|
||
});
|
||
node.dispatchEvent(event);
|
||
return event;
|
||
},
|
||
async: function (callback, waitTime) {
|
||
return Polymer.Async.run(callback.bind(this), waitTime);
|
||
},
|
||
cancelAsync: function (handle) {
|
||
Polymer.Async.cancel(handle);
|
||
},
|
||
arrayDelete: function (path, item) {
|
||
var index;
|
||
if (Array.isArray(path)) {
|
||
index = path.indexOf(item);
|
||
if (index >= 0) {
|
||
return path.splice(index, 1);
|
||
}
|
||
} else {
|
||
var arr = this.get(path);
|
||
index = arr.indexOf(item);
|
||
if (index >= 0) {
|
||
return this.splice(path, index, 1);
|
||
}
|
||
}
|
||
},
|
||
transform: function (transform, node) {
|
||
node = node || this;
|
||
node.style.webkitTransform = transform;
|
||
node.style.transform = transform;
|
||
},
|
||
translate3d: function (x, y, z, node) {
|
||
node = node || this;
|
||
this.transform('translate3d(' + x + ',' + y + ',' + z + ')', node);
|
||
},
|
||
importHref: function (href, onload, onerror) {
|
||
var l = document.createElement('link');
|
||
l.rel = 'import';
|
||
l.href = href;
|
||
if (onload) {
|
||
l.onload = onload.bind(this);
|
||
}
|
||
if (onerror) {
|
||
l.onerror = onerror.bind(this);
|
||
}
|
||
document.head.appendChild(l);
|
||
return l;
|
||
},
|
||
create: function (tag, props) {
|
||
var elt = document.createElement(tag);
|
||
if (props) {
|
||
for (var n in props) {
|
||
elt[n] = props[n];
|
||
}
|
||
}
|
||
return elt;
|
||
},
|
||
mixin: function (target, source) {
|
||
for (var i in source) {
|
||
target[i] = source[i];
|
||
}
|
||
}
|
||
});
|
||
Polymer.Bind = {
|
||
prepareModel: function (model) {
|
||
model._propertyEffects = {};
|
||
model._bindListeners = [];
|
||
var api = this._modelApi;
|
||
for (var n in api) {
|
||
model[n] = api[n];
|
||
}
|
||
},
|
||
_modelApi: {
|
||
_notifyChange: function (property) {
|
||
var eventName = Polymer.CaseMap.camelToDashCase(property) + '-changed';
|
||
this.fire(eventName, { value: this[property] }, { bubbles: false });
|
||
},
|
||
_propertySet: function (property, value, effects) {
|
||
var old = this.__data__[property];
|
||
if (old !== value) {
|
||
this.__data__[property] = value;
|
||
if (typeof value == 'object') {
|
||
this._clearPath(property);
|
||
}
|
||
if (this._propertyChanged) {
|
||
this._propertyChanged(property, value, old);
|
||
}
|
||
if (effects) {
|
||
this._effectEffects(property, value, effects, old);
|
||
}
|
||
}
|
||
return old;
|
||
},
|
||
_effectEffects: function (property, value, effects, old) {
|
||
effects.forEach(function (fx) {
|
||
var fn = Polymer.Bind['_' + fx.kind + 'Effect'];
|
||
if (fn) {
|
||
fn.call(this, property, value, fx.effect, old);
|
||
}
|
||
}, this);
|
||
},
|
||
_clearPath: function (path) {
|
||
for (var prop in this.__data__) {
|
||
if (prop.indexOf(path + '.') === 0) {
|
||
this.__data__[prop] = undefined;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
ensurePropertyEffects: function (model, property) {
|
||
var fx = model._propertyEffects[property];
|
||
if (!fx) {
|
||
fx = model._propertyEffects[property] = [];
|
||
}
|
||
return fx;
|
||
},
|
||
addPropertyEffect: function (model, property, kind, effect) {
|
||
var fx = this.ensurePropertyEffects(model, property);
|
||
fx.push({
|
||
kind: kind,
|
||
effect: effect
|
||
});
|
||
},
|
||
createBindings: function (model) {
|
||
var fx$ = model._propertyEffects;
|
||
if (fx$) {
|
||
for (var n in fx$) {
|
||
var fx = fx$[n];
|
||
fx.sort(this._sortPropertyEffects);
|
||
this._createAccessors(model, n, fx);
|
||
}
|
||
}
|
||
},
|
||
_sortPropertyEffects: function () {
|
||
var EFFECT_ORDER = {
|
||
'compute': 0,
|
||
'annotation': 1,
|
||
'computedAnnotation': 2,
|
||
'reflect': 3,
|
||
'notify': 4,
|
||
'observer': 5,
|
||
'complexObserver': 6,
|
||
'function': 7
|
||
};
|
||
return function (a, b) {
|
||
return EFFECT_ORDER[a.kind] - EFFECT_ORDER[b.kind];
|
||
};
|
||
}(),
|
||
_createAccessors: function (model, property, effects) {
|
||
var defun = {
|
||
get: function () {
|
||
return this.__data__[property];
|
||
}
|
||
};
|
||
var setter = function (value) {
|
||
this._propertySet(property, value, effects);
|
||
};
|
||
if (model.getPropertyInfo && model.getPropertyInfo(property).readOnly) {
|
||
model['_set' + this.upper(property)] = setter;
|
||
} else {
|
||
defun.set = setter;
|
||
}
|
||
Object.defineProperty(model, property, defun);
|
||
},
|
||
upper: function (name) {
|
||
return name[0].toUpperCase() + name.substring(1);
|
||
},
|
||
_addAnnotatedListener: function (model, index, property, path, event) {
|
||
var fn = this._notedListenerFactory(property, path, this._isStructured(path), this._isEventBogus);
|
||
var eventName = event || Polymer.CaseMap.camelToDashCase(property) + '-changed';
|
||
model._bindListeners.push({
|
||
index: index,
|
||
property: property,
|
||
path: path,
|
||
changedFn: fn,
|
||
event: eventName
|
||
});
|
||
},
|
||
_isStructured: function (path) {
|
||
return path.indexOf('.') > 0;
|
||
},
|
||
_isEventBogus: function (e, target) {
|
||
return e.path && e.path[0] !== target;
|
||
},
|
||
_notedListenerFactory: function (property, path, isStructured, bogusTest) {
|
||
return function (e, target) {
|
||
if (!bogusTest(e, target)) {
|
||
if (e.detail && e.detail.path) {
|
||
this.notifyPath(this._fixPath(path, property, e.detail.path), e.detail.value);
|
||
} else {
|
||
var value = target[property];
|
||
if (!isStructured) {
|
||
this[path] = target[property];
|
||
} else {
|
||
if (this.__data__[path] != value) {
|
||
this.set(path, value);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
};
|
||
},
|
||
prepareInstance: function (inst) {
|
||
inst.__data__ = Object.create(null);
|
||
},
|
||
setupBindListeners: function (inst) {
|
||
inst._bindListeners.forEach(function (info) {
|
||
var node = inst._nodes[info.index];
|
||
node.addEventListener(info.event, inst._notifyListener.bind(inst, info.changedFn));
|
||
});
|
||
}
|
||
};
|
||
Polymer.Base.extend(Polymer.Bind, {
|
||
_shouldAddListener: function (effect) {
|
||
return effect.name && effect.mode === '{' && !effect.negate && effect.kind != 'attribute';
|
||
},
|
||
_annotationEffect: function (source, value, effect) {
|
||
if (source != effect.value) {
|
||
value = this.get(effect.value);
|
||
this.__data__[effect.value] = value;
|
||
}
|
||
var calc = effect.negate ? !value : value;
|
||
if (!effect.customEvent || this._nodes[effect.index][effect.name] !== calc) {
|
||
return this._applyEffectValue(calc, effect);
|
||
}
|
||
},
|
||
_reflectEffect: function (source) {
|
||
this.reflectPropertyToAttribute(source);
|
||
},
|
||
_notifyEffect: function (source) {
|
||
this._notifyChange(source);
|
||
},
|
||
_functionEffect: function (source, value, fn, old) {
|
||
fn.call(this, source, value, old);
|
||
},
|
||
_observerEffect: function (source, value, effect, old) {
|
||
var fn = this[effect.method];
|
||
if (fn) {
|
||
fn.call(this, value, old);
|
||
} else {
|
||
this._warn(this._logf('_observerEffect', 'observer method `' + effect.method + '` not defined'));
|
||
}
|
||
},
|
||
_complexObserverEffect: function (source, value, effect) {
|
||
var fn = this[effect.method];
|
||
if (fn) {
|
||
var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value);
|
||
if (args) {
|
||
fn.apply(this, args);
|
||
}
|
||
} else {
|
||
this._warn(this._logf('_complexObserverEffect', 'observer method `' + effect.method + '` not defined'));
|
||
}
|
||
},
|
||
_computeEffect: function (source, value, effect) {
|
||
var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value);
|
||
if (args) {
|
||
var fn = this[effect.method];
|
||
if (fn) {
|
||
this[effect.property] = fn.apply(this, args);
|
||
} else {
|
||
this._warn(this._logf('_computeEffect', 'compute method `' + effect.method + '` not defined'));
|
||
}
|
||
}
|
||
},
|
||
_annotatedComputationEffect: function (source, value, effect) {
|
||
var computedHost = this._rootDataHost || this;
|
||
var fn = computedHost[effect.method];
|
||
if (fn) {
|
||
var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value);
|
||
if (args) {
|
||
var computedvalue = fn.apply(computedHost, args);
|
||
if (effect.negate) {
|
||
computedvalue = !computedvalue;
|
||
}
|
||
this._applyEffectValue(computedvalue, effect);
|
||
}
|
||
} else {
|
||
computedHost._warn(computedHost._logf('_annotatedComputationEffect', 'compute method `' + effect.method + '` not defined'));
|
||
}
|
||
},
|
||
_marshalArgs: function (model, effect, path, value) {
|
||
var values = [];
|
||
var args = effect.args;
|
||
for (var i = 0, l = args.length; i < l; i++) {
|
||
var arg = args[i];
|
||
var name = arg.name;
|
||
var v;
|
||
if (arg.literal) {
|
||
v = arg.value;
|
||
} else if (arg.structured) {
|
||
v = Polymer.Base.get(name, model);
|
||
} else {
|
||
v = model[name];
|
||
}
|
||
if (args.length > 1 && v === undefined) {
|
||
return;
|
||
}
|
||
if (arg.wildcard) {
|
||
var baseChanged = name.indexOf(path + '.') === 0;
|
||
var matches = effect.trigger.name.indexOf(name) === 0 && !baseChanged;
|
||
values[i] = {
|
||
path: matches ? path : name,
|
||
value: matches ? value : v,
|
||
base: v
|
||
};
|
||
} else {
|
||
values[i] = v;
|
||
}
|
||
}
|
||
return values;
|
||
}
|
||
});
|
||
Polymer.Base._addFeature({
|
||
_addPropertyEffect: function (property, kind, effect) {
|
||
Polymer.Bind.addPropertyEffect(this, property, kind, effect);
|
||
},
|
||
_prepEffects: function () {
|
||
Polymer.Bind.prepareModel(this);
|
||
this._addAnnotationEffects(this._notes);
|
||
},
|
||
_prepBindings: function () {
|
||
Polymer.Bind.createBindings(this);
|
||
},
|
||
_addPropertyEffects: function (properties) {
|
||
if (properties) {
|
||
for (var p in properties) {
|
||
var prop = properties[p];
|
||
if (prop.observer) {
|
||
this._addObserverEffect(p, prop.observer);
|
||
}
|
||
if (prop.computed) {
|
||
this._addComputedEffect(p, prop.computed);
|
||
}
|
||
if (prop.notify) {
|
||
this._addPropertyEffect(p, 'notify');
|
||
}
|
||
if (prop.reflectToAttribute) {
|
||
this._addPropertyEffect(p, 'reflect');
|
||
}
|
||
if (prop.readOnly) {
|
||
Polymer.Bind.ensurePropertyEffects(this, p);
|
||
}
|
||
}
|
||
}
|
||
},
|
||
_addComputedEffect: function (name, expression) {
|
||
var sig = this._parseMethod(expression);
|
||
sig.args.forEach(function (arg) {
|
||
this._addPropertyEffect(arg.model, 'compute', {
|
||
method: sig.method,
|
||
args: sig.args,
|
||
trigger: arg,
|
||
property: name
|
||
});
|
||
}, this);
|
||
},
|
||
_addObserverEffect: function (property, observer) {
|
||
this._addPropertyEffect(property, 'observer', {
|
||
method: observer,
|
||
property: property
|
||
});
|
||
},
|
||
_addComplexObserverEffects: function (observers) {
|
||
if (observers) {
|
||
observers.forEach(function (observer) {
|
||
this._addComplexObserverEffect(observer);
|
||
}, this);
|
||
}
|
||
},
|
||
_addComplexObserverEffect: function (observer) {
|
||
var sig = this._parseMethod(observer);
|
||
sig.args.forEach(function (arg) {
|
||
this._addPropertyEffect(arg.model, 'complexObserver', {
|
||
method: sig.method,
|
||
args: sig.args,
|
||
trigger: arg
|
||
});
|
||
}, this);
|
||
},
|
||
_addAnnotationEffects: function (notes) {
|
||
this._nodes = [];
|
||
notes.forEach(function (note) {
|
||
var index = this._nodes.push(note) - 1;
|
||
note.bindings.forEach(function (binding) {
|
||
this._addAnnotationEffect(binding, index);
|
||
}, this);
|
||
}, this);
|
||
},
|
||
_addAnnotationEffect: function (note, index) {
|
||
if (Polymer.Bind._shouldAddListener(note)) {
|
||
Polymer.Bind._addAnnotatedListener(this, index, note.name, note.value, note.event);
|
||
}
|
||
if (note.signature) {
|
||
this._addAnnotatedComputationEffect(note, index);
|
||
} else {
|
||
note.index = index;
|
||
this._addPropertyEffect(note.model, 'annotation', note);
|
||
}
|
||
},
|
||
_addAnnotatedComputationEffect: function (note, index) {
|
||
var sig = note.signature;
|
||
if (sig.static) {
|
||
this.__addAnnotatedComputationEffect('__static__', index, note, sig, null);
|
||
} else {
|
||
sig.args.forEach(function (arg) {
|
||
if (!arg.literal) {
|
||
this.__addAnnotatedComputationEffect(arg.model, index, note, sig, arg);
|
||
}
|
||
}, this);
|
||
}
|
||
},
|
||
__addAnnotatedComputationEffect: function (property, index, note, sig, trigger) {
|
||
this._addPropertyEffect(property, 'annotatedComputation', {
|
||
index: index,
|
||
kind: note.kind,
|
||
property: note.name,
|
||
negate: note.negate,
|
||
method: sig.method,
|
||
args: sig.args,
|
||
trigger: trigger
|
||
});
|
||
},
|
||
_parseMethod: function (expression) {
|
||
var m = expression.match(/(\w*)\((.*)\)/);
|
||
if (m) {
|
||
var sig = {
|
||
method: m[1],
|
||
static: true
|
||
};
|
||
if (m[2].trim()) {
|
||
var args = m[2].replace(/\\,/g, ',').split(',');
|
||
return this._parseArgs(args, sig);
|
||
} else {
|
||
sig.args = Polymer.nar;
|
||
return sig;
|
||
}
|
||
}
|
||
},
|
||
_parseArgs: function (argList, sig) {
|
||
sig.args = argList.map(function (rawArg) {
|
||
var arg = this._parseArg(rawArg);
|
||
if (!arg.literal) {
|
||
sig.static = false;
|
||
}
|
||
return arg;
|
||
}, this);
|
||
return sig;
|
||
},
|
||
_parseArg: function (rawArg) {
|
||
var arg = rawArg.trim().replace(/,/g, ',').replace(/\\(.)/g, '$1');
|
||
var a = {
|
||
name: arg,
|
||
model: this._modelForPath(arg)
|
||
};
|
||
var fc = arg[0];
|
||
if (fc >= '0' && fc <= '9') {
|
||
fc = '#';
|
||
}
|
||
switch (fc) {
|
||
case '\'':
|
||
case '"':
|
||
a.value = arg.slice(1, -1);
|
||
a.literal = true;
|
||
break;
|
||
case '#':
|
||
a.value = Number(arg);
|
||
a.literal = true;
|
||
break;
|
||
}
|
||
if (!a.literal) {
|
||
a.structured = arg.indexOf('.') > 0;
|
||
if (a.structured) {
|
||
a.wildcard = arg.slice(-2) == '.*';
|
||
if (a.wildcard) {
|
||
a.name = arg.slice(0, -2);
|
||
}
|
||
}
|
||
}
|
||
return a;
|
||
},
|
||
_marshalInstanceEffects: function () {
|
||
Polymer.Bind.prepareInstance(this);
|
||
Polymer.Bind.setupBindListeners(this);
|
||
},
|
||
_applyEffectValue: function (value, info) {
|
||
var node = this._nodes[info.index];
|
||
var property = info.property || info.name || 'textContent';
|
||
if (info.kind == 'attribute') {
|
||
this.serializeValueToAttribute(value, property, node);
|
||
} else {
|
||
if (property === 'className') {
|
||
value = this._scopeElementClass(node, value);
|
||
}
|
||
if (property === 'textContent' || node.localName == 'input' && property == 'value') {
|
||
value = value == undefined ? '' : value;
|
||
}
|
||
return node[property] = value;
|
||
}
|
||
},
|
||
_executeStaticEffects: function () {
|
||
if (this._propertyEffects.__static__) {
|
||
this._effectEffects('__static__', null, this._propertyEffects.__static__);
|
||
}
|
||
}
|
||
});
|
||
Polymer.Base._addFeature({
|
||
_setupConfigure: function (initialConfig) {
|
||
this._config = initialConfig || {};
|
||
this._handlers = [];
|
||
},
|
||
_marshalAttributes: function () {
|
||
this._takeAttributesToModel(this._config);
|
||
},
|
||
_configValue: function (name, value) {
|
||
this._config[name] = value;
|
||
},
|
||
_beforeClientsReady: function () {
|
||
this._configure();
|
||
},
|
||
_configure: function () {
|
||
this._configureAnnotationReferences();
|
||
var config = {};
|
||
this.behaviors.forEach(function (b) {
|
||
this._configureProperties(b.properties, config);
|
||
}, this);
|
||
this._configureProperties(this.properties, config);
|
||
this._mixinConfigure(config, this._config);
|
||
this._config = config;
|
||
this._distributeConfig(this._config);
|
||
},
|
||
_configureProperties: function (properties, config) {
|
||
for (var i in properties) {
|
||
var c = properties[i];
|
||
if (c.value !== undefined) {
|
||
var value = c.value;
|
||
if (typeof value == 'function') {
|
||
value = value.call(this, this._config);
|
||
}
|
||
config[i] = value;
|
||
}
|
||
}
|
||
},
|
||
_mixinConfigure: function (a, b) {
|
||
for (var prop in b) {
|
||
if (!this.getPropertyInfo(prop).readOnly) {
|
||
a[prop] = b[prop];
|
||
}
|
||
}
|
||
},
|
||
_distributeConfig: function (config) {
|
||
var fx$ = this._propertyEffects;
|
||
if (fx$) {
|
||
for (var p in config) {
|
||
var fx = fx$[p];
|
||
if (fx) {
|
||
for (var i = 0, l = fx.length, x; i < l && (x = fx[i]); i++) {
|
||
if (x.kind === 'annotation') {
|
||
var node = this._nodes[x.effect.index];
|
||
if (node._configValue) {
|
||
var value = p === x.effect.value ? config[p] : this.get(x.effect.value, config);
|
||
node._configValue(x.effect.name, value);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
_afterClientsReady: function () {
|
||
this._executeStaticEffects();
|
||
this._applyConfig(this._config);
|
||
this._flushHandlers();
|
||
},
|
||
_applyConfig: function (config) {
|
||
for (var n in config) {
|
||
if (this[n] === undefined) {
|
||
var effects = this._propertyEffects[n];
|
||
if (effects) {
|
||
this._propertySet(n, config[n], effects);
|
||
} else {
|
||
this[n] = config[n];
|
||
}
|
||
}
|
||
}
|
||
},
|
||
_notifyListener: function (fn, e) {
|
||
if (!this._clientsReadied) {
|
||
this._queueHandler([
|
||
fn,
|
||
e,
|
||
e.target
|
||
]);
|
||
} else {
|
||
return fn.call(this, e, e.target);
|
||
}
|
||
},
|
||
_queueHandler: function (args) {
|
||
this._handlers.push(args);
|
||
},
|
||
_flushHandlers: function () {
|
||
var h$ = this._handlers;
|
||
for (var i = 0, l = h$.length, h; i < l && (h = h$[i]); i++) {
|
||
h[0].call(this, h[1], h[2]);
|
||
}
|
||
}
|
||
});
|
||
(function () {
|
||
'use strict';
|
||
Polymer.Base._addFeature({
|
||
notifyPath: function (path, value, fromAbove) {
|
||
var old = this._propertySet(path, value);
|
||
if (old !== value) {
|
||
this._pathEffector(path, value);
|
||
if (!fromAbove) {
|
||
this._notifyPath(path, value);
|
||
}
|
||
}
|
||
},
|
||
_getPathParts: function (path) {
|
||
if (Array.isArray(path)) {
|
||
var parts = [];
|
||
for (var i = 0; i < path.length; i++) {
|
||
var args = path[i].toString().split('.');
|
||
for (var j = 0; j < args.length; j++) {
|
||
parts.push(args[j]);
|
||
}
|
||
}
|
||
return parts;
|
||
} else {
|
||
return path.toString().split('.');
|
||
}
|
||
},
|
||
set: function (path, value, root) {
|
||
var prop = root || this;
|
||
var parts = this._getPathParts(path);
|
||
var array;
|
||
var last = parts[parts.length - 1];
|
||
if (parts.length > 1) {
|
||
for (var i = 0; i < parts.length - 1; i++) {
|
||
prop = prop[parts[i]];
|
||
if (array) {
|
||
parts[i] = Polymer.Collection.get(array).getKey(prop);
|
||
}
|
||
if (!prop) {
|
||
return;
|
||
}
|
||
array = Array.isArray(prop) ? prop : null;
|
||
}
|
||
prop[last] = value;
|
||
if (!root) {
|
||
this.notifyPath(parts.join('.'), value);
|
||
}
|
||
} else {
|
||
prop[path] = value;
|
||
}
|
||
},
|
||
get: function (path, root) {
|
||
var prop = root || this;
|
||
var parts = this._getPathParts(path);
|
||
var last = parts.pop();
|
||
while (parts.length) {
|
||
prop = prop[parts.shift()];
|
||
if (!prop) {
|
||
return;
|
||
}
|
||
}
|
||
return prop[last];
|
||
},
|
||
_pathEffector: function (path, value) {
|
||
var model = this._modelForPath(path);
|
||
var fx$ = this._propertyEffects[model];
|
||
if (fx$) {
|
||
fx$.forEach(function (fx) {
|
||
var fxFn = this['_' + fx.kind + 'PathEffect'];
|
||
if (fxFn) {
|
||
fxFn.call(this, path, value, fx.effect);
|
||
}
|
||
}, this);
|
||
}
|
||
if (this._boundPaths) {
|
||
this._notifyBoundPaths(path, value);
|
||
}
|
||
},
|
||
_annotationPathEffect: function (path, value, effect) {
|
||
if (effect.value === path || effect.value.indexOf(path + '.') === 0) {
|
||
Polymer.Bind._annotationEffect.call(this, path, value, effect);
|
||
} else if (path.indexOf(effect.value + '.') === 0 && !effect.negate) {
|
||
var node = this._nodes[effect.index];
|
||
if (node && node.notifyPath) {
|
||
var p = this._fixPath(effect.name, effect.value, path);
|
||
node.notifyPath(p, value, true);
|
||
}
|
||
}
|
||
},
|
||
_complexObserverPathEffect: function (path, value, effect) {
|
||
if (this._pathMatchesEffect(path, effect)) {
|
||
Polymer.Bind._complexObserverEffect.call(this, path, value, effect);
|
||
}
|
||
},
|
||
_computePathEffect: function (path, value, effect) {
|
||
if (this._pathMatchesEffect(path, effect)) {
|
||
Polymer.Bind._computeEffect.call(this, path, value, effect);
|
||
}
|
||
},
|
||
_annotatedComputationPathEffect: function (path, value, effect) {
|
||
if (this._pathMatchesEffect(path, effect)) {
|
||
Polymer.Bind._annotatedComputationEffect.call(this, path, value, effect);
|
||
}
|
||
},
|
||
_pathMatchesEffect: function (path, effect) {
|
||
var effectArg = effect.trigger.name;
|
||
return effectArg == path || effectArg.indexOf(path + '.') === 0 || effect.trigger.wildcard && path.indexOf(effectArg) === 0;
|
||
},
|
||
linkPaths: function (to, from) {
|
||
this._boundPaths = this._boundPaths || {};
|
||
if (from) {
|
||
this._boundPaths[to] = from;
|
||
} else {
|
||
this.unbindPath(to);
|
||
}
|
||
},
|
||
unlinkPaths: function (path) {
|
||
if (this._boundPaths) {
|
||
delete this._boundPaths[path];
|
||
}
|
||
},
|
||
_notifyBoundPaths: function (path, value) {
|
||
var from, to;
|
||
for (var a in this._boundPaths) {
|
||
var b = this._boundPaths[a];
|
||
if (path.indexOf(a + '.') == 0) {
|
||
from = a;
|
||
to = b;
|
||
break;
|
||
}
|
||
if (path.indexOf(b + '.') == 0) {
|
||
from = b;
|
||
to = a;
|
||
break;
|
||
}
|
||
}
|
||
if (from && to) {
|
||
var p = this._fixPath(to, from, path);
|
||
this.notifyPath(p, value);
|
||
}
|
||
},
|
||
_fixPath: function (property, root, path) {
|
||
return property + path.slice(root.length);
|
||
},
|
||
_notifyPath: function (path, value) {
|
||
var rootName = this._modelForPath(path);
|
||
var dashCaseName = Polymer.CaseMap.camelToDashCase(rootName);
|
||
var eventName = dashCaseName + this._EVENT_CHANGED;
|
||
this.fire(eventName, {
|
||
path: path,
|
||
value: value
|
||
}, { bubbles: false });
|
||
},
|
||
_modelForPath: function (path) {
|
||
var dot = path.indexOf('.');
|
||
return dot < 0 ? path : path.slice(0, dot);
|
||
},
|
||
_EVENT_CHANGED: '-changed',
|
||
_notifySplice: function (array, path, index, added, removed) {
|
||
var splices = [{
|
||
index: index,
|
||
addedCount: added,
|
||
removed: removed,
|
||
object: array,
|
||
type: 'splice'
|
||
}];
|
||
var change = {
|
||
keySplices: Polymer.Collection.get(array).applySplices(splices),
|
||
indexSplices: splices
|
||
};
|
||
this.set(path + '.splices', change);
|
||
if (added != removed.length) {
|
||
this.notifyPath(path + '.length', array.length);
|
||
}
|
||
change.keySplices = null;
|
||
change.indexSplices = null;
|
||
},
|
||
push: function (path) {
|
||
var array = this.get(path);
|
||
var args = Array.prototype.slice.call(arguments, 1);
|
||
var len = array.length;
|
||
var ret = array.push.apply(array, args);
|
||
this._notifySplice(array, path, len, args.length, []);
|
||
return ret;
|
||
},
|
||
pop: function (path) {
|
||
var array = this.get(path);
|
||
var args = Array.prototype.slice.call(arguments, 1);
|
||
var rem = array.slice(-1);
|
||
var ret = array.pop.apply(array, args);
|
||
this._notifySplice(array, path, array.length, 0, rem);
|
||
return ret;
|
||
},
|
||
splice: function (path, start, deleteCount) {
|
||
var array = this.get(path);
|
||
var args = Array.prototype.slice.call(arguments, 1);
|
||
var rem = array.slice(start, start + deleteCount);
|
||
var ret = array.splice.apply(array, args);
|
||
this._notifySplice(array, path, start, args.length - 2, rem);
|
||
return ret;
|
||
},
|
||
shift: function (path) {
|
||
var array = this.get(path);
|
||
var args = Array.prototype.slice.call(arguments, 1);
|
||
var ret = array.shift.apply(array, args);
|
||
this._notifySplice(array, path, 0, 0, [ret]);
|
||
return ret;
|
||
},
|
||
unshift: function (path) {
|
||
var array = this.get(path);
|
||
var args = Array.prototype.slice.call(arguments, 1);
|
||
var ret = array.unshift.apply(array, args);
|
||
this._notifySplice(array, path, 0, args.length, []);
|
||
return ret;
|
||
}
|
||
});
|
||
}());
|
||
Polymer.Base._addFeature({
|
||
resolveUrl: function (url) {
|
||
var module = Polymer.DomModule.import(this.is);
|
||
var root = '';
|
||
if (module) {
|
||
var assetPath = module.getAttribute('assetpath') || '';
|
||
root = Polymer.ResolveUrl.resolveUrl(assetPath, module.ownerDocument.baseURI);
|
||
}
|
||
return Polymer.ResolveUrl.resolveUrl(url, root);
|
||
}
|
||
});
|
||
Polymer.CssParse = function () {
|
||
var api = {
|
||
parse: function (text) {
|
||
text = this._clean(text);
|
||
return this._parseCss(this._lex(text), text);
|
||
},
|
||
_clean: function (cssText) {
|
||
return cssText.replace(rx.comments, '').replace(rx.port, '');
|
||
},
|
||
_lex: function (text) {
|
||
var root = {
|
||
start: 0,
|
||
end: text.length
|
||
};
|
||
var n = root;
|
||
for (var i = 0, s = 0, l = text.length; i < l; i++) {
|
||
switch (text[i]) {
|
||
case this.OPEN_BRACE:
|
||
if (!n.rules) {
|
||
n.rules = [];
|
||
}
|
||
var p = n;
|
||
var previous = p.rules[p.rules.length - 1];
|
||
n = {
|
||
start: i + 1,
|
||
parent: p,
|
||
previous: previous
|
||
};
|
||
p.rules.push(n);
|
||
break;
|
||
case this.CLOSE_BRACE:
|
||
n.end = i + 1;
|
||
n = n.parent || root;
|
||
break;
|
||
}
|
||
}
|
||
return root;
|
||
},
|
||
_parseCss: function (node, text) {
|
||
var t = text.substring(node.start, node.end - 1);
|
||
node.parsedCssText = node.cssText = t.trim();
|
||
if (node.parent) {
|
||
var ss = node.previous ? node.previous.end : node.parent.start;
|
||
t = text.substring(ss, node.start - 1);
|
||
t = t.substring(t.lastIndexOf(';') + 1);
|
||
var s = node.parsedSelector = node.selector = t.trim();
|
||
node.atRule = s.indexOf(AT_START) === 0;
|
||
if (node.atRule) {
|
||
if (s.indexOf(MEDIA_START) === 0) {
|
||
node.type = this.types.MEDIA_RULE;
|
||
} else if (s.match(rx.keyframesRule)) {
|
||
node.type = this.types.KEYFRAMES_RULE;
|
||
}
|
||
} else {
|
||
if (s.indexOf(VAR_START) === 0) {
|
||
node.type = this.types.MIXIN_RULE;
|
||
} else {
|
||
node.type = this.types.STYLE_RULE;
|
||
}
|
||
}
|
||
}
|
||
var r$ = node.rules;
|
||
if (r$) {
|
||
for (var i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) {
|
||
this._parseCss(r, text);
|
||
}
|
||
}
|
||
return node;
|
||
},
|
||
stringify: function (node, preserveProperties, text) {
|
||
text = text || '';
|
||
var cssText = '';
|
||
if (node.cssText || node.rules) {
|
||
var r$ = node.rules;
|
||
if (r$ && (preserveProperties || !hasMixinRules(r$))) {
|
||
for (var i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) {
|
||
cssText = this.stringify(r, preserveProperties, cssText);
|
||
}
|
||
} else {
|
||
cssText = preserveProperties ? node.cssText : removeCustomProps(node.cssText);
|
||
cssText = cssText.trim();
|
||
if (cssText) {
|
||
cssText = ' ' + cssText + '\n';
|
||
}
|
||
}
|
||
}
|
||
if (cssText) {
|
||
if (node.selector) {
|
||
text += node.selector + ' ' + this.OPEN_BRACE + '\n';
|
||
}
|
||
text += cssText;
|
||
if (node.selector) {
|
||
text += this.CLOSE_BRACE + '\n\n';
|
||
}
|
||
}
|
||
return text;
|
||
},
|
||
types: {
|
||
STYLE_RULE: 1,
|
||
KEYFRAMES_RULE: 7,
|
||
MEDIA_RULE: 4,
|
||
MIXIN_RULE: 1000
|
||
},
|
||
OPEN_BRACE: '{',
|
||
CLOSE_BRACE: '}'
|
||
};
|
||
function hasMixinRules(rules) {
|
||
return rules[0].selector.indexOf(VAR_START) >= 0;
|
||
}
|
||
function removeCustomProps(cssText) {
|
||
return cssText.replace(rx.customProp, '').replace(rx.mixinProp, '').replace(rx.mixinApply, '').replace(rx.varApply, '');
|
||
}
|
||
var VAR_START = '--';
|
||
var MEDIA_START = '@media';
|
||
var AT_START = '@';
|
||
var rx = {
|
||
comments: /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim,
|
||
port: /@import[^;]*;/gim,
|
||
customProp: /(?:^|[\s;])--[^;{]*?:[^{};]*?;/gim,
|
||
mixinProp: /(?:^|[\s;])--[^;{]*?:[^{;]*?{[^}]*?};?/gim,
|
||
mixinApply: /@apply[\s]*\([^)]*?\)[\s]*;/gim,
|
||
varApply: /[^;:]*?:[^;]*var[^;]*;/gim,
|
||
keyframesRule: /^@[^\s]*keyframes/
|
||
};
|
||
return api;
|
||
}();
|
||
Polymer.StyleUtil = function () {
|
||
return {
|
||
MODULE_STYLES_SELECTOR: 'style, link[rel=import][type~=css]',
|
||
toCssText: function (rules, callback, preserveProperties) {
|
||
if (typeof rules === 'string') {
|
||
rules = this.parser.parse(rules);
|
||
}
|
||
if (callback) {
|
||
this.forEachStyleRule(rules, callback);
|
||
}
|
||
return this.parser.stringify(rules, preserveProperties);
|
||
},
|
||
forRulesInStyles: function (styles, callback) {
|
||
for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) {
|
||
this.forEachStyleRule(this.rulesForStyle(s), callback);
|
||
}
|
||
},
|
||
rulesForStyle: function (style) {
|
||
if (!style.__cssRules) {
|
||
style.__cssRules = this.parser.parse(style.textContent);
|
||
}
|
||
return style.__cssRules;
|
||
},
|
||
clearStyleRules: function (style) {
|
||
style.__cssRules = null;
|
||
},
|
||
forEachStyleRule: function (node, callback) {
|
||
var s = node.selector;
|
||
var skipRules = false;
|
||
if (node.type === this.ruleTypes.STYLE_RULE) {
|
||
callback(node);
|
||
} else if (node.type === this.ruleTypes.KEYFRAMES_RULE || node.type === this.ruleTypes.MIXIN_RULE) {
|
||
skipRules = true;
|
||
}
|
||
var r$ = node.rules;
|
||
if (r$ && !skipRules) {
|
||
for (var i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) {
|
||
this.forEachStyleRule(r, callback);
|
||
}
|
||
}
|
||
},
|
||
applyCss: function (cssText, moniker, target, afterNode) {
|
||
var style = document.createElement('style');
|
||
if (moniker) {
|
||
style.setAttribute('scope', moniker);
|
||
}
|
||
style.textContent = cssText;
|
||
target = target || document.head;
|
||
if (!afterNode) {
|
||
var n$ = target.querySelectorAll('style[scope]');
|
||
afterNode = n$[n$.length - 1];
|
||
}
|
||
target.insertBefore(style, afterNode && afterNode.nextSibling || target.firstChild);
|
||
return style;
|
||
},
|
||
cssFromModule: function (moduleId) {
|
||
var m = Polymer.DomModule.import(moduleId);
|
||
if (m && !m._cssText) {
|
||
var cssText = '';
|
||
var e$ = Array.prototype.slice.call(m.querySelectorAll(this.MODULE_STYLES_SELECTOR));
|
||
for (var i = 0, e; i < e$.length; i++) {
|
||
e = e$[i];
|
||
if (e.localName === 'style') {
|
||
e = e.__appliedElement || e;
|
||
e.parentNode.removeChild(e);
|
||
} else {
|
||
e = e.import && e.import.body;
|
||
}
|
||
if (e) {
|
||
cssText += Polymer.ResolveUrl.resolveCss(e.textContent, e.ownerDocument);
|
||
}
|
||
}
|
||
m._cssText = cssText;
|
||
}
|
||
return m && m._cssText || '';
|
||
},
|
||
parser: Polymer.CssParse,
|
||
ruleTypes: Polymer.CssParse.types
|
||
};
|
||
}();
|
||
Polymer.StyleTransformer = function () {
|
||
var nativeShadow = Polymer.Settings.useNativeShadow;
|
||
var styleUtil = Polymer.StyleUtil;
|
||
var api = {
|
||
dom: function (node, scope, useAttr, shouldRemoveScope) {
|
||
this._transformDom(node, scope || '', useAttr, shouldRemoveScope);
|
||
},
|
||
_transformDom: function (node, selector, useAttr, shouldRemoveScope) {
|
||
if (node.setAttribute) {
|
||
this.element(node, selector, useAttr, shouldRemoveScope);
|
||
}
|
||
var c$ = Polymer.dom(node).childNodes;
|
||
for (var i = 0; i < c$.length; i++) {
|
||
this._transformDom(c$[i], selector, useAttr, shouldRemoveScope);
|
||
}
|
||
},
|
||
element: function (element, scope, useAttr, shouldRemoveScope) {
|
||
if (useAttr) {
|
||
if (shouldRemoveScope) {
|
||
element.removeAttribute(SCOPE_NAME);
|
||
} else {
|
||
element.setAttribute(SCOPE_NAME, scope);
|
||
}
|
||
} else {
|
||
if (scope) {
|
||
if (element.classList) {
|
||
if (shouldRemoveScope) {
|
||
element.classList.remove(SCOPE_NAME);
|
||
element.classList.remove(scope);
|
||
} else {
|
||
element.classList.add(SCOPE_NAME);
|
||
element.classList.add(scope);
|
||
}
|
||
} else if (element.getAttribute) {
|
||
var c = element.getAttribute(CLASS);
|
||
if (shouldRemoveScope) {
|
||
if (c) {
|
||
element.setAttribute(CLASS, c.replace(SCOPE_NAME, '').replace(scope, ''));
|
||
}
|
||
} else {
|
||
element.setAttribute(CLASS, c + (c ? ' ' : '') + SCOPE_NAME + ' ' + scope);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
elementStyles: function (element, callback) {
|
||
var styles = element._styles;
|
||
var cssText = '';
|
||
for (var i = 0, l = styles.length, s, text; i < l && (s = styles[i]); i++) {
|
||
var rules = styleUtil.rulesForStyle(s);
|
||
cssText += nativeShadow ? styleUtil.toCssText(rules, callback) : this.css(rules, element.is, element.extends, callback, element._scopeCssViaAttr) + '\n\n';
|
||
}
|
||
return cssText.trim();
|
||
},
|
||
css: function (rules, scope, ext, callback, useAttr) {
|
||
var hostScope = this._calcHostScope(scope, ext);
|
||
scope = this._calcElementScope(scope, useAttr);
|
||
var self = this;
|
||
return styleUtil.toCssText(rules, function (rule) {
|
||
if (!rule.isScoped) {
|
||
self.rule(rule, scope, hostScope);
|
||
rule.isScoped = true;
|
||
}
|
||
if (callback) {
|
||
callback(rule, scope, hostScope);
|
||
}
|
||
});
|
||
},
|
||
_calcElementScope: function (scope, useAttr) {
|
||
if (scope) {
|
||
return useAttr ? CSS_ATTR_PREFIX + scope + CSS_ATTR_SUFFIX : CSS_CLASS_PREFIX + scope;
|
||
} else {
|
||
return '';
|
||
}
|
||
},
|
||
_calcHostScope: function (scope, ext) {
|
||
return ext ? '[is=' + scope + ']' : scope;
|
||
},
|
||
rule: function (rule, scope, hostScope) {
|
||
this._transformRule(rule, this._transformComplexSelector, scope, hostScope);
|
||
},
|
||
_transformRule: function (rule, transformer, scope, hostScope) {
|
||
var p$ = rule.selector.split(COMPLEX_SELECTOR_SEP);
|
||
for (var i = 0, l = p$.length, p; i < l && (p = p$[i]); i++) {
|
||
p$[i] = transformer.call(this, p, scope, hostScope);
|
||
}
|
||
rule.selector = p$.join(COMPLEX_SELECTOR_SEP);
|
||
},
|
||
_transformComplexSelector: function (selector, scope, hostScope) {
|
||
var stop = false;
|
||
var self = this;
|
||
selector = selector.replace(SIMPLE_SELECTOR_SEP, function (m, c, s) {
|
||
if (!stop) {
|
||
var o = self._transformCompoundSelector(s, c, scope, hostScope);
|
||
if (o.stop) {
|
||
stop = true;
|
||
}
|
||
c = o.combinator;
|
||
s = o.value;
|
||
}
|
||
return c + s;
|
||
});
|
||
return selector;
|
||
},
|
||
_transformCompoundSelector: function (selector, combinator, scope, hostScope) {
|
||
var jumpIndex = selector.search(SCOPE_JUMP);
|
||
if (selector.indexOf(HOST) >= 0) {
|
||
selector = selector.replace(HOST_PAREN, function (m, host, paren) {
|
||
return hostScope + paren;
|
||
});
|
||
selector = selector.replace(HOST, hostScope);
|
||
} else if (jumpIndex !== 0) {
|
||
selector = scope ? this._transformSimpleSelector(selector, scope) : selector;
|
||
}
|
||
if (selector.indexOf(CONTENT) >= 0) {
|
||
combinator = '';
|
||
}
|
||
var stop;
|
||
if (jumpIndex >= 0) {
|
||
selector = selector.replace(SCOPE_JUMP, ' ');
|
||
stop = true;
|
||
}
|
||
return {
|
||
value: selector,
|
||
combinator: combinator,
|
||
stop: stop
|
||
};
|
||
},
|
||
_transformSimpleSelector: function (selector, scope) {
|
||
var p$ = selector.split(PSEUDO_PREFIX);
|
||
p$[0] += scope;
|
||
return p$.join(PSEUDO_PREFIX);
|
||
},
|
||
rootRule: function (rule) {
|
||
this._transformRule(rule, this._transformRootSelector);
|
||
},
|
||
_transformRootSelector: function (selector) {
|
||
return selector.match(SCOPE_JUMP) ? this._transformComplexSelector(selector) : selector.trim() + SCOPE_ROOT_SELECTOR;
|
||
},
|
||
SCOPE_NAME: 'style-scope'
|
||
};
|
||
var SCOPE_NAME = api.SCOPE_NAME;
|
||
var SCOPE_ROOT_SELECTOR = ':not([' + SCOPE_NAME + '])' + ':not(.' + SCOPE_NAME + ')';
|
||
var COMPLEX_SELECTOR_SEP = ',';
|
||
var SIMPLE_SELECTOR_SEP = /(^|[\s>+~]+)([^\s>+~]+)/g;
|
||
var HOST = ':host';
|
||
var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
|
||
var CONTENT = '::content';
|
||
var SCOPE_JUMP = /\:\:content|\:\:shadow|\/deep\//;
|
||
var CSS_CLASS_PREFIX = '.';
|
||
var CSS_ATTR_PREFIX = '[' + SCOPE_NAME + '~=';
|
||
var CSS_ATTR_SUFFIX = ']';
|
||
var PSEUDO_PREFIX = ':';
|
||
var CLASS = 'class';
|
||
return api;
|
||
}();
|
||
Polymer.StyleExtends = function () {
|
||
var styleUtil = Polymer.StyleUtil;
|
||
return {
|
||
hasExtends: function (cssText) {
|
||
return Boolean(cssText.match(this.rx.EXTEND));
|
||
},
|
||
transform: function (style) {
|
||
var rules = styleUtil.rulesForStyle(style);
|
||
var self = this;
|
||
styleUtil.forEachStyleRule(rules, function (rule) {
|
||
var map = self._mapRule(rule);
|
||
if (rule.parent) {
|
||
var m;
|
||
while (m = self.rx.EXTEND.exec(rule.cssText)) {
|
||
var extend = m[1];
|
||
var extendor = self._findExtendor(extend, rule);
|
||
if (extendor) {
|
||
self._extendRule(rule, extendor);
|
||
}
|
||
}
|
||
}
|
||
rule.cssText = rule.cssText.replace(self.rx.EXTEND, '');
|
||
});
|
||
return styleUtil.toCssText(rules, function (rule) {
|
||
if (rule.selector.match(self.rx.STRIP)) {
|
||
rule.cssText = '';
|
||
}
|
||
}, true);
|
||
},
|
||
_mapRule: function (rule) {
|
||
if (rule.parent) {
|
||
var map = rule.parent.map || (rule.parent.map = {});
|
||
var parts = rule.selector.split(',');
|
||
for (var i = 0, p; i < parts.length; i++) {
|
||
p = parts[i];
|
||
map[p.trim()] = rule;
|
||
}
|
||
return map;
|
||
}
|
||
},
|
||
_findExtendor: function (extend, rule) {
|
||
return rule.parent && rule.parent.map && rule.parent.map[extend] || this._findExtendor(extend, rule.parent);
|
||
},
|
||
_extendRule: function (target, source) {
|
||
if (target.parent !== source.parent) {
|
||
this._cloneAndAddRuleToParent(source, target.parent);
|
||
}
|
||
target.extends = target.extends || (target.extends = []);
|
||
target.extends.push(source);
|
||
source.selector = source.selector.replace(this.rx.STRIP, '');
|
||
source.selector = (source.selector && source.selector + ',\n') + target.selector;
|
||
if (source.extends) {
|
||
source.extends.forEach(function (e) {
|
||
this._extendRule(target, e);
|
||
}, this);
|
||
}
|
||
},
|
||
_cloneAndAddRuleToParent: function (rule, parent) {
|
||
rule = Object.create(rule);
|
||
rule.parent = parent;
|
||
if (rule.extends) {
|
||
rule.extends = rule.extends.slice();
|
||
}
|
||
parent.rules.push(rule);
|
||
},
|
||
rx: {
|
||
EXTEND: /@extends\(([^)]*)\)\s*?;/gim,
|
||
STRIP: /%[^,]*$/
|
||
}
|
||
};
|
||
}();
|
||
(function () {
|
||
var prepElement = Polymer.Base._prepElement;
|
||
var nativeShadow = Polymer.Settings.useNativeShadow;
|
||
var styleUtil = Polymer.StyleUtil;
|
||
var styleTransformer = Polymer.StyleTransformer;
|
||
var styleExtends = Polymer.StyleExtends;
|
||
Polymer.Base._addFeature({
|
||
_prepElement: function (element) {
|
||
if (this._encapsulateStyle) {
|
||
styleTransformer.element(element, this.is, this._scopeCssViaAttr);
|
||
}
|
||
prepElement.call(this, element);
|
||
},
|
||
_prepStyles: function () {
|
||
if (this._encapsulateStyle === undefined) {
|
||
this._encapsulateStyle = !nativeShadow && Boolean(this._template);
|
||
}
|
||
this._styles = this._collectStyles();
|
||
var cssText = styleTransformer.elementStyles(this);
|
||
if (cssText && this._template) {
|
||
var style = styleUtil.applyCss(cssText, this.is, nativeShadow ? this._template.content : null);
|
||
if (!nativeShadow) {
|
||
this._scopeStyle = style;
|
||
}
|
||
}
|
||
},
|
||
_collectStyles: function () {
|
||
var styles = [];
|
||
var cssText = '', m$ = this.styleModules;
|
||
if (m$) {
|
||
for (var i = 0, l = m$.length, m; i < l && (m = m$[i]); i++) {
|
||
cssText += styleUtil.cssFromModule(m);
|
||
}
|
||
}
|
||
cssText += styleUtil.cssFromModule(this.is);
|
||
if (cssText) {
|
||
var style = document.createElement('style');
|
||
style.textContent = cssText;
|
||
if (styleExtends.hasExtends(style.textContent)) {
|
||
cssText = styleExtends.transform(style);
|
||
}
|
||
styles.push(style);
|
||
}
|
||
return styles;
|
||
},
|
||
_elementAdd: function (node) {
|
||
if (this._encapsulateStyle) {
|
||
if (node.__styleScoped) {
|
||
node.__styleScoped = false;
|
||
} else {
|
||
styleTransformer.dom(node, this.is, this._scopeCssViaAttr);
|
||
}
|
||
}
|
||
},
|
||
_elementRemove: function (node) {
|
||
if (this._encapsulateStyle) {
|
||
styleTransformer.dom(node, this.is, this._scopeCssViaAttr, true);
|
||
}
|
||
},
|
||
scopeSubtree: function (container, shouldObserve) {
|
||
if (nativeShadow) {
|
||
return;
|
||
}
|
||
var self = this;
|
||
var scopify = function (node) {
|
||
if (node.nodeType === Node.ELEMENT_NODE) {
|
||
node.className = self._scopeElementClass(node, node.className);
|
||
var n$ = node.querySelectorAll('*');
|
||
Array.prototype.forEach.call(n$, function (n) {
|
||
n.className = self._scopeElementClass(n, n.className);
|
||
});
|
||
}
|
||
};
|
||
scopify(container);
|
||
if (shouldObserve) {
|
||
var mo = new MutationObserver(function (mxns) {
|
||
mxns.forEach(function (m) {
|
||
if (m.addedNodes) {
|
||
for (var i = 0; i < m.addedNodes.length; i++) {
|
||
scopify(m.addedNodes[i]);
|
||
}
|
||
}
|
||
});
|
||
});
|
||
mo.observe(container, {
|
||
childList: true,
|
||
subtree: true
|
||
});
|
||
return mo;
|
||
}
|
||
}
|
||
});
|
||
}());
|
||
Polymer.StyleProperties = function () {
|
||
var nativeShadow = Polymer.Settings.useNativeShadow;
|
||
var matchesSelector = Polymer.DomApi.matchesSelector;
|
||
var styleUtil = Polymer.StyleUtil;
|
||
var styleTransformer = Polymer.StyleTransformer;
|
||
return {
|
||
decorateStyles: function (styles) {
|
||
var self = this, props = {};
|
||
styleUtil.forRulesInStyles(styles, function (rule) {
|
||
self.decorateRule(rule);
|
||
self.collectPropertiesInCssText(rule.propertyInfo.cssText, props);
|
||
});
|
||
var names = [];
|
||
for (var i in props) {
|
||
names.push(i);
|
||
}
|
||
return names;
|
||
},
|
||
decorateRule: function (rule) {
|
||
if (rule.propertyInfo) {
|
||
return rule.propertyInfo;
|
||
}
|
||
var info = {}, properties = {};
|
||
var hasProperties = this.collectProperties(rule, properties);
|
||
if (hasProperties) {
|
||
info.properties = properties;
|
||
rule.rules = null;
|
||
}
|
||
info.cssText = this.collectCssText(rule);
|
||
rule.propertyInfo = info;
|
||
return info;
|
||
},
|
||
collectProperties: function (rule, properties) {
|
||
var info = rule.propertyInfo;
|
||
if (info) {
|
||
if (info.properties) {
|
||
Polymer.Base.mixin(properties, info.properties);
|
||
return true;
|
||
}
|
||
} else {
|
||
var m, rx = this.rx.VAR_ASSIGN;
|
||
var cssText = rule.parsedCssText;
|
||
var any;
|
||
while (m = rx.exec(cssText)) {
|
||
properties[m[1]] = (m[2] || m[3]).trim();
|
||
any = true;
|
||
}
|
||
return any;
|
||
}
|
||
},
|
||
collectCssText: function (rule) {
|
||
var customCssText = '';
|
||
var cssText = rule.parsedCssText;
|
||
cssText = cssText.replace(this.rx.BRACKETED, '').replace(this.rx.VAR_ASSIGN, '');
|
||
var parts = cssText.split(';');
|
||
for (var i = 0, p; i < parts.length; i++) {
|
||
p = parts[i];
|
||
if (p.match(this.rx.MIXIN_MATCH) || p.match(this.rx.VAR_MATCH)) {
|
||
customCssText += p + ';\n';
|
||
}
|
||
}
|
||
return customCssText;
|
||
},
|
||
collectPropertiesInCssText: function (cssText, props) {
|
||
var m;
|
||
while (m = this.rx.VAR_CAPTURE.exec(cssText)) {
|
||
props[m[1]] = true;
|
||
}
|
||
},
|
||
reify: function (props) {
|
||
var names = Object.getOwnPropertyNames(props);
|
||
for (var i = 0, n; i < names.length; i++) {
|
||
n = names[i];
|
||
props[n] = this.valueForProperty(props[n], props);
|
||
}
|
||
},
|
||
valueForProperty: function (property, props) {
|
||
if (property) {
|
||
if (property.indexOf(';') >= 0) {
|
||
property = this.valueForProperties(property, props);
|
||
} else {
|
||
var self = this;
|
||
var fn = function (all, prefix, value, fallback) {
|
||
var propertyValue = self.valueForProperty(props[value], props) || (props[fallback] ? self.valueForProperty(props[fallback], props) : fallback);
|
||
return prefix + (propertyValue || '');
|
||
};
|
||
property = property.replace(this.rx.VAR_MATCH, fn);
|
||
}
|
||
}
|
||
return property && property.trim() || '';
|
||
},
|
||
valueForProperties: function (property, props) {
|
||
var parts = property.split(';');
|
||
for (var i = 0, p, m; i < parts.length && (p = parts[i]); i++) {
|
||
m = p.match(this.rx.MIXIN_MATCH);
|
||
if (m) {
|
||
p = this.valueForProperty(props[m[1]], props);
|
||
} else {
|
||
var pp = p.split(':');
|
||
if (pp[1]) {
|
||
pp[1] = pp[1].trim();
|
||
pp[1] = this.valueForProperty(pp[1], props) || pp[1];
|
||
}
|
||
p = pp.join(':');
|
||
}
|
||
parts[i] = p && p.lastIndexOf(';') === p.length - 1 ? p.slice(0, -1) : p || '';
|
||
}
|
||
return parts.join(';');
|
||
},
|
||
applyProperties: function (rule, props) {
|
||
var output = '';
|
||
if (!rule.propertyInfo) {
|
||
this.decorateRule(rule);
|
||
}
|
||
if (rule.propertyInfo.cssText) {
|
||
output = this.valueForProperties(rule.propertyInfo.cssText, props);
|
||
}
|
||
rule.cssText = output;
|
||
},
|
||
propertyDataFromStyles: function (styles, element) {
|
||
var props = {}, self = this;
|
||
var o = [], i = 0;
|
||
styleUtil.forRulesInStyles(styles, function (rule) {
|
||
if (!rule.propertyInfo) {
|
||
self.decorateRule(rule);
|
||
}
|
||
if (element && rule.propertyInfo.properties && matchesSelector.call(element, rule.selector)) {
|
||
self.collectProperties(rule, props);
|
||
addToBitMask(i, o);
|
||
}
|
||
i++;
|
||
});
|
||
return {
|
||
properties: props,
|
||
key: o
|
||
};
|
||
},
|
||
scopePropertiesFromStyles: function (styles) {
|
||
if (!styles._scopeStyleProperties) {
|
||
styles._scopeStyleProperties = this.selectedPropertiesFromStyles(styles, this.SCOPE_SELECTORS);
|
||
}
|
||
return styles._scopeStyleProperties;
|
||
},
|
||
hostPropertiesFromStyles: function (styles) {
|
||
if (!styles._hostStyleProperties) {
|
||
styles._hostStyleProperties = this.selectedPropertiesFromStyles(styles, this.HOST_SELECTORS);
|
||
}
|
||
return styles._hostStyleProperties;
|
||
},
|
||
selectedPropertiesFromStyles: function (styles, selectors) {
|
||
var props = {}, self = this;
|
||
styleUtil.forRulesInStyles(styles, function (rule) {
|
||
if (!rule.propertyInfo) {
|
||
self.decorateRule(rule);
|
||
}
|
||
for (var i = 0; i < selectors.length; i++) {
|
||
if (rule.parsedSelector === selectors[i]) {
|
||
self.collectProperties(rule, props);
|
||
return;
|
||
}
|
||
}
|
||
});
|
||
return props;
|
||
},
|
||
transformStyles: function (element, properties, scopeSelector) {
|
||
var self = this;
|
||
var hostRx = new RegExp(this.rx.HOST_PREFIX + element.is + this.rx.HOST_SUFFIX);
|
||
return styleTransformer.elementStyles(element, function (rule) {
|
||
self.applyProperties(rule, properties);
|
||
if (rule.cssText && !nativeShadow) {
|
||
self._scopeSelector(rule, hostRx, element.is, element._scopeCssViaAttr, scopeSelector);
|
||
}
|
||
});
|
||
},
|
||
_scopeSelector: function (rule, hostRx, is, viaAttr, scopeId) {
|
||
rule.transformedSelector = rule.transformedSelector || rule.selector;
|
||
var selector = rule.transformedSelector;
|
||
var scope = viaAttr ? '[' + styleTransformer.SCOPE_NAME + '~=' + scopeId + ']' : '.' + scopeId;
|
||
var parts = selector.split(',');
|
||
for (var i = 0, l = parts.length, p; i < l && (p = parts[i]); i++) {
|
||
parts[i] = p.match(hostRx) ? p.replace(is, is + scope) : scope + ' ' + p;
|
||
}
|
||
rule.selector = parts.join(',');
|
||
},
|
||
applyElementScopeSelector: function (element, selector, old, viaAttr) {
|
||
var c = viaAttr ? element.getAttribute(styleTransformer.SCOPE_NAME) : element.className;
|
||
v = old ? c.replace(old, selector) : (c ? c + ' ' : '') + this.XSCOPE_NAME + ' ' + selector;
|
||
if (c !== v) {
|
||
if (viaAttr) {
|
||
element.setAttribute(styleTransformer.SCOPE_NAME, v);
|
||
} else {
|
||
element.className = v;
|
||
}
|
||
}
|
||
},
|
||
applyElementStyle: function (element, properties, selector, style) {
|
||
var cssText = style ? style.textContent || '' : this.transformStyles(element, properties, selector);
|
||
var s = element._customStyle;
|
||
if (s && !nativeShadow && s !== style) {
|
||
s._useCount--;
|
||
if (s._useCount <= 0) {
|
||
s.parentNode.removeChild(s);
|
||
}
|
||
}
|
||
if (nativeShadow || (!style || !style.parentNode)) {
|
||
if (nativeShadow && element._customStyle) {
|
||
element._customStyle.textContent = cssText;
|
||
style = element._customStyle;
|
||
} else if (cssText) {
|
||
style = styleUtil.applyCss(cssText, selector, nativeShadow ? element.root : null, element._scopeStyle);
|
||
}
|
||
}
|
||
if (style) {
|
||
style._useCount = style._useCount || 0;
|
||
if (element._customStyle != style) {
|
||
style._useCount++;
|
||
}
|
||
element._customStyle = style;
|
||
}
|
||
return style;
|
||
},
|
||
rx: {
|
||
VAR_ASSIGN: /(?:^|;\s*)(--[^\:;]*?):\s*?(?:([^;{]*?)|{([^}]*)})(?=;)/gim,
|
||
MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\);?/im,
|
||
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gim,
|
||
VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gim,
|
||
BRACKETED: /\{[^}]*\}/g,
|
||
HOST_PREFIX: '(?:^|[^.])',
|
||
HOST_SUFFIX: '($|[.:[\\s>+~])'
|
||
},
|
||
HOST_SELECTORS: [':host'],
|
||
SCOPE_SELECTORS: [':root'],
|
||
XSCOPE_NAME: 'x-scope'
|
||
};
|
||
function addToBitMask(n, bits) {
|
||
var o = parseInt(n / 32);
|
||
var v = 1 << n % 32;
|
||
bits[o] = (bits[o] || 0) | v;
|
||
}
|
||
}();
|
||
Polymer.StyleDefaults = function () {
|
||
var styleProperties = Polymer.StyleProperties;
|
||
var styleUtil = Polymer.StyleUtil;
|
||
var style = document.createElement('style');
|
||
var api = {
|
||
style: style,
|
||
_styles: [style],
|
||
_properties: null,
|
||
applyCss: function (cssText) {
|
||
this.style.textContent += cssText;
|
||
styleUtil.clearStyleRules(this.style);
|
||
this._properties = null;
|
||
},
|
||
get _styleProperties() {
|
||
if (!this._properties) {
|
||
styleProperties.decorateStyles(this._styles);
|
||
this._styles._scopeStyleProperties = null;
|
||
this._properties = styleProperties.scopePropertiesFromStyles(this._styles);
|
||
}
|
||
return this._properties;
|
||
},
|
||
_needsStyleProperties: function () {
|
||
},
|
||
_computeStyleProperties: function () {
|
||
return this._styleProperties;
|
||
}
|
||
};
|
||
return api;
|
||
}();
|
||
(function () {
|
||
Polymer.StyleCache = function () {
|
||
this.cache = {};
|
||
};
|
||
Polymer.StyleCache.prototype = {
|
||
MAX: 100,
|
||
store: function (is, data, keyValues, keyStyles) {
|
||
data.keyValues = keyValues;
|
||
data.styles = keyStyles;
|
||
var s$ = this.cache[is] = this.cache[is] || [];
|
||
s$.push(data);
|
||
if (s$.length > this.MAX) {
|
||
s$.shift();
|
||
}
|
||
},
|
||
retrieve: function (is, keyValues, keyStyles) {
|
||
var cache = this.cache[is];
|
||
if (cache) {
|
||
for (var i = cache.length - 1, data; i >= 0; i--) {
|
||
data = cache[i];
|
||
if (keyStyles === data.styles && this._objectsEqual(keyValues, data.keyValues)) {
|
||
return data;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
clear: function () {
|
||
this.cache = {};
|
||
},
|
||
_objectsEqual: function (target, source) {
|
||
for (var i in target) {
|
||
if (target[i] !== source[i]) {
|
||
return false;
|
||
}
|
||
}
|
||
if (Array.isArray(target)) {
|
||
return target.length === source.length;
|
||
}
|
||
return true;
|
||
}
|
||
};
|
||
}());
|
||
(function () {
|
||
var serializeValueToAttribute = Polymer.Base.serializeValueToAttribute;
|
||
var propertyUtils = Polymer.StyleProperties;
|
||
var styleTransformer = Polymer.StyleTransformer;
|
||
var styleUtil = Polymer.StyleUtil;
|
||
var styleDefaults = Polymer.StyleDefaults;
|
||
var nativeShadow = Polymer.Settings.useNativeShadow;
|
||
Polymer.Base._addFeature({
|
||
_prepStyleProperties: function () {
|
||
this._ownStylePropertyNames = this._styles ? propertyUtils.decorateStyles(this._styles) : [];
|
||
},
|
||
_setupStyleProperties: function () {
|
||
this.customStyle = {};
|
||
},
|
||
_needsStyleProperties: function () {
|
||
return Boolean(this._ownStylePropertyNames && this._ownStylePropertyNames.length);
|
||
},
|
||
_beforeAttached: function () {
|
||
if (!this._scopeSelector && this._needsStyleProperties()) {
|
||
this._updateStyleProperties();
|
||
}
|
||
},
|
||
_updateStyleProperties: function () {
|
||
var info, scope = this.domHost || styleDefaults;
|
||
if (!scope._styleCache) {
|
||
scope._styleCache = new Polymer.StyleCache();
|
||
}
|
||
var scopeData = propertyUtils.propertyDataFromStyles(scope._styles, this);
|
||
info = scope._styleCache.retrieve(this.is, scopeData.key, this._styles);
|
||
var scopeCached = Boolean(info);
|
||
if (scopeCached) {
|
||
this._styleProperties = info._styleProperties;
|
||
} else {
|
||
this._computeStyleProperties(scopeData.properties);
|
||
}
|
||
this._computeOwnStyleProperties();
|
||
if (!scopeCached) {
|
||
info = styleCache.retrieve(this.is, this._ownStyleProperties, this._styles);
|
||
}
|
||
var globalCached = Boolean(info) && !scopeCached;
|
||
style = this._applyStyleProperties(info);
|
||
if (!scopeCached) {
|
||
var cacheableStyle = style;
|
||
if (nativeShadow) {
|
||
cacheableStyle = style.cloneNode ? style.cloneNode(true) : Object.create(style || null);
|
||
}
|
||
info = {
|
||
style: cacheableStyle,
|
||
_scopeSelector: this._scopeSelector,
|
||
_styleProperties: this._styleProperties
|
||
};
|
||
scope._styleCache.store(this.is, info, scopeData.key, this._styles);
|
||
if (!globalCached) {
|
||
styleCache.store(this.is, Object.create(info), this._ownStyleProperties, this._styles);
|
||
}
|
||
}
|
||
},
|
||
_computeStyleProperties: function (scopeProps) {
|
||
var scope = this.domHost || styleDefaults;
|
||
if (!scope._styleProperties) {
|
||
scope._computeStyleProperties();
|
||
}
|
||
var props = Object.create(scope._styleProperties);
|
||
this.mixin(props, propertyUtils.hostPropertiesFromStyles(this._styles));
|
||
scopeProps = scopeProps || propertyUtils.propertyDataFromStyles(scope._styles, this).properties;
|
||
this.mixin(props, scopeProps);
|
||
this.mixin(props, propertyUtils.scopePropertiesFromStyles(this._styles));
|
||
this.mixin(props, this.customStyle);
|
||
propertyUtils.reify(props);
|
||
this._styleProperties = props;
|
||
},
|
||
_computeOwnStyleProperties: function () {
|
||
var props = {};
|
||
for (var i = 0, n; i < this._ownStylePropertyNames.length; i++) {
|
||
n = this._ownStylePropertyNames[i];
|
||
props[n] = this._styleProperties[n];
|
||
}
|
||
this._ownStyleProperties = props;
|
||
},
|
||
_scopeCount: 0,
|
||
_applyStyleProperties: function (info) {
|
||
var oldScopeSelector = this._scopeSelector;
|
||
this._scopeSelector = info ? info._scopeSelector : this.is + '-' + this.__proto__._scopeCount++;
|
||
style = propertyUtils.applyElementStyle(this, this._styleProperties, this._scopeSelector, info && info.style);
|
||
if ((style || oldScopeSelector) && !nativeShadow) {
|
||
propertyUtils.applyElementScopeSelector(this, this._scopeSelector, oldScopeSelector, this._scopeCssViaAttr);
|
||
}
|
||
return style || {};
|
||
},
|
||
serializeValueToAttribute: function (value, attribute, node) {
|
||
node = node || this;
|
||
if (attribute === 'class') {
|
||
var host = node === this ? this.domHost || this.dataHost : this;
|
||
if (host) {
|
||
value = host._scopeElementClass(node, value);
|
||
}
|
||
}
|
||
node = Polymer.dom(node);
|
||
serializeValueToAttribute.call(this, value, attribute, node);
|
||
},
|
||
_scopeElementClass: function (element, selector) {
|
||
if (!nativeShadow && !this._scopeCssViaAttr) {
|
||
selector += (selector ? ' ' : '') + SCOPE_NAME + ' ' + this.is + (element._scopeSelector ? ' ' + XSCOPE_NAME + ' ' + element._scopeSelector : '');
|
||
}
|
||
return selector;
|
||
},
|
||
updateStyles: function () {
|
||
if (this.isAttached) {
|
||
if (this._needsStyleProperties()) {
|
||
this._updateStyleProperties();
|
||
} else {
|
||
this._styleProperties = null;
|
||
}
|
||
if (this._styleCache) {
|
||
this._styleCache.clear();
|
||
}
|
||
this._updateRootStyles();
|
||
}
|
||
},
|
||
_updateRootStyles: function (root) {
|
||
root = root || this.root;
|
||
var c$ = Polymer.dom(root)._query(function (e) {
|
||
return e.shadyRoot || e.shadowRoot;
|
||
});
|
||
for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
|
||
if (c.updateStyles) {
|
||
c.updateStyles();
|
||
}
|
||
}
|
||
}
|
||
});
|
||
Polymer.updateStyles = function () {
|
||
styleDefaults._styleCache.clear();
|
||
Polymer.Base._updateRootStyles(document);
|
||
};
|
||
var styleCache = new Polymer.StyleCache();
|
||
Polymer.customStyleCache = styleCache;
|
||
var SCOPE_NAME = styleTransformer.SCOPE_NAME;
|
||
var XSCOPE_NAME = propertyUtils.XSCOPE_NAME;
|
||
}());
|
||
Polymer.Base._addFeature({
|
||
_registerFeatures: function () {
|
||
this._prepIs();
|
||
this._prepAttributes();
|
||
this._prepExtends();
|
||
this._prepConstructor();
|
||
this._prepTemplate();
|
||
this._prepStyles();
|
||
this._prepStyleProperties();
|
||
this._prepAnnotations();
|
||
this._prepEffects();
|
||
this._prepBehaviors();
|
||
this._prepBindings();
|
||
this._prepShady();
|
||
},
|
||
_prepBehavior: function (b) {
|
||
this._addPropertyEffects(b.properties);
|
||
this._addComplexObserverEffects(b.observers);
|
||
this._addHostAttributes(b.hostAttributes);
|
||
},
|
||
_initFeatures: function () {
|
||
this._poolContent();
|
||
this._setupConfigure();
|
||
this._setupStyleProperties();
|
||
this._pushHost();
|
||
this._stampTemplate();
|
||
this._popHost();
|
||
this._marshalAnnotationReferences();
|
||
this._marshalHostAttributes();
|
||
this._setupDebouncers();
|
||
this._marshalInstanceEffects();
|
||
this._marshalBehaviors();
|
||
this._marshalAttributes();
|
||
this._tryReady();
|
||
},
|
||
_marshalBehavior: function (b) {
|
||
this._listenListeners(b.listeners);
|
||
}
|
||
});
|
||
(function () {
|
||
var nativeShadow = Polymer.Settings.useNativeShadow;
|
||
var propertyUtils = Polymer.StyleProperties;
|
||
var styleUtil = Polymer.StyleUtil;
|
||
var styleDefaults = Polymer.StyleDefaults;
|
||
Polymer({
|
||
is: 'custom-style',
|
||
extends: 'style',
|
||
created: function () {
|
||
this._appliesToDocument = this.parentNode.localName !== 'dom-module';
|
||
if (this._appliesToDocument) {
|
||
var e = this.__appliedElement || this;
|
||
var rules = styleUtil.rulesForStyle(e);
|
||
propertyUtils.decorateStyles([e]);
|
||
this._rulesToDefaultProperties(rules);
|
||
this.async(this._applyStyle);
|
||
}
|
||
},
|
||
_applyStyle: function () {
|
||
var e = this.__appliedElement || this;
|
||
this._computeStyleProperties();
|
||
var props = this._styleProperties;
|
||
var self = this;
|
||
e.textContent = styleUtil.toCssText(styleUtil.rulesForStyle(e), function (rule) {
|
||
if (rule.selector === ':root') {
|
||
rule.selector = 'body';
|
||
}
|
||
var css = rule.cssText = rule.parsedCssText;
|
||
if (rule.propertyInfo && rule.propertyInfo.cssText) {
|
||
css = css.replace(propertyUtils.rx.VAR_ASSIGN, '');
|
||
rule.cssText = propertyUtils.valueForProperties(css, props);
|
||
}
|
||
if (!nativeShadow) {
|
||
Polymer.StyleTransformer.rootRule(rule);
|
||
}
|
||
});
|
||
},
|
||
_rulesToDefaultProperties: function (rules) {
|
||
styleUtil.forEachStyleRule(rules, function (rule) {
|
||
if (!rule.propertyInfo.properties) {
|
||
rule.cssText = '';
|
||
}
|
||
});
|
||
var cssText = styleUtil.parser.stringify(rules, true);
|
||
if (cssText) {
|
||
styleDefaults.applyCss(cssText);
|
||
}
|
||
}
|
||
});
|
||
}());
|
||
Polymer.Templatizer = {
|
||
properties: { _hideTemplateChildren: { observer: '_showHideChildren' } },
|
||
_templatizerStatic: {
|
||
count: 0,
|
||
callbacks: {},
|
||
debouncer: null
|
||
},
|
||
_instanceProps: Polymer.nob,
|
||
created: function () {
|
||
this._templatizerId = this._templatizerStatic.count++;
|
||
},
|
||
templatize: function (template) {
|
||
if (!template._content) {
|
||
template._content = template.content;
|
||
}
|
||
if (template._content._ctor) {
|
||
this.ctor = template._content._ctor;
|
||
this._prepParentProperties(this.ctor.prototype, template);
|
||
return;
|
||
}
|
||
var archetype = Object.create(Polymer.Base);
|
||
this._customPrepAnnotations(archetype, template);
|
||
archetype._prepEffects();
|
||
this._customPrepEffects(archetype);
|
||
archetype._prepBehaviors();
|
||
archetype._prepBindings();
|
||
this._prepParentProperties(archetype, template);
|
||
archetype._notifyPath = this._notifyPathImpl;
|
||
archetype._scopeElementClass = this._scopeElementClassImpl;
|
||
archetype.listen = this._listenImpl;
|
||
var _constructor = this._constructorImpl;
|
||
var ctor = function TemplateInstance(model, host) {
|
||
_constructor.call(this, model, host);
|
||
};
|
||
ctor.prototype = archetype;
|
||
archetype.constructor = ctor;
|
||
template._content._ctor = ctor;
|
||
this.ctor = ctor;
|
||
},
|
||
_getRootDataHost: function () {
|
||
return this.dataHost && this.dataHost._rootDataHost || this.dataHost;
|
||
},
|
||
_showHideChildren: function (hidden) {
|
||
},
|
||
_debounceTemplate: function (fn) {
|
||
this._templatizerStatic.callbacks[this._templatizerId] = fn.bind(this);
|
||
this._templatizerStatic.debouncer = Polymer.Debounce(this._templatizerStatic.debouncer, this._flushTemplates.bind(this, true));
|
||
},
|
||
_flushTemplates: function (debouncerExpired) {
|
||
var db = this._templatizerStatic.debouncer;
|
||
while (debouncerExpired || db && db.finish) {
|
||
db.stop();
|
||
var cbs = this._templatizerStatic.callbacks;
|
||
this._templatizerStatic.callbacks = {};
|
||
for (var id in cbs) {
|
||
cbs[id]();
|
||
}
|
||
debouncerExpired = false;
|
||
}
|
||
},
|
||
_customPrepEffects: function (archetype) {
|
||
var parentProps = archetype._parentProps;
|
||
for (var prop in parentProps) {
|
||
archetype._addPropertyEffect(prop, 'function', this._createHostPropEffector(prop));
|
||
}
|
||
},
|
||
_customPrepAnnotations: function (archetype, template) {
|
||
archetype._template = template;
|
||
var c = template._content;
|
||
if (!c._notes) {
|
||
var rootDataHost = archetype._rootDataHost;
|
||
if (rootDataHost) {
|
||
Polymer.Annotations.prepElement = rootDataHost._prepElement.bind(rootDataHost);
|
||
}
|
||
c._notes = Polymer.Annotations.parseAnnotations(template);
|
||
Polymer.Annotations.prepElement = null;
|
||
this._processAnnotations(c._notes);
|
||
}
|
||
archetype._notes = c._notes;
|
||
archetype._parentProps = c._parentProps;
|
||
},
|
||
_prepParentProperties: function (archetype, template) {
|
||
var parentProps = this._parentProps = archetype._parentProps;
|
||
if (this._forwardParentProp && parentProps) {
|
||
var proto = archetype._parentPropProto;
|
||
var prop;
|
||
if (!proto) {
|
||
for (prop in this._instanceProps) {
|
||
delete parentProps[prop];
|
||
}
|
||
proto = archetype._parentPropProto = Object.create(null);
|
||
if (template != this) {
|
||
Polymer.Bind.prepareModel(proto);
|
||
}
|
||
for (prop in parentProps) {
|
||
var parentProp = '_parent_' + prop;
|
||
var effects = [
|
||
{
|
||
kind: 'function',
|
||
effect: this._createForwardPropEffector(prop)
|
||
},
|
||
{ kind: 'notify' }
|
||
];
|
||
Polymer.Bind._createAccessors(proto, parentProp, effects);
|
||
}
|
||
}
|
||
if (template != this) {
|
||
Polymer.Bind.prepareInstance(template);
|
||
template._forwardParentProp = this._forwardParentProp.bind(this);
|
||
}
|
||
this._extendTemplate(template, proto);
|
||
}
|
||
},
|
||
_createForwardPropEffector: function (prop) {
|
||
return function (source, value) {
|
||
this._forwardParentProp(prop, value);
|
||
};
|
||
},
|
||
_createHostPropEffector: function (prop) {
|
||
return function (source, value) {
|
||
this.dataHost['_parent_' + prop] = value;
|
||
};
|
||
},
|
||
_extendTemplate: function (template, proto) {
|
||
Object.getOwnPropertyNames(proto).forEach(function (n) {
|
||
var val = template[n];
|
||
var pd = Object.getOwnPropertyDescriptor(proto, n);
|
||
Object.defineProperty(template, n, pd);
|
||
if (val !== undefined) {
|
||
template._propertySet(n, val);
|
||
}
|
||
});
|
||
},
|
||
_forwardInstancePath: function (inst, path, value) {
|
||
},
|
||
_notifyPathImpl: function (path, value) {
|
||
var dataHost = this.dataHost;
|
||
var dot = path.indexOf('.');
|
||
var root = dot < 0 ? path : path.slice(0, dot);
|
||
dataHost._forwardInstancePath.call(dataHost, this, path, value);
|
||
if (root in dataHost._parentProps) {
|
||
dataHost.notifyPath('_parent_' + path, value);
|
||
}
|
||
},
|
||
_pathEffector: function (path, value, fromAbove) {
|
||
if (this._forwardParentPath) {
|
||
if (path.indexOf('_parent_') === 0) {
|
||
this._forwardParentPath(path.substring(8), value);
|
||
}
|
||
}
|
||
Polymer.Base._pathEffector.apply(this, arguments);
|
||
},
|
||
_constructorImpl: function (model, host) {
|
||
this._rootDataHost = host._getRootDataHost();
|
||
this._setupConfigure(model);
|
||
this._pushHost(host);
|
||
this.root = this.instanceTemplate(this._template);
|
||
this.root.__styleScoped = true;
|
||
this._popHost();
|
||
this._marshalAnnotatedNodes();
|
||
this._marshalInstanceEffects();
|
||
this._marshalAnnotatedListeners();
|
||
var children = [];
|
||
for (var n = this.root.firstChild; n; n = n.nextSibling) {
|
||
children.push(n);
|
||
n._templateInstance = this;
|
||
}
|
||
this._children = children;
|
||
this._tryReady();
|
||
},
|
||
_listenImpl: function (node, eventName, methodName) {
|
||
var model = this;
|
||
var host = this._rootDataHost;
|
||
var handler = host._createEventHandler(node, eventName, methodName);
|
||
var decorated = function (e) {
|
||
e.model = model;
|
||
handler(e);
|
||
};
|
||
host._listen(node, eventName, decorated);
|
||
},
|
||
_scopeElementClassImpl: function (node, value) {
|
||
var host = this._rootDataHost;
|
||
if (host) {
|
||
return host._scopeElementClass(node, value);
|
||
}
|
||
},
|
||
stamp: function (model) {
|
||
model = model || {};
|
||
if (this._parentProps) {
|
||
for (var prop in this._parentProps) {
|
||
model[prop] = this['_parent_' + prop];
|
||
}
|
||
}
|
||
return new this.ctor(model, this);
|
||
}
|
||
};
|
||
Polymer({
|
||
is: 'dom-template',
|
||
extends: 'template',
|
||
behaviors: [Polymer.Templatizer],
|
||
ready: function () {
|
||
this.templatize(this);
|
||
}
|
||
});
|
||
Polymer._collections = new WeakMap();
|
||
Polymer.Collection = function (userArray) {
|
||
Polymer._collections.set(userArray, this);
|
||
this.userArray = userArray;
|
||
this.store = userArray.slice();
|
||
this.initMap();
|
||
};
|
||
Polymer.Collection.prototype = {
|
||
constructor: Polymer.Collection,
|
||
initMap: function () {
|
||
var omap = this.omap = new WeakMap();
|
||
var pmap = this.pmap = {};
|
||
var s = this.store;
|
||
for (var i = 0; i < s.length; i++) {
|
||
var item = s[i];
|
||
if (item && typeof item == 'object') {
|
||
omap.set(item, i);
|
||
} else {
|
||
pmap[item] = i;
|
||
}
|
||
}
|
||
},
|
||
add: function (item) {
|
||
var key = this.store.push(item) - 1;
|
||
if (item && typeof item == 'object') {
|
||
this.omap.set(item, key);
|
||
} else {
|
||
this.pmap[item] = key;
|
||
}
|
||
return key;
|
||
},
|
||
removeKey: function (key) {
|
||
this._removeFromMap(this.store[key]);
|
||
delete this.store[key];
|
||
},
|
||
_removeFromMap: function (item) {
|
||
if (typeof item == 'object') {
|
||
this.omap.delete(item);
|
||
} else {
|
||
delete this.pmap[item];
|
||
}
|
||
},
|
||
remove: function (item) {
|
||
var key = this.getKey(item);
|
||
this.removeKey(key);
|
||
return key;
|
||
},
|
||
getKey: function (item) {
|
||
if (typeof item == 'object') {
|
||
return this.omap.get(item);
|
||
} else {
|
||
return this.pmap[item];
|
||
}
|
||
},
|
||
getKeys: function () {
|
||
return Object.keys(this.store);
|
||
},
|
||
setItem: function (key, value) {
|
||
this.store[key] = value;
|
||
},
|
||
getItem: function (key) {
|
||
return this.store[key];
|
||
},
|
||
getItems: function () {
|
||
var items = [], store = this.store;
|
||
for (var key in store) {
|
||
items.push(store[key]);
|
||
}
|
||
return items;
|
||
},
|
||
applySplices: function (splices) {
|
||
var keySplices = [];
|
||
for (var i = 0; i < splices.length; i++) {
|
||
var j, o, key, s = splices[i];
|
||
var removed = [];
|
||
for (j = 0; j < s.removed.length; j++) {
|
||
o = s.removed[j];
|
||
key = this.remove(o);
|
||
removed.push(key);
|
||
}
|
||
var added = [];
|
||
for (j = 0; j < s.addedCount; j++) {
|
||
o = this.userArray[s.index + j];
|
||
key = this.add(o);
|
||
added.push(key);
|
||
}
|
||
keySplices.push({
|
||
index: s.index,
|
||
removed: removed,
|
||
removedItems: s.removed,
|
||
added: added
|
||
});
|
||
}
|
||
return keySplices;
|
||
}
|
||
};
|
||
Polymer.Collection.get = function (userArray) {
|
||
return Polymer._collections.get(userArray) || new Polymer.Collection(userArray);
|
||
};
|
||
Polymer({
|
||
is: 'dom-repeat',
|
||
extends: 'template',
|
||
properties: {
|
||
items: { type: Array },
|
||
as: {
|
||
type: String,
|
||
value: 'item'
|
||
},
|
||
indexAs: {
|
||
type: String,
|
||
value: 'index'
|
||
},
|
||
sort: {
|
||
type: Function,
|
||
observer: '_sortChanged'
|
||
},
|
||
filter: {
|
||
type: Function,
|
||
observer: '_filterChanged'
|
||
},
|
||
observe: {
|
||
type: String,
|
||
observer: '_observeChanged'
|
||
},
|
||
delay: Number
|
||
},
|
||
behaviors: [Polymer.Templatizer],
|
||
observers: ['_itemsChanged(items.*)'],
|
||
detached: function () {
|
||
if (this.rows) {
|
||
for (var i = 0; i < this.rows.length; i++) {
|
||
this._detachRow(i);
|
||
}
|
||
}
|
||
},
|
||
attached: function () {
|
||
if (this.rows) {
|
||
var parentNode = Polymer.dom(this).parentNode;
|
||
for (var i = 0; i < this.rows.length; i++) {
|
||
Polymer.dom(parentNode).insertBefore(this.rows[i].root, this);
|
||
}
|
||
}
|
||
},
|
||
ready: function () {
|
||
this._instanceProps = { __key__: true };
|
||
this._instanceProps[this.as] = true;
|
||
this._instanceProps[this.indexAs] = true;
|
||
if (!this.ctor) {
|
||
this.templatize(this);
|
||
}
|
||
},
|
||
_sortChanged: function () {
|
||
var dataHost = this._getRootDataHost();
|
||
var sort = this.sort;
|
||
this._sortFn = sort && (typeof sort == 'function' ? sort : function () {
|
||
return dataHost[sort].apply(dataHost, arguments);
|
||
});
|
||
this._fullRefresh = true;
|
||
if (this.items) {
|
||
this._debounceTemplate(this._render);
|
||
}
|
||
},
|
||
_filterChanged: function () {
|
||
var dataHost = this._getRootDataHost();
|
||
var filter = this.filter;
|
||
this._filterFn = filter && (typeof filter == 'function' ? filter : function () {
|
||
return dataHost[filter].apply(dataHost, arguments);
|
||
});
|
||
this._fullRefresh = true;
|
||
if (this.items) {
|
||
this._debounceTemplate(this._render);
|
||
}
|
||
},
|
||
_observeChanged: function () {
|
||
this._observePaths = this.observe && this.observe.replace('.*', '.').split(' ');
|
||
},
|
||
_itemsChanged: function (change) {
|
||
if (change.path == 'items') {
|
||
if (Array.isArray(this.items)) {
|
||
this.collection = Polymer.Collection.get(this.items);
|
||
} else if (!this.items) {
|
||
this.collection = null;
|
||
} else {
|
||
this._error(this._logf('dom-repeat', 'expected array for `items`,' + ' found', this.items));
|
||
}
|
||
this._splices = [];
|
||
this._fullRefresh = true;
|
||
this._debounceTemplate(this._render);
|
||
} else if (change.path == 'items.splices') {
|
||
this._splices = this._splices.concat(change.value.keySplices);
|
||
this._debounceTemplate(this._render);
|
||
} else {
|
||
var subpath = change.path.slice(6);
|
||
this._forwardItemPath(subpath, change.value);
|
||
this._checkObservedPaths(subpath);
|
||
}
|
||
},
|
||
_checkObservedPaths: function (path) {
|
||
if (this._observePaths) {
|
||
path = path.substring(path.indexOf('.') + 1);
|
||
var paths = this._observePaths;
|
||
for (var i = 0; i < paths.length; i++) {
|
||
if (path.indexOf(paths[i]) === 0) {
|
||
this._fullRefresh = true;
|
||
if (this.delay) {
|
||
this.debounce('render', this._render, this.delay);
|
||
} else {
|
||
this._debounceTemplate(this._render);
|
||
}
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
render: function () {
|
||
this._fullRefresh = true;
|
||
this.debounce('render', this._render);
|
||
this._flushTemplates();
|
||
},
|
||
_render: function () {
|
||
var c = this.collection;
|
||
if (!this._fullRefresh) {
|
||
if (this._sortFn) {
|
||
this._applySplicesViewSort(this._splices);
|
||
} else {
|
||
if (this._filterFn) {
|
||
this._fullRefresh = true;
|
||
} else {
|
||
this._applySplicesArraySort(this._splices);
|
||
}
|
||
}
|
||
}
|
||
if (this._fullRefresh) {
|
||
this._sortAndFilter();
|
||
this._fullRefresh = false;
|
||
}
|
||
this._splices = [];
|
||
var rowForKey = this._rowForKey = {};
|
||
var keys = this._orderedKeys;
|
||
this.rows = this.rows || [];
|
||
for (var i = 0; i < keys.length; i++) {
|
||
var key = keys[i];
|
||
var item = c.getItem(key);
|
||
var row = this.rows[i];
|
||
rowForKey[key] = i;
|
||
if (!row) {
|
||
this.rows.push(row = this._insertRow(i, null, item));
|
||
}
|
||
row[this.as] = item;
|
||
row.__key__ = key;
|
||
row[this.indexAs] = i;
|
||
}
|
||
for (; i < this.rows.length; i++) {
|
||
this._detachRow(i);
|
||
}
|
||
this.rows.splice(keys.length, this.rows.length - keys.length);
|
||
this.fire('dom-change');
|
||
},
|
||
_sortAndFilter: function () {
|
||
var c = this.collection;
|
||
if (!this._sortFn) {
|
||
this._orderedKeys = [];
|
||
var items = this.items;
|
||
if (items) {
|
||
for (var i = 0; i < items.length; i++) {
|
||
this._orderedKeys.push(c.getKey(items[i]));
|
||
}
|
||
}
|
||
} else {
|
||
this._orderedKeys = c ? c.getKeys() : [];
|
||
}
|
||
if (this._filterFn) {
|
||
this._orderedKeys = this._orderedKeys.filter(function (a) {
|
||
return this._filterFn(c.getItem(a));
|
||
}, this);
|
||
}
|
||
if (this._sortFn) {
|
||
this._orderedKeys.sort(function (a, b) {
|
||
return this._sortFn(c.getItem(a), c.getItem(b));
|
||
}.bind(this));
|
||
}
|
||
},
|
||
_keySort: function (a, b) {
|
||
return this.collection.getKey(a) - this.collection.getKey(b);
|
||
},
|
||
_applySplicesViewSort: function (splices) {
|
||
var c = this.collection;
|
||
var keys = this._orderedKeys;
|
||
var rows = this.rows;
|
||
var removedRows = [];
|
||
var addedKeys = [];
|
||
var pool = [];
|
||
var sortFn = this._sortFn || this._keySort.bind(this);
|
||
splices.forEach(function (s) {
|
||
for (var i = 0; i < s.removed.length; i++) {
|
||
var idx = this._rowForKey[s.removed[i]];
|
||
if (idx != null) {
|
||
removedRows.push(idx);
|
||
}
|
||
}
|
||
for (var i = 0; i < s.added.length; i++) {
|
||
addedKeys.push(s.added[i]);
|
||
}
|
||
}, this);
|
||
if (removedRows.length) {
|
||
removedRows.sort();
|
||
for (var i = removedRows.length - 1; i >= 0; i--) {
|
||
var idx = removedRows[i];
|
||
pool.push(this._detachRow(idx));
|
||
rows.splice(idx, 1);
|
||
keys.splice(idx, 1);
|
||
}
|
||
}
|
||
if (addedKeys.length) {
|
||
if (this._filterFn) {
|
||
addedKeys = addedKeys.filter(function (a) {
|
||
return this._filterFn(c.getItem(a));
|
||
}, this);
|
||
}
|
||
addedKeys.sort(function (a, b) {
|
||
return this._sortFn(c.getItem(a), c.getItem(b));
|
||
}.bind(this));
|
||
var start = 0;
|
||
for (var i = 0; i < addedKeys.length; i++) {
|
||
start = this._insertRowIntoViewSort(start, addedKeys[i], pool);
|
||
}
|
||
}
|
||
},
|
||
_insertRowIntoViewSort: function (start, key, pool) {
|
||
var c = this.collection;
|
||
var item = c.getItem(key);
|
||
var end = this.rows.length - 1;
|
||
var idx = -1;
|
||
var sortFn = this._sortFn || this._keySort.bind(this);
|
||
while (start <= end) {
|
||
var mid = start + end >> 1;
|
||
var midKey = this._orderedKeys[mid];
|
||
var cmp = sortFn(c.getItem(midKey), item);
|
||
if (cmp < 0) {
|
||
start = mid + 1;
|
||
} else if (cmp > 0) {
|
||
end = mid - 1;
|
||
} else {
|
||
idx = mid;
|
||
break;
|
||
}
|
||
}
|
||
if (idx < 0) {
|
||
idx = end + 1;
|
||
}
|
||
this._orderedKeys.splice(idx, 0, key);
|
||
this.rows.splice(idx, 0, this._insertRow(idx, pool, c.getItem(key)));
|
||
return idx;
|
||
},
|
||
_applySplicesArraySort: function (splices) {
|
||
var keys = this._orderedKeys;
|
||
var pool = [];
|
||
splices.forEach(function (s) {
|
||
for (var i = 0; i < s.removed.length; i++) {
|
||
pool.push(this._detachRow(s.index + i));
|
||
}
|
||
this.rows.splice(s.index, s.removed.length);
|
||
}, this);
|
||
var c = this.collection;
|
||
splices.forEach(function (s) {
|
||
var args = [
|
||
s.index,
|
||
s.removed.length
|
||
].concat(s.added);
|
||
keys.splice.apply(keys, args);
|
||
for (var i = 0; i < s.added.length; i++) {
|
||
var item = c.getItem(s.added[i]);
|
||
var row = this._insertRow(s.index + i, pool, item);
|
||
this.rows.splice(s.index + i, 0, row);
|
||
}
|
||
}, this);
|
||
},
|
||
_detachRow: function (idx) {
|
||
var row = this.rows[idx];
|
||
var parentNode = Polymer.dom(this).parentNode;
|
||
for (var i = 0; i < row._children.length; i++) {
|
||
var el = row._children[i];
|
||
Polymer.dom(row.root).appendChild(el);
|
||
}
|
||
return row;
|
||
},
|
||
_insertRow: function (idx, pool, item) {
|
||
var row = pool && pool.pop() || this._generateRow(idx, item);
|
||
var beforeRow = this.rows[idx];
|
||
var beforeNode = beforeRow ? beforeRow._children[0] : this;
|
||
var parentNode = Polymer.dom(this).parentNode;
|
||
Polymer.dom(parentNode).insertBefore(row.root, beforeNode);
|
||
return row;
|
||
},
|
||
_generateRow: function (idx, item) {
|
||
var model = { __key__: this.collection.getKey(item) };
|
||
model[this.as] = item;
|
||
model[this.indexAs] = idx;
|
||
var row = this.stamp(model);
|
||
return row;
|
||
},
|
||
_showHideChildren: function (hidden) {
|
||
if (this.rows) {
|
||
for (var i = 0; i < this.rows.length; i++) {
|
||
var c$ = this.rows[i]._children;
|
||
for (var j = 0; j < c$.length; j++) {
|
||
var c = c$[j];
|
||
if (c.style) {
|
||
c.style.display = hidden ? 'none' : '';
|
||
}
|
||
c._hideTemplateChildren = hidden;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
_forwardInstancePath: function (row, path, value) {
|
||
if (path.indexOf(this.as + '.') === 0) {
|
||
this.notifyPath('items.' + row.__key__ + '.' + path.slice(this.as.length + 1), value);
|
||
return true;
|
||
}
|
||
},
|
||
_forwardParentProp: function (prop, value) {
|
||
if (this.rows) {
|
||
this.rows.forEach(function (row) {
|
||
row[prop] = value;
|
||
}, this);
|
||
}
|
||
},
|
||
_forwardParentPath: function (path, value) {
|
||
if (this.rows) {
|
||
this.rows.forEach(function (row) {
|
||
row.notifyPath(path, value, true);
|
||
}, this);
|
||
}
|
||
},
|
||
_forwardItemPath: function (path, value) {
|
||
if (this._rowForKey) {
|
||
var dot = path.indexOf('.');
|
||
var key = path.substring(0, dot < 0 ? path.length : dot);
|
||
var idx = this._rowForKey[key];
|
||
var row = this.rows[idx];
|
||
if (row) {
|
||
if (dot >= 0) {
|
||
path = this.as + '.' + path.substring(dot + 1);
|
||
row.notifyPath(path, value, true);
|
||
} else {
|
||
row[this.as] = value;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
modelForElement: function (el) {
|
||
var model;
|
||
while (el) {
|
||
if (model = el._templateInstance) {
|
||
if (model.dataHost != this) {
|
||
el = model.dataHost;
|
||
} else {
|
||
return model;
|
||
}
|
||
} else {
|
||
el = el.parentNode;
|
||
}
|
||
}
|
||
},
|
||
itemForElement: function (el) {
|
||
var instance = this.modelForElement(el);
|
||
return instance && instance[this.as];
|
||
},
|
||
keyForElement: function (el) {
|
||
var instance = this.modelForElement(el);
|
||
return instance && instance.__key__;
|
||
},
|
||
indexForElement: function (el) {
|
||
var instance = this.modelForElement(el);
|
||
return instance && instance[this.indexAs];
|
||
}
|
||
});
|
||
Polymer({
|
||
is: 'array-selector',
|
||
properties: {
|
||
items: {
|
||
type: Array,
|
||
observer: '_itemsChanged'
|
||
},
|
||
selected: {
|
||
type: Object,
|
||
notify: true
|
||
},
|
||
toggle: Boolean,
|
||
multi: Boolean
|
||
},
|
||
_itemsChanged: function () {
|
||
if (Array.isArray(this.selected)) {
|
||
for (var i = 0; i < this.selected.length; i++) {
|
||
this.unlinkPaths('selected.' + i);
|
||
}
|
||
} else {
|
||
this.unlinkPaths('selected');
|
||
}
|
||
if (this.multi) {
|
||
this.selected = [];
|
||
} else {
|
||
this.selected = null;
|
||
}
|
||
},
|
||
deselect: function (item) {
|
||
if (this.multi) {
|
||
var scol = Polymer.Collection.get(this.selected);
|
||
var sidx = this.selected.indexOf(item);
|
||
if (sidx >= 0) {
|
||
var skey = scol.getKey(item);
|
||
this.splice('selected', sidx, 1);
|
||
this.unlinkPaths('selected.' + skey);
|
||
return true;
|
||
}
|
||
} else {
|
||
this.selected = null;
|
||
this.unlinkPaths('selected');
|
||
}
|
||
},
|
||
select: function (item) {
|
||
var icol = Polymer.Collection.get(this.items);
|
||
var key = icol.getKey(item);
|
||
if (this.multi) {
|
||
var scol = Polymer.Collection.get(this.selected);
|
||
var skey = scol.getKey(item);
|
||
if (skey >= 0) {
|
||
this.deselect(item);
|
||
} else if (this.toggle) {
|
||
this.push('selected', item);
|
||
this.async(function () {
|
||
skey = scol.getKey(item);
|
||
this.linkPaths('selected.' + skey, 'items.' + key);
|
||
});
|
||
}
|
||
} else {
|
||
if (this.toggle && item == this.selected) {
|
||
this.deselect();
|
||
} else {
|
||
this.linkPaths('selected', 'items.' + key);
|
||
this.selected = item;
|
||
}
|
||
}
|
||
}
|
||
});
|
||
Polymer({
|
||
is: 'dom-if',
|
||
extends: 'template',
|
||
properties: {
|
||
'if': {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
restamp: {
|
||
type: Boolean,
|
||
value: false
|
||
}
|
||
},
|
||
behaviors: [Polymer.Templatizer],
|
||
observers: ['_queueRender(if, restamp)'],
|
||
_queueRender: function () {
|
||
this._debounceTemplate(this._render);
|
||
},
|
||
detached: function () {
|
||
this._teardownInstance();
|
||
},
|
||
attached: function () {
|
||
if (this.if && this.ctor) {
|
||
this.async(this._ensureInstance);
|
||
}
|
||
},
|
||
render: function () {
|
||
this._flushTemplates();
|
||
},
|
||
_render: function () {
|
||
if (this.if) {
|
||
if (!this.ctor) {
|
||
this._wrapTextNodes(this._content || this.content);
|
||
this.templatize(this);
|
||
}
|
||
this._ensureInstance();
|
||
this._showHideChildren();
|
||
} else if (this.restamp) {
|
||
this._teardownInstance();
|
||
}
|
||
if (!this.restamp && this._instance) {
|
||
this._showHideChildren();
|
||
}
|
||
if (this.if != this._lastIf) {
|
||
this.fire('dom-change');
|
||
this._lastIf = this.if;
|
||
}
|
||
},
|
||
_ensureInstance: function () {
|
||
if (!this._instance) {
|
||
this._instance = this.stamp();
|
||
var root = this._instance.root;
|
||
var parent = Polymer.dom(Polymer.dom(this).parentNode);
|
||
parent.insertBefore(root, this);
|
||
}
|
||
},
|
||
_teardownInstance: function () {
|
||
if (this._instance) {
|
||
var c = this._instance._children;
|
||
if (c) {
|
||
var parent = Polymer.dom(Polymer.dom(c[0]).parentNode);
|
||
c.forEach(function (n) {
|
||
parent.removeChild(n);
|
||
});
|
||
}
|
||
this._instance = null;
|
||
}
|
||
},
|
||
_wrapTextNodes: function (root) {
|
||
for (var n = root.firstChild; n; n = n.nextSibling) {
|
||
if (n.nodeType === Node.TEXT_NODE) {
|
||
var s = document.createElement('span');
|
||
root.insertBefore(s, n);
|
||
s.appendChild(n);
|
||
n = s;
|
||
}
|
||
}
|
||
},
|
||
_showHideChildren: function () {
|
||
var hidden = this._hideTemplateChildren || !this.if;
|
||
if (this._instance) {
|
||
var c$ = this._instance._children;
|
||
for (var i = 0; i < c$.length; i++) {
|
||
var c = c$[i];
|
||
c.style.display = hidden ? 'none' : '';
|
||
c._hideTemplateChildren = hidden;
|
||
}
|
||
}
|
||
},
|
||
_forwardParentProp: function (prop, value) {
|
||
if (this._instance) {
|
||
this._instance[prop] = value;
|
||
}
|
||
},
|
||
_forwardParentPath: function (path, value) {
|
||
if (this._instance) {
|
||
this._instance.notifyPath(path, value, true);
|
||
}
|
||
}
|
||
});
|
||
Polymer.ImportStatus = {
|
||
_ready: false,
|
||
_callbacks: [],
|
||
whenLoaded: function (cb) {
|
||
if (this._ready) {
|
||
cb();
|
||
} else {
|
||
this._callbacks.push(cb);
|
||
}
|
||
},
|
||
_importsLoaded: function () {
|
||
this._ready = true;
|
||
this._callbacks.forEach(function (cb) {
|
||
cb();
|
||
});
|
||
this._callbacks = [];
|
||
}
|
||
};
|
||
window.addEventListener('load', function () {
|
||
Polymer.ImportStatus._importsLoaded();
|
||
});
|
||
if (window.HTMLImports) {
|
||
HTMLImports.whenReady(function () {
|
||
Polymer.ImportStatus._importsLoaded();
|
||
});
|
||
}
|
||
Polymer({
|
||
is: 'dom-bind',
|
||
extends: 'template',
|
||
created: function () {
|
||
Polymer.ImportStatus.whenLoaded(this._readySelf.bind(this));
|
||
},
|
||
_registerFeatures: function () {
|
||
this._prepExtends();
|
||
this._prepConstructor();
|
||
},
|
||
_insertChildren: function () {
|
||
var parentDom = Polymer.dom(Polymer.dom(this).parentNode);
|
||
parentDom.insertBefore(this.root, this);
|
||
},
|
||
_removeChildren: function () {
|
||
if (this._children) {
|
||
for (var i = 0; i < this._children.length; i++) {
|
||
this.root.appendChild(this._children[i]);
|
||
}
|
||
}
|
||
},
|
||
_initFeatures: function () {
|
||
},
|
||
_scopeElementClass: function (element, selector) {
|
||
if (this.dataHost) {
|
||
return this.dataHost._scopeElementClass(element, selector);
|
||
} else {
|
||
return selector;
|
||
}
|
||
},
|
||
_prepConfigure: function () {
|
||
var config = {};
|
||
for (var prop in this._propertyEffects) {
|
||
config[prop] = this[prop];
|
||
}
|
||
this._setupConfigure = this._setupConfigure.bind(this, config);
|
||
},
|
||
attached: function () {
|
||
if (!this._children) {
|
||
this._template = this;
|
||
this._prepAnnotations();
|
||
this._prepEffects();
|
||
this._prepBehaviors();
|
||
this._prepConfigure();
|
||
this._prepBindings();
|
||
Polymer.Base._initFeatures.call(this);
|
||
this._children = Array.prototype.slice.call(this.root.childNodes);
|
||
}
|
||
this._insertChildren();
|
||
this.fire('dom-change');
|
||
},
|
||
detached: function () {
|
||
this._removeChildren();
|
||
}
|
||
});</script>
|
||
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic,500,500italic,700,700italic">
|
||
|
||
<style is="custom-style">
|
||
|
||
:root {
|
||
|
||
/* Shared Styles */
|
||
|
||
/*
|
||
Unfortunately, we can't make use of these yet - sibling properties aren't
|
||
evaluated. See https://github.com/Polymer/polymer/issues/1399
|
||
|
||
--paper-font-common-base: {
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
-webkit-font-smoothing: antialiased;
|
||
};
|
||
|
||
--paper-font-common-code: {
|
||
font-family: 'Inconsolata', 'Consolas', 'Source Code Pro', 'Monaco', 'Menlo', monospace;
|
||
-webkit-font-smoothing: antialiased;
|
||
};
|
||
|
||
--paper-font-common-expensive-kerning: {
|
||
text-rendering: optimizeLegibility;
|
||
};
|
||
|
||
--paper-font-common-nowrap: {
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
};
|
||
*/
|
||
|
||
/* Material Font Styles */
|
||
|
||
--paper-font-display4: {
|
||
/* @apply(--paper-font-common-base) */
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
-webkit-font-smoothing: antialiased;
|
||
/* @apply(--paper-font-common-expensive-kerning); */
|
||
text-rendering: optimizeLegibility;
|
||
/* @apply(--paper-font-common-nowrap); */
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
|
||
font-size: 112px;
|
||
font-weight: 300;
|
||
letter-spacing: -.044em;
|
||
line-height: 120px;
|
||
};
|
||
|
||
--paper-font-display3: {
|
||
/* @apply(--paper-font-common-base) */
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
-webkit-font-smoothing: antialiased;
|
||
/* @apply(--paper-font-common-expensive-kerning); */
|
||
text-rendering: optimizeLegibility;
|
||
/* @apply(--paper-font-common-nowrap); */
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
|
||
font-size: 56px;
|
||
font-weight: 400;
|
||
letter-spacing: -.026em;
|
||
line-height: 60px;
|
||
};
|
||
|
||
--paper-font-display2: {
|
||
/* @apply(--paper-font-common-base) */
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
-webkit-font-smoothing: antialiased;
|
||
/* @apply(--paper-font-common-expensive-kerning); */
|
||
text-rendering: optimizeLegibility;
|
||
|
||
font-size: 45px;
|
||
font-weight: 400;
|
||
letter-spacing: -.018em;
|
||
line-height: 48px;
|
||
};
|
||
|
||
--paper-font-display1: {
|
||
/* @apply(--paper-font-common-base) */
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
-webkit-font-smoothing: antialiased;
|
||
/* @apply(--paper-font-common-expensive-kerning); */
|
||
text-rendering: optimizeLegibility;
|
||
|
||
font-size: 34px;
|
||
font-weight: 400;
|
||
letter-spacing: -.01em;
|
||
line-height: 40px;
|
||
};
|
||
|
||
--paper-font-headline: {
|
||
/* @apply(--paper-font-common-base) */
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
-webkit-font-smoothing: antialiased;
|
||
/* @apply(--paper-font-common-expensive-kerning); */
|
||
text-rendering: optimizeLegibility;
|
||
|
||
font-size: 24px;
|
||
font-weight: 400;
|
||
letter-spacing: -.012em;
|
||
line-height: 32px;
|
||
};
|
||
|
||
--paper-font-title: {
|
||
/* @apply(--paper-font-common-base) */
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
-webkit-font-smoothing: antialiased;
|
||
/* @apply(--paper-font-common-expensive-kerning); */
|
||
text-rendering: optimizeLegibility;
|
||
/* @apply(--paper-font-common-nowrap); */
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
|
||
font-size: 20px;
|
||
font-weight: 500;
|
||
line-height: 28px;
|
||
};
|
||
|
||
--paper-font-subhead: {
|
||
/* @apply(--paper-font-common-base) */
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
-webkit-font-smoothing: antialiased;
|
||
/* @apply(--paper-font-common-expensive-kerning); */
|
||
text-rendering: optimizeLegibility;
|
||
|
||
font-size: 16px;
|
||
font-weight: 400;
|
||
line-height: 24px;
|
||
};
|
||
|
||
--paper-font-body2: {
|
||
/* @apply(--paper-font-common-base) */
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
-webkit-font-smoothing: antialiased;
|
||
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
line-height: 24px;
|
||
};
|
||
|
||
--paper-font-body1: {
|
||
/* @apply(--paper-font-common-base) */
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
-webkit-font-smoothing: antialiased;
|
||
|
||
font-size: 14px;
|
||
font-weight: 400;
|
||
line-height: 20px;
|
||
};
|
||
|
||
--paper-font-caption: {
|
||
/* @apply(--paper-font-common-base) */
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
-webkit-font-smoothing: antialiased;
|
||
/* @apply(--paper-font-common-nowrap); */
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
|
||
font-size: 12px;
|
||
font-weight: 400;
|
||
letter-spacing: 0.011em;
|
||
line-height: 20px;
|
||
};
|
||
|
||
--paper-font-menu: {
|
||
/* @apply(--paper-font-common-base) */
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
-webkit-font-smoothing: antialiased;
|
||
/* @apply(--paper-font-common-expensive-kerning); */
|
||
text-rendering: optimizeLegibility;
|
||
/* @apply(--paper-font-common-nowrap); */
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
|
||
font-size: 13px;
|
||
font-weight: 500;
|
||
line-height: 24px;
|
||
};
|
||
|
||
--paper-font-button: {
|
||
/* @apply(--paper-font-common-base) */
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
-webkit-font-smoothing: antialiased;
|
||
/* @apply(--paper-font-common-expensive-kerning); */
|
||
text-rendering: optimizeLegibility;
|
||
/* @apply(--paper-font-common-nowrap); */
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
letter-spacing: 0.018em;
|
||
line-height: 24px;
|
||
text-transform: uppercase;
|
||
};
|
||
|
||
--paper-font-code2: {
|
||
/* @apply(--paper-font-common-code); */
|
||
font-family: 'Inconsolata', 'Consolas', 'Source Code Pro', 'Monaco', 'Menlo', monospace;
|
||
-webkit-font-smoothing: antialiased;
|
||
|
||
font-size: 14px;
|
||
font-weight: 700;
|
||
line-height: 20px;
|
||
};
|
||
|
||
--paper-font-code1: {
|
||
/* @apply(--paper-font-common-code); */
|
||
font-family: 'Inconsolata', 'Consolas', 'Source Code Pro', 'Monaco', 'Menlo', monospace;
|
||
-webkit-font-smoothing: antialiased;
|
||
|
||
font-size: 14px;
|
||
font-weight: 500;
|
||
line-height: 20px;
|
||
};
|
||
|
||
}
|
||
|
||
</style>
|
||
<script>!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([/*!******************************!*\
|
||
!*** ./src/export_window.js ***!
|
||
\******************************/
|
||
function(t,e,n){"use strict";"hass"in window||(window.hass=n(/*! ./homeassistant */55))},/*!*******************************!*\
|
||
!*** ./src/app_dispatcher.js ***!
|
||
\*******************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(/*! flux */61),i=r.Dispatcher;e["default"]=new i,t.exports=e["default"]},/*!**************************!*\
|
||
!*** ./src/constants.js ***!
|
||
\**************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(/*! lodash */9),i=["ACTION_LOG_OUT","ACTION_VALIDATING_AUTH_TOKEN","ACTION_VALID_AUTH_TOKEN","ACTION_INVALID_AUTH_TOKEN","ACTION_FETCH_ALL","ACTION_NEW_CONFIG","ACTION_NEW_EVENTS","ACTION_NEW_SERVICES","ACTION_NEW_STATES","ACTION_NEW_STATE_HISTORY","ACTION_NEW_LOGBOOK","ACTION_NEW_NOTIFICATION","ACTION_SET_PREFERENCE","ACTION_EVENT_FIRED","ACTION_INITIAL_LOAD_DONE","ACTION_STREAM_START","ACTION_STREAM_STOP","ACTION_STREAM_ERROR","ACTION_REMOTE_EVENT_RECEIVED","ACTION_LISTENING_START","ACTION_LISTENING_TRANSMITTING","ACTION_LISTENING_DONE","ACTION_LISTENING_ERROR","ACTION_LISTENING_RESULT"];e["default"]=r.merge({REMOTE_EVENT_HOMEASSISTANT_START:"homeassistant_start",REMOTE_EVENT_HOMEASSISTANT_STOP:"homeassistant_stop",REMOTE_EVENT_STATE_CHANGED:"state_changed",REMOTE_EVENT_TIME_CHANGED:"time_changed",REMOTE_EVENT_CALL_SERVICE:"call_service",REMOTE_EVENT_SERVICE_EXECUTED:"service_executed",REMOTE_EVENT_PLATFORM_DISCOVERED:"platform_discovered",REMOTE_EVENT_SERVICE_REGISTERED:"service_registered",REMOTE_EVENT_COMPONENT_LOADED:"component_loaded",UNIT_TEMP_C:"°C",UNIT_TEMP_F:"°F"},r.zipObject(i,i)),t.exports=e["default"]},/*!*****************************!*\
|
||
!*** ./src/stores/store.js ***!
|
||
\*****************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},i=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}}(),o=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&&(t.__proto__=e)},u=n(/*! events */97),a="change",s=function(t){function e(){r(this,e),null!=t&&t.apply(this,arguments)}return o(e,t),i(e,[{key:"emitChange",value:function(){this.emit(a)}},{key:"addChangeListener",value:function(t){this.on(a,t)}},{key:"removeChangeListener",value:function(t){this.removeListener(a,t)}}]),e}(u.EventEmitter);e["default"]=s,t.exports=e["default"]},/*!***************************************!*\
|
||
!*** ./~/immutable/dist/immutable.js ***!
|
||
\***************************************/
|
||
function(t,e,n){!function(e,n){t.exports=n()}(this,function(){"use strict";function t(t,e){e&&(t.prototype=Object.create(e.prototype)),t.prototype.constructor=t}function e(t){return t.value=!1,t}function n(t){t&&(t.value=!0)}function r(){}function i(t,e){e=e||0;for(var n=Math.max(0,t.length-e),r=new Array(n),i=0;n>i;i++)r[i]=t[i+e];return r}function o(t){return void 0===t.size&&(t.size=t.__iterate(a)),t.size}function u(t,e){return e>=0?+e:o(t)+ +e}function a(){return!0}function s(t,e,n){return(0===t||void 0!==n&&-n>=t)&&(void 0===e||void 0!==n&&e>=n)}function c(t,e){return l(t,e,0)}function f(t,e){return l(t,e,e)}function l(t,e,n){return void 0===t?n:0>t?Math.max(0,e+t):void 0===e?t:Math.min(e,t)}function h(t){return d(t)?t:x(t)}function p(t){return y(t)?t:C(t)}function _(t){return g(t)?t:k(t)}function v(t){return d(t)&&!m(t)?t:j(t)}function d(t){return!(!t||!t[vn])}function y(t){return!(!t||!t[dn])}function g(t){return!(!t||!t[yn])}function m(t){return y(t)||g(t)}function w(t){return!(!t||!t[gn])}function b(t){this.next=t}function T(t,e,n,r){var i=0===t?e:1===t?n:[e,n];return r?r.value=i:r={value:i,done:!1},r}function E(){return{value:void 0,done:!0}}function O(t){return!!A(t)}function I(t){return t&&"function"==typeof t.next}function S(t){var e=A(t);return e&&e.call(t)}function A(t){var e=t&&(Tn&&t[Tn]||t[En]);return"function"==typeof e?e:void 0}function N(t){return t&&"number"==typeof t.length}function x(t){return null===t||void 0===t?P():d(t)?t.toSeq():W(t)}function C(t){return null===t||void 0===t?P().toKeyedSeq():d(t)?y(t)?t.toSeq():t.fromEntrySeq():q(t)}function k(t){return null===t||void 0===t?P():d(t)?y(t)?t.entrySeq():t.toIndexedSeq():U(t)}function j(t){return(null===t||void 0===t?P():d(t)?y(t)?t.entrySeq():t:U(t)).toSetSeq()}function M(t){this._array=t,this.size=t.length}function D(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length}function R(t){this._iterable=t,this.size=t.length||t.size}function z(t){this._iterator=t,this._iteratorCache=[]}function L(t){return!(!t||!t[In])}function P(){return Sn||(Sn=new M([]))}function q(t){var e=Array.isArray(t)?new M(t).fromEntrySeq():I(t)?new z(t).fromEntrySeq():O(t)?new R(t).fromEntrySeq():"object"==typeof t?new D(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function U(t){var e=G(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function W(t){var e=G(t)||"object"==typeof t&&new D(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t);return e}function G(t){return N(t)?new M(t):I(t)?new z(t):O(t)?new R(t):void 0}function V(t,e,n,r){var i=t._cache;if(i){for(var o=i.length-1,u=0;o>=u;u++){var a=i[n?o-u:u];if(e(a[1],r?a[0]:u,t)===!1)return u+1}return u}return t.__iterateUncached(e,n)}function $(t,e,n,r){var i=t._cache;if(i){var o=i.length-1,u=0;return new b(function(){var t=i[n?o-u:u];return u++>o?E():T(e,r?t[0]:u-1,t[1])})}return t.__iteratorUncached(e,n)}function F(){throw TypeError("Abstract")}function K(){}function H(){}function B(){}function J(t,e){if(t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1;if("function"==typeof t.valueOf&&"function"==typeof e.valueOf){if(t=t.valueOf(),e=e.valueOf(),t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1}return"function"==typeof t.equals&&"function"==typeof e.equals&&t.equals(e)?!0:!1}function Y(t,e){return e?X(e,t,"",{"":t}):Q(t)}function X(t,e,n,r){return Array.isArray(e)?t.call(r,n,k(e).map(function(n,r){return X(t,n,r,e)})):Z(e)?t.call(r,n,C(e).map(function(n,r){return X(t,n,r,e)})):e}function Q(t){return Array.isArray(t)?k(t).map(Q).toList():Z(t)?C(t).map(Q).toMap():t}function Z(t){return t&&(t.constructor===Object||void 0===t.constructor)}function tt(t){return t>>>1&1073741824|3221225471&t}function et(t){if(t===!1||null===t||void 0===t)return 0;if("function"==typeof t.valueOf&&(t=t.valueOf(),t===!1||null===t||void 0===t))return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){var n=0|t;for(n!==t&&(n^=4294967295*t);t>4294967295;)t/=4294967295,n^=t;return tt(n)}return"string"===e?t.length>Dn?nt(t):rt(t):"function"==typeof t.hashCode?t.hashCode():it(t)}function nt(t){var e=Ln[t];return void 0===e&&(e=rt(t),zn===Rn&&(zn=0,Ln={}),zn++,Ln[t]=e),e}function rt(t){for(var e=0,n=0;n<t.length;n++)e=31*e+t.charCodeAt(n)|0;return tt(e)}function it(t){var e;if(kn&&(e=An.get(t),void 0!==e))return e;if(e=t[Mn],void 0!==e)return e;if(!Cn){if(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[Mn],void 0!==e)return e;if(e=ot(t),void 0!==e)return e}if(e=++jn,1073741824&jn&&(jn=0),kn)An.set(t,e);else{if(void 0!==xn&&xn(t)===!1)throw new Error("Non-extensible objects are not allowed as keys.");if(Cn)Object.defineProperty(t,Mn,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(void 0!==t.propertyIsEnumerable&&t.propertyIsEnumerable===t.constructor.prototype.propertyIsEnumerable)t.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},t.propertyIsEnumerable[Mn]=e;else{if(void 0===t.nodeType)throw new Error("Unable to set a non-enumerable property on object.");t[Mn]=e}}return e}function ot(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function ut(t,e){if(!t)throw new Error(e)}function at(t){ut(t!==1/0,"Cannot perform this action with an infinite size.")}function st(t,e){this._iter=t,this._useKeys=e,this.size=t.size}function ct(t){this._iter=t,this.size=t.size}function ft(t){this._iter=t,this.size=t.size}function lt(t){this._iter=t,this.size=t.size}function ht(t){var e=Mt(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.includes(e)},e.includes=function(e){return t.has(e)},e.cacheResult=Dt,e.__iterateUncached=function(e,n){var r=this;return t.__iterate(function(t,n){return e(n,t,r)!==!1},n)},e.__iteratorUncached=function(e,n){if(e===bn){var r=t.__iterator(e,n);return new b(function(){var t=r.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t})}return t.__iterator(e===wn?mn:wn,n)},e}function pt(t,e,n){var r=Mt(t);return r.size=t.size,r.has=function(e){return t.has(e)},r.get=function(r,i){var o=t.get(r,hn);return o===hn?i:e.call(n,o,r,t)},r.__iterateUncached=function(r,i){var o=this;return t.__iterate(function(t,i,u){return r(e.call(n,t,i,u),i,o)!==!1},i)},r.__iteratorUncached=function(r,i){var o=t.__iterator(bn,i);return new b(function(){var i=o.next();if(i.done)return i;var u=i.value,a=u[0];return T(r,a,e.call(n,u[1],a,t),i)})},r}function _t(t,e){var n=Mt(t);return n._iter=t,n.size=t.size,n.reverse=function(){return t},t.flip&&(n.flip=function(){var e=ht(t);return e.reverse=function(){return t.flip()},e}),n.get=function(n,r){return t.get(e?n:-1-n,r)},n.has=function(n){return t.has(e?n:-1-n)},n.includes=function(e){return t.includes(e)},n.cacheResult=Dt,n.__iterate=function(e,n){var r=this;return t.__iterate(function(t,n){return e(t,n,r)},!n)},n.__iterator=function(e,n){return t.__iterator(e,!n)},n}function vt(t,e,n,r){var i=Mt(t);return r&&(i.has=function(r){var i=t.get(r,hn);return i!==hn&&!!e.call(n,i,r,t)},i.get=function(r,i){var o=t.get(r,hn);return o!==hn&&e.call(n,o,r,t)?o:i}),i.__iterateUncached=function(i,o){var u=this,a=0;return t.__iterate(function(t,o,s){return e.call(n,t,o,s)?(a++,i(t,r?o:a-1,u)):void 0},o),a},i.__iteratorUncached=function(i,o){var u=t.__iterator(bn,o),a=0;return new b(function(){for(;;){var o=u.next();if(o.done)return o;var s=o.value,c=s[0],f=s[1];if(e.call(n,f,c,t))return T(i,r?c:a++,f,o)}})},i}function dt(t,e,n){var r=Lt().asMutable();return t.__iterate(function(i,o){r.update(e.call(n,i,o,t),0,function(t){return t+1})}),r.asImmutable()}function yt(t,e,n){var r=y(t),i=(w(t)?Ee():Lt()).asMutable();t.__iterate(function(o,u){i.update(e.call(n,o,u,t),function(t){return t=t||[],t.push(r?[u,o]:o),t})});var o=jt(t);return i.map(function(e){return xt(t,o(e))})}function gt(t,e,n,r){var i=t.size;if(s(e,n,i))return t;var o=c(e,i),a=f(n,i);if(o!==o||a!==a)return gt(t.toSeq().cacheResult(),e,n,r);var l=a-o;0>l&&(l=0);var h=Mt(t);return h.size=0===l?l:t.size&&l||void 0,!r&&L(t)&&l>=0&&(h.get=function(e,n){return e=u(this,e),e>=0&&l>e?t.get(e+o,n):n}),h.__iterateUncached=function(e,n){var i=this;if(0===l)return 0;if(n)return this.cacheResult().__iterate(e,n);var u=0,a=!0,s=0;return t.__iterate(function(t,n){return a&&(a=u++<o)?void 0:(s++,e(t,r?n:s-1,i)!==!1&&s!==l)}),s},h.__iteratorUncached=function(e,n){if(l&&n)return this.cacheResult().__iterator(e,n);var i=l&&t.__iterator(e,n),u=0,a=0;return new b(function(){for(;u++<o;)i.next();if(++a>l)return E();var t=i.next();return r||e===wn?t:e===mn?T(e,a-1,void 0,t):T(e,a-1,t.value[1],t)})},h}function mt(t,e,n){var r=Mt(t);return r.__iterateUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterate(r,i);var u=0;return t.__iterate(function(t,i,a){return e.call(n,t,i,a)&&++u&&r(t,i,o)}),u},r.__iteratorUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterator(r,i);var u=t.__iterator(bn,i),a=!0;return new b(function(){if(!a)return E();var t=u.next();if(t.done)return t;var i=t.value,s=i[0],c=i[1];return e.call(n,c,s,o)?r===bn?t:T(r,s,c,t):(a=!1,E())})},r}function wt(t,e,n,r){var i=Mt(t);return i.__iterateUncached=function(i,o){var u=this;if(o)return this.cacheResult().__iterate(i,o);var a=!0,s=0;return t.__iterate(function(t,o,c){return a&&(a=e.call(n,t,o,c))?void 0:(s++,i(t,r?o:s-1,u))}),s},i.__iteratorUncached=function(i,o){var u=this;if(o)return this.cacheResult().__iterator(i,o);var a=t.__iterator(bn,o),s=!0,c=0;return new b(function(){var t,o,f;do{if(t=a.next(),t.done)return r||i===wn?t:i===mn?T(i,c++,void 0,t):T(i,c++,t.value[1],t);var l=t.value;o=l[0],f=l[1],s&&(s=e.call(n,f,o,u))}while(s);return i===bn?t:T(i,o,f,t)})},i}function bt(t,e){var n=y(t),r=[t].concat(e).map(function(t){return d(t)?n&&(t=p(t)):t=n?q(t):U(Array.isArray(t)?t:[t]),t}).filter(function(t){return 0!==t.size});if(0===r.length)return t;if(1===r.length){var i=r[0];if(i===t||n&&y(i)||g(t)&&g(i))return i}var o=new M(r);return n?o=o.toKeyedSeq():g(t)||(o=o.toSetSeq()),o=o.flatten(!0),o.size=r.reduce(function(t,e){if(void 0!==t){var n=e.size;if(void 0!==n)return t+n}},0),o}function Tt(t,e,n){var r=Mt(t);return r.__iterateUncached=function(r,i){function o(t,s){var c=this;t.__iterate(function(t,i){return(!e||e>s)&&d(t)?o(t,s+1):r(t,n?i:u++,c)===!1&&(a=!0),!a},i)}var u=0,a=!1;return o(t,0),u},r.__iteratorUncached=function(r,i){var o=t.__iterator(r,i),u=[],a=0;return new b(function(){for(;o;){var t=o.next();if(t.done===!1){var s=t.value;if(r===bn&&(s=s[1]),e&&!(u.length<e)||!d(s))return n?t:T(r,a++,s,t);u.push(o),o=s.__iterator(r,i)}else o=u.pop()}return E()})},r}function Et(t,e,n){var r=jt(t);return t.toSeq().map(function(i,o){return r(e.call(n,i,o,t))}).flatten(!0)}function Ot(t,e){var n=Mt(t);return n.size=t.size&&2*t.size-1,n.__iterateUncached=function(n,r){var i=this,o=0;return t.__iterate(function(t,r){return(!o||n(e,o++,i)!==!1)&&n(t,o++,i)!==!1},r),o},n.__iteratorUncached=function(n,r){var i,o=t.__iterator(wn,r),u=0;return new b(function(){return(!i||u%2)&&(i=o.next(),i.done)?i:u%2?T(n,u++,e):T(n,u++,i.value,i)})},n}function It(t,e,n){e||(e=Rt);var r=y(t),i=0,o=t.toSeq().map(function(e,r){return[r,e,i++,n?n(e,r,t):e]}).toArray();return o.sort(function(t,n){return e(t[3],n[3])||t[2]-n[2]}).forEach(r?function(t,e){o[e].length=2}:function(t,e){o[e]=t[1]}),r?C(o):g(t)?k(o):j(o)}function St(t,e,n){if(e||(e=Rt),n){var r=t.toSeq().map(function(e,r){return[e,n(e,r,t)]}).reduce(function(t,n){return At(e,t[1],n[1])?n:t});return r&&r[0]}return t.reduce(function(t,n){return At(e,t,n)?n:t})}function At(t,e,n){var r=t(n,e);return 0===r&&n!==e&&(void 0===n||null===n||n!==n)||r>0}function Nt(t,e,n){var r=Mt(t);return r.size=new M(n).map(function(t){return t.size}).min(),r.__iterate=function(t,e){for(var n,r=this.__iterator(wn,e),i=0;!(n=r.next()).done&&t(n.value,i++,this)!==!1;);return i},r.__iteratorUncached=function(t,r){var i=n.map(function(t){return t=h(t),S(r?t.reverse():t)}),o=0,u=!1;return new b(function(){var n;return u||(n=i.map(function(t){return t.next()}),u=n.some(function(t){return t.done})),u?E():T(t,o++,e.apply(null,n.map(function(t){return t.value})))})},r}function xt(t,e){return L(t)?e:t.constructor(e)}function Ct(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function kt(t){return at(t.size),o(t)}function jt(t){return y(t)?p:g(t)?_:v}function Mt(t){return Object.create((y(t)?C:g(t)?k:j).prototype)}function Dt(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):x.prototype.cacheResult.call(this)}function Rt(t,e){return t>e?1:e>t?-1:0}function zt(t){var e=S(t);if(!e){if(!N(t))throw new TypeError("Expected iterable or array-like: "+t);e=S(h(t))}return e}function Lt(t){return null===t||void 0===t?Bt():Pt(t)?t:Bt().withMutations(function(e){var n=p(t);at(n.size),n.forEach(function(t,n){return e.set(n,t)})})}function Pt(t){return!(!t||!t[Pn])}function qt(t,e){this.ownerID=t,this.entries=e}function Ut(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n}function Wt(t,e,n){this.ownerID=t,this.count=e,this.nodes=n}function Gt(t,e,n){this.ownerID=t,this.keyHash=e,this.entries=n}function Vt(t,e,n){this.ownerID=t,this.keyHash=e,this.entry=n}function $t(t,e,n){this._type=e,this._reverse=n,this._stack=t._root&&Kt(t._root)}function Ft(t,e){return T(t,e[0],e[1])}function Kt(t,e){return{node:t,index:0,__prev:e}}function Ht(t,e,n,r){var i=Object.create(qn);return i.size=t,i._root=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function Bt(){return Un||(Un=Ht(0))}function Jt(t,n,r){var i,o;if(t._root){var u=e(pn),a=e(_n);if(i=Yt(t._root,t.__ownerID,0,void 0,n,r,u,a),!a.value)return t;o=t.size+(u.value?r===hn?-1:1:0)}else{if(r===hn)return t;o=1,i=new qt(t.__ownerID,[[n,r]])}return t.__ownerID?(t.size=o,t._root=i,t.__hash=void 0,t.__altered=!0,t):i?Ht(o,i):Bt()}function Yt(t,e,r,i,o,u,a,s){return t?t.update(e,r,i,o,u,a,s):u===hn?t:(n(s),n(a),new Vt(e,i,[o,u]))}function Xt(t){return t.constructor===Vt||t.constructor===Gt}function Qt(t,e,n,r,i){if(t.keyHash===r)return new Gt(e,r,[t.entry,i]);var o,u=(0===n?t.keyHash:t.keyHash>>>n)&ln,a=(0===n?r:r>>>n)&ln,s=u===a?[Qt(t,e,n+cn,r,i)]:(o=new Vt(e,r,i),a>u?[t,o]:[o,t]);return new Ut(e,1<<u|1<<a,s)}function Zt(t,e,n,i){t||(t=new r);for(var o=new Vt(t,et(n),[n,i]),u=0;u<e.length;u++){var a=e[u];o=o.update(t,0,void 0,a[0],a[1])}return o}function te(t,e,n,r){for(var i=0,o=0,u=new Array(n),a=0,s=1,c=e.length;c>a;a++,s<<=1){var f=e[a];void 0!==f&&a!==r&&(i|=s,u[o++]=f)}return new Ut(t,i,u)}function ee(t,e,n,r,i){for(var o=0,u=new Array(fn),a=0;0!==n;a++,n>>>=1)u[a]=1&n?e[o++]:void 0;return u[r]=i,new Wt(t,o+1,u)}function ne(t,e,n){for(var r=[],i=0;i<n.length;i++){var o=n[i],u=p(o);d(o)||(u=u.map(function(t){return Y(t)})),r.push(u)}return ie(t,e,r)}function re(t){return function(e,n,r){return e&&e.mergeDeepWith&&d(n)?e.mergeDeepWith(t,n):t?t(e,n,r):n}}function ie(t,e,n){return n=n.filter(function(t){return 0!==t.size}),0===n.length?t:0!==t.size||t.__ownerID||1!==n.length?t.withMutations(function(t){for(var r=e?function(n,r){t.update(r,hn,function(t){return t===hn?n:e(t,n,r)})}:function(e,n){t.set(n,e)},i=0;i<n.length;i++)n[i].forEach(r)}):t.constructor(n[0])}function oe(t,e,n,r){var i=t===hn,o=e.next();if(o.done){var u=i?n:t,a=r(u);return a===u?t:a}ut(i||t&&t.set,"invalid keyPath");var s=o.value,c=i?hn:t.get(s,hn),f=oe(c,e,n,r);return f===c?t:f===hn?t.remove(s):(i?Bt():t).set(s,f)}function ue(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function ae(t,e,n,r){var o=r?t:i(t);return o[e]=n,o}function se(t,e,n,r){var i=t.length+1;if(r&&e+1===i)return t[e]=n,t;for(var o=new Array(i),u=0,a=0;i>a;a++)a===e?(o[a]=n,u=-1):o[a]=t[a+u];return o}function ce(t,e,n){var r=t.length-1;if(n&&e===r)return t.pop(),t;for(var i=new Array(r),o=0,u=0;r>u;u++)u===e&&(o=1),i[u]=t[u+o];return i}function fe(t){var e=ve();if(null===t||void 0===t)return e;if(le(t))return t;var n=_(t),r=n.size;return 0===r?e:(at(r),r>0&&fn>r?_e(0,r,cn,null,new he(n.toArray())):e.withMutations(function(t){t.setSize(r),n.forEach(function(e,n){return t.set(n,e)})}))}function le(t){return!(!t||!t[$n])}function he(t,e){this.array=t,this.ownerID=e}function pe(t,e){function n(t,e,n){return 0===e?r(t,n):i(t,e,n)}function r(t,n){var r=n===a?s&&s.array:t&&t.array,i=n>o?0:o-n,c=u-n;return c>fn&&(c=fn),function(){if(i===c)return Hn;var t=e?--c:i++;return r&&r[t]}}function i(t,r,i){var a,s=t&&t.array,c=i>o?0:o-i>>r,f=(u-i>>r)+1;return f>fn&&(f=fn),function(){for(;;){if(a){var t=a();if(t!==Hn)return t;a=null}if(c===f)return Hn;var o=e?--f:c++;a=n(s&&s[o],r-cn,i+(o<<r))}}}var o=t._origin,u=t._capacity,a=Te(u),s=t._tail;return n(t._root,t._level,0)}function _e(t,e,n,r,i,o,u){var a=Object.create(Fn);return a.size=e-t,a._origin=t,a._capacity=e,a._level=n,a._root=r,a._tail=i,a.__ownerID=o,a.__hash=u,a.__altered=!1,a}function ve(){return Kn||(Kn=_e(0,0,cn))}function de(t,n,r){if(n=u(t,n),n>=t.size||0>n)return t.withMutations(function(t){0>n?we(t,n).set(0,r):we(t,0,n+1).set(n,r)});n+=t._origin;var i=t._tail,o=t._root,a=e(_n);return n>=Te(t._capacity)?i=ye(i,t.__ownerID,0,n,r,a):o=ye(o,t.__ownerID,t._level,n,r,a),a.value?t.__ownerID?(t._root=o,t._tail=i,t.__hash=void 0,t.__altered=!0,t):_e(t._origin,t._capacity,t._level,o,i):t}function ye(t,e,r,i,o,u){var a=i>>>r&ln,s=t&&a<t.array.length;if(!s&&void 0===o)return t;var c;if(r>0){var f=t&&t.array[a],l=ye(f,e,r-cn,i,o,u);return l===f?t:(c=ge(t,e),c.array[a]=l,c)}return s&&t.array[a]===o?t:(n(u),c=ge(t,e),void 0===o&&a===c.array.length-1?c.array.pop():c.array[a]=o,c)}function ge(t,e){return e&&t&&e===t.ownerID?t:new he(t?t.array.slice():[],e)}function me(t,e){if(e>=Te(t._capacity))return t._tail;if(e<1<<t._level+cn){for(var n=t._root,r=t._level;n&&r>0;)n=n.array[e>>>r&ln],r-=cn;return n}}function we(t,e,n){var i=t.__ownerID||new r,o=t._origin,u=t._capacity,a=o+e,s=void 0===n?u:0>n?u+n:o+n;if(a===o&&s===u)return t;if(a>=s)return t.clear();for(var c=t._level,f=t._root,l=0;0>a+l;)f=new he(f&&f.array.length?[void 0,f]:[],i),c+=cn,l+=1<<c;l&&(a+=l,o+=l,s+=l,u+=l);for(var h=Te(u),p=Te(s);p>=1<<c+cn;)f=new he(f&&f.array.length?[f]:[],i),c+=cn;var _=t._tail,v=h>p?me(t,s-1):p>h?new he([],i):_;if(_&&p>h&&u>a&&_.array.length){f=ge(f,i);for(var d=f,y=c;y>cn;y-=cn){var g=h>>>y&ln;d=d.array[g]=ge(d.array[g],i)}d.array[h>>>cn&ln]=_}if(u>s&&(v=v&&v.removeAfter(i,0,s)),a>=p)a-=p,s-=p,c=cn,f=null,v=v&&v.removeBefore(i,0,a);else if(a>o||h>p){for(l=0;f;){var m=a>>>c&ln;if(m!==p>>>c&ln)break;m&&(l+=(1<<c)*m),c-=cn,f=f.array[m]}f&&a>o&&(f=f.removeBefore(i,c,a-l)),f&&h>p&&(f=f.removeAfter(i,c,p-l)),l&&(a-=l,s-=l)}return t.__ownerID?(t.size=s-a,t._origin=a,t._capacity=s,t._level=c,t._root=f,t._tail=v,t.__hash=void 0,t.__altered=!0,t):_e(a,s,c,f,v)}function be(t,e,n){for(var r=[],i=0,o=0;o<n.length;o++){var u=n[o],a=_(u);a.size>i&&(i=a.size),d(u)||(a=a.map(function(t){return Y(t)})),r.push(a)}return i>t.size&&(t=t.setSize(i)),ie(t,e,r)}function Te(t){return fn>t?0:t-1>>>cn<<cn}function Ee(t){return null===t||void 0===t?Se():Oe(t)?t:Se().withMutations(function(e){var n=p(t);at(n.size),n.forEach(function(t,n){return e.set(n,t)})})}function Oe(t){return Pt(t)&&w(t)}function Ie(t,e,n,r){var i=Object.create(Ee.prototype);return i.size=t?t.size:0,i._map=t,i._list=e,i.__ownerID=n,i.__hash=r,i}function Se(){return Bn||(Bn=Ie(Bt(),ve()))}function Ae(t,e,n){var r,i,o=t._map,u=t._list,a=o.get(e),s=void 0!==a;if(n===hn){if(!s)return t;u.size>=fn&&u.size>=2*o.size?(i=u.filter(function(t,e){return void 0!==t&&a!==e}),r=i.toKeyedSeq().map(function(t){return t[0]}).flip().toMap(),t.__ownerID&&(r.__ownerID=i.__ownerID=t.__ownerID)):(r=o.remove(e),i=a===u.size-1?u.pop():u.set(a,void 0))}else if(s){if(n===u.get(a)[1])return t;r=o,i=u.set(a,[e,n])}else r=o.set(e,u.size),i=u.set(u.size,[e,n]);return t.__ownerID?(t.size=r.size,t._map=r,t._list=i,t.__hash=void 0,t):Ie(r,i)}function Ne(t){return null===t||void 0===t?ke():xe(t)?t:ke().unshiftAll(t)}function xe(t){return!(!t||!t[Jn])}function Ce(t,e,n,r){var i=Object.create(Yn);return i.size=t,i._head=e,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function ke(){return Xn||(Xn=Ce(0))}function je(t){return null===t||void 0===t?ze():Me(t)?t:ze().withMutations(function(e){var n=v(t);at(n.size),n.forEach(function(t){return e.add(t)})})}function Me(t){return!(!t||!t[Qn])}function De(t,e){return t.__ownerID?(t.size=e.size,t._map=e,t):e===t._map?t:0===e.size?t.__empty():t.__make(e)}function Re(t,e){var n=Object.create(Zn);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function ze(){return tr||(tr=Re(Bt()))}function Le(t){return null===t||void 0===t?Ue():Pe(t)?t:Ue().withMutations(function(e){var n=v(t);at(n.size),n.forEach(function(t){return e.add(t)})})}function Pe(t){return Me(t)&&w(t)}function qe(t,e){var n=Object.create(er);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function Ue(){return nr||(nr=qe(Se()))}function We(t,e){var n,r=function(o){if(o instanceof r)return o;if(!(this instanceof r))return new r(o);if(!n){n=!0;var u=Object.keys(t);$e(i,u),i.size=u.length,i._name=e,i._keys=u,i._defaultValues=t}this._map=Lt(o)},i=r.prototype=Object.create(rr);return i.constructor=r,r}function Ge(t,e,n){var r=Object.create(Object.getPrototypeOf(t));return r._map=e,r.__ownerID=n,r}function Ve(t){return t._name||t.constructor.name||"Record"}function $e(t,e){try{e.forEach(Fe.bind(void 0,t))}catch(n){}}function Fe(t,e){Object.defineProperty(t,e,{get:function(){return this.get(e)},set:function(t){ut(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}function Ke(t,e){if(t===e)return!0;if(!d(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||y(t)!==y(e)||g(t)!==g(e)||w(t)!==w(e))return!1;if(0===t.size&&0===e.size)return!0;var n=!m(t);if(w(t)){var r=t.entries();return e.every(function(t,e){var i=r.next().value;return i&&J(i[1],t)&&(n||J(i[0],e))})&&r.next().done}var i=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{i=!0;var o=t;t=e,e=o}var u=!0,a=e.__iterate(function(e,r){return(n?t.has(e):i?J(e,t.get(r,hn)):J(t.get(r,hn),e))?void 0:(u=!1,!1)});return u&&t.size===a}function He(t,e,n){if(!(this instanceof He))return new He(t,e,n);if(ut(0!==n,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),n=void 0===n?1:Math.abs(n),t>e&&(n=-n),this._start=t,this._end=e,this._step=n,this.size=Math.max(0,Math.ceil((e-t)/n-1)+1),0===this.size){if(ir)return ir;ir=this}}function Be(t,e){if(!(this instanceof Be))return new Be(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(or)return or;or=this}}function Je(t,e){var n=function(n){t.prototype[n]=e[n]};return Object.keys(e).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(n),t}function Ye(t,e){return e}function Xe(t,e){return[e,t]}function Qe(t){return function(){return!t.apply(this,arguments)}}function Ze(t){return function(){return-t.apply(this,arguments)}}function tn(t){return"string"==typeof t?JSON.stringify(t):t}function en(){return i(arguments)}function nn(t,e){return e>t?1:t>e?-1:0}function rn(t){if(t.size===1/0)return 0;var e=w(t),n=y(t),r=e?1:0,i=t.__iterate(n?e?function(t,e){r=31*r+un(et(t),et(e))|0}:function(t,e){r=r+un(et(t),et(e))|0}:e?function(t){r=31*r+et(t)|0}:function(t){r=r+et(t)|0});return on(i,r)}function on(t,e){return e=Nn(e,3432918353),e=Nn(e<<15|e>>>-15,461845907),e=Nn(e<<13|e>>>-13,5),e=(e+3864292196|0)^t,e=Nn(e^e>>>16,2246822507),e=Nn(e^e>>>13,3266489909),e=tt(e^e>>>16)}function un(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}var an=Array.prototype.slice,sn="delete",cn=5,fn=1<<cn,ln=fn-1,hn={},pn={value:!1},_n={value:!1};t(p,h),t(_,h),t(v,h),h.isIterable=d,h.isKeyed=y,h.isIndexed=g,h.isAssociative=m,h.isOrdered=w,h.Keyed=p,h.Indexed=_,h.Set=v;var vn="@@__IMMUTABLE_ITERABLE__@@",dn="@@__IMMUTABLE_KEYED__@@",yn="@@__IMMUTABLE_INDEXED__@@",gn="@@__IMMUTABLE_ORDERED__@@",mn=0,wn=1,bn=2,Tn="function"==typeof Symbol&&Symbol.iterator,En="@@iterator",On=Tn||En;b.prototype.toString=function(){return"[Iterator]"},b.KEYS=mn,b.VALUES=wn,b.ENTRIES=bn,b.prototype.inspect=b.prototype.toSource=function(){return this.toString()},b.prototype[On]=function(){return this},t(x,h),x.of=function(){return x(arguments)},x.prototype.toSeq=function(){return this},x.prototype.toString=function(){return this.__toString("Seq {","}")},x.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},x.prototype.__iterate=function(t,e){return V(this,t,e,!0)},x.prototype.__iterator=function(t,e){return $(this,t,e,!0)},t(C,x),C.prototype.toKeyedSeq=function(){return this},t(k,x),k.of=function(){return k(arguments)},k.prototype.toIndexedSeq=function(){return this},k.prototype.toString=function(){return this.__toString("Seq [","]")},k.prototype.__iterate=function(t,e){return V(this,t,e,!1)},k.prototype.__iterator=function(t,e){return $(this,t,e,!1)},t(j,x),j.of=function(){return j(arguments)},j.prototype.toSetSeq=function(){return this},x.isSeq=L,x.Keyed=C,x.Set=j,x.Indexed=k;var In="@@__IMMUTABLE_SEQ__@@";x.prototype[In]=!0,t(M,k),M.prototype.get=function(t,e){return this.has(t)?this._array[u(this,t)]:e},M.prototype.__iterate=function(t,e){for(var n=this._array,r=n.length-1,i=0;r>=i;i++)if(t(n[e?r-i:i],i,this)===!1)return i+1;return i},M.prototype.__iterator=function(t,e){var n=this._array,r=n.length-1,i=0;return new b(function(){return i>r?E():T(t,i,n[e?r-i++:i++])})},t(D,C),D.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},D.prototype.has=function(t){return this._object.hasOwnProperty(t)},D.prototype.__iterate=function(t,e){for(var n=this._object,r=this._keys,i=r.length-1,o=0;i>=o;o++){var u=r[e?i-o:o];if(t(n[u],u,this)===!1)return o+1}return o},D.prototype.__iterator=function(t,e){var n=this._object,r=this._keys,i=r.length-1,o=0;return new b(function(){var u=r[e?i-o:o];return o++>i?E():T(t,u,n[u])})},D.prototype[gn]=!0,t(R,k),R.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var n=this._iterable,r=S(n),i=0;if(I(r))for(var o;!(o=r.next()).done&&t(o.value,i++,this)!==!1;);return i},R.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=this._iterable,r=S(n);if(!I(r))return new b(E);var i=0;return new b(function(){var e=r.next();return e.done?e:T(t,i++,e.value)})},t(z,k),z.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var n=this._iterator,r=this._iteratorCache,i=0;i<r.length;)if(t(r[i],i++,this)===!1)return i;for(var o;!(o=n.next()).done;){var u=o.value;if(r[i]=u,t(u,i++,this)===!1)break}return i},z.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=this._iterator,r=this._iteratorCache,i=0;return new b(function(){if(i>=r.length){var e=n.next();if(e.done)return e;r[i]=e.value}return T(t,i,r[i++])})};var Sn;t(F,h),t(K,F),t(H,F),t(B,F),F.Keyed=K,F.Indexed=H,F.Set=B;var An,Nn="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){t=0|t,e=0|e;var n=65535&t,r=65535&e;return n*r+((t>>>16)*r+n*(e>>>16)<<16>>>0)|0},xn=Object.isExtensible,Cn=function(){try{return Object.defineProperty({},"@",{}),!0}catch(t){return!1}}(),kn="function"==typeof WeakMap;kn&&(An=new WeakMap);var jn=0,Mn="__immutablehash__";"function"==typeof Symbol&&(Mn=Symbol(Mn));var Dn=16,Rn=255,zn=0,Ln={};t(st,C),st.prototype.get=function(t,e){return this._iter.get(t,e)},st.prototype.has=function(t){return this._iter.has(t)},st.prototype.valueSeq=function(){return this._iter.valueSeq()},st.prototype.reverse=function(){var t=this,e=_t(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},st.prototype.map=function(t,e){var n=this,r=pt(this,t,e);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(t,e)}),r},st.prototype.__iterate=function(t,e){var n,r=this;return this._iter.__iterate(this._useKeys?function(e,n){return t(e,n,r)}:(n=e?kt(this):0,function(i){return t(i,e?--n:n++,r)}),e)},st.prototype.__iterator=function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var n=this._iter.__iterator(wn,e),r=e?kt(this):0;return new b(function(){var i=n.next();return i.done?i:T(t,e?--r:r++,i.value,i)})},st.prototype[gn]=!0,t(ct,k),ct.prototype.includes=function(t){return this._iter.includes(t)},ct.prototype.__iterate=function(t,e){var n=this,r=0;return this._iter.__iterate(function(e){return t(e,r++,n)},e)},ct.prototype.__iterator=function(t,e){var n=this._iter.__iterator(wn,e),r=0;return new b(function(){var e=n.next();return e.done?e:T(t,r++,e.value,e)})},t(ft,j),ft.prototype.has=function(t){return this._iter.includes(t)},ft.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate(function(e){return t(e,e,n)},e)},ft.prototype.__iterator=function(t,e){var n=this._iter.__iterator(wn,e);return new b(function(){var e=n.next();return e.done?e:T(t,e.value,e.value,e)})},t(lt,C),lt.prototype.entrySeq=function(){return this._iter.toSeq()},lt.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate(function(e){if(e){Ct(e);var r=d(e);return t(r?e.get(1):e[1],r?e.get(0):e[0],n)}},e)},lt.prototype.__iterator=function(t,e){var n=this._iter.__iterator(wn,e);return new b(function(){for(;;){var e=n.next();if(e.done)return e;var r=e.value;if(r){Ct(r);var i=d(r);return T(t,i?r.get(0):r[0],i?r.get(1):r[1],e)}}})},ct.prototype.cacheResult=st.prototype.cacheResult=ft.prototype.cacheResult=lt.prototype.cacheResult=Dt,t(Lt,K),Lt.prototype.toString=function(){return this.__toString("Map {","}")},Lt.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},Lt.prototype.set=function(t,e){return Jt(this,t,e)},Lt.prototype.setIn=function(t,e){return this.updateIn(t,hn,function(){return e})},Lt.prototype.remove=function(t){return Jt(this,t,hn)},Lt.prototype.deleteIn=function(t){return this.updateIn(t,function(){return hn})},Lt.prototype.update=function(t,e,n){return 1===arguments.length?t(this):this.updateIn([t],e,n)},Lt.prototype.updateIn=function(t,e,n){n||(n=e,e=void 0);var r=oe(this,zt(t),e,n);return r===hn?void 0:r},Lt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Bt()},Lt.prototype.merge=function(){return ne(this,void 0,arguments)},Lt.prototype.mergeWith=function(t){var e=an.call(arguments,1);return ne(this,t,e)},Lt.prototype.mergeIn=function(t){var e=an.call(arguments,1);return this.updateIn(t,Bt(),function(t){return t.merge.apply(t,e)})},Lt.prototype.mergeDeep=function(){return ne(this,re(void 0),arguments)},Lt.prototype.mergeDeepWith=function(t){var e=an.call(arguments,1);return ne(this,re(t),e)},Lt.prototype.mergeDeepIn=function(t){var e=an.call(arguments,1);return this.updateIn(t,Bt(),function(t){return t.mergeDeep.apply(t,e)})},Lt.prototype.sort=function(t){return Ee(It(this,t))},Lt.prototype.sortBy=function(t,e){return Ee(It(this,e,t))},Lt.prototype.withMutations=function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},Lt.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new r)},Lt.prototype.asImmutable=function(){return this.__ensureOwner()},Lt.prototype.wasAltered=function(){return this.__altered},Lt.prototype.__iterator=function(t,e){return new $t(this,t,e)},Lt.prototype.__iterate=function(t,e){var n=this,r=0;return this._root&&this._root.iterate(function(e){return r++,t(e[1],e[0],n)},e),r},Lt.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Ht(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Lt.isMap=Pt;
|
||
|
||
var Pn="@@__IMMUTABLE_MAP__@@",qn=Lt.prototype;qn[Pn]=!0,qn[sn]=qn.remove,qn.removeIn=qn.deleteIn,qt.prototype.get=function(t,e,n,r){for(var i=this.entries,o=0,u=i.length;u>o;o++)if(J(n,i[o][0]))return i[o][1];return r},qt.prototype.update=function(t,e,r,o,u,a,s){for(var c=u===hn,f=this.entries,l=0,h=f.length;h>l&&!J(o,f[l][0]);l++);var p=h>l;if(p?f[l][1]===u:c)return this;if(n(s),(c||!p)&&n(a),!c||1!==f.length){if(!p&&!c&&f.length>=Wn)return Zt(t,f,o,u);var _=t&&t===this.ownerID,v=_?f:i(f);return p?c?l===h-1?v.pop():v[l]=v.pop():v[l]=[o,u]:v.push([o,u]),_?(this.entries=v,this):new qt(t,v)}},Ut.prototype.get=function(t,e,n,r){void 0===e&&(e=et(n));var i=1<<((0===t?e:e>>>t)&ln),o=this.bitmap;return 0===(o&i)?r:this.nodes[ue(o&i-1)].get(t+cn,e,n,r)},Ut.prototype.update=function(t,e,n,r,i,o,u){void 0===n&&(n=et(r));var a=(0===e?n:n>>>e)&ln,s=1<<a,c=this.bitmap,f=0!==(c&s);if(!f&&i===hn)return this;var l=ue(c&s-1),h=this.nodes,p=f?h[l]:void 0,_=Yt(p,t,e+cn,n,r,i,o,u);if(_===p)return this;if(!f&&_&&h.length>=Gn)return ee(t,h,c,a,_);if(f&&!_&&2===h.length&&Xt(h[1^l]))return h[1^l];if(f&&_&&1===h.length&&Xt(_))return _;var v=t&&t===this.ownerID,d=f?_?c:c^s:c|s,y=f?_?ae(h,l,_,v):ce(h,l,v):se(h,l,_,v);return v?(this.bitmap=d,this.nodes=y,this):new Ut(t,d,y)},Wt.prototype.get=function(t,e,n,r){void 0===e&&(e=et(n));var i=(0===t?e:e>>>t)&ln,o=this.nodes[i];return o?o.get(t+cn,e,n,r):r},Wt.prototype.update=function(t,e,n,r,i,o,u){void 0===n&&(n=et(r));var a=(0===e?n:n>>>e)&ln,s=i===hn,c=this.nodes,f=c[a];if(s&&!f)return this;var l=Yt(f,t,e+cn,n,r,i,o,u);if(l===f)return this;var h=this.count;if(f){if(!l&&(h--,Vn>h))return te(t,c,h,a)}else h++;var p=t&&t===this.ownerID,_=ae(c,a,l,p);return p?(this.count=h,this.nodes=_,this):new Wt(t,h,_)},Gt.prototype.get=function(t,e,n,r){for(var i=this.entries,o=0,u=i.length;u>o;o++)if(J(n,i[o][0]))return i[o][1];return r},Gt.prototype.update=function(t,e,r,o,u,a,s){void 0===r&&(r=et(o));var c=u===hn;if(r!==this.keyHash)return c?this:(n(s),n(a),Qt(this,t,e,r,[o,u]));for(var f=this.entries,l=0,h=f.length;h>l&&!J(o,f[l][0]);l++);var p=h>l;if(p?f[l][1]===u:c)return this;if(n(s),(c||!p)&&n(a),c&&2===h)return new Vt(t,this.keyHash,f[1^l]);var _=t&&t===this.ownerID,v=_?f:i(f);return p?c?l===h-1?v.pop():v[l]=v.pop():v[l]=[o,u]:v.push([o,u]),_?(this.entries=v,this):new Gt(t,this.keyHash,v)},Vt.prototype.get=function(t,e,n,r){return J(n,this.entry[0])?this.entry[1]:r},Vt.prototype.update=function(t,e,r,i,o,u,a){var s=o===hn,c=J(i,this.entry[0]);return(c?o===this.entry[1]:s)?this:(n(a),s?void n(u):c?t&&t===this.ownerID?(this.entry[1]=o,this):new Vt(t,this.keyHash,[i,o]):(n(u),Qt(this,t,e,et(i),[i,o])))},qt.prototype.iterate=Gt.prototype.iterate=function(t,e){for(var n=this.entries,r=0,i=n.length-1;i>=r;r++)if(t(n[e?i-r:r])===!1)return!1},Ut.prototype.iterate=Wt.prototype.iterate=function(t,e){for(var n=this.nodes,r=0,i=n.length-1;i>=r;r++){var o=n[e?i-r:r];if(o&&o.iterate(t,e)===!1)return!1}},Vt.prototype.iterate=function(t,e){return t(this.entry)},t($t,b),$t.prototype.next=function(){for(var t=this._type,e=this._stack;e;){var n,r=e.node,i=e.index++;if(r.entry){if(0===i)return Ft(t,r.entry)}else if(r.entries){if(n=r.entries.length-1,n>=i)return Ft(t,r.entries[this._reverse?n-i:i])}else if(n=r.nodes.length-1,n>=i){var o=r.nodes[this._reverse?n-i:i];if(o){if(o.entry)return Ft(t,o.entry);e=this._stack=Kt(o,e)}continue}e=this._stack=this._stack.__prev}return E()};var Un,Wn=fn/4,Gn=fn/2,Vn=fn/4;t(fe,H),fe.of=function(){return this(arguments)},fe.prototype.toString=function(){return this.__toString("List [","]")},fe.prototype.get=function(t,e){if(t=u(this,t),0>t||t>=this.size)return e;t+=this._origin;var n=me(this,t);return n&&n.array[t&ln]},fe.prototype.set=function(t,e){return de(this,t,e)},fe.prototype.remove=function(t){return this.has(t)?0===t?this.shift():t===this.size-1?this.pop():this.splice(t,1):this},fe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=cn,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):ve()},fe.prototype.push=function(){var t=arguments,e=this.size;return this.withMutations(function(n){we(n,0,e+t.length);for(var r=0;r<t.length;r++)n.set(e+r,t[r])})},fe.prototype.pop=function(){return we(this,0,-1)},fe.prototype.unshift=function(){var t=arguments;return this.withMutations(function(e){we(e,-t.length);for(var n=0;n<t.length;n++)e.set(n,t[n])})},fe.prototype.shift=function(){return we(this,1)},fe.prototype.merge=function(){return be(this,void 0,arguments)},fe.prototype.mergeWith=function(t){var e=an.call(arguments,1);return be(this,t,e)},fe.prototype.mergeDeep=function(){return be(this,re(void 0),arguments)},fe.prototype.mergeDeepWith=function(t){var e=an.call(arguments,1);return be(this,re(t),e)},fe.prototype.setSize=function(t){return we(this,0,t)},fe.prototype.slice=function(t,e){var n=this.size;return s(t,e,n)?this:we(this,c(t,n),f(e,n))},fe.prototype.__iterator=function(t,e){var n=0,r=pe(this,e);return new b(function(){var e=r();return e===Hn?E():T(t,n++,e)})},fe.prototype.__iterate=function(t,e){for(var n,r=0,i=pe(this,e);(n=i())!==Hn&&t(n,r++,this)!==!1;);return r},fe.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?_e(this._origin,this._capacity,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)},fe.isList=le;var $n="@@__IMMUTABLE_LIST__@@",Fn=fe.prototype;Fn[$n]=!0,Fn[sn]=Fn.remove,Fn.setIn=qn.setIn,Fn.deleteIn=Fn.removeIn=qn.removeIn,Fn.update=qn.update,Fn.updateIn=qn.updateIn,Fn.mergeIn=qn.mergeIn,Fn.mergeDeepIn=qn.mergeDeepIn,Fn.withMutations=qn.withMutations,Fn.asMutable=qn.asMutable,Fn.asImmutable=qn.asImmutable,Fn.wasAltered=qn.wasAltered,he.prototype.removeBefore=function(t,e,n){if(n===e?1<<e:0||0===this.array.length)return this;var r=n>>>e&ln;if(r>=this.array.length)return new he([],t);var i,o=0===r;if(e>0){var u=this.array[r];if(i=u&&u.removeBefore(t,e-cn,n),i===u&&o)return this}if(o&&!i)return this;var a=ge(this,t);if(!o)for(var s=0;r>s;s++)a.array[s]=void 0;return i&&(a.array[r]=i),a},he.prototype.removeAfter=function(t,e,n){if(n===e?1<<e:0||0===this.array.length)return this;var r=n-1>>>e&ln;if(r>=this.array.length)return this;var i,o=r===this.array.length-1;if(e>0){var u=this.array[r];if(i=u&&u.removeAfter(t,e-cn,n),i===u&&o)return this}if(o&&!i)return this;var a=ge(this,t);return o||a.array.pop(),i&&(a.array[r]=i),a};var Kn,Hn={};t(Ee,Lt),Ee.of=function(){return this(arguments)},Ee.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Ee.prototype.get=function(t,e){var n=this._map.get(t);return void 0!==n?this._list.get(n)[1]:e},Ee.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):Se()},Ee.prototype.set=function(t,e){return Ae(this,t,e)},Ee.prototype.remove=function(t){return Ae(this,t,hn)},Ee.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Ee.prototype.__iterate=function(t,e){var n=this;return this._list.__iterate(function(e){return e&&t(e[1],e[0],n)},e)},Ee.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},Ee.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._list.__ensureOwner(t);return t?Ie(e,n,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=n,this)},Ee.isOrderedMap=Oe,Ee.prototype[gn]=!0,Ee.prototype[sn]=Ee.prototype.remove;var Bn;t(Ne,H),Ne.of=function(){return this(arguments)},Ne.prototype.toString=function(){return this.__toString("Stack [","]")},Ne.prototype.get=function(t,e){var n=this._head;for(t=u(this,t);n&&t--;)n=n.next;return n?n.value:e},Ne.prototype.peek=function(){return this._head&&this._head.value},Ne.prototype.push=function(){if(0===arguments.length)return this;for(var t=this.size+arguments.length,e=this._head,n=arguments.length-1;n>=0;n--)e={value:arguments[n],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):Ce(t,e)},Ne.prototype.pushAll=function(t){if(t=_(t),0===t.size)return this;at(t.size);var e=this.size,n=this._head;return t.reverse().forEach(function(t){e++,n={value:t,next:n}}),this.__ownerID?(this.size=e,this._head=n,this.__hash=void 0,this.__altered=!0,this):Ce(e,n)},Ne.prototype.pop=function(){return this.slice(1)},Ne.prototype.unshift=function(){return this.push.apply(this,arguments)},Ne.prototype.unshiftAll=function(t){return this.pushAll(t)},Ne.prototype.shift=function(){return this.pop.apply(this,arguments)},Ne.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):ke()},Ne.prototype.slice=function(t,e){if(s(t,e,this.size))return this;var n=c(t,this.size),r=f(e,this.size);if(r!==this.size)return H.prototype.slice.call(this,t,e);for(var i=this.size-n,o=this._head;n--;)o=o.next;return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):Ce(i,o)},Ne.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Ce(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Ne.prototype.__iterate=function(t,e){if(e)return this.reverse().__iterate(t);for(var n=0,r=this._head;r&&t(r.value,n++,this)!==!1;)r=r.next;return n},Ne.prototype.__iterator=function(t,e){if(e)return this.reverse().__iterator(t);var n=0,r=this._head;return new b(function(){if(r){var e=r.value;return r=r.next,T(t,n++,e)}return E()})},Ne.isStack=xe;var Jn="@@__IMMUTABLE_STACK__@@",Yn=Ne.prototype;Yn[Jn]=!0,Yn.withMutations=qn.withMutations,Yn.asMutable=qn.asMutable,Yn.asImmutable=qn.asImmutable,Yn.wasAltered=qn.wasAltered;var Xn;t(je,B),je.of=function(){return this(arguments)},je.fromKeys=function(t){return this(p(t).keySeq())},je.prototype.toString=function(){return this.__toString("Set {","}")},je.prototype.has=function(t){return this._map.has(t)},je.prototype.add=function(t){return De(this,this._map.set(t,!0))},je.prototype.remove=function(t){return De(this,this._map.remove(t))},je.prototype.clear=function(){return De(this,this._map.clear())},je.prototype.union=function(){var t=an.call(arguments,0);return t=t.filter(function(t){return 0!==t.size}),0===t.length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations(function(e){for(var n=0;n<t.length;n++)v(t[n]).forEach(function(t){return e.add(t)})}):this.constructor(t[0])},je.prototype.intersect=function(){var t=an.call(arguments,0);if(0===t.length)return this;t=t.map(function(t){return v(t)});var e=this;return this.withMutations(function(n){e.forEach(function(e){t.every(function(t){return t.includes(e)})||n.remove(e)})})},je.prototype.subtract=function(){var t=an.call(arguments,0);if(0===t.length)return this;t=t.map(function(t){return v(t)});var e=this;return this.withMutations(function(n){e.forEach(function(e){t.some(function(t){return t.includes(e)})&&n.remove(e)})})},je.prototype.merge=function(){return this.union.apply(this,arguments)},je.prototype.mergeWith=function(t){var e=an.call(arguments,1);return this.union.apply(this,e)},je.prototype.sort=function(t){return Le(It(this,t))},je.prototype.sortBy=function(t,e){return Le(It(this,e,t))},je.prototype.wasAltered=function(){return this._map.wasAltered()},je.prototype.__iterate=function(t,e){var n=this;return this._map.__iterate(function(e,r){return t(r,r,n)},e)},je.prototype.__iterator=function(t,e){return this._map.map(function(t,e){return e}).__iterator(t,e)},je.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?this.__make(e,t):(this.__ownerID=t,this._map=e,this)},je.isSet=Me;var Qn="@@__IMMUTABLE_SET__@@",Zn=je.prototype;Zn[Qn]=!0,Zn[sn]=Zn.remove,Zn.mergeDeep=Zn.merge,Zn.mergeDeepWith=Zn.mergeWith,Zn.withMutations=qn.withMutations,Zn.asMutable=qn.asMutable,Zn.asImmutable=qn.asImmutable,Zn.__empty=ze,Zn.__make=Re;var tr;t(Le,je),Le.of=function(){return this(arguments)},Le.fromKeys=function(t){return this(p(t).keySeq())},Le.prototype.toString=function(){return this.__toString("OrderedSet {","}")},Le.isOrderedSet=Pe;var er=Le.prototype;er[gn]=!0,er.__empty=Ue,er.__make=qe;var nr;t(We,K),We.prototype.toString=function(){return this.__toString(Ve(this)+" {","}")},We.prototype.has=function(t){return this._defaultValues.hasOwnProperty(t)},We.prototype.get=function(t,e){if(!this.has(t))return e;var n=this._defaultValues[t];return this._map?this._map.get(t,n):n},We.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var t=this.constructor;return t._empty||(t._empty=Ge(this,Bt()))},We.prototype.set=function(t,e){if(!this.has(t))throw new Error('Cannot set unknown key "'+t+'" on '+Ve(this));var n=this._map&&this._map.set(t,e);return this.__ownerID||n===this._map?this:Ge(this,n)},We.prototype.remove=function(t){if(!this.has(t))return this;var e=this._map&&this._map.remove(t);return this.__ownerID||e===this._map?this:Ge(this,e)},We.prototype.wasAltered=function(){return this._map.wasAltered()},We.prototype.__iterator=function(t,e){var n=this;return p(this._defaultValues).map(function(t,e){return n.get(e)}).__iterator(t,e)},We.prototype.__iterate=function(t,e){var n=this;return p(this._defaultValues).map(function(t,e){return n.get(e)}).__iterate(t,e)},We.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?Ge(this,e,t):(this.__ownerID=t,this._map=e,this)};var rr=We.prototype;rr[sn]=rr.remove,rr.deleteIn=rr.removeIn=qn.removeIn,rr.merge=qn.merge,rr.mergeWith=qn.mergeWith,rr.mergeIn=qn.mergeIn,rr.mergeDeep=qn.mergeDeep,rr.mergeDeepWith=qn.mergeDeepWith,rr.mergeDeepIn=qn.mergeDeepIn,rr.setIn=qn.setIn,rr.update=qn.update,rr.updateIn=qn.updateIn,rr.withMutations=qn.withMutations,rr.asMutable=qn.asMutable,rr.asImmutable=qn.asImmutable,t(He,k),He.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(this._step>1?" by "+this._step:"")+" ]"},He.prototype.get=function(t,e){return this.has(t)?this._start+u(this,t)*this._step:e},He.prototype.includes=function(t){var e=(t-this._start)/this._step;return e>=0&&e<this.size&&e===Math.floor(e)},He.prototype.slice=function(t,e){return s(t,e,this.size)?this:(t=c(t,this.size),e=f(e,this.size),t>=e?new He(0,0):new He(this.get(t,this._end),this.get(e,this._end),this._step))},He.prototype.indexOf=function(t){var e=t-this._start;if(e%this._step===0){var n=e/this._step;if(n>=0&&n<this.size)return n}return-1},He.prototype.lastIndexOf=function(t){return this.indexOf(t)},He.prototype.__iterate=function(t,e){for(var n=this.size-1,r=this._step,i=e?this._start+n*r:this._start,o=0;n>=o;o++){if(t(i,o,this)===!1)return o+1;i+=e?-r:r}return o},He.prototype.__iterator=function(t,e){var n=this.size-1,r=this._step,i=e?this._start+n*r:this._start,o=0;return new b(function(){var u=i;return i+=e?-r:r,o>n?E():T(t,o++,u)})},He.prototype.equals=function(t){return t instanceof He?this._start===t._start&&this._end===t._end&&this._step===t._step:Ke(this,t)};var ir;t(Be,k),Be.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},Be.prototype.get=function(t,e){return this.has(t)?this._value:e},Be.prototype.includes=function(t){return J(this._value,t)},Be.prototype.slice=function(t,e){var n=this.size;return s(t,e,n)?this:new Be(this._value,f(e,n)-c(t,n))},Be.prototype.reverse=function(){return this},Be.prototype.indexOf=function(t){return J(this._value,t)?0:-1},Be.prototype.lastIndexOf=function(t){return J(this._value,t)?this.size:-1},Be.prototype.__iterate=function(t,e){for(var n=0;n<this.size;n++)if(t(this._value,n,this)===!1)return n+1;return n},Be.prototype.__iterator=function(t,e){var n=this,r=0;return new b(function(){return r<n.size?T(t,r++,n._value):E()})},Be.prototype.equals=function(t){return t instanceof Be?J(this._value,t._value):Ke(t)};var or;h.Iterator=b,Je(h,{toArray:function(){at(this.size);var t=new Array(this.size||0);return this.valueSeq().__iterate(function(e,n){t[n]=e}),t},toIndexedSeq:function(){return new ct(this)},toJS:function(){return this.toSeq().map(function(t){return t&&"function"==typeof t.toJS?t.toJS():t}).__toJS()},toJSON:function(){return this.toSeq().map(function(t){return t&&"function"==typeof t.toJSON?t.toJSON():t}).__toJS()},toKeyedSeq:function(){return new st(this,!0)},toMap:function(){return Lt(this.toKeyedSeq())},toObject:function(){at(this.size);var t={};return this.__iterate(function(e,n){t[n]=e}),t},toOrderedMap:function(){return Ee(this.toKeyedSeq())},toOrderedSet:function(){return Le(y(this)?this.valueSeq():this)},toSet:function(){return je(y(this)?this.valueSeq():this)},toSetSeq:function(){return new ft(this)},toSeq:function(){return g(this)?this.toIndexedSeq():y(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Ne(y(this)?this.valueSeq():this)},toList:function(){return fe(y(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(t,e){return 0===this.size?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){var t=an.call(arguments,0);return xt(this,bt(this,t))},contains:function(t){return this.includes(t)},includes:function(t){return this.some(function(e){return J(e,t)})},entries:function(){return this.__iterator(bn)},every:function(t,e){at(this.size);var n=!0;return this.__iterate(function(r,i,o){return t.call(e,r,i,o)?void 0:(n=!1,!1)}),n},filter:function(t,e){return xt(this,vt(this,t,e,!0))},find:function(t,e,n){var r=this.findEntry(t,e);return r?r[1]:n},findEntry:function(t,e){var n;return this.__iterate(function(r,i,o){return t.call(e,r,i,o)?(n=[i,r],!1):void 0}),n},findLastEntry:function(t,e){return this.toSeq().reverse().findEntry(t,e)},forEach:function(t,e){return at(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){at(this.size),t=void 0!==t?""+t:",";var e="",n=!0;return this.__iterate(function(r){n?n=!1:e+=t,e+=null!==r&&void 0!==r?r.toString():""}),e},keys:function(){return this.__iterator(mn)},map:function(t,e){return xt(this,pt(this,t,e))},reduce:function(t,e,n){at(this.size);var r,i;return arguments.length<2?i=!0:r=e,this.__iterate(function(e,o,u){i?(i=!1,r=e):r=t.call(n,r,e,o,u)}),r},reduceRight:function(t,e,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return xt(this,_t(this,!0))},slice:function(t,e){return xt(this,gt(this,t,e,!0))},some:function(t,e){return!this.every(Qe(t),e)},sort:function(t){return xt(this,It(this,t))},values:function(){return this.__iterator(wn)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(t,e){return o(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return dt(this,t,e)},equals:function(t){return Ke(this,t)},entrySeq:function(){var t=this;if(t._cache)return new M(t._cache);var e=t.toSeq().map(Xe).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(Qe(t),e)},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},first:function(){return this.find(a)},flatMap:function(t,e){return xt(this,Et(this,t,e))},flatten:function(t){return xt(this,Tt(this,t,!0))},fromEntrySeq:function(){return new lt(this)},get:function(t,e){return this.find(function(e,n){return J(n,t)},void 0,e)},getIn:function(t,e){for(var n,r=this,i=zt(t);!(n=i.next()).done;){var o=n.value;if(r=r&&r.get?r.get(o,hn):hn,r===hn)return e}return r},groupBy:function(t,e){return yt(this,t,e)},has:function(t){return this.get(t,hn)!==hn},hasIn:function(t){return this.getIn(t,hn)!==hn},isSubset:function(t){return t="function"==typeof t.includes?t:h(t),this.every(function(e){return t.includes(e)})},isSuperset:function(t){return t.isSubset(this)},keySeq:function(){return this.toSeq().map(Ye).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},max:function(t){return St(this,t)},maxBy:function(t,e){return St(this,e,t)},min:function(t){return St(this,t?Ze(t):nn)},minBy:function(t,e){return St(this,e?Ze(e):nn,t)},rest:function(){return this.slice(1)},skip:function(t){return this.slice(Math.max(0,t))},skipLast:function(t){return xt(this,this.toSeq().reverse().skip(t).reverse())},skipWhile:function(t,e){return xt(this,wt(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(Qe(t),e)},sortBy:function(t,e){return xt(this,It(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return xt(this,this.toSeq().reverse().take(t).reverse())},takeWhile:function(t,e){return xt(this,mt(this,t,e))},takeUntil:function(t,e){return this.takeWhile(Qe(t),e)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=rn(this))}});var ur=h.prototype;ur[vn]=!0,ur[On]=ur.values,ur.__toJS=ur.toArray,ur.__toStringMapper=tn,ur.inspect=ur.toSource=function(){return this.toString()},ur.chain=ur.flatMap,function(){try{Object.defineProperty(ur,"length",{get:function(){if(!h.noLengthWarning){var t;try{throw new Error}catch(e){t=e.stack}if(-1===t.indexOf("_wrapObject"))return console&&console.warn&&console.warn("iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. "+t),this.size}}})}catch(t){}}(),Je(p,{flip:function(){return xt(this,ht(this))},findKey:function(t,e){var n=this.findEntry(t,e);return n&&n[0]},findLastKey:function(t,e){return this.toSeq().reverse().findKey(t,e)},keyOf:function(t){return this.findKey(function(e){return J(e,t)})},lastKeyOf:function(t){return this.findLastKey(function(e){return J(e,t)})},mapEntries:function(t,e){var n=this,r=0;return xt(this,this.toSeq().map(function(i,o){return t.call(e,[o,i],r++,n)}).fromEntrySeq())},mapKeys:function(t,e){var n=this;return xt(this,this.toSeq().flip().map(function(r,i){return t.call(e,r,i,n)}).flip())}});var ar=p.prototype;ar[dn]=!0,ar[On]=ur.entries,ar.__toJS=ur.toObject,ar.__toStringMapper=function(t,e){return JSON.stringify(e)+": "+tn(t)},Je(_,{toKeyedSeq:function(){return new st(this,!1)},filter:function(t,e){return xt(this,vt(this,t,e,!1))},findIndex:function(t,e){var n=this.findEntry(t,e);return n?n[0]:-1},indexOf:function(t){var e=this.toKeyedSeq().keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){return this.toSeq().reverse().indexOf(t)},reverse:function(){return xt(this,_t(this,!1))},slice:function(t,e){return xt(this,gt(this,t,e,!1))},splice:function(t,e){var n=arguments.length;if(e=Math.max(0|e,0),0===n||2===n&&!e)return this;t=c(t,this.size);var r=this.slice(0,t);return xt(this,1===n?r:r.concat(i(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var n=this.toKeyedSeq().findLastKey(t,e);return void 0===n?-1:n},first:function(){return this.get(0)},flatten:function(t){return xt(this,Tt(this,t,!1))},get:function(t,e){return t=u(this,t),0>t||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find(function(e,n){return n===t},void 0,e)},has:function(t){return t=u(this,t),t>=0&&(void 0!==this.size?this.size===1/0||t<this.size:-1!==this.indexOf(t))},interpose:function(t){return xt(this,Ot(this,t))},interleave:function(){var t=[this].concat(i(arguments)),e=Nt(this.toSeq(),k.of,t),n=e.flatten(!0);return e.size&&(n.size=e.size*t.length),xt(this,n)},last:function(){return this.get(-1)},skipWhile:function(t,e){return xt(this,wt(this,t,e,!1))},zip:function(){var t=[this].concat(i(arguments));return xt(this,Nt(this,en,t))},zipWith:function(t){var e=i(arguments);return e[0]=this,xt(this,Nt(this,t,e))}}),_.prototype[yn]=!0,_.prototype[gn]=!0,Je(v,{get:function(t,e){return this.has(t)?t:e},includes:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}}),v.prototype.has=ur.includes,Je(C,p.prototype),Je(k,_.prototype),Je(j,v.prototype),Je(K,p.prototype),Je(H,_.prototype),Je(B,v.prototype);var sr={Iterable:h,Seq:x,Collection:F,Map:Lt,OrderedMap:Ee,List:fe,Stack:Ne,Set:je,OrderedSet:Le,Record:We,Range:He,Repeat:Be,is:J,fromJS:Y};return sr})},/*!*************************!*\
|
||
!*** ./src/call_api.js ***!
|
||
\*************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t&&t.__esModule?t:{"default":t}},i=n(/*! ./stores/auth */19),o=r(i),u=function(t,e){var n=void 0===arguments[2]?null:arguments[2],r=void 0===arguments[3]?{}:arguments[3],i=r.authToken||o["default"].authToken,u=o["default"].host+"/api/"+e;return new Promise(function(e,r){var o=new XMLHttpRequest;o.open(t,u,!0),o.setRequestHeader("X-HA-access",i),o.onload=function(){if(o.status>199&&o.status<300)e(JSON.parse(o.responseText));else try{r(JSON.parse(o.responseText))}catch(t){r({})}},o.onerror=function(){return r({})},n?o.send(JSON.stringify(n)):o.send()})};e["default"]=u,t.exports=e["default"]},/*!**********************************!*\
|
||
!*** ./~/lodash/lang/isArray.js ***!
|
||
\**********************************/
|
||
function(t,e,n){var r=n(/*! ../internal/isLength */7),i=n(/*! ./isNative */48),o=n(/*! ../internal/isObjectLike */12),u="[object Array]",a=Object.prototype,s=a.toString,c=i(c=Array.isArray)&&c,f=c||function(t){return o(t)&&r(t.length)&&s.call(t)==u};t.exports=f},/*!***************************************!*\
|
||
!*** ./~/lodash/internal/isLength.js ***!
|
||
\***************************************/
|
||
function(t,e,n){function r(t){return"number"==typeof t&&t>-1&&t%1==0&&i>=t}var i=Math.pow(2,53)-1;t.exports=r},/*!***************************************!*\
|
||
!*** ./~/lodash/internal/toObject.js ***!
|
||
\***************************************/
|
||
function(t,e,n){function r(t){return i(t)?t:Object(t)}var i=n(/*! ../lang/isObject */10);t.exports=r},/*!***************************!*\
|
||
!*** ./~/lodash/index.js ***!
|
||
\***************************/
|
||
function(t,e,n){var r;(function(t,i){(function(){function o(t,e){if(t!==e){var n=t===t,r=e===e;if(t>e||!n||t===A&&r)return 1;if(e>t||!r||e===A&&n)return-1}return 0}function u(t,e,n){for(var r=t.length,i=n?r:-1;n?i--:++i<r;)if(e(t[i],i,t))return i;return-1}function a(t,e,n){if(e!==e)return g(t,n);for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function s(t){return"function"==typeof t||!1}function c(t){return"string"==typeof t?t:null==t?"":t+""}function f(t){return t.charCodeAt(0)}function l(t,e){for(var n=-1,r=t.length;++n<r&&e.indexOf(t.charAt(n))>-1;);return n}function h(t,e){for(var n=t.length;n--&&e.indexOf(t.charAt(n))>-1;);return n}function p(t,e){return o(t.criteria,e.criteria)||t.index-e.index}function _(t,e,n){for(var r=-1,i=t.criteria,u=e.criteria,a=i.length,s=n.length;++r<a;){var c=o(i[r],u[r]);if(c)return r>=s?c:c*(n[r]?1:-1)}return t.index-e.index}function v(t){return Ht[t]}function d(t){return Bt[t]}function y(t){return"\\"+Xt[t]}function g(t,e,n){for(var r=t.length,i=e+(n?0:-1);n?i--:++i<r;){var o=t[i];if(o!==o)return i}return-1}function m(t){return!!t&&"object"==typeof t}function w(t){return 160>=t&&t>=9&&13>=t||32==t||160==t||5760==t||6158==t||t>=8192&&(8202>=t||8232==t||8233==t||8239==t||8287==t||12288==t||65279==t)}function b(t,e){for(var n=-1,r=t.length,i=-1,o=[];++n<r;)t[n]===e&&(t[n]=K,o[++i]=n);return o}function T(t,e){for(var n,r=-1,i=t.length,o=-1,u=[];++r<i;){var a=t[r],s=e?e(a,r,t):a;r&&n===s||(n=s,u[++o]=a)}return u}function E(t){for(var e=-1,n=t.length;++e<n&&w(t.charCodeAt(e)););return e}function O(t){for(var e=t.length;e--&&w(t.charCodeAt(e)););return e}function I(t){return Jt[t]}function S(t){function e(t){if(m(t)&&!Sa(t)&&!(t instanceof i)){if(t instanceof r)return t;if(Vo.call(t,"__chain__")&&Vo.call(t,"__wrapped__"))return ur(t)}return new r(t)}function n(){}function r(t,e,n){this.__wrapped__=t,this.__actions__=n||[],this.__chain__=!!e}function i(t){this.__wrapped__=t,this.__actions__=null,this.__dir__=1,this.__dropCount__=0,this.__filtered__=!1,this.__iteratees__=null,this.__takeCount__=Tu,this.__views__=null}function w(){var t=this.__actions__,e=this.__iteratees__,n=this.__views__,r=new i(this.__wrapped__);return r.__actions__=t?te(t):null,r.__dir__=this.__dir__,r.__filtered__=this.__filtered__,r.__iteratees__=e?te(e):null,r.__takeCount__=this.__takeCount__,r.__views__=n?te(n):null,r}function Z(){if(this.__filtered__){var t=new i(this);t.__dir__=-1,t.__filtered__=!0}else t=this.clone(),t.__dir__*=-1;return t}function rt(){var t=this.__wrapped__.value();if(!Sa(t))return tn(t,this.__actions__);var e=this.__dir__,n=0>e,r=qn(0,t.length,this.__views__),i=r.start,o=r.end,u=o-i,a=n?o:i-1,s=du(u,this.__takeCount__),c=this.__iteratees__,f=c?c.length:0,l=0,h=[];t:for(;u--&&s>l;){a+=e;for(var p=-1,_=t[a];++p<f;){var v=c[p],d=v.iteratee,y=v.type;if(y==G){if(v.done&&(n?a>v.index:a<v.index)&&(v.count=0,v.done=!1),v.index=a,!v.done){var g=v.limit;if(!(v.done=g>-1?v.count++>=g:!d(_)))continue t}}else{var m=d(_);if(y==$)_=m;else if(!m){if(y==V)continue t;break t}}}h[l++]=_}return h}function ot(){this.__data__={}}function Ht(t){return this.has(t)&&delete this.__data__[t]}function Bt(t){return"__proto__"==t?A:this.__data__[t]}function Jt(t){return"__proto__"!=t&&Vo.call(this.__data__,t)}function Yt(t,e){return"__proto__"!=t&&(this.__data__[t]=e),this}function Xt(t){var e=t?t.length:0;for(this.data={hash:hu(null),set:new iu};e--;)this.push(t[e])}function Qt(t,e){var n=t.data,r="string"==typeof e||Oi(e)?n.set.has(e):n.hash[e];return r?0:-1}function Zt(t){var e=this.data;"string"==typeof t||Oi(t)?e.set.add(t):e.hash[t]=!0}function te(t,e){var n=-1,r=t.length;for(e||(e=No(r));++n<r;)e[n]=t[n];return e}function ee(t,e){for(var n=-1,r=t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function ne(t,e){for(var n=t.length;n--&&e(t[n],n,t)!==!1;);return t}function oe(t,e){for(var n=-1,r=t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function ue(t,e){for(var n=-1,r=t.length,i=-1,o=[];++n<r;){var u=t[n];e(u,n,t)&&(o[++i]=u)}return o}function ae(t,e){for(var n=-1,r=t.length,i=No(r);++n<r;)i[n]=e(t[n],n,t);return i}function se(t){for(var e=-1,n=t.length,r=bu;++e<n;){var i=t[e];i>r&&(r=i)}return r}function ce(t){for(var e=-1,n=t.length,r=Tu;++e<n;){var i=t[e];r>i&&(r=i)}return r}function fe(t,e,n,r){var i=-1,o=t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function le(t,e,n,r){var i=t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function he(t,e){for(var n=-1,r=t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function pe(t){for(var e=t.length,n=0;e--;)n+=+t[e]||0;return n}function _e(t,e){return t===A?e:t}function ve(t,e,n,r){return t!==A&&Vo.call(r,n)?t:e}function de(t,e,n){var r=Pa(e);eu.apply(r,Gu(e));for(var i=-1,o=r.length;++i<o;){var u=r[i],a=t[u],s=n(a,e[u],u,t,e);(s===s?s===a:a!==a)&&(a!==A||u in t)||(t[u]=s)}return t}function ye(t,e){for(var n=-1,r=null==t,i=!r&&$n(t),o=i&&t.length,u=e.length,a=No(u);++n<u;){var s=e[n];i?a[n]=Fn(s,o)?t[s]:A:a[n]=r?A:t[s]}return a}function ge(t,e,n){n||(n={});for(var r=-1,i=e.length;++r<i;){var o=e[r];n[o]=t[o]}return n}function me(t,e,n){var r=typeof t;return"function"==r?e===A?t:rn(t,e,n):null==t?_o:"object"==r?Le(t):e===A?bo(t):Pe(t,e)}function we(t,e,n,r,i,o,u){var a;if(n&&(a=i?n(t,r,i):n(t)),a!==A)return a;if(!Oi(t))return t;var s=Sa(t);if(s){if(a=Un(t),!e)return te(t,a)}else{var c=Fo.call(t),f=c==Q;if(c!=et&&c!=H&&(!f||i))return Ft[c]?Gn(t,c,e):i?t:{};if(a=Wn(f?{}:t),!e)return ku(a,t)}o||(o=[]),u||(u=[]);for(var l=o.length;l--;)if(o[l]==t)return u[l];return o.push(t),u.push(a),(s?ee:xe)(t,function(r,i){a[i]=we(r,e,n,i,t,o,u)}),a}function be(t,e,n){if("function"!=typeof t)throw new Lo(F);return ou(function(){t.apply(A,n)},e)}function Te(t,e){var n=t?t.length:0,r=[];if(!n)return r;var i=-1,o=Pn(),u=o==a,s=u&&e.length>=200?Pu(e):null,c=e.length;s&&(o=Qt,u=!1,e=s);t:for(;++i<n;){var f=t[i];if(u&&f===f){for(var l=c;l--;)if(e[l]===f)continue t;r.push(f)}else o(e,f,0)<0&&r.push(f)}return r}function Ee(t,e){var n=!0;return Mu(t,function(t,r,i){return n=!!e(t,r,i)}),n}function Oe(t,e,n,r){var i=t.length;for(n=null==n?0:+n||0,0>n&&(n=-n>i?0:i+n),r=r===A||r>i?i:+r||0,0>r&&(r+=i),i=n>r?0:r>>>0,n>>>=0;i>n;)t[n++]=e;return t}function Ie(t,e){var n=[];return Mu(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n}function Se(t,e,n,r){var i;return n(t,function(t,n,o){return e(t,n,o)?(i=r?n:t,!1):void 0}),i}function Ae(t,e,n){for(var r=-1,i=t.length,o=-1,u=[];++r<i;){var a=t[r];if(m(a)&&$n(a)&&(n||Sa(a)||yi(a))){e&&(a=Ae(a,e,n));for(var s=-1,c=a.length;++s<c;)u[++o]=a[s]}else n||(u[++o]=a)}return u}function Ne(t,e){return Ru(t,e,Wi)}function xe(t,e){return Ru(t,e,Pa)}function Ce(t,e){return zu(t,e,Pa)}function ke(t,e){for(var n=-1,r=e.length,i=-1,o=[];++n<r;){var u=e[n];Na(t[u])&&(o[++i]=u)}return o}function je(t,e,n){if(null!=t){n!==A&&n in ir(t)&&(e=[n]);for(var r=-1,i=e.length;null!=t&&++r<i;)t=t[e[r]];return r&&r==i?t:A}}function Me(t,e,n,r,i,o){if(t===e)return!0;var u=typeof t,a=typeof e;return"function"!=u&&"object"!=u&&"function"!=a&&"object"!=a||null==t||null==e?t!==t&&e!==e:De(t,e,Me,n,r,i,o)}function De(t,e,n,r,i,o,u){var a=Sa(t),s=Sa(e),c=B,f=B;a||(c=Fo.call(t),c==H?c=et:c!=et&&(a=ji(t))),s||(f=Fo.call(e),f==H?f=et:f!=et&&(s=ji(e)));var l=c==et,h=f==et,p=c==f;if(p&&!a&&!l)return Dn(t,e,c);if(!i){var _=l&&Vo.call(t,"__wrapped__"),v=h&&Vo.call(e,"__wrapped__");if(_||v)return n(_?t.value():t,v?e.value():e,r,i,o,u)}if(!p)return!1;o||(o=[]),u||(u=[]);for(var d=o.length;d--;)if(o[d]==t)return u[d]==e;o.push(t),u.push(e);var y=(a?Mn:Rn)(t,e,n,r,i,o,u);return o.pop(),u.pop(),y}function Re(t,e,n,r,i){for(var o=-1,u=e.length,a=!i;++o<u;)if(a&&r[o]?n[o]!==t[e[o]]:!(e[o]in t))return!1;for(o=-1;++o<u;){var s=e[o],c=t[s],f=n[o];if(a&&r[o])var l=c!==A||s in t;else l=i?i(c,f,s):A,l===A&&(l=Me(f,c,i,!0));if(!l)return!1}return!0}function ze(t,e){var n=-1,r=$n(t)?No(t.length):[];return Mu(t,function(t,i,o){r[++n]=e(t,i,o)}),r}function Le(t){var e=Pa(t),n=e.length;if(!n)return po(!0);if(1==n){var r=e[0],i=t[r];if(Yn(i))return function(t){return null==t?!1:t[r]===i&&(i!==A||r in ir(t))}}for(var o=No(n),u=No(n);n--;)i=t[e[n]],o[n]=i,u[n]=Yn(i);return function(t){return null!=t&&Re(ir(t),e,o,u)}}function Pe(t,e){var n=Sa(t),r=Hn(t)&&Yn(e),i=t+"";return t=or(t),function(o){if(null==o)return!1;var u=i;if(o=ir(o),!(!n&&r||u in o)){if(o=1==t.length?o:je(o,Ke(t,0,-1)),null==o)return!1;u=wr(t),o=ir(o)}return o[u]===e?e!==A||u in o:Me(e,o[u],null,!0)}}function qe(t,e,n,r,i){if(!Oi(t))return t;var o=$n(e)&&(Sa(e)||ji(e));if(!o){var u=Pa(e);eu.apply(u,Gu(e))}return ee(u||e,function(a,s){if(u&&(s=a,a=e[s]),m(a))r||(r=[]),i||(i=[]),Ue(t,e,s,qe,n,r,i);else{var c=t[s],f=n?n(c,a,s,t,e):A,l=f===A;l&&(f=a),!o&&f===A||!l&&(f===f?f===c:c!==c)||(t[s]=f)}}),t}function Ue(t,e,n,r,i,o,u){for(var a=o.length,s=e[n];a--;)if(o[a]==s)return void(t[n]=u[a]);var c=t[n],f=i?i(c,s,n,t,e):A,l=f===A;l&&(f=s,$n(s)&&(Sa(s)||ji(s))?f=Sa(c)?c:$n(c)?te(c):[]:xa(s)||yi(s)?f=yi(c)?Ri(c):xa(c)?c:{}:l=!1),o.push(s),u.push(f),l?t[n]=r(f,s,i,o,u):(f===f?f!==c:c===c)&&(t[n]=f)}function We(t){return function(e){return null==e?A:e[t]}}function Ge(t){var e=t+"";return t=or(t),function(n){return je(n,t,e)}}function Ve(t,e){for(var n=t?e.length:0;n--;){var r=parseFloat(e[n]);if(r!=i&&Fn(r)){var i=r;uu.call(t,r,1)}}return t}function $e(t,e){return t+Qo(wu()*(e-t+1))}function Fe(t,e,n,r,i){return i(t,function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)}),n}function Ke(t,e,n){var r=-1,i=t.length;e=null==e?0:+e||0,0>e&&(e=-e>i?0:i+e),n=n===A||n>i?i:+n||0,0>n&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=No(i);++r<i;)o[r]=t[r+e];return o}function He(t,e){var n;return Mu(t,function(t,r,i){return n=e(t,r,i),!n}),!!n}function Be(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}function Je(t,e,n){var r=Ln(),i=-1;e=ae(e,function(t){return r(t)});var o=ze(t,function(t){var n=ae(e,function(e){return e(t)});return{criteria:n,index:++i,value:t}});return Be(o,function(t,e){return _(t,e,n)})}function Ye(t,e){var n=0;return Mu(t,function(t,r,i){n+=+e(t,r,i)||0}),n}function Xe(t,e){var n=-1,r=Pn(),i=t.length,o=r==a,u=o&&i>=200,s=u?Pu():null,c=[];s?(r=Qt,o=!1):(u=!1,s=e?[]:c);t:for(;++n<i;){var f=t[n],l=e?e(f,n,t):f;if(o&&f===f){for(var h=s.length;h--;)if(s[h]===l)continue t;e&&s.push(l),c.push(f)}else r(s,l,0)<0&&((e||u)&&s.push(l),c.push(f))}return c}function Qe(t,e){for(var n=-1,r=e.length,i=No(r);++n<r;)i[n]=t[e[n]];return i}function Ze(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?Ke(t,r?0:o,r?o+1:i):Ke(t,r?o+1:0,r?i:o)}function tn(t,e){var n=t;n instanceof i&&(n=n.value());for(var r=-1,o=e.length;++r<o;){var u=[n],a=e[r];eu.apply(u,a.args),n=a.func.apply(a.thisArg,u)}return n}function en(t,e,n){var r=0,i=t?t.length:r;if("number"==typeof e&&e===e&&Iu>=i){for(;i>r;){var o=r+i>>>1,u=t[o];(n?e>=u:e>u)?r=o+1:i=o}return i}return nn(t,e,_o,n)}function nn(t,e,n,r){e=n(e);for(var i=0,o=t?t.length:0,u=e!==e,a=e===A;o>i;){var s=Qo((i+o)/2),c=n(t[s]),f=c===c;if(u)var l=f||r;else l=a?f&&(r||c!==A):r?e>=c:e>c;l?i=s+1:o=s}return du(o,Ou)}function rn(t,e,n){if("function"!=typeof t)return _o;if(e===A)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 3:return function(n,r,i){return t.call(e,n,r,i)};case 4:return function(n,r,i,o){return t.call(e,n,r,i,o)};case 5:return function(n,r,i,o,u){return t.call(e,n,r,i,o,u)}}return function(){return t.apply(e,arguments)}}function on(t){return Jo.call(t,0)}function un(t,e,n){for(var r=n.length,i=-1,o=vu(t.length-r,0),u=-1,a=e.length,s=No(o+a);++u<a;)s[u]=e[u];for(;++i<r;)s[n[i]]=t[i];for(;o--;)s[u++]=t[i++];return s}function an(t,e,n){for(var r=-1,i=n.length,o=-1,u=vu(t.length-i,0),a=-1,s=e.length,c=No(u+s);++o<u;)c[o]=t[o];for(var f=o;++a<s;)c[f+a]=e[a];for(;++r<i;)c[f+n[r]]=t[o++];return c}function sn(t,e){return function(n,r,i){var o=e?e():{};if(r=Ln(r,i,3),Sa(n))for(var u=-1,a=n.length;++u<a;){var s=n[u];t(o,s,r(s,u,n),n)}else Mu(n,function(e,n,i){t(o,e,r(e,n,i),i)});return o}}function cn(t){return li(function(e,n){var r=-1,i=null==e?0:n.length,o=i>2&&n[i-2],u=i>2&&n[2],a=i>1&&n[i-1];for("function"==typeof o?(o=rn(o,a,5),i-=2):(o="function"==typeof a?a:null,i-=o?1:0),u&&Kn(n[0],n[1],u)&&(o=3>i?null:o,i=1);++r<i;){var s=n[r];s&&t(e,s,o)}return e})}function fn(t,e){return function(n,r){var i=n?Wu(n):0;if(!Jn(i))return t(n,r);for(var o=e?i:-1,u=ir(n);(e?o--:++o<i)&&r(u[o],o,u)!==!1;);return n}}function ln(t){return function(e,n,r){for(var i=ir(e),o=r(e),u=o.length,a=t?u:-1;t?a--:++a<u;){var s=o[a];if(n(i[s],s,i)===!1)break}return e}}function hn(t,e){function n(){var i=this&&this!==re&&this instanceof n?r:t;return i.apply(e,arguments)}var r=_n(t);return n}function pn(t){return function(e){for(var n=-1,r=lo(Xi(e)),i=r.length,o="";++n<i;)o=t(o,r[n],n);return o}}function _n(t){return function(){var e=ju(t.prototype),n=t.apply(e,arguments);return Oi(n)?n:e}}function vn(t){function e(n,r,i){i&&Kn(n,r,i)&&(r=null);var o=jn(n,t,null,null,null,null,null,r);return o.placeholder=e.placeholder,o}return e}function dn(t,e){return function(n,r,i){i&&Kn(n,r,i)&&(r=null);var o=Ln(),u=null==r;if(o===me&&u||(u=!1,r=o(r,i,3)),u){var a=Sa(n);if(a||!ki(n))return t(a?n:rr(n));r=f}return zn(n,r,e)}}function yn(t,e){return function(n,r,i){if(r=Ln(r,i,3),Sa(n)){var o=u(n,r,e);return o>-1?n[o]:A}return Se(n,r,t)}}function gn(t){return function(e,n,r){return e&&e.length?(n=Ln(n,r,3),u(e,n,t)):-1}}function mn(t){return function(e,n,r){return n=Ln(n,r,3),Se(e,n,t,!0)}}function wn(t){return function(){var e=arguments.length;if(!e)return function(){return arguments[0]};for(var n,i=t?e:-1,o=0,u=No(e);t?i--:++i<e;){var a=u[o++]=arguments[i];if("function"!=typeof a)throw new Lo(F);var s=n?"":Uu(a);n="wrapper"==s?new r([]):n}for(i=n?-1:e;++i<e;){a=u[i],s=Uu(a);var c="wrapper"==s?qu(a):null;n=c&&Bn(c[0])&&c[1]==(z|j|D|L)&&!c[4].length&&1==c[9]?n[Uu(c[0])].apply(n,c[3]):1==a.length&&Bn(a)?n[s]():n.thru(a)}return function(){var t=arguments;if(n&&1==t.length&&Sa(t[0]))return n.plant(t[0]).value();for(var r=0,i=u[r].apply(this,t);++r<e;)i=u[r].call(this,i);return i}}}function bn(t,e){return function(n,r,i){return"function"==typeof r&&i===A&&Sa(n)?t(n,r):e(n,rn(r,i,3))}}function Tn(t){return function(e,n,r){return("function"!=typeof n||r!==A)&&(n=rn(n,r,3)),t(e,n,Wi)}}function En(t){return function(e,n,r){return("function"!=typeof n||r!==A)&&(n=rn(n,r,3)),t(e,n)}}function On(t){return function(e,n,r){var i={};return n=Ln(n,r,3),xe(e,function(e,r,o){var u=n(e,r,o);r=t?u:r,e=t?e:u,i[r]=e}),i}}function In(t){return function(e,n,r){return e=c(e),(t?e:"")+xn(e,n,r)+(t?"":e)}}function Sn(t){var e=li(function(n,r){var i=b(r,e.placeholder);return jn(n,t,null,r,i)});return e}function An(t,e){return function(n,r,i,o){var u=arguments.length<3;return"function"==typeof r&&o===A&&Sa(n)?t(n,r,i,u):Fe(n,Ln(r,o,4),i,u,e)}}function Nn(t,e,n,r,i,o,u,a,s,c){function f(){for(var m=arguments.length,w=m,T=No(m);w--;)T[w]=arguments[w];if(r&&(T=un(T,r,i)),o&&(T=an(T,o,u)),_||d){var E=f.placeholder,O=b(T,E);if(m-=O.length,c>m){var I=a?te(a):null,S=vu(c-m,0),N=_?O:null,k=_?null:O,j=_?T:null,M=_?null:T;e|=_?D:R,e&=~(_?R:D),v||(e&=~(x|C));var z=[t,e,n,j,N,M,k,I,s,S],L=Nn.apply(A,z);return Bn(t)&&Vu(L,z),L.placeholder=E,L}}var P=h?n:this;p&&(t=P[g]),a&&(T=tr(T,a)),l&&s<T.length&&(T.length=s);var q=this&&this!==re&&this instanceof f?y||_n(t):t;return q.apply(P,T)}var l=e&z,h=e&x,p=e&C,_=e&j,v=e&k,d=e&M,y=!p&&_n(t),g=t;return f}function xn(t,e,n){var r=t.length;if(e=+e,r>=e||!pu(e))return"";var i=e-r;return n=null==n?" ":n+"",ro(n,Yo(i/n.length)).slice(0,i)}function Cn(t,e,n,r){function i(){for(var e=-1,a=arguments.length,s=-1,c=r.length,f=No(a+c);++s<c;)f[s]=r[s];for(;a--;)f[s++]=arguments[++e];var l=this&&this!==re&&this instanceof i?u:t;return l.apply(o?n:this,f)}var o=e&x,u=_n(t);return i}function kn(t){return function(e,n,r,i){var o=Ln(r);return o===me&&null==r?en(e,n,t):nn(e,n,o(r,i,1),t)}}function jn(t,e,n,r,i,o,u,a){var s=e&C;if(!s&&"function"!=typeof t)throw new Lo(F);var c=r?r.length:0;if(c||(e&=~(D|R),r=i=null),c-=i?i.length:0,e&R){var f=r,l=i;r=i=null}var h=s?null:qu(t),p=[t,e,n,r,i,f,l,o,u,a];if(h&&(Xn(p,h),e=p[1],a=p[9]),p[9]=null==a?s?0:t.length:vu(a-c,0)||0,e==x)var _=hn(p[0],p[2]);else _=e!=D&&e!=(x|D)||p[4].length?Nn.apply(A,p):Cn.apply(A,p);var v=h?Lu:Vu;return v(_,p)}function Mn(t,e,n,r,i,o,u){var a=-1,s=t.length,c=e.length,f=!0;if(s!=c&&!(i&&c>s))return!1;for(;f&&++a<s;){var l=t[a],h=e[a];if(f=A,r&&(f=i?r(h,l,a):r(l,h,a)),f===A)if(i)for(var p=c;p--&&(h=e[p],!(f=l&&l===h||n(l,h,r,i,o,u))););else f=l&&l===h||n(l,h,r,i,o,u)}return!!f}function Dn(t,e,n){switch(n){case J:case Y:return+t==+e;case X:return t.name==e.name&&t.message==e.message;case tt:return t!=+t?e!=+e:t==+e;case nt:case it:return t==e+""}return!1}function Rn(t,e,n,r,i,o,u){var a=Pa(t),s=a.length,c=Pa(e),f=c.length;if(s!=f&&!i)return!1;for(var l=i,h=-1;++h<s;){var p=a[h],_=i?p in e:Vo.call(e,p);if(_){var v=t[p],d=e[p];_=A,r&&(_=i?r(d,v,p):r(v,d,p)),_===A&&(_=v&&v===d||n(v,d,r,i,o,u))}if(!_)return!1;l||(l="constructor"==p)}if(!l){var y=t.constructor,g=e.constructor;if(y!=g&&"constructor"in t&&"constructor"in e&&!("function"==typeof y&&y instanceof y&&"function"==typeof g&&g instanceof g))return!1}return!0}function zn(t,e,n){var r=n?Tu:bu,i=r,o=i;return Mu(t,function(t,u,a){var s=e(t,u,a);((n?i>s:s>i)||s===r&&s===o)&&(i=s,o=t)}),o}function Ln(t,n,r){var i=e.callback||ho;return i=i===ho?me:i,r?i(t,n,r):i}function Pn(t,n,r){var i=e.indexOf||yr;return i=i===yr?a:i,t?i(t,n,r):i}function qn(t,e,n){for(var r=-1,i=n?n.length:0;++r<i;){var o=n[r],u=o.size;switch(o.type){case"drop":t+=u;break;case"dropRight":e-=u;break;case"take":e=du(e,t+u);break;case"takeRight":t=vu(t,e-u)}}return{start:t,end:e}}function Un(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Vo.call(t,"index")&&(n.index=t.index,n.input=t.input),n}function Wn(t){var e=t.constructor;return"function"==typeof e&&e instanceof e||(e=Do),new e}function Gn(t,e,n){var r=t.constructor;switch(e){case ut:return on(t);case J:case Y:return new r(+t);case at:case st:case ct:case ft:case lt:case ht:case pt:case _t:case vt:var i=t.buffer;return new r(n?on(i):i,t.byteOffset,t.length);case tt:case it:return new r(t);case nt:var o=new r(t.source,Dt.exec(t));o.lastIndex=t.lastIndex}return o}function Vn(t,e,n){null==t||Hn(e,t)||(e=or(e),t=1==e.length?t:je(t,Ke(e,0,-1)),e=wr(e));var r=null==t?t:t[e];return null==r?A:r.apply(t,n)}function $n(t){return null!=t&&Jn(Wu(t))}function Fn(t,e){return t=+t,e=null==e?Au:e,t>-1&&t%1==0&&e>t}function Kn(t,e,n){if(!Oi(n))return!1;var r=typeof e;if("number"==r?$n(n)&&Fn(e,n.length):"string"==r&&e in n){var i=n[e];return t===t?t===i:i!==i}return!1}function Hn(t,e){var n=typeof t;if("string"==n&&At.test(t)||"number"==n)return!0;if(Sa(t))return!1;var r=!St.test(t);return r||null!=e&&t in ir(e)}function Bn(t){var n=Uu(t);return!!n&&t===e[n]&&n in i.prototype}function Jn(t){return"number"==typeof t&&t>-1&&t%1==0&&Au>=t}function Yn(t){return t===t&&!Oi(t)}function Xn(t,e){var n=t[1],r=e[1],i=n|r,o=z>i,u=r==z&&n==j||r==z&&n==L&&t[7].length<=e[8]||r==(z|L)&&n==j;if(!o&&!u)return t;r&x&&(t[2]=e[2],i|=n&x?0:k);var a=e[3];if(a){var s=t[3];t[3]=s?un(s,a,e[4]):te(a),t[4]=s?b(t[3],K):te(e[4])}return a=e[5],a&&(s=t[5],t[5]=s?an(s,a,e[6]):te(a),t[6]=s?b(t[5],K):te(e[6])),a=e[7],a&&(t[7]=te(a)),r&z&&(t[8]=null==t[8]?e[8]:du(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i,t}function Qn(t,e){t=ir(t);for(var n=-1,r=e.length,i={};++n<r;){var o=e[n];o in t&&(i[o]=t[o])}return i}function Zn(t,e){var n={};return Ne(t,function(t,r,i){e(t,r,i)&&(n[r]=t)}),n}function tr(t,e){for(var n=t.length,r=du(e.length,n),i=te(t);r--;){var o=e[r];t[r]=Fn(o,n)?i[o]:A}return t}function er(t){{var n;e.support}if(!m(t)||Fo.call(t)!=et||!Vo.call(t,"constructor")&&(n=t.constructor,"function"==typeof n&&!(n instanceof n)))return!1;var r;return Ne(t,function(t,e){r=e}),r===A||Vo.call(t,r)}function nr(t){for(var n=Wi(t),r=n.length,i=r&&t.length,o=e.support,u=i&&Jn(i)&&(Sa(t)||o.nonEnumArgs&&yi(t)),a=-1,s=[];++a<r;){var c=n[a];(u&&Fn(c,i)||Vo.call(t,c))&&s.push(c)}return s}function rr(t){return null==t?[]:$n(t)?Oi(t)?t:Do(t):Ki(t)}function ir(t){return Oi(t)?t:Do(t)}function or(t){if(Sa(t))return t;var e=[];return c(t).replace(Nt,function(t,n,r,i){e.push(r?i.replace(jt,"$1"):n||t)}),e}function ur(t){return t instanceof i?t.clone():new r(t.__wrapped__,t.__chain__,te(t.__actions__))}function ar(t,e,n){e=(n?Kn(t,e,n):null==e)?1:vu(+e||1,1);for(var r=0,i=t?t.length:0,o=-1,u=No(Yo(i/e));i>r;)u[++o]=Ke(t,r,r+=e);return u}function sr(t){for(var e=-1,n=t?t.length:0,r=-1,i=[];++e<n;){var o=t[e];o&&(i[++r]=o)}return i}function cr(t,e,n){var r=t?t.length:0;return r?((n?Kn(t,e,n):null==e)&&(e=1),Ke(t,0>e?0:e)):[]}function fr(t,e,n){var r=t?t.length:0;return r?((n?Kn(t,e,n):null==e)&&(e=1),e=r-(+e||0),Ke(t,0,0>e?0:e)):[]}function lr(t,e,n){return t&&t.length?Ze(t,Ln(e,n,3),!0,!0):[]}function hr(t,e,n){return t&&t.length?Ze(t,Ln(e,n,3),!0):[]}function pr(t,e,n,r){var i=t?t.length:0;return i?(n&&"number"!=typeof n&&Kn(t,e,n)&&(n=0,r=i),Oe(t,e,n,r)):[]}function _r(t){return t?t[0]:A}function vr(t,e,n){var r=t?t.length:0;return n&&Kn(t,e,n)&&(e=!1),r?Ae(t,e):[]}function dr(t){var e=t?t.length:0;return e?Ae(t,!0):[]}function yr(t,e,n){var r=t?t.length:0;if(!r)return-1;if("number"==typeof n)n=0>n?vu(r+n,0):n;else if(n){var i=en(t,e),o=t[i];return(e===e?e===o:o!==o)?i:-1}return a(t,e,n||0)}function gr(t){return fr(t,1)}function mr(){for(var t=[],e=-1,n=arguments.length,r=[],i=Pn(),o=i==a,u=[];++e<n;){var s=arguments[e];$n(s)&&(t.push(s),r.push(o&&s.length>=120?Pu(e&&s):null))}if(n=t.length,2>n)return u;var c=t[0],f=-1,l=c?c.length:0,h=r[0];t:for(;++f<l;)if(s=c[f],(h?Qt(h,s):i(u,s,0))<0){for(e=n;--e;){var p=r[e];if((p?Qt(p,s):i(t[e],s,0))<0)continue t}h&&h.push(s),u.push(s)}return u}function wr(t){var e=t?t.length:0;return e?t[e-1]:A}function br(t,e,n){var r=t?t.length:0;if(!r)return-1;var i=r;if("number"==typeof n)i=(0>n?vu(r+n,0):du(n||0,r-1))+1;else if(n){i=en(t,e,!0)-1;var o=t[i];return(e===e?e===o:o!==o)?i:-1}if(e!==e)return g(t,i,!0);for(;i--;)if(t[i]===e)return i;return-1}function Tr(){var t=arguments,e=t[0];if(!e||!e.length)return e;for(var n=0,r=Pn(),i=t.length;++n<i;)for(var o=0,u=t[n];(o=r(e,u,o))>-1;)uu.call(e,o,1);return e}function Er(t,e,n){var r=[];if(!t||!t.length)return r;var i=-1,o=[],u=t.length;for(e=Ln(e,n,3);++i<u;){var a=t[i];e(a,i,t)&&(r.push(a),o.push(i))}return Ve(t,o),r}function Or(t){return cr(t,1)}function Ir(t,e,n){var r=t?t.length:0;return r?(n&&"number"!=typeof n&&Kn(t,e,n)&&(e=0,n=r),Ke(t,e,n)):[]}function Sr(t,e,n){var r=t?t.length:0;return r?((n?Kn(t,e,n):null==e)&&(e=1),Ke(t,0,0>e?0:e)):[]}function Ar(t,e,n){var r=t?t.length:0;return r?((n?Kn(t,e,n):null==e)&&(e=1),e=r-(+e||0),Ke(t,0>e?0:e)):[]}function Nr(t,e,n){return t&&t.length?Ze(t,Ln(e,n,3),!1,!0):[]}function xr(t,e,n){return t&&t.length?Ze(t,Ln(e,n,3)):[]}function Cr(t,e,n,r){var i=t?t.length:0;if(!i)return[];null!=e&&"boolean"!=typeof e&&(r=n,n=Kn(t,e,r)?null:e,e=!1);var o=Ln();return(o!==me||null!=n)&&(n=o(n,r,3)),e&&Pn()==a?T(t,n):Xe(t,n)}function kr(t){if(!t||!t.length)return[];var e=-1,n=0;t=ue(t,function(t){return $n(t)?(n=vu(t.length,n),!0):void 0});for(var r=No(n);++e<n;)r[e]=ae(t,We(e));return r}function jr(t,e,n){var r=t?t.length:0;if(!r)return[];var i=kr(t);return null==e?i:(e=rn(e,n,4),ae(i,function(t){return fe(t,e,A,!0)}))}function Mr(){for(var t=-1,e=arguments.length;++t<e;){var n=arguments[t];if($n(n))var r=r?Te(r,n).concat(Te(n,r)):n}return r?Xe(r):[]}function Dr(t,e){var n=-1,r=t?t.length:0,i={};for(!r||e||Sa(t[0])||(e=[]);++n<r;){var o=t[n];e?i[o]=e[n]:o&&(i[o[0]]=o[1])}return i}function Rr(t){var n=e(t);return n.__chain__=!0,n}function zr(t,e,n){return e.call(n,t),t}function Lr(t,e,n){return e.call(n,t)}function Pr(){return Rr(this)}function qr(){return new r(this.value(),this.__chain__)}function Ur(t){for(var e,r=this;r instanceof n;){var i=ur(r);e?o.__wrapped__=i:e=i;var o=i;r=r.__wrapped__}return o.__wrapped__=t,e}function Wr(){var t=this.__wrapped__;return t instanceof i?(this.__actions__.length&&(t=new i(this)),new r(t.reverse(),this.__chain__)):this.thru(function(t){return t.reverse()})}function Gr(){return this.value()+""}function Vr(){return tn(this.__wrapped__,this.__actions__)}function $r(t,e,n){var r=Sa(t)?oe:Ee;return n&&Kn(t,e,n)&&(e=null),("function"!=typeof e||n!==A)&&(e=Ln(e,n,3)),r(t,e)}function Fr(t,e,n){var r=Sa(t)?ue:Ie;return e=Ln(e,n,3),r(t,e)}function Kr(t,e){return na(t,Le(e))}function Hr(t,e,n,r){var i=t?Wu(t):0;return Jn(i)||(t=Ki(t),i=t.length),i?(n="number"!=typeof n||r&&Kn(e,n,r)?0:0>n?vu(i+n,0):n||0,"string"==typeof t||!Sa(t)&&ki(t)?i>n&&t.indexOf(e,n)>-1:Pn(t,e,n)>-1):!1}function Br(t,e,n){var r=Sa(t)?ae:ze;return e=Ln(e,n,3),r(t,e)}function Jr(t,e){return Br(t,bo(e))}function Yr(t,e,n){var r=Sa(t)?ue:Ie;return e=Ln(e,n,3),r(t,function(t,n,r){return!e(t,n,r)})}function Xr(t,e,n){if(n?Kn(t,e,n):null==e){t=rr(t);var r=t.length;return r>0?t[$e(0,r-1)]:A}var i=Qr(t);return i.length=du(0>e?0:+e||0,i.length),i}function Qr(t){t=rr(t);for(var e=-1,n=t.length,r=No(n);++e<n;){var i=$e(0,e);e!=i&&(r[e]=r[i]),r[i]=t[e]}return r}function Zr(t){var e=t?Wu(t):0;return Jn(e)?e:Pa(t).length}function ti(t,e,n){var r=Sa(t)?he:He;return n&&Kn(t,e,n)&&(e=null),("function"!=typeof e||n!==A)&&(e=Ln(e,n,3)),r(t,e)}function ei(t,e,n){if(null==t)return[];n&&Kn(t,e,n)&&(e=null);var r=-1;e=Ln(e,n,3);var i=ze(t,function(t,n,i){return{criteria:e(t,n,i),index:++r,value:t}});return Be(i,p)}function ni(t,e,n,r){return null==t?[]:(r&&Kn(e,n,r)&&(n=null),Sa(e)||(e=null==e?[]:[e]),Sa(n)||(n=null==n?[]:[n]),Je(t,e,n))}function ri(t,e){return Fr(t,Le(e))}function ii(t,e){if("function"!=typeof e){if("function"!=typeof t)throw new Lo(F);var n=t;t=e,e=n}return t=pu(t=+t)?t:0,function(){return--t<1?e.apply(this,arguments):void 0}}function oi(t,e,n){return n&&Kn(t,e,n)&&(e=null),e=t&&null==e?t.length:vu(+e||0,0),jn(t,z,null,null,null,null,e)}function ui(t,e){var n;if("function"!=typeof e){if("function"!=typeof t)throw new Lo(F);var r=t;t=e,e=r}return function(){return--t>0&&(n=e.apply(this,arguments)),1>=t&&(e=null),n}}function ai(t,e,n){function r(){h&&Xo(h),s&&Xo(s),s=h=p=A}function i(){var n=e-(pa()-f);if(0>=n||n>e){s&&Xo(s);var r=p;s=h=p=A,r&&(_=pa(),c=t.apply(l,a),h||s||(a=l=null))}else h=ou(i,n)}function o(){h&&Xo(h),s=h=p=A,(d||v!==e)&&(_=pa(),c=t.apply(l,a),h||s||(a=l=null))}function u(){if(a=arguments,f=pa(),l=this,p=d&&(h||!y),v===!1)var n=y&&!h;else{s||y||(_=f);var r=v-(f-_),u=0>=r||r>v;u?(s&&(s=Xo(s)),_=f,c=t.apply(l,a)):s||(s=ou(o,r))}return u&&h?h=Xo(h):h||e===v||(h=ou(i,e)),n&&(u=!0,c=t.apply(l,a)),!u||h||s||(a=l=null),c}var a,s,c,f,l,h,p,_=0,v=!1,d=!0;if("function"!=typeof t)throw new Lo(F);if(e=0>e?0:+e||0,n===!0){var y=!0;d=!1}else Oi(n)&&(y=n.leading,v="maxWait"in n&&vu(+n.maxWait||0,e),d="trailing"in n?n.trailing:d);return u.cancel=r,u}function si(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new Lo(F);var n=function(){var r=arguments,i=n.cache,o=e?e.apply(this,r):r[0];if(i.has(o))return i.get(o);var u=t.apply(this,r);return i.set(o,u),u};return n.cache=new si.Cache,n}function ci(t){if("function"!=typeof t)throw new Lo(F);return function(){return!t.apply(this,arguments)}}function fi(t){return ui(2,t)}function li(t,e){if("function"!=typeof t)throw new Lo(F);return e=vu(e===A?t.length-1:+e||0,0),function(){for(var n=arguments,r=-1,i=vu(n.length-e,0),o=No(i);++r<i;)o[r]=n[e+r];switch(e){case 0:return t.call(this,o);case 1:return t.call(this,n[0],o);case 2:return t.call(this,n[0],n[1],o)}var u=No(e+1);for(r=-1;++r<e;)u[r]=n[r];return u[e]=o,t.apply(this,u)}}function hi(t){if("function"!=typeof t)throw new Lo(F);return function(e){return t.apply(this,e)}}function pi(t,e,n){var r=!0,i=!0;if("function"!=typeof t)throw new Lo(F);return n===!1?r=!1:Oi(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Kt.leading=r,Kt.maxWait=+e,Kt.trailing=i,ai(t,e,Kt)}function _i(t,e){return e=null==e?_o:e,jn(e,D,null,[t],[])}function vi(t,e,n,r){return e&&"boolean"!=typeof e&&Kn(t,e,n)?e=!1:"function"==typeof e&&(r=n,n=e,e=!1),n="function"==typeof n&&rn(n,r,1),we(t,e,n)}function di(t,e,n){return e="function"==typeof e&&rn(e,n,1),we(t,!0,e)}function yi(t){return m(t)&&$n(t)&&Fo.call(t)==H}function gi(t){return t===!0||t===!1||m(t)&&Fo.call(t)==J}function mi(t){return m(t)&&Fo.call(t)==Y}function wi(t){return!!t&&1===t.nodeType&&m(t)&&Fo.call(t).indexOf("Element")>-1}function bi(t){return null==t?!0:$n(t)&&(Sa(t)||ki(t)||yi(t)||m(t)&&Na(t.splice))?!t.length:!Pa(t).length}function Ti(t,e,n,r){if(n="function"==typeof n&&rn(n,r,3),!n&&Yn(t)&&Yn(e))return t===e;var i=n?n(t,e):A;return i===A?Me(t,e,n):!!i}function Ei(t){return m(t)&&"string"==typeof t.message&&Fo.call(t)==X}function Oi(t){var e=typeof t;return"function"==e||!!t&&"object"==e}function Ii(t,e,n,r){var i=Pa(e),o=i.length;if(!o)return!0;if(null==t)return!1;if(n="function"==typeof n&&rn(n,r,3),t=ir(t),!n&&1==o){var u=i[0],a=e[u];if(Yn(a))return a===t[u]&&(a!==A||u in t)}for(var s=No(o),c=No(o);o--;)a=s[o]=e[i[o]],c[o]=Yn(a);return Re(t,i,s,c,n)}function Si(t){return xi(t)&&t!=+t}function Ai(t){return null==t?!1:Fo.call(t)==Q?Ho.test(Go.call(t)):m(t)&&zt.test(t)}function Ni(t){return null===t}function xi(t){return"number"==typeof t||m(t)&&Fo.call(t)==tt}function Ci(t){return m(t)&&Fo.call(t)==nt}function ki(t){return"string"==typeof t||m(t)&&Fo.call(t)==it}function ji(t){return m(t)&&Jn(t.length)&&!!$t[Fo.call(t)]}function Mi(t){return t===A}function Di(t){var e=t?Wu(t):0;return Jn(e)?e?te(t):[]:Ki(t)}function Ri(t){return ge(t,Wi(t))}function zi(t,e,n){var r=ju(t);return n&&Kn(t,e,n)&&(e=null),e?ku(r,e):r}function Li(t){return ke(t,Wi(t))}function Pi(t,e,n){var r=null==t?A:je(t,or(e),e+"");return r===A?n:r}function qi(t,e){if(null==t)return!1;var n=Vo.call(t,e);return n||Hn(e)||(e=or(e),t=1==e.length?t:je(t,Ke(e,0,-1)),e=wr(e),n=null!=t&&Vo.call(t,e)),n}function Ui(t,e,n){n&&Kn(t,e,n)&&(e=null);for(var r=-1,i=Pa(t),o=i.length,u={};++r<o;){var a=i[r],s=t[a];e?Vo.call(u,s)?u[s].push(a):u[s]=[a]:u[s]=a}return u}function Wi(t){if(null==t)return[];Oi(t)||(t=Do(t));var e=t.length;e=e&&Jn(e)&&(Sa(t)||Cu.nonEnumArgs&&yi(t))&&e||0;for(var n=t.constructor,r=-1,i="function"==typeof n&&n.prototype===t,o=No(e),u=e>0;++r<e;)o[r]=r+"";for(var a in t)u&&Fn(a,e)||"constructor"==a&&(i||!Vo.call(t,a))||o.push(a);return o}function Gi(t){for(var e=-1,n=Pa(t),r=n.length,i=No(r);++e<r;){var o=n[e];i[e]=[o,t[o]]}return i}function Vi(t,e,n){var r=null==t?A:t[e];return r===A&&(null==t||Hn(e,t)||(e=or(e),t=1==e.length?t:je(t,Ke(e,0,-1)),r=null==t?A:t[wr(e)]),r=r===A?n:r),Na(r)?r.call(t):r}function $i(t,e,n){if(null==t)return t;var r=e+"";e=null!=t[r]||Hn(e,t)?[r]:or(e);for(var i=-1,o=e.length,u=o-1,a=t;null!=a&&++i<o;){var s=e[i];Oi(a)&&(i==u?a[s]=n:null==a[s]&&(a[s]=Fn(e[i+1])?[]:{})),a=a[s]}return t}function Fi(t,e,n,r){var i=Sa(t)||ji(t);if(e=Ln(e,r,4),null==n)if(i||Oi(t)){var o=t.constructor;n=i?Sa(t)?new o:[]:ju(Na(o)&&o.prototype)}else n={};return(i?ee:xe)(t,function(t,r,i){return e(n,t,r,i)}),n}function Ki(t){return Qe(t,Pa(t))}function Hi(t){return Qe(t,Wi(t))}function Bi(t,e,n){return e=+e||0,"undefined"==typeof n?(n=e,e=0):n=+n||0,t>=du(e,n)&&t<vu(e,n)}function Ji(t,e,n){n&&Kn(t,e,n)&&(e=n=null);var r=null==t,i=null==e;if(null==n&&(i&&"boolean"==typeof t?(n=t,t=1):"boolean"==typeof e&&(n=e,i=!0)),r&&i&&(e=1,i=!1),t=+t||0,i?(e=t,t=0):e=+e||0,n||t%1||e%1){var o=wu();return du(t+o*(e-t+parseFloat("1e-"+((o+"").length-1))),e)}return $e(t,e)}function Yi(t){return t=c(t),t&&t.charAt(0).toUpperCase()+t.slice(1)}function Xi(t){return t=c(t),t&&t.replace(Lt,v).replace(kt,"")}function Qi(t,e,n){t=c(t),e+="";var r=t.length;return n=n===A?r:du(0>n?0:+n||0,r),n-=e.length,n>=0&&t.indexOf(e,n)==n}function Zi(t){return t=c(t),t&&Tt.test(t)?t.replace(wt,d):t}function to(t){return t=c(t),t&&Ct.test(t)?t.replace(xt,"\\$&"):t}function eo(t,e,n){t=c(t),e=+e;var r=t.length;if(r>=e||!pu(e))return t;var i=(e-r)/2,o=Qo(i),u=Yo(i);return n=xn("",u,n),
|
||
n.slice(0,o)+t+n}function no(t,e,n){return n&&Kn(t,e,n)&&(e=0),mu(t,e)}function ro(t,e){var n="";if(t=c(t),e=+e,1>e||!t||!pu(e))return n;do e%2&&(n+=t),e=Qo(e/2),t+=t;while(e);return n}function io(t,e,n){return t=c(t),n=null==n?0:du(0>n?0:+n||0,t.length),t.lastIndexOf(e,n)==n}function oo(t,n,r){var i=e.templateSettings;r&&Kn(t,n,r)&&(n=r=null),t=c(t),n=de(ku({},r||n),i,ve);var o,u,a=de(ku({},n.imports),i.imports,ve),s=Pa(a),f=Qe(a,s),l=0,h=n.interpolate||Pt,p="__p += '",_=Ro((n.escape||Pt).source+"|"+h.source+"|"+(h===It?Mt:Pt).source+"|"+(n.evaluate||Pt).source+"|$","g"),v="//# sourceURL="+("sourceURL"in n?n.sourceURL:"lodash.templateSources["+ ++Vt+"]")+"\n";t.replace(_,function(e,n,r,i,a,s){return r||(r=i),p+=t.slice(l,s).replace(qt,y),n&&(o=!0,p+="' +\n__e("+n+") +\n'"),a&&(u=!0,p+="';\n"+a+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=s+e.length,e}),p+="';\n";var d=n.variable;d||(p="with (obj) {\n"+p+"\n}\n"),p=(u?p.replace(dt,""):p).replace(yt,"$1").replace(gt,"$1;"),p="function("+(d||"obj")+") {\n"+(d?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(u?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var g=Ya(function(){return ko(s,v+"return "+p).apply(A,f)});if(g.source=p,Ei(g))throw g;return g}function uo(t,e,n){var r=t;return(t=c(t))?(n?Kn(r,e,n):null==e)?t.slice(E(t),O(t)+1):(e+="",t.slice(l(t,e),h(t,e)+1)):t}function ao(t,e,n){var r=t;return t=c(t),t?t.slice((n?Kn(r,e,n):null==e)?E(t):l(t,e+"")):t}function so(t,e,n){var r=t;return t=c(t),t?(n?Kn(r,e,n):null==e)?t.slice(0,O(t)+1):t.slice(0,h(t,e+"")+1):t}function co(t,e,n){n&&Kn(t,e,n)&&(e=null);var r=P,i=q;if(null!=e)if(Oi(e)){var o="separator"in e?e.separator:o;r="length"in e?+e.length||0:r,i="omission"in e?c(e.omission):i}else r=+e||0;if(t=c(t),r>=t.length)return t;var u=r-i.length;if(1>u)return i;var a=t.slice(0,u);if(null==o)return a+i;if(Ci(o)){if(t.slice(u).search(o)){var s,f,l=t.slice(0,u);for(o.global||(o=Ro(o.source,(Dt.exec(o)||"")+"g")),o.lastIndex=0;s=o.exec(l);)f=s.index;a=a.slice(0,null==f?u:f)}}else if(t.indexOf(o,u)!=u){var h=a.lastIndexOf(o);h>-1&&(a=a.slice(0,h))}return a+i}function fo(t){return t=c(t),t&&bt.test(t)?t.replace(mt,I):t}function lo(t,e,n){return n&&Kn(t,e,n)&&(e=null),t=c(t),t.match(e||Ut)||[]}function ho(t,e,n){return n&&Kn(t,e,n)&&(e=null),m(t)?vo(t):me(t,e)}function po(t){return function(){return t}}function _o(t){return t}function vo(t){return Le(we(t,!0))}function yo(t,e){return Pe(t,we(e,!0))}function go(t,e,n){if(null==n){var r=Oi(e),i=r&&Pa(e),o=i&&i.length&&ke(e,i);(o?o.length:r)||(o=!1,n=e,e=t,t=this)}o||(o=ke(e,Pa(e)));var u=!0,a=-1,s=Na(t),c=o.length;n===!1?u=!1:Oi(n)&&"chain"in n&&(u=n.chain);for(;++a<c;){var f=o[a],l=e[f];t[f]=l,s&&(t.prototype[f]=function(e){return function(){var n=this.__chain__;if(u||n){var r=t(this.__wrapped__),i=r.__actions__=te(this.__actions__);return i.push({func:e,args:arguments,thisArg:t}),r.__chain__=n,r}var o=[this.value()];return eu.apply(o,arguments),e.apply(t,o)}}(l))}return t}function mo(){return t._=Ko,this}function wo(){}function bo(t){return Hn(t)?We(t):Ge(t)}function To(t){return function(e){return je(t,or(e),e+"")}}function Eo(t,e,n){n&&Kn(t,e,n)&&(e=n=null),t=+t||0,n=null==n?1:+n||0,null==e?(e=t,t=0):e=+e||0;for(var r=-1,i=vu(Yo((e-t)/(n||1)),0),o=No(i);++r<i;)o[r]=t,t+=n;return o}function Oo(t,e,n){if(t=Qo(t),1>t||!pu(t))return[];var r=-1,i=No(du(t,Eu));for(e=rn(e,n,1);++r<t;)Eu>r?i[r]=e(r):e(r);return i}function Io(t){var e=++$o;return c(t)+e}function So(t,e){return(+t||0)+(+e||0)}function Ao(t,e,n){n&&Kn(t,e,n)&&(e=null);var r=Ln(),i=null==e;return r===me&&i||(i=!1,e=r(e,n,3)),i?pe(Sa(t)?t:rr(t)):Ye(t,e)}t=t?ie.defaults(re.Object(),t,ie.pick(re,Gt)):re;var No=t.Array,xo=t.Date,Co=t.Error,ko=t.Function,jo=t.Math,Mo=t.Number,Do=t.Object,Ro=t.RegExp,zo=t.String,Lo=t.TypeError,Po=No.prototype,qo=Do.prototype,Uo=zo.prototype,Wo=(Wo=t.window)&&Wo.document,Go=ko.prototype.toString,Vo=qo.hasOwnProperty,$o=0,Fo=qo.toString,Ko=t._,Ho=Ro("^"+to(Fo).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Bo=Ai(Bo=t.ArrayBuffer)&&Bo,Jo=Ai(Jo=Bo&&new Bo(0).slice)&&Jo,Yo=jo.ceil,Xo=t.clearTimeout,Qo=jo.floor,Zo=Ai(Zo=Do.getOwnPropertySymbols)&&Zo,tu=Ai(tu=Do.getPrototypeOf)&&tu,eu=Po.push,nu=Ai(nu=Do.preventExtensions)&&nu,ru=qo.propertyIsEnumerable,iu=Ai(iu=t.Set)&&iu,ou=t.setTimeout,uu=Po.splice,au=Ai(au=t.Uint8Array)&&au,su=Ai(su=t.WeakMap)&&su,cu=function(){try{var e=Ai(e=t.Float64Array)&&e,n=new e(new Bo(10),0,1)&&e}catch(r){}return n}(),fu=function(){var t=nu&&Ai(t=Do.assign)&&t;try{if(t){var e=nu({1:0});e[0]=1}}catch(n){try{t(e,"xo")}catch(n){}return!e[1]&&t}return!1}(),lu=Ai(lu=No.isArray)&&lu,hu=Ai(hu=Do.create)&&hu,pu=t.isFinite,_u=Ai(_u=Do.keys)&&_u,vu=jo.max,du=jo.min,yu=Ai(yu=xo.now)&&yu,gu=Ai(gu=Mo.isFinite)&&gu,mu=t.parseInt,wu=jo.random,bu=Mo.NEGATIVE_INFINITY,Tu=Mo.POSITIVE_INFINITY,Eu=jo.pow(2,32)-1,Ou=Eu-1,Iu=Eu>>>1,Su=cu?cu.BYTES_PER_ELEMENT:0,Au=jo.pow(2,53)-1,Nu=su&&new su,xu={},Cu=e.support={};!function(t){var e=function(){this.x=t},n=arguments,r=[];e.prototype={valueOf:t,y:t};for(var i in new e)r.push(i);Cu.funcDecomp=/\bthis\b/.test(function(){return this}),Cu.funcNames="string"==typeof ko.name;try{Cu.dom=11===Wo.createDocumentFragment().nodeType}catch(o){Cu.dom=!1}try{Cu.nonEnumArgs=!ru.call(n,1)}catch(o){Cu.nonEnumArgs=!0}}(1,0),e.templateSettings={escape:Et,evaluate:Ot,interpolate:It,variable:"",imports:{_:e}};var ku=fu||function(t,e){return null==e?t:ge(e,Gu(e),ge(e,Pa(e),t))},ju=function(){function e(){}return function(n){if(Oi(n)){e.prototype=n;var r=new e;e.prototype=null}return r||t.Object()}}(),Mu=fn(xe),Du=fn(Ce,!0),Ru=ln(),zu=ln(!0),Lu=Nu?function(t,e){return Nu.set(t,e),t}:_o;Jo||(on=Bo&&au?function(t){var e=t.byteLength,n=cu?Qo(e/Su):0,r=n*Su,i=new Bo(e);if(n){var o=new cu(i,0,n);o.set(new cu(t,0,n))}return e!=r&&(o=new au(i,r),o.set(new au(t,r))),i}:po(null));var Pu=hu&&iu?function(t){return new Xt(t)}:po(null),qu=Nu?function(t){return Nu.get(t)}:wo,Uu=function(){return Cu.funcNames?"constant"==po.name?We("name"):function(t){for(var e=t.name,n=xu[e],r=n?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}:po("")}(),Wu=We("length"),Gu=Zo?function(t){return Zo(ir(t))}:po([]),Vu=function(){var t=0,e=0;return function(n,r){var i=pa(),o=W-(i-e);if(e=i,o>0){if(++t>=U)return n}else t=0;return Lu(n,r)}}(),$u=li(function(t,e){return $n(t)?Te(t,Ae(e,!1,!0)):[]}),Fu=gn(),Ku=gn(!0),Hu=li(function(t,e){e=Ae(e);var n=ye(t,e);return Ve(t,e.sort(o)),n}),Bu=kn(),Ju=kn(!0),Yu=li(function(t){return Xe(Ae(t,!1,!0))}),Xu=li(function(t,e){return $n(t)?Te(t,e):[]}),Qu=li(kr),Zu=li(function(t){var e=t.length,n=t[e-2],r=t[e-1];return e>2&&"function"==typeof n?e-=2:(n=e>1&&"function"==typeof r?(--e,r):A,r=A),t.length=e,jr(t,n,r)}),ta=li(function(t,e){return ye(t,Ae(e))}),ea=sn(function(t,e,n){Vo.call(t,n)?++t[n]:t[n]=1}),na=yn(Mu),ra=yn(Du,!0),ia=bn(ee,Mu),oa=bn(ne,Du),ua=sn(function(t,e,n){Vo.call(t,n)?t[n].push(e):t[n]=[e]}),aa=sn(function(t,e,n){t[n]=e}),sa=li(function(t,e,n){var r=-1,i="function"==typeof e,o=Hn(e),u=$n(t)?No(t.length):[];return Mu(t,function(t){var a=i?e:o&&null!=t&&t[e];u[++r]=a?a.apply(t,n):Vn(t,e,n)}),u}),ca=sn(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),fa=An(fe,Mu),la=An(le,Du),ha=li(function(t,e){if(null==t)return[];var n=e[2];return n&&Kn(e[0],e[1],n)&&(e.length=1),Je(t,Ae(e),[])}),pa=yu||function(){return(new xo).getTime()},_a=li(function(t,e,n){var r=x;if(n.length){var i=b(n,_a.placeholder);r|=D}return jn(t,r,e,n,i)}),va=li(function(t,e){e=e.length?Ae(e):Li(t);for(var n=-1,r=e.length;++n<r;){var i=e[n];t[i]=jn(t[i],x,t)}return t}),da=li(function(t,e,n){var r=x|C;if(n.length){var i=b(n,da.placeholder);r|=D}return jn(e,r,t,n,i)}),ya=vn(j),ga=vn(M),ma=li(function(t,e){return be(t,1,e)}),wa=li(function(t,e,n){return be(t,e,n)}),ba=wn(),Ta=wn(!0),Ea=Sn(D),Oa=Sn(R),Ia=li(function(t,e){return jn(t,L,null,null,null,Ae(e))}),Sa=lu||function(t){return m(t)&&Jn(t.length)&&Fo.call(t)==B};Cu.dom||(wi=function(t){return!!t&&1===t.nodeType&&m(t)&&!xa(t)});var Aa=gu||function(t){return"number"==typeof t&&pu(t)},Na=s(/x/)||au&&!s(au)?function(t){return Fo.call(t)==Q}:s,xa=tu?function(t){if(!t||Fo.call(t)!=et)return!1;var e=t.valueOf,n=Ai(e)&&(n=tu(e))&&tu(n);return n?t==n||tu(t)==n:er(t)}:er,Ca=cn(function(t,e,n){return n?de(t,e,n):ku(t,e)}),ka=li(function(t){var e=t[0];return null==e?e:(t.push(_e),Ca.apply(A,t))}),ja=mn(xe),Ma=mn(Ce),Da=Tn(Ru),Ra=Tn(zu),za=En(xe),La=En(Ce),Pa=_u?function(t){var e=null!=t&&t.constructor;return"function"==typeof e&&e.prototype===t||"function"!=typeof t&&$n(t)?nr(t):Oi(t)?_u(t):[]}:nr,qa=On(!0),Ua=On(),Wa=cn(qe),Ga=li(function(t,e){if(null==t)return{};if("function"!=typeof e[0]){var e=ae(Ae(e),zo);return Qn(t,Te(Wi(t),e))}var n=rn(e[0],e[1],3);return Zn(t,function(t,e,r){return!n(t,e,r)})}),Va=li(function(t,e){return null==t?{}:"function"==typeof e[0]?Zn(t,rn(e[0],e[1],3)):Qn(t,Ae(e))}),$a=pn(function(t,e,n){return e=e.toLowerCase(),t+(n?e.charAt(0).toUpperCase()+e.slice(1):e)}),Fa=pn(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),Ka=In(),Ha=In(!0);8!=mu(Wt+"08")&&(no=function(t,e,n){return(n?Kn(t,e,n):null==e)?e=0:e&&(e=+e),t=uo(t),mu(t,e||(Rt.test(t)?16:10))});var Ba=pn(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}),Ja=pn(function(t,e,n){return t+(n?" ":"")+(e.charAt(0).toUpperCase()+e.slice(1))}),Ya=li(function(t,e){try{return t.apply(A,e)}catch(n){return Ei(n)?n:new Co(n)}}),Xa=li(function(t,e){return function(n){return Vn(n,t,e)}}),Qa=li(function(t,e){return function(n){return Vn(t,n,e)}}),Za=dn(se),ts=dn(ce,!0);return e.prototype=n.prototype,r.prototype=ju(n.prototype),r.prototype.constructor=r,i.prototype=ju(n.prototype),i.prototype.constructor=i,ot.prototype["delete"]=Ht,ot.prototype.get=Bt,ot.prototype.has=Jt,ot.prototype.set=Yt,Xt.prototype.push=Zt,si.Cache=ot,e.after=ii,e.ary=oi,e.assign=Ca,e.at=ta,e.before=ui,e.bind=_a,e.bindAll=va,e.bindKey=da,e.callback=ho,e.chain=Rr,e.chunk=ar,e.compact=sr,e.constant=po,e.countBy=ea,e.create=zi,e.curry=ya,e.curryRight=ga,e.debounce=ai,e.defaults=ka,e.defer=ma,e.delay=wa,e.difference=$u,e.drop=cr,e.dropRight=fr,e.dropRightWhile=lr,e.dropWhile=hr,e.fill=pr,e.filter=Fr,e.flatten=vr,e.flattenDeep=dr,e.flow=ba,e.flowRight=Ta,e.forEach=ia,e.forEachRight=oa,e.forIn=Da,e.forInRight=Ra,e.forOwn=za,e.forOwnRight=La,e.functions=Li,e.groupBy=ua,e.indexBy=aa,e.initial=gr,e.intersection=mr,e.invert=Ui,e.invoke=sa,e.keys=Pa,e.keysIn=Wi,e.map=Br,e.mapKeys=qa,e.mapValues=Ua,e.matches=vo,e.matchesProperty=yo,e.memoize=si,e.merge=Wa,e.method=Xa,e.methodOf=Qa,e.mixin=go,e.negate=ci,e.omit=Ga,e.once=fi,e.pairs=Gi,e.partial=Ea,e.partialRight=Oa,e.partition=ca,e.pick=Va,e.pluck=Jr,e.property=bo,e.propertyOf=To,e.pull=Tr,e.pullAt=Hu,e.range=Eo,e.rearg=Ia,e.reject=Yr,e.remove=Er,e.rest=Or,e.restParam=li,e.set=$i,e.shuffle=Qr,e.slice=Ir,e.sortBy=ei,e.sortByAll=ha,e.sortByOrder=ni,e.spread=hi,e.take=Sr,e.takeRight=Ar,e.takeRightWhile=Nr,e.takeWhile=xr,e.tap=zr,e.throttle=pi,e.thru=Lr,e.times=Oo,e.toArray=Di,e.toPlainObject=Ri,e.transform=Fi,e.union=Yu,e.uniq=Cr,e.unzip=kr,e.unzipWith=jr,e.values=Ki,e.valuesIn=Hi,e.where=ri,e.without=Xu,e.wrap=_i,e.xor=Mr,e.zip=Qu,e.zipObject=Dr,e.zipWith=Zu,e.backflow=Ta,e.collect=Br,e.compose=Ta,e.each=ia,e.eachRight=oa,e.extend=Ca,e.iteratee=ho,e.methods=Li,e.object=Dr,e.select=Fr,e.tail=Or,e.unique=Cr,go(e,e),e.add=So,e.attempt=Ya,e.camelCase=$a,e.capitalize=Yi,e.clone=vi,e.cloneDeep=di,e.deburr=Xi,e.endsWith=Qi,e.escape=Zi,e.escapeRegExp=to,e.every=$r,e.find=na,e.findIndex=Fu,e.findKey=ja,e.findLast=ra,e.findLastIndex=Ku,e.findLastKey=Ma,e.findWhere=Kr,e.first=_r,e.get=Pi,e.has=qi,e.identity=_o,e.includes=Hr,e.indexOf=yr,e.inRange=Bi,e.isArguments=yi,e.isArray=Sa,e.isBoolean=gi,e.isDate=mi,e.isElement=wi,e.isEmpty=bi,e.isEqual=Ti,e.isError=Ei,e.isFinite=Aa,e.isFunction=Na,e.isMatch=Ii,e.isNaN=Si,e.isNative=Ai,e.isNull=Ni,e.isNumber=xi,e.isObject=Oi,e.isPlainObject=xa,e.isRegExp=Ci,e.isString=ki,e.isTypedArray=ji,e.isUndefined=Mi,e.kebabCase=Fa,e.last=wr,e.lastIndexOf=br,e.max=Za,e.min=ts,e.noConflict=mo,e.noop=wo,e.now=pa,e.pad=eo,e.padLeft=Ka,e.padRight=Ha,e.parseInt=no,e.random=Ji,e.reduce=fa,e.reduceRight=la,e.repeat=ro,e.result=Vi,e.runInContext=S,e.size=Zr,e.snakeCase=Ba,e.some=ti,e.sortedIndex=Bu,e.sortedLastIndex=Ju,e.startCase=Ja,e.startsWith=io,e.sum=Ao,e.template=oo,e.trim=uo,e.trimLeft=ao,e.trimRight=so,e.trunc=co,e.unescape=fo,e.uniqueId=Io,e.words=lo,e.all=$r,e.any=ti,e.contains=Hr,e.detect=na,e.foldl=fa,e.foldr=la,e.head=_r,e.include=Hr,e.inject=fa,go(e,function(){var t={};return xe(e,function(n,r){e.prototype[r]||(t[r]=n)}),t}(),!1),e.sample=Xr,e.prototype.sample=function(t){return this.__chain__||null!=t?this.thru(function(e){return Xr(e,t)}):Xr(this.value())},e.VERSION=N,ee(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){e[t].placeholder=e}),ee(["dropWhile","filter","map","takeWhile"],function(t,e){var n=e!=$,r=e==G;i.prototype[t]=function(t,o){var u=this.__filtered__,a=u&&r?new i(this):this.clone(),s=a.__iteratees__||(a.__iteratees__=[]);return s.push({done:!1,count:0,index:0,iteratee:Ln(t,o,1),limit:-1,type:e}),a.__filtered__=u||n,a}}),ee(["drop","take"],function(t,e){var n=t+"While";i.prototype[t]=function(n){var r=this.__filtered__,i=r&&!e?this.dropWhile():this.clone();if(n=null==n?1:vu(Qo(n)||0,0),r)e?i.__takeCount__=du(i.__takeCount__,n):wr(i.__iteratees__).limit=n;else{var o=i.__views__||(i.__views__=[]);o.push({size:n,type:t+(i.__dir__<0?"Right":"")})}return i},i.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()},i.prototype[t+"RightWhile"]=function(t,e){return this.reverse()[n](t,e).reverse()}}),ee(["first","last"],function(t,e){var n="take"+(e?"Right":"");i.prototype[t]=function(){return this[n](1).value()[0]}}),ee(["initial","rest"],function(t,e){var n="drop"+(e?"":"Right");i.prototype[t]=function(){return this[n](1)}}),ee(["pluck","where"],function(t,e){var n=e?"filter":"map",r=e?Le:bo;i.prototype[t]=function(t){return this[n](r(t))}}),i.prototype.compact=function(){return this.filter(_o)},i.prototype.reject=function(t,e){return t=Ln(t,e,1),this.filter(function(e){return!t(e)})},i.prototype.slice=function(t,e){t=null==t?0:+t||0;var n=this;return 0>t?n=this.takeRight(-t):t&&(n=this.drop(t)),e!==A&&(e=+e||0,n=0>e?n.dropRight(-e):n.take(e-t)),n},i.prototype.toArray=function(){return this.drop(0)},xe(i.prototype,function(t,n){var o=e[n];if(o){var u=/^(?:filter|map|reject)|While$/.test(n),a=/^(?:first|last)$/.test(n);e.prototype[n]=function(){var n=arguments,s=this.__chain__,c=this.__wrapped__,f=!!this.__actions__.length,l=c instanceof i,h=n[0],p=l||Sa(c);p&&u&&"function"==typeof h&&1!=h.length&&(l=p=!1);var _=l&&!f;if(a&&!s)return _?t.call(c):o.call(e,this.value());var v=function(t){var r=[t];return eu.apply(r,n),o.apply(e,r)};if(p){var d=_?c:new i(this),y=t.apply(d,n);if(!a&&(f||y.__actions__)){var g=y.__actions__||(y.__actions__=[]);g.push({func:Lr,args:[v],thisArg:e})}return new r(y,s)}return this.thru(v)}}}),ee(["concat","join","pop","push","replace","shift","sort","splice","split","unshift"],function(t){var n=(/^(?:replace|split)$/.test(t)?Uo:Po)[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:join|pop|replace|shift)$/.test(t);e.prototype[t]=function(){var t=arguments;return i&&!this.__chain__?n.apply(this.value(),t):this[r](function(e){return n.apply(e,t)})}}),xe(i.prototype,function(t,n){var r=e[n];if(r){var i=r.name,o=xu[i]||(xu[i]=[]);o.push({name:n,func:r})}}),xu[Nn(null,C).name]=[{name:"wrapper",func:null}],i.prototype.clone=w,i.prototype.reverse=Z,i.prototype.value=rt,e.prototype.chain=Pr,e.prototype.commit=qr,e.prototype.plant=Ur,e.prototype.reverse=Wr,e.prototype.toString=Gr,e.prototype.run=e.prototype.toJSON=e.prototype.valueOf=e.prototype.value=Vr,e.prototype.collect=e.prototype.map,e.prototype.head=e.prototype.first,e.prototype.select=e.prototype.filter,e.prototype.tail=e.prototype.rest,e}var A,N="3.8.0",x=1,C=2,k=4,j=8,M=16,D=32,R=64,z=128,L=256,P=30,q="...",U=150,W=16,G=0,V=1,$=2,F="Expected a function",K="__lodash_placeholder__",H="[object Arguments]",B="[object Array]",J="[object Boolean]",Y="[object Date]",X="[object Error]",Q="[object Function]",Z="[object Map]",tt="[object Number]",et="[object Object]",nt="[object RegExp]",rt="[object Set]",it="[object String]",ot="[object WeakMap]",ut="[object ArrayBuffer]",at="[object Float32Array]",st="[object Float64Array]",ct="[object Int8Array]",ft="[object Int16Array]",lt="[object Int32Array]",ht="[object Uint8Array]",pt="[object Uint8ClampedArray]",_t="[object Uint16Array]",vt="[object Uint32Array]",dt=/\b__p \+= '';/g,yt=/\b(__p \+=) '' \+/g,gt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39|#96);/g,wt=/[&<>"'`]/g,bt=RegExp(mt.source),Tt=RegExp(wt.source),Et=/<%-([\s\S]+?)%>/g,Ot=/<%([\s\S]+?)%>/g,It=/<%=([\s\S]+?)%>/g,St=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,At=/^\w*$/,Nt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,xt=/[.*+?^${}()|[\]\/\\]/g,Ct=RegExp(xt.source),kt=/[\u0300-\u036f\ufe20-\ufe23]/g,jt=/\\(\\)?/g,Mt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Dt=/\w*$/,Rt=/^0[xX]/,zt=/^\[object .+?Constructor\]$/,Lt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Pt=/($^)/,qt=/['\n\r\u2028\u2029\\]/g,Ut=function(){var t="[A-Z\\xc0-\\xd6\\xd8-\\xde]",e="[a-z\\xdf-\\xf6\\xf8-\\xff]+";return RegExp(t+"+(?="+t+e+")|"+t+"?"+e+"|"+t+"+|[0-9]+","g")}(),Wt=" \f \ufeff\n\r\u2028\u2029 ",Gt=["Array","ArrayBuffer","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Math","Number","Object","RegExp","Set","String","_","clearTimeout","document","isFinite","parseInt","setTimeout","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","window"],Vt=-1,$t={};$t[at]=$t[st]=$t[ct]=$t[ft]=$t[lt]=$t[ht]=$t[pt]=$t[_t]=$t[vt]=!0,$t[H]=$t[B]=$t[ut]=$t[J]=$t[Y]=$t[X]=$t[Q]=$t[Z]=$t[tt]=$t[et]=$t[nt]=$t[rt]=$t[it]=$t[ot]=!1;var Ft={};Ft[H]=Ft[B]=Ft[ut]=Ft[J]=Ft[Y]=Ft[at]=Ft[st]=Ft[ct]=Ft[ft]=Ft[lt]=Ft[tt]=Ft[et]=Ft[nt]=Ft[it]=Ft[ht]=Ft[pt]=Ft[_t]=Ft[vt]=!0,Ft[X]=Ft[Q]=Ft[Z]=Ft[rt]=Ft[ot]=!1;var Kt={leading:!1,maxWait:0,trailing:!1},Ht={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Bt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Jt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Yt={"function":!0,object:!0},Xt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Qt=Yt[typeof e]&&e&&!e.nodeType&&e,Zt=Yt[typeof t]&&t&&!t.nodeType&&t,te=Qt&&Zt&&"object"==typeof i&&i&&i.Object&&i,ee=Yt[typeof self]&&self&&self.Object&&self,ne=Yt[typeof window]&&window&&window.Object&&window,re=(Zt&&Zt.exports===Qt&&Qt,te||ne!==(this&&this.window)&&ne||ee||this),ie=S();re._=ie,r=function(){return ie}.call(e,n,e,t),!(r!==A&&(t.exports=r))}).call(this)}).call(e,n(/*! (webpack)/buildin/module.js */96)(t),function(){return this}())},/*!***********************************!*\
|
||
!*** ./~/lodash/lang/isObject.js ***!
|
||
\***********************************/
|
||
function(t,e,n){function r(t){var e=typeof t;return"function"==e||!!t&&"object"==e}t.exports=r},/*!******************************************!*\
|
||
!*** ./~/lodash/internal/isArrayLike.js ***!
|
||
\******************************************/
|
||
function(t,e,n){function r(t){return null!=t&&o(i(t))}var i=n(/*! ./getLength */43),o=n(/*! ./isLength */7);t.exports=r},/*!*******************************************!*\
|
||
!*** ./~/lodash/internal/isObjectLike.js ***!
|
||
\*******************************************/
|
||
function(t,e,n){function r(t){return!!t&&"object"==typeof t}t.exports=r},/*!*********************************!*\
|
||
!*** ./~/lodash/object/keys.js ***!
|
||
\*********************************/
|
||
function(t,e,n){var r=n(/*! ../internal/isArrayLike */11),i=n(/*! ../lang/isNative */48),o=n(/*! ../lang/isObject */10),u=n(/*! ../internal/shimKeys */89),a=i(a=Object.keys)&&a,s=a?function(t){var e=null!=t&&t.constructor;return"function"==typeof e&&e.prototype===t||"function"!=typeof t&&r(t)?u(t):o(t)?a(t):[]}:u;t.exports=s},/*!*************************************!*\
|
||
!*** ./src/actions/notification.js ***!
|
||
\*************************************/
|
||
function(t,e,n){"use strict";function r(t){i.dispatch({actionType:u,message:t})}Object.defineProperty(e,"__esModule",{value:!0}),e.notify=r;var i=n(/*! ../app_dispatcher */1),o=n(/*! ../constants */2),u=o.ACTION_NEW_NOTIFICATION},/*!********************************!*\
|
||
!*** ./src/actions/service.js ***!
|
||
\********************************/
|
||
function(t,e,n){"use strict";function r(t){t.length>0&&h["default"].dispatch({actionType:_["default"].ACTION_NEW_SERVICES,services:t})}function i(t){return u("homeassistant","turn_on",{entity_id:t})}function o(t){return u("homeassistant","turn_off",{entity_id:t})}function u(t,e){var n=void 0===arguments[2]?{}:arguments[2];return f["default"]("POST","services/"+t+"/"+e,n).then(function(r){v.notify("turn_on"==e&&n.entity_id?"Turned on "+n.entity_id+".":"turn_off"==e&&n.entity_id?"Turned off "+n.entity_id+".":"Service "+t+"/"+e+" called."),d.newStates(r)})}function a(){return f["default"]("GET","services").then(r)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(t){return t&&t.__esModule?t:{"default":t}};e.newServices=r,e.callTurnOn=i,e.callTurnOff=o,e.callService=u,e.fetchAll=a;var c=n(/*! ../call_api */5),f=s(c),l=n(/*! ../app_dispatcher */1),h=s(l),p=n(/*! ../constants */2),_=s(p),v=n(/*! ./notification */14),d=n(/*! ./state */16)},/*!******************************!*\
|
||
!*** ./src/actions/state.js ***!
|
||
\******************************/
|
||
function(t,e,n){"use strict";function r(t,e){(t.length>0||e)&&l["default"].dispatch({actionType:h.ACTION_NEW_STATES,states:t,replace:!!e})}function i(t,e){var n=void 0===arguments[2]?!1:arguments[2],i={state:e};n&&(i.attributes=n),c["default"]("POST","states/"+t,i).then(function(n){p.notify("State of "+t+" set to "+e+"."),r([n])})}function o(t){c["default"]("GET","states/"+t).then(function(t){r([t])})}function u(){c["default"]("GET","states").then(function(t){r(t,!0)})}Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){return t&&t.__esModule?t:{"default":t}};e.newStates=r,e.set=i,e.fetch=o,e.fetchAll=u;var s=n(/*! ../call_api */5),c=a(s),f=n(/*! ../app_dispatcher */1),l=a(f),h=n(/*! ../constants */2),p=n(/*! ./notification */14)},/*!*****************************!*\
|
||
!*** ./src/actions/sync.js ***!
|
||
\*****************************/
|
||
function(t,e,n){"use strict";function r(){f["default"].dispatch({actionType:h["default"].ACTION_FETCH_ALL}),p.fetch(),v&&d()}function i(){v=!0,r()}function o(){v=!1,d.cancel()}Object.defineProperty(e,"__esModule",{value:!0});var u=function(t){return t&&t.__esModule?t:{"default":t}};e.fetchAll=r,e.start=i,e.stop=o;var a=n(/*! lodash */9),s=u(a),c=n(/*! ../app_dispatcher */1),f=u(c),l=n(/*! ../constants */2),h=u(l),p=n(/*! ./bootstrap */24),_=3e4,v=!1,d=s["default"].debounce(r,_)},/*!*****************************!*\
|
||
!*** ./src/models/state.js ***!
|
||
\*****************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t&&t.__esModule?t:{"default":t}},i=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,o=void 0;try{for(var u,a=t[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(s){i=!0,o=s}finally{try{!r&&a["return"]&&a["return"]()}finally{if(i)throw o}}return n}throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},u=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}}(),a=function(t,e,n){for(var r=!0;r;){a=c=s=void 0,r=!1;var i=t,o=e,u=n,a=Object.getOwnPropertyDescriptor(i,o);if(void 0!==a){if("value"in a)return a.value;var s=a.get;return void 0===s?void 0:s.call(u)}var c=Object.getPrototypeOf(i);if(null===c)return void 0;t=c,e=o,n=u,r=!0}},s=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&&(t.__proto__=e)},c=n(/*! immutable */4),f=n(/*! ../stores/service */20),l=r(f),h=n(/*! ../util */22),p=new c.Record({entityId:null,domain:null,objectId:null,state:null,entityDisplay:null,stateDisplay:null,lastChanged:null,lastChangedAsDate:null,attributes:{},isCustomGroup:null},"State"),_=function(t){function e(t,n,r){var u=void 0===arguments[3]?{}:arguments[3];o(this,e);var s=t.split("."),c=i(s,2),f=c[0],l=c[1],p=n.replace(/_/g," ");u.unit_of_measurement&&(p+=" "+u.unit_of_measurement),a(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,{entityId:t,domain:f,objectId:l,state:n,stateDisplay:p,lastChanged:r,attributes:u,entityDisplay:u.friendly_name||l.replace(/_/g," "),lastChangedAsDate:h.parseDateTime(r),isCustomGroup:"group"===f&&!u.auto})}return s(e,t),u(e,[{key:"canToggle",get:function(){return"group"===this.domain&&("on"===this.state||"off"===this.state)||l["default"].has(this.domain,"turn_on")}}],[{key:"fromJSON",value:function(t){var n=t.entity_id,r=t.state,i=t.last_changed,o=t.attributes;return new e(n,r,i,o)}}]),e}(p);e["default"]=_,t.exports=e["default"]},/*!****************************!*\
|
||
!*** ./src/stores/auth.js ***!
|
||
\****************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t&&t.__esModule?t:{"default":t}},i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=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}}(),u=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&&(t.__proto__=e)},a=n(/*! ../app_dispatcher */1),s=r(a),c=n(/*! ../constants */2),f=r(c),l=n(/*! ../stores/store */3),h=r(l),p=!1,_=!1,v="",d="",y=!1,g="",m=function(t){function e(){i(this,e),null!=t&&t.apply(this,arguments)}return u(e,t),o(e,[{key:"isValidating",get:function(){return p}},{key:"isLoggedIn",get:function(){return _}},{key:"authToken",get:function(){return v}},{key:"host",get:function(){return d}},{key:"lastAttemptInvalid",get:function(){return y}},{key:"lastAttemptMessage",get:function(){return g}}]),e}(h["default"]),w=new m;w.dispatchToken=s["default"].register(function(t){switch(t.actionType){case f["default"].ACTION_VALIDATING_AUTH_TOKEN:p=!0,v=t.authToken,d=t.host,w.emitChange();break;case f["default"].ACTION_VALID_AUTH_TOKEN:p=!1,_=!0,y=!1,g="",w.emitChange();break;case f["default"].ACTION_INVALID_AUTH_TOKEN:p=!1,_=!1,v="",d="",y=!0,g=t.message||"Unexpected result from API",w.emitChange();break;case f["default"].ACTION_LOG_OUT:p=!1,_=!1,v="",d="",y=!1,g="",w.emitChange()}}),e["default"]=w,t.exports=e["default"]},/*!*******************************!*\
|
||
!*** ./src/stores/service.js ***!
|
||
\*******************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t&&t.__esModule?t:{"default":t}},i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=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}}(),u=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&&(t.__proto__=e)},a=n(/*! immutable */4),s=n(/*! ../app_dispatcher */1),c=r(s),f=n(/*! ../constants */2),l=r(f),h=n(/*! ./store */3),p=r(h),_=new a.Map,v=function(t){function e(){i(this,e),null!=t&&t.apply(this,arguments)}return u(e,t),o(e,[{key:"all",get:function(){return _}},{key:"has",value:function(t,e){var n=_.get(t);return n&&n.contains(e)}},{key:"getServices",value:function(t){return _.get(t)||new a.List}}]),e}(p["default"]),d=new v;d.dispatchToken=c["default"].register(function(t){switch(t.actionType){case l["default"].ACTION_NEW_SERVICES:_=(new a.Map).withMutations(function(e){t.services.forEach(function(t){e.set(t.domain,new a.List(t.services))})}),d.emitChange();break;case l["default"].ACTION_REMOTE_EVENT_RECEIVED:if(t.event.event_type!==l["default"].REMOTE_EVENT_SERVICE_REGISTERED)break;var e=t.event.data,n=e.domain,r=e.service;if(d.has(n,r))break;var i=d.getServices(n);_=_.set(n,i.push(r)),d.emitChange();break;case l["default"].ACTION_LOG_OUT:_=new a.Map,d.emitChange()}}),e["default"]=d,t.exports=e["default"]},/*!******************************!*\
|
||
!*** ./src/stores/stream.js ***!
|
||
\******************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t&&t.__esModule?t:{"default":t}},i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=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}}(),u=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&&(t.__proto__=e)},a=n(/*! ../app_dispatcher */1),s=r(a),c=n(/*! ../constants */2),f=r(c),l=n(/*! ./store */3),h=r(l),p="STATE_CONNECTED",_="STATE_DISCONNECTED",v="STATE_ERROR",d=_,y=function(t){function e(){i(this,e),null!=t&&t.apply(this,arguments)}return u(e,t),o(e,[{key:"state",get:function(){return d}},{key:"isStreaming",get:function(){return d===this.STATE_CONNECTED}},{key:"hasError",get:function(){return d===this.STATE_ERROR}}]),e}(h["default"]),g=new y;g.STATE_CONNECTED=p,g.STATE_DISCONNECTED=_,g.STATE_ERROR=v,g.dispatchToken=s["default"].register(function(t){switch(t.actionType){case f["default"].ACTION_STREAM_START:d=p,g.emitChange();break;case f["default"].ACTION_STREAM_STOP:d=_,g.emitChange();break;case f["default"].ACTION_STREAM_ERROR:d=v,g.emitChange()}}),e["default"]=g,t.exports=e["default"]},/*!*********************!*\
|
||
!*** ./src/util.js ***!
|
||
\*********************/
|
||
function(t,e,n){"use strict";function r(t){var e=t.split(" "),n=i(e,2),r=n[0],o=n[1],u=r.split(":"),a=i(u,3),s=a[0],c=a[1],f=a[2],l=o.split("-"),h=i(l,3),p=h[0],_=h[1],v=h[2];return new Date(Date.UTC(v,parseInt(_)-1,p,s,c,f))}Object.defineProperty(e,"__esModule",{value:!0});var i=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,o=void 0;try{for(var u,a=t[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(s){i=!0,o=s}finally{try{!r&&a["return"]&&a["return"]()}finally{if(i)throw o}}return n}throw new TypeError("Invalid attempt to destructure non-iterable instance")};e.parseDateTime=r},/*!**************************************!*\
|
||
!*** ./~/lodash/internal/isIndex.js ***!
|
||
\**************************************/
|
||
function(t,e,n){function r(t,e){return t=+t,e=null==e?i:e,t>-1&&t%1==0&&e>t}var i=Math.pow(2,53)-1;t.exports=r},/*!**********************************!*\
|
||
!*** ./src/actions/bootstrap.js ***!
|
||
\**********************************/
|
||
function(t,e,n){"use strict";function r(t){f.newStates(t.states,!0),l.newServices(t.services),h.newEvents(t.events),p.newConfig(t.config)}function i(){void 0===arguments[0]?!1:arguments[0];return a["default"]("GET","bootstrap").then(r)}Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){return t&&t.__esModule?t:{"default":t}};e.newBootstrapData=r,e.fetch=i;var u=n(/*! ../call_api */5),a=o(u),s=n(/*! ../app_dispatcher */1),c=(o(s),n(/*! ../constants */2)),f=(o(c),n(/*! ./state */16)),l=n(/*! ./service */15),h=n(/*! ./event */26),p=n(/*! ./config */25)},/*!*******************************!*\
|
||
!*** ./src/actions/config.js ***!
|
||
\*******************************/
|
||
function(t,e,n){"use strict";function r(t){c["default"].dispatch({actionType:l["default"].ACTION_NEW_CONFIG,config:t})}function i(){return a["default"]("GET","config").then(r)}Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){return t&&t.__esModule?t:{"default":t}};e.newConfig=r,e.fetch=i;var u=n(/*! ../call_api */5),a=o(u),s=n(/*! ../app_dispatcher */1),c=o(s),f=n(/*! ../constants */2),l=o(f)},/*!******************************!*\
|
||
!*** ./src/actions/event.js ***!
|
||
\******************************/
|
||
function(t,e,n){"use strict";function r(t){f["default"].dispatch({actionType:h["default"].ACTION_NEW_EVENTS,events:t})}function i(){s["default"]("GET","events").then(r)}function o(t){var e=void 0===arguments[1]?{}:arguments[1];return s["default"]("POST","events/"+t,e).then(function(){p.notify("Event "+t+" successful fired!"),f["default"].dispatch({actionType:h["default"].ACTION_EVENT_FIRED,eventType:t,eventData:e})})}Object.defineProperty(e,"__esModule",{value:!0});var u=function(t){return t&&t.__esModule?t:{"default":t}};e.newEvents=r,e.fetchAll=i,e.fire=o;var a=n(/*! ../call_api */5),s=u(a),c=n(/*! ../app_dispatcher */1),f=u(c),l=n(/*! ../constants */2),h=u(l),p=n(/*! ./notification */14)},/*!*******************************!*\
|
||
!*** ./src/actions/stream.js ***!
|
||
\*******************************/
|
||
function(t,e,n){"use strict";function r(){return"EventSource"in window}function i(t){var e=void 0===arguments[1]?!0:arguments[1];null!==y&&w();var n="/api/stream";t&&(n+="?api_password="+t),y=new EventSource(n),g=t,y.addEventListener("open",function(){m(),l["default"].dispatch({actionType:p["default"].ACTION_STREAM_START}),v.stop(),e?v.fetchAll():e=!0},!1),y.addEventListener("message",function(t){m(),"ping"!==t.data&&l["default"].dispatch({actionType:p["default"].ACTION_REMOTE_EVENT_RECEIVED,event:JSON.parse(t.data)})},!1),y.addEventListener("error",function(){y.readyState!==EventSource.CLOSED&&l["default"].dispatch({actionType:p["default"].ACTION_STREAM_ERROR})},!1)}function o(){w(),l["default"].dispatch({actionType:p["default"].ACTION_STREAM_STOP}),v.start()}Object.defineProperty(e,"__esModule",{value:!0});var u=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e},a=function(t){return t&&t.__esModule?t:{"default":t}};e.isSupported=r,e.start=i,e.stop=o;var s=n(/*! lodash */9),c=a(s),f=n(/*! ../app_dispatcher */1),l=a(f),h=n(/*! ../constants */2),p=a(h),_=n(/*! ./sync */17),v=u(_),d=6e4,y=null,g=null,m=c["default"].debounce(function(){i(g)},d),w=function(){y.close(),y=null,g=null,m.cancel()}},/*!*********************************!*\
|
||
!*** ./src/stores/component.js ***!
|
||
\*********************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t&&t.__esModule?t:{"default":t}},i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=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}}(),u=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&&(t.__proto__=e)},a=(n(/*! immutable */4),n(/*! ../app_dispatcher */1)),s=r(a),c=n(/*! ../constants */2),f=r(c),l=n(/*! ./store */3),h=r(l),p=n(/*! ./config */29),_=r(p),v=_["default"].components,d=function(t){function e(){i(this,e),null!=t&&t.apply(this,arguments)}return u(e,t),o(e,[{key:"loaded",get:function(){return v}},{key:"isLoaded",value:function(t){return v.contains(t)}}]),e}(h["default"]),y=new d;y.dispatchToken=s["default"].register(function(t){switch(t.actionType){case f["default"].ACTION_NEW_CONFIG:s["default"].waitFor([_["default"].dispatchToken]),v=_["default"].components,y.emitChange();break;case f["default"].ACTION_REMOTE_EVENT_RECEIVED:if(t.event.event_type!==f["default"].REMOTE_EVENT_COMPONENT_LOADED)break;var e=t.event.data.component;if(y.isLoaded(e))break;v=v.push(e),y.emitChange();break;case f["default"].ACTION_LOG_OUT:s["default"].waitFor([_["default"].dispatchToken]),v=_["default"].components,y.emitChange()}}),e["default"]=y,t.exports=e["default"]},/*!******************************!*\
|
||
!*** ./src/stores/config.js ***!
|
||
\******************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t&&t.__esModule?t:{"default":t}},i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=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}}(),u=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&&(t.__proto__=e)},a=n(/*! ../models/config */57),s=r(a),c=n(/*! ../app_dispatcher */1),f=r(c),l=n(/*! ../constants */2),h=r(l),p=n(/*! ./store */3),_=r(p),v=new s["default"],d=function(t){function e(){i(this,e),null!=t&&t.apply(this,arguments)}return u(e,t),o(e,[{key:"latitude",get:function(){return v.latitude}},{key:"longitude",get:function(){return v.longitude}},{key:"temperature_unit",get:function(){return v.temperature_unit}},{key:"location_name",get:function(){return v.location_name}},{key:"time_zone",get:function(){return v.time_zone}},{key:"components",get:function(){return v.components}}]),e}(_["default"]),y=new d;y.dispatchToken=f["default"].register(function(t){switch(t.actionType){case h["default"].ACTION_NEW_CONFIG:v=s["default"].fromJSON(t.config),y.emitChange();break;case h["default"].ACTION_LOG_OUT:v=new s["default"],y.emitChange()}}),e["default"]=y,t.exports=e["default"]},/*!*****************************!*\
|
||
!*** ./src/stores/event.js ***!
|
||
\*****************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t&&t.__esModule?t:{"default":t}},i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=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}}(),u=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&&(t.__proto__=e)},a=n(/*! immutable */4),s=n(/*! ../app_dispatcher */1),c=r(s),f=n(/*! ../constants */2),l=r(f),h=n(/*! ./store */3),p=r(h),_=new a.List,v=function(t){function e(){i(this,e),null!=t&&t.apply(this,arguments)}return u(e,t),o(e,[{key:"all",get:function(){return _}}]),e}(p["default"]),d=new v;d.dispatchToken=c["default"].register(function(t){switch(t.actionType){case l["default"].ACTION_NEW_EVENTS:_=new a.List(t.events),d.emitChange();break;case l["default"].ACTION_LOG_OUT:_=new a.List,d.emitChange()}}),e["default"]=d,t.exports=e["default"]},/*!*******************************!*\
|
||
!*** ./src/stores/logbook.js ***!
|
||
\*******************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t&&t.__esModule?t:{"default":t}},i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=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}}(),u=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&&(t.__proto__=e)},a=n(/*! immutable */4),s=n(/*! ../app_dispatcher */1),c=r(s),f=n(/*! ../constants */2),l=r(f),h=n(/*! ../stores/store */3),p=r(h),_=n(/*! ../models/logbook_entry */58),v=r(_),d=6e4,y=null,g=null,m=new a.List,w=function(t){function e(){i(this,e),null!=t&&t.apply(this,arguments)}return u(e,t),o(e,[{key:"shouldFetch",value:function(){var t=void 0===arguments[0]?null:arguments[0];return t!=g||null===y||(new Date).getTime()-y.getTime()>d}},{key:"all",get:function(){return m}}]),e}(p["default"]),b=new w;b.dispatchToken=c["default"].register(function(t){switch(t.actionType){case l["default"].ACTION_NEW_LOGBOOK:g=t.date,m=new a.List(t.logbookEntries.map(function(t){return v["default"].fromJSON(t)})),y=new Date,b.emitChange();break;case l["default"].ACTION_LOG_OUT:g=null,y=null,m=new a.List,b.emitChange()}}),e["default"]=b,t.exports=e["default"]},/*!************************************!*\
|
||
!*** ./src/stores/notification.js ***!
|
||
\************************************/
|
||
function(t,e,n){"use strict";function r(){return y.size}Object.defineProperty(e,"__esModule",{value:!0});var i=function(t){return t&&t.__esModule?t:{"default":t}},o=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},u=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}}(),a=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&&(t.__proto__=e)},s=n(/*! immutable */4),c=n(/*! ../app_dispatcher */1),f=i(c),l=n(/*! ../constants */2),h=i(l),p=n(/*! ../stores/store */3),_=i(p),v=n(/*! ../models/notification */59),d=i(v),y=new s.List,g=function(t){function e(){o(this,e),null!=t&&t.apply(this,arguments)}return a(e,t),u(e,[{key:"hasNewNotifications",value:function(){var t=void 0===arguments[0]?0:arguments[0];return t+1<=y.size}},{key:"lastNotification",get:function(){return y.last()}}]),e}(_["default"]),m=new g;m.dispatchToken=f["default"].register(function(t){switch(t.actionType){case h["default"].ACTION_NEW_NOTIFICATION:y=y.push(new d["default"](r(),t.message)),m.emitChange();break;case h["default"].ACTION_LOG_OUT:y=new s.List,m.emitChange()}}),e["default"]=m,t.exports=e["default"]},/*!*****************************!*\
|
||
!*** ./src/stores/state.js ***!
|
||
\*****************************/
|
||
function(t,e,n){"use strict";function r(t){return t.entityId}function i(t){b=b.set(t.entity_id,w["default"].fromJSON(t))}function o(t,e){var n=e?new f.Map:b;b=n.withMutations(function(e){return t.forEach(function(t){return e.set(t.entity_id,w["default"].fromJSON(t))}),e})}Object.defineProperty(e,"__esModule",{value:!0});var u=function(t){return t&&t.__esModule?t:{"default":t}},a=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},s=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}}(),c=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&&(t.__proto__=e)},f=n(/*! immutable */4),l=n(/*! ../app_dispatcher */1),h=u(l),p=n(/*! ../constants */2),_=u(p),v=n(/*! ./store */3),d=u(v),y=n(/*! ./stream */21),g=u(y),m=n(/*! ../models/state */18),w=u(m),b=new f.Map,T=function(t){function e(){a(this,e),null!=t&&t.apply(this,arguments)}return c(e,t),s(e,[{key:"all",get:function(){return b.valueSeq().sortBy(r)}},{key:"get",value:function(t){return t=t.toLowerCase(),b.get(t)||null}},{key:"gets",value:function(t){return t=t.map(function(t){return t.toLowerCase()}),b.valueSeq().filter(function(e){return-1!==t.indexOf(e.entityId)}).sortBy(r)}},{key:"entityIDs",get:function(){return b.keySeq().sort()}},{key:"domains",get:function(){return b.keySeq().map(function(t){return t.split(".")[0]}).sort().toOrderedSet()}}]),e}(d["default"]),E=new T;E.dispatchToken=h["default"].register(function(t){switch(t.actionType){case _["default"].ACTION_NEW_STATES:(!g["default"].isStreaming||t.replace)&&(o(t.states,t.replace),E.emitChange());break;case _["default"].ACTION_REMOTE_EVENT_RECEIVED:t.event.event_type===_["default"].REMOTE_EVENT_STATE_CHANGED&&(i(t.event.data.new_state),E.emitChange());break;case _["default"].ACTION_LOG_OUT:b=new f.Map,E.emitChange()}}),e["default"]=E,t.exports=e["default"]},/*!*************************************!*\
|
||
!*** ./src/stores/state_history.js ***!
|
||
\*************************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t&&t.__esModule?t:{"default":t}},i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=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}}(),u=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&&(t.__proto__=e)},a=n(/*! lodash/collection/foreach */65),s=r(a),c=n(/*! lodash/collection/sortby */66),f=r(c),l=n(/*! lodash/object/values */92),h=r(l),p=n(/*! ../app_dispatcher */1),_=r(p),v=n(/*! ../constants */2),d=r(v),y=n(/*! ../stores/store */3),g=r(y),m=6e4,w=function(){return(new Date).getTime()},b=function(t){return!t||w()-t>m},T=null,E={},O={},I=null,S={},A=function(t){function e(){i(this,e),null!=t&&t.apply(this,arguments)}return u(e,t),o(e,[{key:"shouldFetchEntity",value:function(t){return b(E[t])}},{key:"shouldFetch",value:function(t){return null!==t?t!==I:b(T)}},{key:"get",value:function(t){return O[t]||null}},{key:"all",value:function(){var t=void 0===arguments[0]?null:arguments[0],e=void 0;if(null===t)e=O;else{if(t!==I)throw"Date "+t+" is not loaded.";e=S}return f["default"](h["default"](e),function(t){return t[0].entityId})}}]),e}(g["default"]),N=new A;N.dispatchToken=_["default"].register(function(t){switch(t.actionType){case d["default"].ACTION_NEW_STATE_HISTORY:var e=void 0,n=w();t.date?(I=t.date,e=S={}):e=O,s["default"](t.stateHistory,function(r){if(0!==r.length){var i=r[0].entityId;e[i]=r,t.date||(E[i]=n)}}),!t.date&&t.isFetchAll&&(T=n),N.emitChange();break;case d["default"].ACTION_LOG_OUT:T=null,E={},O={},I=null,S={},N.emitChange()}}),e["default"]=N,t.exports=e["default"]},/*!****************************!*\
|
||
!*** ./src/stores/sync.js ***!
|
||
\****************************/
|
||
function(t,e,n){"use strict";function r(t){return-1!==y.indexOf(t)}function i(){return y.length===v}Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){return t&&t.__esModule?t:{"default":t}},u=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},a=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}}(),s=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&&(t.__proto__=e)},c=n(/*! ../app_dispatcher */1),f=o(c),l=n(/*! ../constants */2),h=o(l),p=n(/*! ../stores/store */3),_=o(p),v=4,d=!1,y=[],g=function(t){function e(){u(this,e),null!=t&&t.apply(this,arguments)}return s(e,t),a(e,[{key:"isFetching",get:function(){return!i()}},{key:"initialLoadDone",get:function(){return d}},{key:"componentsLoaded",get:function(){return r(h["default"].ACTION_NEW_CONFIG)}},{key:"eventsLoaded",get:function(){return r(h["default"].ACTION_NEW_EVENTS)}},{key:"servicesLoaded",get:function(){return r(h["default"].ACTION_NEW_SERVICES)}},{key:"statesLoaded",get:function(){return r(h["default"].ACTION_NEW_STATES)}}]),e}(_["default"]),m=new g;m.dispatchToken=f["default"].register(function(t){switch(t.actionType){case h["default"].ACTION_FETCH_ALL:y=[],m.emitChange();break;case h["default"].ACTION_NEW_CONFIG:case h["default"].ACTION_NEW_EVENTS:case h["default"].ACTION_NEW_SERVICES:case h["default"].ACTION_NEW_STATES:r(t.actionType)||(y.push(t.actionType),d=d||i(),m.emitChange());break;case h["default"].ACTION_LOG_OUT:d=!1,y=[],m.emitChange()}}),e["default"]=m,t.exports=e["default"]},/*!*****************************!*\
|
||
!*** ./src/stores/voice.js ***!
|
||
\*****************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t&&t.__esModule?t:{"default":t}},i=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=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}}(),u=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&&(t.__proto__=e)},a=n(/*! ../app_dispatcher */1),s=r(a),c=n(/*! ../constants */2),f=r(c),l=n(/*! ./store */3),h=r(l),p="STATE_LISTENING",_="STATE_TRANSMITTING",v="STATE_IDLE",d="STATE_ERROR",y=v,g="",m="",w=function(t){function e(){i(this,e),null!=t&&t.apply(this,arguments)}return u(e,t),o(e,[{key:"state",get:function(){return y}},{key:"isListening",get:function(){return y===p}},{key:"isTransmitting",get:function(){return y===_}},{key:"hasError",get:function(){return y===d}},{key:"interimTranscript",get:function(){return g}},{key:"finalTranscript",get:function(){return m}}]),e}(h["default"]),b=new w;b.STATE_LISTENING=p,b.STATE_TRANSMITTING=_,b.STATE_IDLE=v,b.STATE_ERROR=d,b.dispatchToken=s["default"].register(function(t){switch(t.actionType){case f["default"].ACTION_LISTENING_START:y=p,g="",m="",b.emitChange();break;case f["default"].ACTION_LISTENING_TRANSMITTING:y=_,g="",m=t.finalTranscript,b.emitChange();break;case f["default"].ACTION_LISTENING_DONE:y=v,b.emitChange();break;case f["default"].ACTION_LISTENING_ERROR:y=d,b.emitChange();break;case f["default"].ACTION_LISTENING_RESULT:g=t.interimTranscript,m=t.finalTranscript,b.emitChange()}}),e["default"]=b,t.exports=e["default"]},/*!***************************************!*\
|
||
!*** ./~/lodash/internal/baseEach.js ***!
|
||
\***************************************/
|
||
function(t,e,n){var r=n(/*! ./baseForOwn */71),i=n(/*! ./createBaseEach */82),o=i(r);t.exports=o},/*!**************************************!*\
|
||
!*** ./~/lodash/internal/baseGet.js ***!
|
||
\**************************************/
|
||
function(t,e,n){function r(t,e,n){if(null!=t){void 0!==n&&n in i(t)&&(e=[n]);for(var r=-1,o=e.length;null!=t&&++r<o;)t=t[e[r]];return r&&r==o?t:void 0}}var i=n(/*! ./toObject */8);t.exports=r},/*!******************************************!*\
|
||
!*** ./~/lodash/internal/baseIsEqual.js ***!
|
||
\******************************************/
|
||
function(t,e,n){function r(t,e,n,o,u,a){if(t===e)return!0;var s=typeof t,c=typeof e;return"function"!=s&&"object"!=s&&"function"!=c&&"object"!=c||null==t||null==e?t!==t&&e!==e:i(t,e,r,n,o,u,a)}var i=n(/*! ./baseIsEqualDeep */72);t.exports=r},/*!*******************************************!*\
|
||
!*** ./~/lodash/internal/baseProperty.js ***!
|
||
\*******************************************/
|
||
function(t,e,n){function r(t){return function(e){return null==e?void 0:e[t]}}t.exports=r},/*!*******************************************!*\
|
||
!*** ./~/lodash/internal/baseToString.js ***!
|
||
\*******************************************/
|
||
function(t,e,n){function r(t){return"string"==typeof t?t:null==t?"":t+""}t.exports=r},/*!*******************************************!*\
|
||
!*** ./~/lodash/internal/bindCallback.js ***!
|
||
\*******************************************/
|
||
function(t,e,n){function r(t,e,n){if("function"!=typeof t)return i;if(void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 3:return function(n,r,i){return t.call(e,n,r,i)};case 4:return function(n,r,i,o){return t.call(e,n,r,i,o)};case 5:return function(n,r,i,o,u){return t.call(e,n,r,i,o,u)}}return function(){return t.apply(e,arguments)}}var i=n(/*! ../utility/identity */50);t.exports=r},/*!****************************************!*\
|
||
!*** ./~/lodash/internal/getLength.js ***!
|
||
\****************************************/
|
||
function(t,e,n){var r=n(/*! ./baseProperty */40),i=r("length");t.exports=i},/*!************************************!*\
|
||
!*** ./~/lodash/internal/isKey.js ***!
|
||
\************************************/
|
||
function(t,e,n){function r(t,e){var n=typeof t;if("string"==n&&a.test(t)||"number"==n)return!0;if(i(t))return!1;var r=!u.test(t);return r||null!=e&&t in o(e)}var i=n(/*! ../lang/isArray */6),o=n(/*! ./toObject */8),u=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=r},/*!*************************************************!*\
|
||
!*** ./~/lodash/internal/isStrictComparable.js ***!
|
||
\*************************************************/
|
||
function(t,e,n){function r(t){return t===t&&!i(t)}var i=n(/*! ../lang/isObject */10);t.exports=r},/*!*************************************!*\
|
||
!*** ./~/lodash/internal/toPath.js ***!
|
||
\*************************************/
|
||
function(t,e,n){function r(t){if(o(t))return t;var e=[];return i(t).replace(u,function(t,n,r,i){e.push(r?i.replace(a,"$1"):n||t)}),e}var i=n(/*! ./baseToString */41),o=n(/*! ../lang/isArray */6),u=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,a=/\\(\\)?/g;t.exports=r},/*!**************************************!*\
|
||
!*** ./~/lodash/lang/isArguments.js ***!
|
||
\**************************************/
|
||
function(t,e,n){function r(t){return o(t)&&i(t)&&s.call(t)==u}var i=n(/*! ../internal/isArrayLike */11),o=n(/*! ../internal/isObjectLike */12),u="[object Arguments]",a=Object.prototype,s=a.toString;t.exports=r},/*!***********************************!*\
|
||
!*** ./~/lodash/lang/isNative.js ***!
|
||
\***********************************/
|
||
function(t,e,n){function r(t){return null==t?!1:f.call(t)==u?l.test(c.call(t)):o(t)&&a.test(t)}var i=n(/*! ../string/escapeRegExp */93),o=n(/*! ../internal/isObjectLike */12),u="[object Function]",a=/^\[object .+?Constructor\]$/,s=Object.prototype,c=Function.prototype.toString,f=s.toString,l=RegExp("^"+i(f).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=r},/*!*****************************!*\
|
||
!*** ./~/lodash/support.js ***!
|
||
\*****************************/
|
||
function(t,e,n){(function(e){var n=Object.prototype,r=(r=e.window)&&r.document,i=n.propertyIsEnumerable,o={};!function(t){var e=function(){this.x=t},n=arguments,u=[];e.prototype={valueOf:t,y:t};for(var a in new e)u.push(a);o.funcDecomp=/\bthis\b/.test(function(){return this}),o.funcNames="string"==typeof Function.name;try{o.dom=11===r.createDocumentFragment().nodeType}catch(s){o.dom=!1}try{o.nonEnumArgs=!i.call(n,1)}catch(s){o.nonEnumArgs=!0}}(1,0),t.exports=o}).call(e,function(){return this}())},/*!**************************************!*\
|
||
!*** ./~/lodash/utility/identity.js ***!
|
||
\**************************************/
|
||
function(t,e,n){function r(t){return t}t.exports=r},/*!*****************************!*\
|
||
!*** ./src/actions/auth.js ***!
|
||
\*****************************/
|
||
function(t,e,n){"use strict";function r(t,e){var n=e.useStreaming,r=void 0===n?v.isSupported:n,i=e.rememberLogin,o=void 0===i?!1:i,u=e.host,a=void 0===u?"":u;c["default"].dispatch({actionType:l["default"].ACTION_VALIDATING_AUTH_TOKEN,authToken:t,host:a}),d.fetch().then(function(){c["default"].dispatch({actionType:l["default"].ACTION_VALID_AUTH_TOKEN,authToken:t,rememberLogin:o}),r?v.start(t,!1):p.start()},function(t){c["default"].dispatch({actionType:l["default"].ACTION_INVALID_AUTH_TOKEN,message:t.message})})}function i(){c["default"].dispatch({actionType:l["default"].ACTION_LOG_OUT})}Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e["default"]=t,e},u=function(t){return t&&t.__esModule?t:{"default":t}};e.validate=r,e.logOut=i;var a=n(/*! ../call_api */5),s=(u(a),n(/*! ../app_dispatcher */1)),c=u(s),f=n(/*! ../constants */2),l=u(f),h=n(/*! ./sync */17),p=o(h),_=n(/*! ./stream */27),v=o(_),d=n(/*! ./bootstrap */24)},/*!********************************!*\
|
||
!*** ./src/actions/logbook.js ***!
|
||
\********************************/
|
||
function(t,e,n){"use strict";function r(t,e){c["default"].dispatch({actionType:l["default"].ACTION_NEW_LOGBOOK,date:t,logbookEntries:e})}function i(){var t=void 0===arguments[0]?null:arguments[0],e="logbook";null!=t&&(e+="/"+t),a["default"]("GET",e).then(function(e){return r(t,e)})}Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){return t&&t.__esModule?t:{"default":t}};e.fetch=i;var u=n(/*! ../call_api */5),a=o(u),s=n(/*! ../app_dispatcher */1),c=o(s),f=n(/*! ../constants */2),l=o(f)},/*!**************************************!*\
|
||
!*** ./src/actions/state_history.js ***!
|
||
\**************************************/
|
||
function(t,e,n){"use strict";function r(t,e){var n=void 0===arguments[2]?null:arguments[2];(t||e.length>0)&&f["default"].dispatch({actionType:h["default"].ACTION_NEW_STATE_HISTORY,date:n,stateHistory:e.map(function(t){return t.map(_["default"].fromJSON)}),isFetchAll:t})}function i(){var t=void 0===arguments[0]?null:arguments[0],e="history/period";null!=t&&(e+="/"+t),s["default"]("GET",e).then(function(e){return r(!0,e,t)})}function o(t){s["default"]("GET","history/period?filter_entity_id="+t).then(function(t){return r(!1,t)})}Object.defineProperty(e,"__esModule",{value:!0});var u=function(t){return t&&t.__esModule?t:{"default":t}};e.fetchAll=i,e.fetch=o;var a=n(/*! ../call_api */5),s=u(a),c=n(/*! ../app_dispatcher */1),f=u(c),l=n(/*! ../constants */2),h=u(l),p=n(/*! ../models/state */18),_=u(p)},/*!******************************!*\
|
||
!*** ./src/actions/voice.js ***!
|
||
\******************************/
|
||
function(t,e,n){"use strict";function r(){return"webkitSpeechRecognition"in window}function i(){var t=g||y;l["default"].dispatch({actionType:p["default"].ACTION_LISTENING_TRANSMITTING,finalTranscript:t}),_.callService("conversation","process",{text:t}).then(function(){l["default"].dispatch({actionType:p["default"].ACTION_LISTENING_DONE,finalTranscript:t})},function(){l["default"].dispatch({actionType:p["default"].ACTION_LISTENING_ERROR})})}function o(){null!==d&&(d.onstart=null,d.onresult=null,d.onerror=null,d.onend=null,d.stop(),d=null,i()),y="",g=""}function u(){o(),window.r=d=new webkitSpeechRecognition,d.interimResults=!0,d.onstart=function(){l["default"].dispatch({actionType:p["default"].ACTION_LISTENING_START})},d.onresult=function(t){y="";for(var e=t.resultIndex;e<t.results.length;++e)t.results[e].isFinal?g+=t.results[e][0].transcript:y+=t.results[e][0].transcript;l["default"].dispatch({actionType:p["default"].ACTION_LISTENING_RESULT,interimTranscript:y,finalTranscript:g}),m()},d.onerror=function(){l["default"].dispatch({actionType:p["default"].ACTION_LISTENING_ERROR})},d.onend=o,d.start()}Object.defineProperty(e,"__esModule",{value:!0});var a=function(t){return t&&t.__esModule?t:{"default":t}};e.isSupported=r,e.stop=o,e.listen=u;var s=n(/*! lodash */9),c=a(s),f=n(/*! ../app_dispatcher */1),l=a(f),h=n(/*! ../constants */2),p=a(h),_=n(/*! ./service */15),v=3e3,d=null,y="",g="",m=c["default"].debounce(o,v)},/*!******************************!*\
|
||
!*** ./src/homeassistant.js ***!
|
||
\******************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t&&t.__esModule?t:{"default":t}},i=n(/*! ./app_dispatcher */1),o=r(i);e["default"]={callApi:n(/*! ./call_api */5),dispatcher:o["default"],constants:n(/*! ./constants */2),util:n(/*! ./util */22),authActions:n(/*! ./actions/auth */51),eventActions:n(/*! ./actions/event */26),serviceActions:n(/*! ./actions/service */15),stateActions:n(/*! ./actions/state */16),syncActions:n(/*! ./actions/sync */17),stateHistoryActions:n(/*! ./actions/state_history */53),streamActions:n(/*! ./actions/stream */27),voiceActions:n(/*! ./actions/voice */54),logbookActions:n(/*! ./actions/logbook */52),configActions:n(/*! ./actions/config */25),authStore:n(/*! ./stores/auth */19),componentStore:n(/*! ./stores/component */28),eventStore:n(/*! ./stores/event */30),serviceStore:n(/*! ./stores/service */20),stateStore:n(/*! ./stores/state */33),syncStore:n(/*! ./stores/sync */35),stateHistoryStore:n(/*! ./stores/state_history */34),streamStore:n(/*! ./stores/stream */21),preferenceStore:n(/*! ./stores/preference */60),notificationStore:n(/*! ./stores/notification */32),voiceStore:n(/*! ./stores/voice */36),logbookStore:n(/*! ./stores/logbook */31),configStore:n(/*! ./stores/config */29),stateModel:n(/*! ./models/state */18),storeListenerMixIn:n(/*! ./mixins/store_listener */56)},t.exports=e["default"]},/*!**************************************!*\
|
||
!*** ./src/mixins/store_listener.js ***!
|
||
\**************************************/
|
||
function(t,e,n){"use strict";function r(t,e){e=e||this;var n=[];_.forEach(o,function(r,i){if(e[i]){var o=e[i].bind(e,r);r.addChangeListener(o),n.push({store:r,listener:o}),t&&o()}}.bind(e)),e._storeListeners=n}function i(t){t=t||this,t._storeListeners.forEach(function(t){var e=t.store,n=t.listener;e.removeChangeListener(n)})}Object.defineProperty(e,"__esModule",{value:!0}),e.listenToStores=r,e.stopListeningToStores=i,_=n(/*! lodash */9);var o={authStoreChanged:n(/*! ../stores/auth */19),componentStoreChanged:n(/*! ../stores/component */28),eventStoreChanged:n(/*! ../stores/event */30),serviceStoreChanged:n(/*! ../stores/service */20),stateStoreChanged:n(/*! ../stores/state */33),stateHistoryStoreChanged:n(/*! ../stores/state_history */34),streamStoreChanged:n(/*! ../stores/stream */21),syncStoreChanged:n(/*! ../stores/sync */35),notificationStoreChanged:n(/*! ../stores/notification */32),voiceStoreChanged:n(/*! ../stores/voice */36),logbookStoreChanged:n(/*! ../stores/logbook */31)}},/*!******************************!*\
|
||
!*** ./src/models/config.js ***!
|
||
\******************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},i=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}}(),o=function(t,e,n){for(var r=!0;r;){a=c=s=void 0,r=!1;var i=t,o=e,u=n,a=Object.getOwnPropertyDescriptor(i,o);if(void 0!==a){if("value"in a)return a.value;var s=a.get;return void 0===s?void 0:s.call(u)}var c=Object.getPrototypeOf(i);if(null===c)return void 0;t=c,e=o,n=u,r=!0}},u=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&&(t.__proto__=e)},a=n(/*! immutable */4),s=new a.Record({latitude:null,longitude:null,temperature_unit:null,location_name:null,time_zone:null,components:null},"Config"),c=function(t){function e(t,n,i,u,s,c){r(this,e),o(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,{latitude:t,longitude:n,temperature_unit:i,location_name:u||"",time_zone:s,components:new a.List(c)})}return u(e,t),i(e,null,[{key:"fromJSON",value:function(t){var n=t.latitude,r=t.longitude,i=t.temperature_unit,o=t.location_name,u=t.time_zone,a=t.components;return new e(n,r,i,o,u,a)}}]),e}(s);e["default"]=c,t.exports=e["default"]},/*!*************************************!*\
|
||
!*** ./src/models/logbook_entry.js ***!
|
||
\*************************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},i=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}}(),o=function(t,e,n){for(var r=!0;r;){a=c=s=void 0,r=!1;var i=t,o=e,u=n,a=Object.getOwnPropertyDescriptor(i,o);if(void 0!==a){if("value"in a)return a.value;var s=a.get;return void 0===s?void 0:s.call(u)}var c=Object.getPrototypeOf(i);if(null===c)return void 0;t=c,e=o,n=u,r=!0}},u=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&&(t.__proto__=e)},a=n(/*! immutable */4),s=n(/*! ../util */22),c=new a.Record({when:null,name:null,message:null,domain:null,entityId:null},"LogbookEntry"),f=function(t){function e(t,n,i,u,a){r(this,e),o(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,{when:t,name:n,message:i,domain:u,entityId:a})}return u(e,t),i(e,null,[{key:"fromJSON",value:function(t){var n=t.when,r=t.name,i=t.message,o=t.domain,u=t.entity_id;return new e(s.parseDateTime(n),r,i,o,u)}}]),e}(c);e["default"]=f,t.exports=e["default"]},/*!************************************!*\
|
||
!*** ./src/models/notification.js ***!
|
||
\************************************/
|
||
function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},i=function(t,e,n){for(var r=!0;r;){a=c=s=void 0,r=!1;var i=t,o=e,u=n,a=Object.getOwnPropertyDescriptor(i,o);if(void 0!==a){if("value"in a)return a.value;var s=a.get;return void 0===s?void 0:s.call(u)}var c=Object.getPrototypeOf(i);if(null===c)return void 0;t=c,e=o,n=u,r=!0}},o=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&&(t.__proto__=e)},u=n(/*! immutable */4),a=new u.Record({id:null,message:null},"Notification"),s=function(t){function e(t,n){r(this,e),i(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,{id:t,message:n})}return o(e,t),e}(a);e["default"]=s,t.exports=e["default"]},/*!**********************************!*\
|
||
!*** ./src/stores/preference.js ***!
|
||
\**********************************/
|
||
function(t,e,n){"use strict";function r(t,e){d[t]=JSON.stringify(e)}function i(t,e){return t in d?JSON.parse(d[t]):e}function o(t){return t in d?(d.removeItem(t),!0):!1}Object.defineProperty(e,"__esModule",{value:!0});var u=function(t){return t&&t.__esModule?t:{"default":t}},a=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},s=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}}(),c=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&&(t.__proto__=e)},f=n(/*! ../app_dispatcher */1),l=u(f),h=n(/*! ../constants */2),p=u(h),_=n(/*! ./store */3),v=u(_);try{var d=localStorage}catch(y){var d={}}var g="PREF_AUTH_TOKEN",m=null,w="PREF_USE_STREAMING",b=!0,T=function(t){function e(){a(this,e),null!=t&&t.apply(this,arguments)}return c(e,t),s(e,[{key:"useStreaming",get:function(){return i(w,b)}},{key:"hasAuthToken",get:function(){return null!==this.authToken}},{key:"authToken",get:function(){return i(g,m)}}]),e}(v["default"]),E=new T;E.dispatchToken=l["default"].register(function(t){switch(t.actionType){case p["default"].ACTION_VALID_AUTH_TOKEN:t.rememberLogin&&(r(g,t.authToken),E.emitChange());break;case p["default"].ACTION_LOG_OUT:o(g)&&E.emitChange();break;case p["default"].ACTION_STREAM_START:r(w,!0),E.emitChange();break;case p["default"].ACTION_STREAM_STOP:r(w,!1),E.emitChange()}}),e["default"]=E,t.exports=e["default"]},/*!*************************!*\
|
||
!*** ./~/flux/index.js ***!
|
||
\*************************/
|
||
function(t,e,n){t.exports.Dispatcher=n(/*! ./lib/Dispatcher */62)},/*!**********************************!*\
|
||
!*** ./~/flux/lib/Dispatcher.js ***!
|
||
\**********************************/
|
||
function(t,e,n){"use strict";function r(){this.$Dispatcher_callbacks={},this.$Dispatcher_isPending={},this.$Dispatcher_isHandled={},this.$Dispatcher_isDispatching=!1,this.$Dispatcher_pendingPayload=null}var i=n(/*! ./invariant */63),o=1,u="ID_";r.prototype.register=function(t){var e=u+o++;return this.$Dispatcher_callbacks[e]=t,e},r.prototype.unregister=function(t){i(this.$Dispatcher_callbacks[t],"Dispatcher.unregister(...): `%s` does not map to a registered callback.",t),delete this.$Dispatcher_callbacks[t]},r.prototype.waitFor=function(t){i(this.$Dispatcher_isDispatching,"Dispatcher.waitFor(...): Must be invoked while dispatching.");for(var e=0;e<t.length;e++){var n=t[e];this.$Dispatcher_isPending[n]?i(this.$Dispatcher_isHandled[n],"Dispatcher.waitFor(...): Circular dependency detected while waiting for `%s`.",n):(i(this.$Dispatcher_callbacks[n],"Dispatcher.waitFor(...): `%s` does not map to a registered callback.",n),this.$Dispatcher_invokeCallback(n))}},r.prototype.dispatch=function(t){i(!this.$Dispatcher_isDispatching,"Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch."),this.$Dispatcher_startDispatching(t);try{for(var e in this.$Dispatcher_callbacks)this.$Dispatcher_isPending[e]||this.$Dispatcher_invokeCallback(e)}finally{this.$Dispatcher_stopDispatching()}},r.prototype.isDispatching=function(){return this.$Dispatcher_isDispatching},r.prototype.$Dispatcher_invokeCallback=function(t){this.$Dispatcher_isPending[t]=!0,this.$Dispatcher_callbacks[t](this.$Dispatcher_pendingPayload),this.$Dispatcher_isHandled[t]=!0},r.prototype.$Dispatcher_startDispatching=function(t){for(var e in this.$Dispatcher_callbacks)this.$Dispatcher_isPending[e]=!1,this.$Dispatcher_isHandled[e]=!1;this.$Dispatcher_pendingPayload=t,this.$Dispatcher_isDispatching=!0},r.prototype.$Dispatcher_stopDispatching=function(){this.$Dispatcher_pendingPayload=null,this.$Dispatcher_isDispatching=!1},t.exports=r},/*!*********************************!*\
|
||
!*** ./~/flux/lib/invariant.js ***!
|
||
\*********************************/
|
||
function(t,e,n){"use strict";var r=function(t,e,n,r,i,o,u,a){if(!t){var s;if(void 0===e)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,o,u,a],f=0;s=new Error("Invariant Violation: "+e.replace(/%s/g,function(){return c[f++]}))}throw s.framesToPop=1,s}};t.exports=r},/*!********************************!*\
|
||
!*** ./~/lodash/array/last.js ***!
|
||
\********************************/
|
||
function(t,e,n){function r(t){var e=t?t.length:0;return e?t[e-1]:void 0}t.exports=r},/*!****************************************!*\
|
||
!*** ./~/lodash/collection/foreach.js ***!
|
||
\****************************************/
|
||
function(t,e,n){var r=n(/*! ../internal/arrayEach */67),i=n(/*! ../internal/baseEach */37),o=n(/*! ../internal/createForEach */84),u=o(r,i);t.exports=u},/*!***************************************!*\
|
||
!*** ./~/lodash/collection/sortby.js ***!
|
||
\***************************************/
|
||
function(t,e,n){function r(t,e,n){if(null==t)return[];n&&s(t,e,n)&&(e=null);var r=-1;e=i(e,n,3);var c=o(t,function(t,n,i){return{criteria:e(t,n,i),index:++r,value:t}});return u(c,a)}var i=n(/*! ../internal/baseCallback */68),o=n(/*! ../internal/baseMap */74),u=n(/*! ../internal/baseSortBy */79),a=n(/*! ../internal/compareAscending */81),s=n(/*! ../internal/isIterateeCall */88);t.exports=r},/*!****************************************!*\
|
||
!*** ./~/lodash/internal/arrayEach.js ***!
|
||
\****************************************/
|
||
function(t,e,n){function r(t,e){for(var n=-1,r=t.length;++n<r&&e(t[n],n,t)!==!1;);return t}t.exports=r},/*!*******************************************!*\
|
||
!*** ./~/lodash/internal/baseCallback.js ***!
|
||
\*******************************************/
|
||
function(t,e,n){function r(t,e,n){var r=typeof t;return"function"==r?void 0===e?t:u(t,e,n):null==t?a:"object"==r?i(t):void 0===e?s(t):o(t,e)}var i=n(/*! ./baseMatches */75),o=n(/*! ./baseMatchesProperty */76),u=n(/*! ./bindCallback */42),a=n(/*! ../utility/identity */50),s=n(/*! ../utility/property */95);t.exports=r},/*!***************************************************!*\
|
||
!*** ./~/lodash/internal/baseCompareAscending.js ***!
|
||
\***************************************************/
|
||
function(t,e,n){function r(t,e){if(t!==e){var n=t===t,r=e===e;if(t>e||!n||void 0===t&&r)return 1;if(e>t||!r||void 0===e&&n)return-1}return 0}t.exports=r},/*!**************************************!*\
|
||
!*** ./~/lodash/internal/baseFor.js ***!
|
||
\**************************************/
|
||
function(t,e,n){var r=n(/*! ./createBaseFor */83),i=r();t.exports=i},/*!*****************************************!*\
|
||
!*** ./~/lodash/internal/baseForOwn.js ***!
|
||
\*****************************************/
|
||
function(t,e,n){function r(t,e){return i(t,e,o)}var i=n(/*! ./baseFor */70),o=n(/*! ../object/keys */13);t.exports=r},/*!**********************************************!*\
|
||
!*** ./~/lodash/internal/baseIsEqualDeep.js ***!
|
||
\**********************************************/
|
||
function(t,e,n){function r(t,e,n,r,h,v,d){var y=a(t),g=a(e),m=f,w=f;y||(m=_.call(t),m==c?m=l:m!=l&&(y=s(t))),g||(w=_.call(e),w==c?w=l:w!=l&&(g=s(e)));var b=m==l,T=w==l,E=m==w;if(E&&!y&&!b)return o(t,e,m);if(!h){var O=b&&p.call(t,"__wrapped__"),I=T&&p.call(e,"__wrapped__");if(O||I)return n(O?t.value():t,I?e.value():e,r,h,v,d)}if(!E)return!1;v||(v=[]),d||(d=[]);for(var S=v.length;S--;)if(v[S]==t)return d[S]==e;v.push(t),d.push(e);var A=(y?i:u)(t,e,n,r,h,v,d);return v.pop(),d.pop(),A}var i=n(/*! ./equalArrays */85),o=n(/*! ./equalByTag */86),u=n(/*! ./equalObjects */87),a=n(/*! ../lang/isArray */6),s=n(/*! ../lang/isTypedArray */90),c="[object Arguments]",f="[object Array]",l="[object Object]",h=Object.prototype,p=h.hasOwnProperty,_=h.toString;t.exports=r},/*!******************************************!*\
|
||
!*** ./~/lodash/internal/baseIsMatch.js ***!
|
||
\******************************************/
|
||
function(t,e,n){function r(t,e,n,r,o){for(var u=-1,a=e.length,s=!o;++u<a;)if(s&&r[u]?n[u]!==t[e[u]]:!(e[u]in t))return!1;for(u=-1;++u<a;){var c=e[u],f=t[c],l=n[u];if(s&&r[u])var h=void 0!==f||c in t;else h=o?o(f,l,c):void 0,void 0===h&&(h=i(l,f,o,!0));if(!h)return!1}return!0}var i=n(/*! ./baseIsEqual */39);t.exports=r},/*!**************************************!*\
|
||
!*** ./~/lodash/internal/baseMap.js ***!
|
||
\**************************************/
|
||
function(t,e,n){function r(t,e){var n=-1,r=o(t)?Array(t.length):[];return i(t,function(t,i,o){r[++n]=e(t,i,o)}),r}var i=n(/*! ./baseEach */37),o=n(/*! ./isArrayLike */11);t.exports=r},/*!******************************************!*\
|
||
!*** ./~/lodash/internal/baseMatches.js ***!
|
||
\******************************************/
|
||
function(t,e,n){function r(t){var e=a(t),n=e.length;if(!n)return o(!0);if(1==n){var r=e[0],c=t[r];if(u(c))return function(t){return null==t?!1:t[r]===c&&(void 0!==c||r in s(t))}}for(var f=Array(n),l=Array(n);n--;)c=t[e[n]],f[n]=c,l[n]=u(c);return function(t){return null!=t&&i(s(t),e,f,l)}}var i=n(/*! ./baseIsMatch */73),o=n(/*! ../utility/constant */94),u=n(/*! ./isStrictComparable */45),a=n(/*! ../object/keys */13),s=n(/*! ./toObject */8);t.exports=r},/*!**************************************************!*\
|
||
!*** ./~/lodash/internal/baseMatchesProperty.js ***!
|
||
\**************************************************/
|
||
function(t,e,n){function r(t,e){var n=a(t),r=s(t)&&c(e),p=t+"";return t=h(t),function(a){if(null==a)return!1;var s=p;if(a=l(a),!(!n&&r||s in a)){if(a=1==t.length?a:i(a,u(t,0,-1)),null==a)return!1;s=f(t),a=l(a)}return a[s]===e?void 0!==e||s in a:o(e,a[s],null,!0)}}var i=n(/*! ./baseGet */38),o=n(/*! ./baseIsEqual */39),u=n(/*! ./baseSlice */78),a=n(/*! ../lang/isArray */6),s=n(/*! ./isKey */44),c=n(/*! ./isStrictComparable */45),f=n(/*! ../array/last */64),l=n(/*! ./toObject */8),h=n(/*! ./toPath */46);t.exports=r},/*!***********************************************!*\
|
||
!*** ./~/lodash/internal/basePropertyDeep.js ***!
|
||
\***********************************************/
|
||
function(t,e,n){function r(t){var e=t+"";return t=o(t),function(n){return i(n,t,e)}}var i=n(/*! ./baseGet */38),o=n(/*! ./toPath */46);t.exports=r},/*!****************************************!*\
|
||
!*** ./~/lodash/internal/baseSlice.js ***!
|
||
\****************************************/
|
||
function(t,e,n){function r(t,e,n){var r=-1,i=t.length;e=null==e?0:+e||0,0>e&&(e=-e>i?0:i+e),n=void 0===n||n>i?i:+n||0,0>n&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=t[r+e];return o}t.exports=r},/*!*****************************************!*\
|
||
!*** ./~/lodash/internal/baseSortBy.js ***!
|
||
\*****************************************/
|
||
function(t,e,n){function r(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}t.exports=r},/*!*****************************************!*\
|
||
!*** ./~/lodash/internal/baseValues.js ***!
|
||
\*****************************************/
|
||
function(t,e,n){function r(t,e){for(var n=-1,r=e.length,i=Array(r);++n<r;)i[n]=t[e[n]];return i}t.exports=r},/*!***********************************************!*\
|
||
!*** ./~/lodash/internal/compareAscending.js ***!
|
||
\***********************************************/
|
||
function(t,e,n){function r(t,e){return i(t.criteria,e.criteria)||t.index-e.index}var i=n(/*! ./baseCompareAscending */69);t.exports=r},/*!*********************************************!*\
|
||
!*** ./~/lodash/internal/createBaseEach.js ***!
|
||
\*********************************************/
|
||
function(t,e,n){function r(t,e){return function(n,r){var a=n?i(n):0;if(!o(a))return t(n,r);for(var s=e?a:-1,c=u(n);(e?s--:++s<a)&&r(c[s],s,c)!==!1;);return n}}var i=n(/*! ./getLength */43),o=n(/*! ./isLength */7),u=n(/*! ./toObject */8);t.exports=r},/*!********************************************!*\
|
||
!*** ./~/lodash/internal/createBaseFor.js ***!
|
||
\********************************************/
|
||
function(t,e,n){function r(t){return function(e,n,r){for(var o=i(e),u=r(e),a=u.length,s=t?a:-1;t?s--:++s<a;){var c=u[s];if(n(o[c],c,o)===!1)break}return e}}var i=n(/*! ./toObject */8);t.exports=r},/*!********************************************!*\
|
||
!*** ./~/lodash/internal/createForEach.js ***!
|
||
\********************************************/
|
||
function(t,e,n){function r(t,e){return function(n,r,u){return"function"==typeof r&&void 0===u&&o(n)?t(n,r):e(n,i(r,u,3))}}var i=n(/*! ./bindCallback */42),o=n(/*! ../lang/isArray */6);t.exports=r},/*!******************************************!*\
|
||
!*** ./~/lodash/internal/equalArrays.js ***!
|
||
\******************************************/
|
||
function(t,e,n){function r(t,e,n,r,i,o,u){var a=-1,s=t.length,c=e.length,f=!0;if(s!=c&&!(i&&c>s))return!1;for(;f&&++a<s;){var l=t[a],h=e[a];if(f=void 0,r&&(f=i?r(h,l,a):r(l,h,a)),void 0===f)if(i)for(var p=c;p--&&(h=e[p],!(f=l&&l===h||n(l,h,r,i,o,u))););else f=l&&l===h||n(l,h,r,i,o,u)}return!!f}t.exports=r},/*!*****************************************!*\
|
||
!*** ./~/lodash/internal/equalByTag.js ***!
|
||
\*****************************************/
|
||
function(t,e,n){function r(t,e,n){switch(n){case i:case o:return+t==+e;case u:return t.name==e.name&&t.message==e.message;case a:return t!=+t?e!=+e:t==+e;case s:case c:return t==e+""}return!1}var i="[object Boolean]",o="[object Date]",u="[object Error]",a="[object Number]",s="[object RegExp]",c="[object String]";t.exports=r},/*!*******************************************!*\
|
||
!*** ./~/lodash/internal/equalObjects.js ***!
|
||
\*******************************************/
|
||
function(t,e,n){function r(t,e,n,r,o,a,s){var c=i(t),f=c.length,l=i(e),h=l.length;if(f!=h&&!o)return!1;for(var p=o,_=-1;++_<f;){var v=c[_],d=o?v in e:u.call(e,v);if(d){var y=t[v],g=e[v];d=void 0,r&&(d=o?r(g,y,v):r(y,g,v)),void 0===d&&(d=y&&y===g||n(y,g,r,o,a,s))}if(!d)return!1;p||(p="constructor"==v)}if(!p){var m=t.constructor,w=e.constructor;if(m!=w&&"constructor"in t&&"constructor"in e&&!("function"==typeof m&&m instanceof m&&"function"==typeof w&&w instanceof w))return!1}return!0}var i=n(/*! ../object/keys */13),o=Object.prototype,u=o.hasOwnProperty;t.exports=r},/*!*********************************************!*\
|
||
!*** ./~/lodash/internal/isIterateeCall.js ***!
|
||
\*********************************************/
|
||
function(t,e,n){function r(t,e,n){if(!u(n))return!1;var r=typeof e;if("number"==r?i(n)&&o(e,n.length):"string"==r&&e in n){var a=n[e];return t===t?t===a:a!==a}return!1}var i=n(/*! ./isArrayLike */11),o=n(/*! ./isIndex */23),u=n(/*! ../lang/isObject */10);t.exports=r},/*!***************************************!*\
|
||
!*** ./~/lodash/internal/shimKeys.js ***!
|
||
\***************************************/
|
||
function(t,e,n){function r(t){for(var e=s(t),n=e.length,r=n&&t.length,f=r&&a(r)&&(o(t)||c.nonEnumArgs&&i(t)),h=-1,p=[];++h<n;){var _=e[h];(f&&u(_,r)||l.call(t,_))&&p.push(_)}return p}var i=n(/*! ../lang/isArguments */47),o=n(/*! ../lang/isArray */6),u=n(/*! ./isIndex */23),a=n(/*! ./isLength */7),s=n(/*! ../object/keysIn */91),c=n(/*! ../support */49),f=Object.prototype,l=f.hasOwnProperty;t.exports=r},/*!***************************************!*\
|
||
!*** ./~/lodash/lang/isTypedArray.js ***!
|
||
\***************************************/
|
||
function(t,e,n){function r(t){return o(t)&&i(t.length)&&!!x[k.call(t)]}var i=n(/*! ../internal/isLength */7),o=n(/*! ../internal/isObjectLike */12),u="[object Arguments]",a="[object Array]",s="[object Boolean]",c="[object Date]",f="[object Error]",l="[object Function]",h="[object Map]",p="[object Number]",_="[object Object]",v="[object RegExp]",d="[object Set]",y="[object String]",g="[object WeakMap]",m="[object ArrayBuffer]",w="[object Float32Array]",b="[object Float64Array]",T="[object Int8Array]",E="[object Int16Array]",O="[object Int32Array]",I="[object Uint8Array]",S="[object Uint8ClampedArray]",A="[object Uint16Array]",N="[object Uint32Array]",x={};x[w]=x[b]=x[T]=x[E]=x[O]=x[I]=x[S]=x[A]=x[N]=!0,x[u]=x[a]=x[m]=x[s]=x[c]=x[f]=x[l]=x[h]=x[p]=x[_]=x[v]=x[d]=x[y]=x[g]=!1;var C=Object.prototype,k=C.toString;t.exports=r},/*!***********************************!*\
|
||
!*** ./~/lodash/object/keysIn.js ***!
|
||
\***********************************/
|
||
function(t,e,n){function r(t){if(null==t)return[];s(t)||(t=Object(t));var e=t.length;e=e&&a(e)&&(o(t)||c.nonEnumArgs&&i(t))&&e||0;for(var n=t.constructor,r=-1,f="function"==typeof n&&n.prototype===t,h=Array(e),p=e>0;++r<e;)h[r]=r+"";for(var _ in t)p&&u(_,e)||"constructor"==_&&(f||!l.call(t,_))||h.push(_);return h}var i=n(/*! ../lang/isArguments */47),o=n(/*! ../lang/isArray */6),u=n(/*! ../internal/isIndex */23),a=n(/*! ../internal/isLength */7),s=n(/*! ../lang/isObject */10),c=n(/*! ../support */49),f=Object.prototype,l=f.hasOwnProperty;t.exports=r},/*!***********************************!*\
|
||
!*** ./~/lodash/object/values.js ***!
|
||
\***********************************/
|
||
function(t,e,n){function r(t){return i(t,o(t))}var i=n(/*! ../internal/baseValues */80),o=n(/*! ./keys */13);t.exports=r},/*!*****************************************!*\
|
||
!*** ./~/lodash/string/escapeRegExp.js ***!
|
||
\*****************************************/
|
||
function(t,e,n){function r(t){return t=i(t),t&&u.test(t)?t.replace(o,"\\$&"):t}var i=n(/*! ../internal/baseToString */41),o=/[.*+?^${}()|[\]\/\\]/g,u=RegExp(o.source);t.exports=r},/*!**************************************!*\
|
||
!*** ./~/lodash/utility/constant.js ***!
|
||
\**************************************/
|
||
function(t,e,n){function r(t){return function(){return t}}t.exports=r},/*!**************************************!*\
|
||
!*** ./~/lodash/utility/property.js ***!
|
||
\**************************************/
|
||
function(t,e,n){function r(t){return u(t)?i(t):o(t)}var i=n(/*! ../internal/baseProperty */40),o=n(/*! ../internal/basePropertyDeep */77),u=n(/*! ../internal/isKey */44);t.exports=r},/*!***********************************!*\
|
||
!*** (webpack)/buildin/module.js ***!
|
||
\***********************************/
|
||
function(t,e,n){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},/*!********************************************************!*\
|
||
!*** (webpack)/~/node-libs-browser/~/events/events.js ***!
|
||
\********************************************************/
|
||
function(t,e,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"number"==typeof t}function u(t){return"object"==typeof t&&null!==t}function a(t){return void 0===t}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!o(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,n,r,o,s,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||u(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[t],a(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(r=arguments.length,o=new Array(r-1),s=1;r>s;s++)o[s-1]=arguments[s];n.apply(this,o)}else if(u(n)){for(r=arguments.length,o=new Array(r-1),s=1;r>s;s++)o[s-1]=arguments[s];for(c=n.slice(),r=c.length,s=0;r>s;s++)c[s].apply(this,o)}return!0},r.prototype.addListener=function(t,e){var n;if(!i(e))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?u(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,u(this._events[t])&&!this._events[t].warned){var n;n=a(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())}return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,a;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(u(n)){for(a=o;a-->0;)if(n[a]===e||n[a].listener&&n[a].listener===e){r=a;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],i(n))this.removeListener(t,n);else for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.listenerCount=function(t,e){var n;return n=t._events&&t._events[e]?i(t._events[e])?1:t._events[e].length:0}}]);
|
||
//# sourceMappingURL=homeassistant.min.js.map</script>
|
||
|
||
<script>
|
||
(function() {
|
||
var DOMAINS_WITH_CARD = ['thermostat', 'configurator', 'scene', 'media_player'];
|
||
var DOMAINS_WITH_MORE_INFO = [
|
||
'light', 'group', 'sun', 'configurator', 'thermostat', 'script', 'media_player'
|
||
];
|
||
var DOMAINS_HIDE_MORE_INFO = [
|
||
'sensor',
|
||
];
|
||
|
||
// Add some frontend specific helpers to the models
|
||
Object.defineProperties(window.hass.stateModel.prototype, {
|
||
// how to render the card for this state
|
||
cardType: {
|
||
get: function() {
|
||
console.warn('Deprecated method. Please use hass.uiUtil.stateCardType');
|
||
return window.hass.uiUtil.stateCardType(this);
|
||
}
|
||
},
|
||
|
||
// how to render the more info of this state
|
||
moreInfoType: {
|
||
get: function() {
|
||
console.warn('Deprecated method. Please use hass.uiUtil.stateMoreInfoType');
|
||
return window.hass.uiUtil.stateMoreInfoType(this);
|
||
}
|
||
},
|
||
});
|
||
|
||
var dispatcher = window.hass.dispatcher,
|
||
constants = window.hass.constants,
|
||
preferenceStore = window.hass.preferenceStore,
|
||
authActions = window.hass.authActions;
|
||
|
||
window.hass.uiConstants = {
|
||
ACTION_SHOW_DIALOG_MORE_INFO: 'ACTION_SHOW_DIALOG_MORE_INFO',
|
||
ACTION_SHOW_DATE_PICKER: 'ACTION_SHOW_DATE_PICKER',
|
||
|
||
STATE_FILTERS: {
|
||
'group': 'Groups',
|
||
'script': 'Scripts',
|
||
'scene': 'Scenes',
|
||
},
|
||
};
|
||
|
||
window.hass.uiActions = {
|
||
showMoreInfoDialog: function(entityId) {
|
||
dispatcher.dispatch({
|
||
actionType: window.hass.uiConstants.ACTION_SHOW_DIALOG_MORE_INFO,
|
||
entityId: entityId,
|
||
});
|
||
},
|
||
|
||
showDatePicker: function(dateSelectedCallback, startDate) {
|
||
startDate = startDate || null;
|
||
|
||
dispatcher.dispatch({
|
||
actionType: window.hass.uiConstants.ACTION_SHOW_DATE_PICKER,
|
||
dateSelectedCallback: dateSelectedCallback,
|
||
startDate: startDate,
|
||
});
|
||
},
|
||
|
||
validateAuth: function(authToken, rememberLogin) {
|
||
authActions.validate(authToken, {
|
||
useStreaming: preferenceStore.useStreaming,
|
||
rememberLogin: rememberLogin,
|
||
});
|
||
},
|
||
};
|
||
|
||
// UI specific util methods
|
||
window.hass.uiUtil = {
|
||
stateCardType: function(state) {
|
||
if(DOMAINS_WITH_CARD.indexOf(state.domain) !== -1) {
|
||
return state.domain;
|
||
} else if(state.canToggle) {
|
||
return "toggle";
|
||
} else {
|
||
return "display";
|
||
}
|
||
},
|
||
|
||
stateMoreInfoType: function(state) {
|
||
if(DOMAINS_HIDE_MORE_INFO.indexOf(state.domain) !== -1) {
|
||
return false;
|
||
} else if(DOMAINS_WITH_MORE_INFO.indexOf(state.domain) !== -1) {
|
||
return state.domain;
|
||
} else {
|
||
return 'default';
|
||
}
|
||
},
|
||
|
||
attributeClassNames: function(stateObj, attributes) {
|
||
if (!stateObj) return '';
|
||
return attributes.map(function(attribute) {
|
||
return attribute in stateObj.attributes ? 'has-' + attribute : '';
|
||
}).join(' ');
|
||
},
|
||
};
|
||
})();
|
||
</script>
|
||
|
||
<script>//! moment.js
|
||
//! version : 2.10.3
|
||
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
||
//! license : MIT
|
||
//! momentjs.com
|
||
|
||
(function (global, factory) {
|
||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||
typeof define === 'function' && define.amd ? define(factory) :
|
||
global.moment = factory()
|
||
}(this, function () { 'use strict';
|
||
|
||
var hookCallback;
|
||
|
||
function utils_hooks__hooks () {
|
||
return hookCallback.apply(null, arguments);
|
||
}
|
||
|
||
// This is done to register the method called with moment()
|
||
// without creating circular dependencies.
|
||
function setHookCallback (callback) {
|
||
hookCallback = callback;
|
||
}
|
||
|
||
function isArray(input) {
|
||
return Object.prototype.toString.call(input) === '[object Array]';
|
||
}
|
||
|
||
function isDate(input) {
|
||
return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
|
||
}
|
||
|
||
function map(arr, fn) {
|
||
var res = [], i;
|
||
for (i = 0; i < arr.length; ++i) {
|
||
res.push(fn(arr[i], i));
|
||
}
|
||
return res;
|
||
}
|
||
|
||
function hasOwnProp(a, b) {
|
||
return Object.prototype.hasOwnProperty.call(a, b);
|
||
}
|
||
|
||
function extend(a, b) {
|
||
for (var i in b) {
|
||
if (hasOwnProp(b, i)) {
|
||
a[i] = b[i];
|
||
}
|
||
}
|
||
|
||
if (hasOwnProp(b, 'toString')) {
|
||
a.toString = b.toString;
|
||
}
|
||
|
||
if (hasOwnProp(b, 'valueOf')) {
|
||
a.valueOf = b.valueOf;
|
||
}
|
||
|
||
return a;
|
||
}
|
||
|
||
function create_utc__createUTC (input, format, locale, strict) {
|
||
return createLocalOrUTC(input, format, locale, strict, true).utc();
|
||
}
|
||
|
||
function defaultParsingFlags() {
|
||
// We need to deep clone this object.
|
||
return {
|
||
empty : false,
|
||
unusedTokens : [],
|
||
unusedInput : [],
|
||
overflow : -2,
|
||
charsLeftOver : 0,
|
||
nullInput : false,
|
||
invalidMonth : null,
|
||
invalidFormat : false,
|
||
userInvalidated : false,
|
||
iso : false
|
||
};
|
||
}
|
||
|
||
function getParsingFlags(m) {
|
||
if (m._pf == null) {
|
||
m._pf = defaultParsingFlags();
|
||
}
|
||
return m._pf;
|
||
}
|
||
|
||
function valid__isValid(m) {
|
||
if (m._isValid == null) {
|
||
var flags = getParsingFlags(m);
|
||
m._isValid = !isNaN(m._d.getTime()) &&
|
||
flags.overflow < 0 &&
|
||
!flags.empty &&
|
||
!flags.invalidMonth &&
|
||
!flags.nullInput &&
|
||
!flags.invalidFormat &&
|
||
!flags.userInvalidated;
|
||
|
||
if (m._strict) {
|
||
m._isValid = m._isValid &&
|
||
flags.charsLeftOver === 0 &&
|
||
flags.unusedTokens.length === 0 &&
|
||
flags.bigHour === undefined;
|
||
}
|
||
}
|
||
return m._isValid;
|
||
}
|
||
|
||
function valid__createInvalid (flags) {
|
||
var m = create_utc__createUTC(NaN);
|
||
if (flags != null) {
|
||
extend(getParsingFlags(m), flags);
|
||
}
|
||
else {
|
||
getParsingFlags(m).userInvalidated = true;
|
||
}
|
||
|
||
return m;
|
||
}
|
||
|
||
var momentProperties = utils_hooks__hooks.momentProperties = [];
|
||
|
||
function copyConfig(to, from) {
|
||
var i, prop, val;
|
||
|
||
if (typeof from._isAMomentObject !== 'undefined') {
|
||
to._isAMomentObject = from._isAMomentObject;
|
||
}
|
||
if (typeof from._i !== 'undefined') {
|
||
to._i = from._i;
|
||
}
|
||
if (typeof from._f !== 'undefined') {
|
||
to._f = from._f;
|
||
}
|
||
if (typeof from._l !== 'undefined') {
|
||
to._l = from._l;
|
||
}
|
||
if (typeof from._strict !== 'undefined') {
|
||
to._strict = from._strict;
|
||
}
|
||
if (typeof from._tzm !== 'undefined') {
|
||
to._tzm = from._tzm;
|
||
}
|
||
if (typeof from._isUTC !== 'undefined') {
|
||
to._isUTC = from._isUTC;
|
||
}
|
||
if (typeof from._offset !== 'undefined') {
|
||
to._offset = from._offset;
|
||
}
|
||
if (typeof from._pf !== 'undefined') {
|
||
to._pf = getParsingFlags(from);
|
||
}
|
||
if (typeof from._locale !== 'undefined') {
|
||
to._locale = from._locale;
|
||
}
|
||
|
||
if (momentProperties.length > 0) {
|
||
for (i in momentProperties) {
|
||
prop = momentProperties[i];
|
||
val = from[prop];
|
||
if (typeof val !== 'undefined') {
|
||
to[prop] = val;
|
||
}
|
||
}
|
||
}
|
||
|
||
return to;
|
||
}
|
||
|
||
var updateInProgress = false;
|
||
|
||
// Moment prototype object
|
||
function Moment(config) {
|
||
copyConfig(this, config);
|
||
this._d = new Date(+config._d);
|
||
// Prevent infinite loop in case updateOffset creates new moment
|
||
// objects.
|
||
if (updateInProgress === false) {
|
||
updateInProgress = true;
|
||
utils_hooks__hooks.updateOffset(this);
|
||
updateInProgress = false;
|
||
}
|
||
}
|
||
|
||
function isMoment (obj) {
|
||
return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
|
||
}
|
||
|
||
function toInt(argumentForCoercion) {
|
||
var coercedNumber = +argumentForCoercion,
|
||
value = 0;
|
||
|
||
if (coercedNumber !== 0 && isFinite(coercedNumber)) {
|
||
if (coercedNumber >= 0) {
|
||
value = Math.floor(coercedNumber);
|
||
} else {
|
||
value = Math.ceil(coercedNumber);
|
||
}
|
||
}
|
||
|
||
return value;
|
||
}
|
||
|
||
function compareArrays(array1, array2, dontConvert) {
|
||
var len = Math.min(array1.length, array2.length),
|
||
lengthDiff = Math.abs(array1.length - array2.length),
|
||
diffs = 0,
|
||
i;
|
||
for (i = 0; i < len; i++) {
|
||
if ((dontConvert && array1[i] !== array2[i]) ||
|
||
(!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
|
||
diffs++;
|
||
}
|
||
}
|
||
return diffs + lengthDiff;
|
||
}
|
||
|
||
function Locale() {
|
||
}
|
||
|
||
var locales = {};
|
||
var globalLocale;
|
||
|
||
function normalizeLocale(key) {
|
||
return key ? key.toLowerCase().replace('_', '-') : key;
|
||
}
|
||
|
||
// pick the locale from the array
|
||
// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
|
||
// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
|
||
function chooseLocale(names) {
|
||
var i = 0, j, next, locale, split;
|
||
|
||
while (i < names.length) {
|
||
split = normalizeLocale(names[i]).split('-');
|
||
j = split.length;
|
||
next = normalizeLocale(names[i + 1]);
|
||
next = next ? next.split('-') : null;
|
||
while (j > 0) {
|
||
locale = loadLocale(split.slice(0, j).join('-'));
|
||
if (locale) {
|
||
return locale;
|
||
}
|
||
if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
|
||
//the next array item is better than a shallower substring of this one
|
||
break;
|
||
}
|
||
j--;
|
||
}
|
||
i++;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
function loadLocale(name) {
|
||
var oldLocale = null;
|
||
// TODO: Find a better way to register and load all the locales in Node
|
||
if (!locales[name] && typeof module !== 'undefined' &&
|
||
module && module.exports) {
|
||
try {
|
||
oldLocale = globalLocale._abbr;
|
||
require('./locale/' + name);
|
||
// because defineLocale currently also sets the global locale, we
|
||
// want to undo that for lazy loaded locales
|
||
locale_locales__getSetGlobalLocale(oldLocale);
|
||
} catch (e) { }
|
||
}
|
||
return locales[name];
|
||
}
|
||
|
||
// This function will load locale and then set the global locale. If
|
||
// no arguments are passed in, it will simply return the current global
|
||
// locale key.
|
||
function locale_locales__getSetGlobalLocale (key, values) {
|
||
var data;
|
||
if (key) {
|
||
if (typeof values === 'undefined') {
|
||
data = locale_locales__getLocale(key);
|
||
}
|
||
else {
|
||
data = defineLocale(key, values);
|
||
}
|
||
|
||
if (data) {
|
||
// moment.duration._locale = moment._locale = data;
|
||
globalLocale = data;
|
||
}
|
||
}
|
||
|
||
return globalLocale._abbr;
|
||
}
|
||
|
||
function defineLocale (name, values) {
|
||
if (values !== null) {
|
||
values.abbr = name;
|
||
if (!locales[name]) {
|
||
locales[name] = new Locale();
|
||
}
|
||
locales[name].set(values);
|
||
|
||
// backwards compat for now: also set the locale
|
||
locale_locales__getSetGlobalLocale(name);
|
||
|
||
return locales[name];
|
||
} else {
|
||
// useful for testing
|
||
delete locales[name];
|
||
return null;
|
||
}
|
||
}
|
||
|
||
// returns locale data
|
||
function locale_locales__getLocale (key) {
|
||
var locale;
|
||
|
||
if (key && key._locale && key._locale._abbr) {
|
||
key = key._locale._abbr;
|
||
}
|
||
|
||
if (!key) {
|
||
return globalLocale;
|
||
}
|
||
|
||
if (!isArray(key)) {
|
||
//short-circuit everything else
|
||
locale = loadLocale(key);
|
||
if (locale) {
|
||
return locale;
|
||
}
|
||
key = [key];
|
||
}
|
||
|
||
return chooseLocale(key);
|
||
}
|
||
|
||
var aliases = {};
|
||
|
||
function addUnitAlias (unit, shorthand) {
|
||
var lowerCase = unit.toLowerCase();
|
||
aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
|
||
}
|
||
|
||
function normalizeUnits(units) {
|
||
return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
|
||
}
|
||
|
||
function normalizeObjectUnits(inputObject) {
|
||
var normalizedInput = {},
|
||
normalizedProp,
|
||
prop;
|
||
|
||
for (prop in inputObject) {
|
||
if (hasOwnProp(inputObject, prop)) {
|
||
normalizedProp = normalizeUnits(prop);
|
||
if (normalizedProp) {
|
||
normalizedInput[normalizedProp] = inputObject[prop];
|
||
}
|
||
}
|
||
}
|
||
|
||
return normalizedInput;
|
||
}
|
||
|
||
function makeGetSet (unit, keepTime) {
|
||
return function (value) {
|
||
if (value != null) {
|
||
get_set__set(this, unit, value);
|
||
utils_hooks__hooks.updateOffset(this, keepTime);
|
||
return this;
|
||
} else {
|
||
return get_set__get(this, unit);
|
||
}
|
||
};
|
||
}
|
||
|
||
function get_set__get (mom, unit) {
|
||
return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]();
|
||
}
|
||
|
||
function get_set__set (mom, unit, value) {
|
||
return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
|
||
}
|
||
|
||
// MOMENTS
|
||
|
||
function getSet (units, value) {
|
||
var unit;
|
||
if (typeof units === 'object') {
|
||
for (unit in units) {
|
||
this.set(unit, units[unit]);
|
||
}
|
||
} else {
|
||
units = normalizeUnits(units);
|
||
if (typeof this[units] === 'function') {
|
||
return this[units](value);
|
||
}
|
||
}
|
||
return this;
|
||
}
|
||
|
||
function zeroFill(number, targetLength, forceSign) {
|
||
var output = '' + Math.abs(number),
|
||
sign = number >= 0;
|
||
|
||
while (output.length < targetLength) {
|
||
output = '0' + output;
|
||
}
|
||
return (sign ? (forceSign ? '+' : '') : '-') + output;
|
||
}
|
||
|
||
var formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g;
|
||
|
||
var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
|
||
|
||
var formatFunctions = {};
|
||
|
||
var formatTokenFunctions = {};
|
||
|
||
// token: 'M'
|
||
// padded: ['MM', 2]
|
||
// ordinal: 'Mo'
|
||
// callback: function () { this.month() + 1 }
|
||
function addFormatToken (token, padded, ordinal, callback) {
|
||
var func = callback;
|
||
if (typeof callback === 'string') {
|
||
func = function () {
|
||
return this[callback]();
|
||
};
|
||
}
|
||
if (token) {
|
||
formatTokenFunctions[token] = func;
|
||
}
|
||
if (padded) {
|
||
formatTokenFunctions[padded[0]] = function () {
|
||
return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
|
||
};
|
||
}
|
||
if (ordinal) {
|
||
formatTokenFunctions[ordinal] = function () {
|
||
return this.localeData().ordinal(func.apply(this, arguments), token);
|
||
};
|
||
}
|
||
}
|
||
|
||
function removeFormattingTokens(input) {
|
||
if (input.match(/\[[\s\S]/)) {
|
||
return input.replace(/^\[|\]$/g, '');
|
||
}
|
||
return input.replace(/\\/g, '');
|
||
}
|
||
|
||
function makeFormatFunction(format) {
|
||
var array = format.match(formattingTokens), i, length;
|
||
|
||
for (i = 0, length = array.length; i < length; i++) {
|
||
if (formatTokenFunctions[array[i]]) {
|
||
array[i] = formatTokenFunctions[array[i]];
|
||
} else {
|
||
array[i] = removeFormattingTokens(array[i]);
|
||
}
|
||
}
|
||
|
||
return function (mom) {
|
||
var output = '';
|
||
for (i = 0; i < length; i++) {
|
||
output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
|
||
}
|
||
return output;
|
||
};
|
||
}
|
||
|
||
// format date using native date object
|
||
function formatMoment(m, format) {
|
||
if (!m.isValid()) {
|
||
return m.localeData().invalidDate();
|
||
}
|
||
|
||
format = expandFormat(format, m.localeData());
|
||
|
||
if (!formatFunctions[format]) {
|
||
formatFunctions[format] = makeFormatFunction(format);
|
||
}
|
||
|
||
return formatFunctions[format](m);
|
||
}
|
||
|
||
function expandFormat(format, locale) {
|
||
var i = 5;
|
||
|
||
function replaceLongDateFormatTokens(input) {
|
||
return locale.longDateFormat(input) || input;
|
||
}
|
||
|
||
localFormattingTokens.lastIndex = 0;
|
||
while (i >= 0 && localFormattingTokens.test(format)) {
|
||
format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
|
||
localFormattingTokens.lastIndex = 0;
|
||
i -= 1;
|
||
}
|
||
|
||
return format;
|
||
}
|
||
|
||
var match1 = /\d/; // 0 - 9
|
||
var match2 = /\d\d/; // 00 - 99
|
||
var match3 = /\d{3}/; // 000 - 999
|
||
var match4 = /\d{4}/; // 0000 - 9999
|
||
var match6 = /[+-]?\d{6}/; // -999999 - 999999
|
||
var match1to2 = /\d\d?/; // 0 - 99
|
||
var match1to3 = /\d{1,3}/; // 0 - 999
|
||
var match1to4 = /\d{1,4}/; // 0 - 9999
|
||
var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
|
||
|
||
var matchUnsigned = /\d+/; // 0 - inf
|
||
var matchSigned = /[+-]?\d+/; // -inf - inf
|
||
|
||
var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
|
||
|
||
var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
|
||
|
||
// any word (or two) characters or numbers including two/three word month in arabic.
|
||
var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
|
||
|
||
var regexes = {};
|
||
|
||
function addRegexToken (token, regex, strictRegex) {
|
||
regexes[token] = typeof regex === 'function' ? regex : function (isStrict) {
|
||
return (isStrict && strictRegex) ? strictRegex : regex;
|
||
};
|
||
}
|
||
|
||
function getParseRegexForToken (token, config) {
|
||
if (!hasOwnProp(regexes, token)) {
|
||
return new RegExp(unescapeFormat(token));
|
||
}
|
||
|
||
return regexes[token](config._strict, config._locale);
|
||
}
|
||
|
||
// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
|
||
function unescapeFormat(s) {
|
||
return s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
|
||
return p1 || p2 || p3 || p4;
|
||
}).replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
||
}
|
||
|
||
var tokens = {};
|
||
|
||
function addParseToken (token, callback) {
|
||
var i, func = callback;
|
||
if (typeof token === 'string') {
|
||
token = [token];
|
||
}
|
||
if (typeof callback === 'number') {
|
||
func = function (input, array) {
|
||
array[callback] = toInt(input);
|
||
};
|
||
}
|
||
for (i = 0; i < token.length; i++) {
|
||
tokens[token[i]] = func;
|
||
}
|
||
}
|
||
|
||
function addWeekParseToken (token, callback) {
|
||
addParseToken(token, function (input, array, config, token) {
|
||
config._w = config._w || {};
|
||
callback(input, config._w, config, token);
|
||
});
|
||
}
|
||
|
||
function addTimeToArrayFromToken(token, input, config) {
|
||
if (input != null && hasOwnProp(tokens, token)) {
|
||
tokens[token](input, config._a, config, token);
|
||
}
|
||
}
|
||
|
||
var YEAR = 0;
|
||
var MONTH = 1;
|
||
var DATE = 2;
|
||
var HOUR = 3;
|
||
var MINUTE = 4;
|
||
var SECOND = 5;
|
||
var MILLISECOND = 6;
|
||
|
||
function daysInMonth(year, month) {
|
||
return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
|
||
}
|
||
|
||
// FORMATTING
|
||
|
||
addFormatToken('M', ['MM', 2], 'Mo', function () {
|
||
return this.month() + 1;
|
||
});
|
||
|
||
addFormatToken('MMM', 0, 0, function (format) {
|
||
return this.localeData().monthsShort(this, format);
|
||
});
|
||
|
||
addFormatToken('MMMM', 0, 0, function (format) {
|
||
return this.localeData().months(this, format);
|
||
});
|
||
|
||
// ALIASES
|
||
|
||
addUnitAlias('month', 'M');
|
||
|
||
// PARSING
|
||
|
||
addRegexToken('M', match1to2);
|
||
addRegexToken('MM', match1to2, match2);
|
||
addRegexToken('MMM', matchWord);
|
||
addRegexToken('MMMM', matchWord);
|
||
|
||
addParseToken(['M', 'MM'], function (input, array) {
|
||
array[MONTH] = toInt(input) - 1;
|
||
});
|
||
|
||
addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
|
||
var month = config._locale.monthsParse(input, token, config._strict);
|
||
// if we didn't find a month name, mark the date as invalid.
|
||
if (month != null) {
|
||
array[MONTH] = month;
|
||
} else {
|
||
getParsingFlags(config).invalidMonth = input;
|
||
}
|
||
});
|
||
|
||
// LOCALES
|
||
|
||
var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
|
||
function localeMonths (m) {
|
||
return this._months[m.month()];
|
||
}
|
||
|
||
var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
|
||
function localeMonthsShort (m) {
|
||
return this._monthsShort[m.month()];
|
||
}
|
||
|
||
function localeMonthsParse (monthName, format, strict) {
|
||
var i, mom, regex;
|
||
|
||
if (!this._monthsParse) {
|
||
this._monthsParse = [];
|
||
this._longMonthsParse = [];
|
||
this._shortMonthsParse = [];
|
||
}
|
||
|
||
for (i = 0; i < 12; i++) {
|
||
// make the regex if we don't have it already
|
||
mom = create_utc__createUTC([2000, i]);
|
||
if (strict && !this._longMonthsParse[i]) {
|
||
this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
|
||
this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
|
||
}
|
||
if (!strict && !this._monthsParse[i]) {
|
||
regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
|
||
this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
|
||
}
|
||
// test the regex
|
||
if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
|
||
return i;
|
||
} else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
|
||
return i;
|
||
} else if (!strict && this._monthsParse[i].test(monthName)) {
|
||
return i;
|
||
}
|
||
}
|
||
}
|
||
|
||
// MOMENTS
|
||
|
||
function setMonth (mom, value) {
|
||
var dayOfMonth;
|
||
|
||
// TODO: Move this out of here!
|
||
if (typeof value === 'string') {
|
||
value = mom.localeData().monthsParse(value);
|
||
// TODO: Another silent failure?
|
||
if (typeof value !== 'number') {
|
||
return mom;
|
||
}
|
||
}
|
||
|
||
dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
|
||
mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
|
||
return mom;
|
||
}
|
||
|
||
function getSetMonth (value) {
|
||
if (value != null) {
|
||
setMonth(this, value);
|
||
utils_hooks__hooks.updateOffset(this, true);
|
||
return this;
|
||
} else {
|
||
return get_set__get(this, 'Month');
|
||
}
|
||
}
|
||
|
||
function getDaysInMonth () {
|
||
return daysInMonth(this.year(), this.month());
|
||
}
|
||
|
||
function checkOverflow (m) {
|
||
var overflow;
|
||
var a = m._a;
|
||
|
||
if (a && getParsingFlags(m).overflow === -2) {
|
||
overflow =
|
||
a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
|
||
a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
|
||
a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
|
||
a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
|
||
a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
|
||
a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
|
||
-1;
|
||
|
||
if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
|
||
overflow = DATE;
|
||
}
|
||
|
||
getParsingFlags(m).overflow = overflow;
|
||
}
|
||
|
||
return m;
|
||
}
|
||
|
||
function warn(msg) {
|
||
if (utils_hooks__hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) {
|
||
console.warn('Deprecation warning: ' + msg);
|
||
}
|
||
}
|
||
|
||
function deprecate(msg, fn) {
|
||
var firstTime = true,
|
||
msgWithStack = msg + '\n' + (new Error()).stack;
|
||
|
||
return extend(function () {
|
||
if (firstTime) {
|
||
warn(msgWithStack);
|
||
firstTime = false;
|
||
}
|
||
return fn.apply(this, arguments);
|
||
}, fn);
|
||
}
|
||
|
||
var deprecations = {};
|
||
|
||
function deprecateSimple(name, msg) {
|
||
if (!deprecations[name]) {
|
||
warn(msg);
|
||
deprecations[name] = true;
|
||
}
|
||
}
|
||
|
||
utils_hooks__hooks.suppressDeprecationWarnings = false;
|
||
|
||
var from_string__isoRegex = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
|
||
|
||
var isoDates = [
|
||
['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/],
|
||
['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/],
|
||
['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/],
|
||
['GGGG-[W]WW', /\d{4}-W\d{2}/],
|
||
['YYYY-DDD', /\d{4}-\d{3}/]
|
||
];
|
||
|
||
// iso time formats and regexes
|
||
var isoTimes = [
|
||
['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/],
|
||
['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
|
||
['HH:mm', /(T| )\d\d:\d\d/],
|
||
['HH', /(T| )\d\d/]
|
||
];
|
||
|
||
var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
|
||
|
||
// date from iso format
|
||
function configFromISO(config) {
|
||
var i, l,
|
||
string = config._i,
|
||
match = from_string__isoRegex.exec(string);
|
||
|
||
if (match) {
|
||
getParsingFlags(config).iso = true;
|
||
for (i = 0, l = isoDates.length; i < l; i++) {
|
||
if (isoDates[i][1].exec(string)) {
|
||
// match[5] should be 'T' or undefined
|
||
config._f = isoDates[i][0] + (match[6] || ' ');
|
||
break;
|
||
}
|
||
}
|
||
for (i = 0, l = isoTimes.length; i < l; i++) {
|
||
if (isoTimes[i][1].exec(string)) {
|
||
config._f += isoTimes[i][0];
|
||
break;
|
||
}
|
||
}
|
||
if (string.match(matchOffset)) {
|
||
config._f += 'Z';
|
||
}
|
||
configFromStringAndFormat(config);
|
||
} else {
|
||
config._isValid = false;
|
||
}
|
||
}
|
||
|
||
// date from iso format or fallback
|
||
function configFromString(config) {
|
||
var matched = aspNetJsonRegex.exec(config._i);
|
||
|
||
if (matched !== null) {
|
||
config._d = new Date(+matched[1]);
|
||
return;
|
||
}
|
||
|
||
configFromISO(config);
|
||
if (config._isValid === false) {
|
||
delete config._isValid;
|
||
utils_hooks__hooks.createFromInputFallback(config);
|
||
}
|
||
}
|
||
|
||
utils_hooks__hooks.createFromInputFallback = deprecate(
|
||
'moment construction falls back to js Date. This is ' +
|
||
'discouraged and will be removed in upcoming major ' +
|
||
'release. Please refer to ' +
|
||
'https://github.com/moment/moment/issues/1407 for more info.',
|
||
function (config) {
|
||
config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
|
||
}
|
||
);
|
||
|
||
function createDate (y, m, d, h, M, s, ms) {
|
||
//can't just apply() to create a date:
|
||
//http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
|
||
var date = new Date(y, m, d, h, M, s, ms);
|
||
|
||
//the date constructor doesn't accept years < 1970
|
||
if (y < 1970) {
|
||
date.setFullYear(y);
|
||
}
|
||
return date;
|
||
}
|
||
|
||
function createUTCDate (y) {
|
||
var date = new Date(Date.UTC.apply(null, arguments));
|
||
if (y < 1970) {
|
||
date.setUTCFullYear(y);
|
||
}
|
||
return date;
|
||
}
|
||
|
||
addFormatToken(0, ['YY', 2], 0, function () {
|
||
return this.year() % 100;
|
||
});
|
||
|
||
addFormatToken(0, ['YYYY', 4], 0, 'year');
|
||
addFormatToken(0, ['YYYYY', 5], 0, 'year');
|
||
addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
|
||
|
||
// ALIASES
|
||
|
||
addUnitAlias('year', 'y');
|
||
|
||
// PARSING
|
||
|
||
addRegexToken('Y', matchSigned);
|
||
addRegexToken('YY', match1to2, match2);
|
||
addRegexToken('YYYY', match1to4, match4);
|
||
addRegexToken('YYYYY', match1to6, match6);
|
||
addRegexToken('YYYYYY', match1to6, match6);
|
||
|
||
addParseToken(['YYYY', 'YYYYY', 'YYYYYY'], YEAR);
|
||
addParseToken('YY', function (input, array) {
|
||
array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input);
|
||
});
|
||
|
||
// HELPERS
|
||
|
||
function daysInYear(year) {
|
||
return isLeapYear(year) ? 366 : 365;
|
||
}
|
||
|
||
function isLeapYear(year) {
|
||
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
||
}
|
||
|
||
// HOOKS
|
||
|
||
utils_hooks__hooks.parseTwoDigitYear = function (input) {
|
||
return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
|
||
};
|
||
|
||
// MOMENTS
|
||
|
||
var getSetYear = makeGetSet('FullYear', false);
|
||
|
||
function getIsLeapYear () {
|
||
return isLeapYear(this.year());
|
||
}
|
||
|
||
addFormatToken('w', ['ww', 2], 'wo', 'week');
|
||
addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
|
||
|
||
// ALIASES
|
||
|
||
addUnitAlias('week', 'w');
|
||
addUnitAlias('isoWeek', 'W');
|
||
|
||
// PARSING
|
||
|
||
addRegexToken('w', match1to2);
|
||
addRegexToken('ww', match1to2, match2);
|
||
addRegexToken('W', match1to2);
|
||
addRegexToken('WW', match1to2, match2);
|
||
|
||
addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
|
||
week[token.substr(0, 1)] = toInt(input);
|
||
});
|
||
|
||
// HELPERS
|
||
|
||
// firstDayOfWeek 0 = sun, 6 = sat
|
||
// the day of the week that starts the week
|
||
// (usually sunday or monday)
|
||
// firstDayOfWeekOfYear 0 = sun, 6 = sat
|
||
// the first week is the week that contains the first
|
||
// of this day of the week
|
||
// (eg. ISO weeks use thursday (4))
|
||
function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
|
||
var end = firstDayOfWeekOfYear - firstDayOfWeek,
|
||
daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
|
||
adjustedMoment;
|
||
|
||
|
||
if (daysToDayOfWeek > end) {
|
||
daysToDayOfWeek -= 7;
|
||
}
|
||
|
||
if (daysToDayOfWeek < end - 7) {
|
||
daysToDayOfWeek += 7;
|
||
}
|
||
|
||
adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');
|
||
return {
|
||
week: Math.ceil(adjustedMoment.dayOfYear() / 7),
|
||
year: adjustedMoment.year()
|
||
};
|
||
}
|
||
|
||
// LOCALES
|
||
|
||
function localeWeek (mom) {
|
||
return weekOfYear(mom, this._week.dow, this._week.doy).week;
|
||
}
|
||
|
||
var defaultLocaleWeek = {
|
||
dow : 0, // Sunday is the first day of the week.
|
||
doy : 6 // The week that contains Jan 1st is the first week of the year.
|
||
};
|
||
|
||
function localeFirstDayOfWeek () {
|
||
return this._week.dow;
|
||
}
|
||
|
||
function localeFirstDayOfYear () {
|
||
return this._week.doy;
|
||
}
|
||
|
||
// MOMENTS
|
||
|
||
function getSetWeek (input) {
|
||
var week = this.localeData().week(this);
|
||
return input == null ? week : this.add((input - week) * 7, 'd');
|
||
}
|
||
|
||
function getSetISOWeek (input) {
|
||
var week = weekOfYear(this, 1, 4).week;
|
||
return input == null ? week : this.add((input - week) * 7, 'd');
|
||
}
|
||
|
||
addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
|
||
|
||
// ALIASES
|
||
|
||
addUnitAlias('dayOfYear', 'DDD');
|
||
|
||
// PARSING
|
||
|
||
addRegexToken('DDD', match1to3);
|
||
addRegexToken('DDDD', match3);
|
||
addParseToken(['DDD', 'DDDD'], function (input, array, config) {
|
||
config._dayOfYear = toInt(input);
|
||
});
|
||
|
||
// HELPERS
|
||
|
||
//http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
|
||
function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
|
||
var d = createUTCDate(year, 0, 1).getUTCDay();
|
||
var daysToAdd;
|
||
var dayOfYear;
|
||
|
||
d = d === 0 ? 7 : d;
|
||
weekday = weekday != null ? weekday : firstDayOfWeek;
|
||
daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0);
|
||
dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1;
|
||
|
||
return {
|
||
year : dayOfYear > 0 ? year : year - 1,
|
||
dayOfYear : dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear
|
||
};
|
||
}
|
||
|
||
// MOMENTS
|
||
|
||
function getSetDayOfYear (input) {
|
||
var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
|
||
return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
|
||
}
|
||
|
||
// Pick the first defined of two or three arguments.
|
||
function defaults(a, b, c) {
|
||
if (a != null) {
|
||
return a;
|
||
}
|
||
if (b != null) {
|
||
return b;
|
||
}
|
||
return c;
|
||
}
|
||
|
||
function currentDateArray(config) {
|
||
var now = new Date();
|
||
if (config._useUTC) {
|
||
return [now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()];
|
||
}
|
||
return [now.getFullYear(), now.getMonth(), now.getDate()];
|
||
}
|
||
|
||
// convert an array to a date.
|
||
// the array should mirror the parameters below
|
||
// note: all values past the year are optional and will default to the lowest possible value.
|
||
// [year, month, day , hour, minute, second, millisecond]
|
||
function configFromArray (config) {
|
||
var i, date, input = [], currentDate, yearToUse;
|
||
|
||
if (config._d) {
|
||
return;
|
||
}
|
||
|
||
currentDate = currentDateArray(config);
|
||
|
||
//compute day of the year from weeks and weekdays
|
||
if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
|
||
dayOfYearFromWeekInfo(config);
|
||
}
|
||
|
||
//if the day of the year is set, figure out what it is
|
||
if (config._dayOfYear) {
|
||
yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
|
||
|
||
if (config._dayOfYear > daysInYear(yearToUse)) {
|
||
getParsingFlags(config)._overflowDayOfYear = true;
|
||
}
|
||
|
||
date = createUTCDate(yearToUse, 0, config._dayOfYear);
|
||
config._a[MONTH] = date.getUTCMonth();
|
||
config._a[DATE] = date.getUTCDate();
|
||
}
|
||
|
||
// Default to current date.
|
||
// * if no year, month, day of month are given, default to today
|
||
// * if day of month is given, default month and year
|
||
// * if month is given, default only year
|
||
// * if year is given, don't default anything
|
||
for (i = 0; i < 3 && config._a[i] == null; ++i) {
|
||
config._a[i] = input[i] = currentDate[i];
|
||
}
|
||
|
||
// Zero out whatever was not defaulted, including time
|
||
for (; i < 7; i++) {
|
||
config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
|
||
}
|
||
|
||
// Check for 24:00:00.000
|
||
if (config._a[HOUR] === 24 &&
|
||
config._a[MINUTE] === 0 &&
|
||
config._a[SECOND] === 0 &&
|
||
config._a[MILLISECOND] === 0) {
|
||
config._nextDay = true;
|
||
config._a[HOUR] = 0;
|
||
}
|
||
|
||
config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
|
||
// Apply timezone offset from input. The actual utcOffset can be changed
|
||
// with parseZone.
|
||
if (config._tzm != null) {
|
||
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
|
||
}
|
||
|
||
if (config._nextDay) {
|
||
config._a[HOUR] = 24;
|
||
}
|
||
}
|
||
|
||
function dayOfYearFromWeekInfo(config) {
|
||
var w, weekYear, week, weekday, dow, doy, temp;
|
||
|
||
w = config._w;
|
||
if (w.GG != null || w.W != null || w.E != null) {
|
||
dow = 1;
|
||
doy = 4;
|
||
|
||
// TODO: We need to take the current isoWeekYear, but that depends on
|
||
// how we interpret now (local, utc, fixed offset). So create
|
||
// a now version of current config (take local/utc/offset flags, and
|
||
// create now).
|
||
weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year);
|
||
week = defaults(w.W, 1);
|
||
weekday = defaults(w.E, 1);
|
||
} else {
|
||
dow = config._locale._week.dow;
|
||
doy = config._locale._week.doy;
|
||
|
||
weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year);
|
||
week = defaults(w.w, 1);
|
||
|
||
if (w.d != null) {
|
||
// weekday -- low day numbers are considered next week
|
||
weekday = w.d;
|
||
if (weekday < dow) {
|
||
++week;
|
||
}
|
||
} else if (w.e != null) {
|
||
// local weekday -- counting starts from begining of week
|
||
weekday = w.e + dow;
|
||
} else {
|
||
// default to begining of week
|
||
weekday = dow;
|
||
}
|
||
}
|
||
temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow);
|
||
|
||
config._a[YEAR] = temp.year;
|
||
config._dayOfYear = temp.dayOfYear;
|
||
}
|
||
|
||
utils_hooks__hooks.ISO_8601 = function () {};
|
||
|
||
// date from string and format string
|
||
function configFromStringAndFormat(config) {
|
||
// TODO: Move this to another part of the creation flow to prevent circular deps
|
||
if (config._f === utils_hooks__hooks.ISO_8601) {
|
||
configFromISO(config);
|
||
return;
|
||
}
|
||
|
||
config._a = [];
|
||
getParsingFlags(config).empty = true;
|
||
|
||
// This array is used to make a Date, either with `new Date` or `Date.UTC`
|
||
var string = '' + config._i,
|
||
i, parsedInput, tokens, token, skipped,
|
||
stringLength = string.length,
|
||
totalParsedInputLength = 0;
|
||
|
||
tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
|
||
|
||
for (i = 0; i < tokens.length; i++) {
|
||
token = tokens[i];
|
||
parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
|
||
if (parsedInput) {
|
||
skipped = string.substr(0, string.indexOf(parsedInput));
|
||
if (skipped.length > 0) {
|
||
getParsingFlags(config).unusedInput.push(skipped);
|
||
}
|
||
string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
|
||
totalParsedInputLength += parsedInput.length;
|
||
}
|
||
// don't parse if it's not a known token
|
||
if (formatTokenFunctions[token]) {
|
||
if (parsedInput) {
|
||
getParsingFlags(config).empty = false;
|
||
}
|
||
else {
|
||
getParsingFlags(config).unusedTokens.push(token);
|
||
}
|
||
addTimeToArrayFromToken(token, parsedInput, config);
|
||
}
|
||
else if (config._strict && !parsedInput) {
|
||
getParsingFlags(config).unusedTokens.push(token);
|
||
}
|
||
}
|
||
|
||
// add remaining unparsed input length to the string
|
||
getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
|
||
if (string.length > 0) {
|
||
getParsingFlags(config).unusedInput.push(string);
|
||
}
|
||
|
||
// clear _12h flag if hour is <= 12
|
||
if (getParsingFlags(config).bigHour === true &&
|
||
config._a[HOUR] <= 12 &&
|
||
config._a[HOUR] > 0) {
|
||
getParsingFlags(config).bigHour = undefined;
|
||
}
|
||
// handle meridiem
|
||
config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
|
||
|
||
configFromArray(config);
|
||
checkOverflow(config);
|
||
}
|
||
|
||
|
||
function meridiemFixWrap (locale, hour, meridiem) {
|
||
var isPm;
|
||
|
||
if (meridiem == null) {
|
||
// nothing to do
|
||
return hour;
|
||
}
|
||
if (locale.meridiemHour != null) {
|
||
return locale.meridiemHour(hour, meridiem);
|
||
} else if (locale.isPM != null) {
|
||
// Fallback
|
||
isPm = locale.isPM(meridiem);
|
||
if (isPm && hour < 12) {
|
||
hour += 12;
|
||
}
|
||
if (!isPm && hour === 12) {
|
||
hour = 0;
|
||
}
|
||
return hour;
|
||
} else {
|
||
// this is not supposed to happen
|
||
return hour;
|
||
}
|
||
}
|
||
|
||
function configFromStringAndArray(config) {
|
||
var tempConfig,
|
||
bestMoment,
|
||
|
||
scoreToBeat,
|
||
i,
|
||
currentScore;
|
||
|
||
if (config._f.length === 0) {
|
||
getParsingFlags(config).invalidFormat = true;
|
||
config._d = new Date(NaN);
|
||
return;
|
||
}
|
||
|
||
for (i = 0; i < config._f.length; i++) {
|
||
currentScore = 0;
|
||
tempConfig = copyConfig({}, config);
|
||
if (config._useUTC != null) {
|
||
tempConfig._useUTC = config._useUTC;
|
||
}
|
||
tempConfig._f = config._f[i];
|
||
configFromStringAndFormat(tempConfig);
|
||
|
||
if (!valid__isValid(tempConfig)) {
|
||
continue;
|
||
}
|
||
|
||
// if there is any input that was not parsed add a penalty for that format
|
||
currentScore += getParsingFlags(tempConfig).charsLeftOver;
|
||
|
||
//or tokens
|
||
currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
|
||
|
||
getParsingFlags(tempConfig).score = currentScore;
|
||
|
||
if (scoreToBeat == null || currentScore < scoreToBeat) {
|
||
scoreToBeat = currentScore;
|
||
bestMoment = tempConfig;
|
||
}
|
||
}
|
||
|
||
extend(config, bestMoment || tempConfig);
|
||
}
|
||
|
||
function configFromObject(config) {
|
||
if (config._d) {
|
||
return;
|
||
}
|
||
|
||
var i = normalizeObjectUnits(config._i);
|
||
config._a = [i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond];
|
||
|
||
configFromArray(config);
|
||
}
|
||
|
||
function createFromConfig (config) {
|
||
var input = config._i,
|
||
format = config._f,
|
||
res;
|
||
|
||
config._locale = config._locale || locale_locales__getLocale(config._l);
|
||
|
||
if (input === null || (format === undefined && input === '')) {
|
||
return valid__createInvalid({nullInput: true});
|
||
}
|
||
|
||
if (typeof input === 'string') {
|
||
config._i = input = config._locale.preparse(input);
|
||
}
|
||
|
||
if (isMoment(input)) {
|
||
return new Moment(checkOverflow(input));
|
||
} else if (isArray(format)) {
|
||
configFromStringAndArray(config);
|
||
} else if (format) {
|
||
configFromStringAndFormat(config);
|
||
} else if (isDate(input)) {
|
||
config._d = input;
|
||
} else {
|
||
configFromInput(config);
|
||
}
|
||
|
||
res = new Moment(checkOverflow(config));
|
||
if (res._nextDay) {
|
||
// Adding is smart enough around DST
|
||
res.add(1, 'd');
|
||
res._nextDay = undefined;
|
||
}
|
||
|
||
return res;
|
||
}
|
||
|
||
function configFromInput(config) {
|
||
var input = config._i;
|
||
if (input === undefined) {
|
||
config._d = new Date();
|
||
} else if (isDate(input)) {
|
||
config._d = new Date(+input);
|
||
} else if (typeof input === 'string') {
|
||
configFromString(config);
|
||
} else if (isArray(input)) {
|
||
config._a = map(input.slice(0), function (obj) {
|
||
return parseInt(obj, 10);
|
||
});
|
||
configFromArray(config);
|
||
} else if (typeof(input) === 'object') {
|
||
configFromObject(config);
|
||
} else if (typeof(input) === 'number') {
|
||
// from milliseconds
|
||
config._d = new Date(input);
|
||
} else {
|
||
utils_hooks__hooks.createFromInputFallback(config);
|
||
}
|
||
}
|
||
|
||
function createLocalOrUTC (input, format, locale, strict, isUTC) {
|
||
var c = {};
|
||
|
||
if (typeof(locale) === 'boolean') {
|
||
strict = locale;
|
||
locale = undefined;
|
||
}
|
||
// object construction must be done this way.
|
||
// https://github.com/moment/moment/issues/1423
|
||
c._isAMomentObject = true;
|
||
c._useUTC = c._isUTC = isUTC;
|
||
c._l = locale;
|
||
c._i = input;
|
||
c._f = format;
|
||
c._strict = strict;
|
||
|
||
return createFromConfig(c);
|
||
}
|
||
|
||
function local__createLocal (input, format, locale, strict) {
|
||
return createLocalOrUTC(input, format, locale, strict, false);
|
||
}
|
||
|
||
var prototypeMin = deprecate(
|
||
'moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548',
|
||
function () {
|
||
var other = local__createLocal.apply(null, arguments);
|
||
return other < this ? this : other;
|
||
}
|
||
);
|
||
|
||
var prototypeMax = deprecate(
|
||
'moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548',
|
||
function () {
|
||
var other = local__createLocal.apply(null, arguments);
|
||
return other > this ? this : other;
|
||
}
|
||
);
|
||
|
||
// Pick a moment m from moments so that m[fn](other) is true for all
|
||
// other. This relies on the function fn to be transitive.
|
||
//
|
||
// moments should either be an array of moment objects or an array, whose
|
||
// first element is an array of moment objects.
|
||
function pickBy(fn, moments) {
|
||
var res, i;
|
||
if (moments.length === 1 && isArray(moments[0])) {
|
||
moments = moments[0];
|
||
}
|
||
if (!moments.length) {
|
||
return local__createLocal();
|
||
}
|
||
res = moments[0];
|
||
for (i = 1; i < moments.length; ++i) {
|
||
if (moments[i][fn](res)) {
|
||
res = moments[i];
|
||
}
|
||
}
|
||
return res;
|
||
}
|
||
|
||
// TODO: Use [].sort instead?
|
||
function min () {
|
||
var args = [].slice.call(arguments, 0);
|
||
|
||
return pickBy('isBefore', args);
|
||
}
|
||
|
||
function max () {
|
||
var args = [].slice.call(arguments, 0);
|
||
|
||
return pickBy('isAfter', args);
|
||
}
|
||
|
||
function Duration (duration) {
|
||
var normalizedInput = normalizeObjectUnits(duration),
|
||
years = normalizedInput.year || 0,
|
||
quarters = normalizedInput.quarter || 0,
|
||
months = normalizedInput.month || 0,
|
||
weeks = normalizedInput.week || 0,
|
||
days = normalizedInput.day || 0,
|
||
hours = normalizedInput.hour || 0,
|
||
minutes = normalizedInput.minute || 0,
|
||
seconds = normalizedInput.second || 0,
|
||
milliseconds = normalizedInput.millisecond || 0;
|
||
|
||
// representation for dateAddRemove
|
||
this._milliseconds = +milliseconds +
|
||
seconds * 1e3 + // 1000
|
||
minutes * 6e4 + // 1000 * 60
|
||
hours * 36e5; // 1000 * 60 * 60
|
||
// Because of dateAddRemove treats 24 hours as different from a
|
||
// day when working around DST, we need to store them separately
|
||
this._days = +days +
|
||
weeks * 7;
|
||
// It is impossible translate months into days without knowing
|
||
// which months you are are talking about, so we have to store
|
||
// it separately.
|
||
this._months = +months +
|
||
quarters * 3 +
|
||
years * 12;
|
||
|
||
this._data = {};
|
||
|
||
this._locale = locale_locales__getLocale();
|
||
|
||
this._bubble();
|
||
}
|
||
|
||
function isDuration (obj) {
|
||
return obj instanceof Duration;
|
||
}
|
||
|
||
function offset (token, separator) {
|
||
addFormatToken(token, 0, 0, function () {
|
||
var offset = this.utcOffset();
|
||
var sign = '+';
|
||
if (offset < 0) {
|
||
offset = -offset;
|
||
sign = '-';
|
||
}
|
||
return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
|
||
});
|
||
}
|
||
|
||
offset('Z', ':');
|
||
offset('ZZ', '');
|
||
|
||
// PARSING
|
||
|
||
addRegexToken('Z', matchOffset);
|
||
addRegexToken('ZZ', matchOffset);
|
||
addParseToken(['Z', 'ZZ'], function (input, array, config) {
|
||
config._useUTC = true;
|
||
config._tzm = offsetFromString(input);
|
||
});
|
||
|
||
// HELPERS
|
||
|
||
// timezone chunker
|
||
// '+10:00' > ['10', '00']
|
||
// '-1530' > ['-15', '30']
|
||
var chunkOffset = /([\+\-]|\d\d)/gi;
|
||
|
||
function offsetFromString(string) {
|
||
var matches = ((string || '').match(matchOffset) || []);
|
||
var chunk = matches[matches.length - 1] || [];
|
||
var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
|
||
var minutes = +(parts[1] * 60) + toInt(parts[2]);
|
||
|
||
return parts[0] === '+' ? minutes : -minutes;
|
||
}
|
||
|
||
// Return a moment from input, that is local/utc/zone equivalent to model.
|
||
function cloneWithOffset(input, model) {
|
||
var res, diff;
|
||
if (model._isUTC) {
|
||
res = model.clone();
|
||
diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);
|
||
// Use low-level api, because this fn is low-level api.
|
||
res._d.setTime(+res._d + diff);
|
||
utils_hooks__hooks.updateOffset(res, false);
|
||
return res;
|
||
} else {
|
||
return local__createLocal(input).local();
|
||
}
|
||
return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();
|
||
}
|
||
|
||
function getDateOffset (m) {
|
||
// On Firefox.24 Date#getTimezoneOffset returns a floating point.
|
||
// https://github.com/moment/moment/pull/1871
|
||
return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
|
||
}
|
||
|
||
// HOOKS
|
||
|
||
// This function will be called whenever a moment is mutated.
|
||
// It is intended to keep the offset in sync with the timezone.
|
||
utils_hooks__hooks.updateOffset = function () {};
|
||
|
||
// MOMENTS
|
||
|
||
// keepLocalTime = true means only change the timezone, without
|
||
// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
|
||
// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
|
||
// +0200, so we adjust the time as needed, to be valid.
|
||
//
|
||
// Keeping the time actually adds/subtracts (one hour)
|
||
// from the actual represented time. That is why we call updateOffset
|
||
// a second time. In case it wants us to change the offset again
|
||
// _changeInProgress == true case, then we have to adjust, because
|
||
// there is no such time in the given timezone.
|
||
function getSetOffset (input, keepLocalTime) {
|
||
var offset = this._offset || 0,
|
||
localAdjust;
|
||
if (input != null) {
|
||
if (typeof input === 'string') {
|
||
input = offsetFromString(input);
|
||
}
|
||
if (Math.abs(input) < 16) {
|
||
input = input * 60;
|
||
}
|
||
if (!this._isUTC && keepLocalTime) {
|
||
localAdjust = getDateOffset(this);
|
||
}
|
||
this._offset = input;
|
||
this._isUTC = true;
|
||
if (localAdjust != null) {
|
||
this.add(localAdjust, 'm');
|
||
}
|
||
if (offset !== input) {
|
||
if (!keepLocalTime || this._changeInProgress) {
|
||
add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false);
|
||
} else if (!this._changeInProgress) {
|
||
this._changeInProgress = true;
|
||
utils_hooks__hooks.updateOffset(this, true);
|
||
this._changeInProgress = null;
|
||
}
|
||
}
|
||
return this;
|
||
} else {
|
||
return this._isUTC ? offset : getDateOffset(this);
|
||
}
|
||
}
|
||
|
||
function getSetZone (input, keepLocalTime) {
|
||
if (input != null) {
|
||
if (typeof input !== 'string') {
|
||
input = -input;
|
||
}
|
||
|
||
this.utcOffset(input, keepLocalTime);
|
||
|
||
return this;
|
||
} else {
|
||
return -this.utcOffset();
|
||
}
|
||
}
|
||
|
||
function setOffsetToUTC (keepLocalTime) {
|
||
return this.utcOffset(0, keepLocalTime);
|
||
}
|
||
|
||
function setOffsetToLocal (keepLocalTime) {
|
||
if (this._isUTC) {
|
||
this.utcOffset(0, keepLocalTime);
|
||
this._isUTC = false;
|
||
|
||
if (keepLocalTime) {
|
||
this.subtract(getDateOffset(this), 'm');
|
||
}
|
||
}
|
||
return this;
|
||
}
|
||
|
||
function setOffsetToParsedOffset () {
|
||
if (this._tzm) {
|
||
this.utcOffset(this._tzm);
|
||
} else if (typeof this._i === 'string') {
|
||
this.utcOffset(offsetFromString(this._i));
|
||
}
|
||
return this;
|
||
}
|
||
|
||
function hasAlignedHourOffset (input) {
|
||
if (!input) {
|
||
input = 0;
|
||
}
|
||
else {
|
||
input = local__createLocal(input).utcOffset();
|
||
}
|
||
|
||
return (this.utcOffset() - input) % 60 === 0;
|
||
}
|
||
|
||
function isDaylightSavingTime () {
|
||
return (
|
||
this.utcOffset() > this.clone().month(0).utcOffset() ||
|
||
this.utcOffset() > this.clone().month(5).utcOffset()
|
||
);
|
||
}
|
||
|
||
function isDaylightSavingTimeShifted () {
|
||
if (this._a) {
|
||
var other = this._isUTC ? create_utc__createUTC(this._a) : local__createLocal(this._a);
|
||
return this.isValid() && compareArrays(this._a, other.toArray()) > 0;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
function isLocal () {
|
||
return !this._isUTC;
|
||
}
|
||
|
||
function isUtcOffset () {
|
||
return this._isUTC;
|
||
}
|
||
|
||
function isUtc () {
|
||
return this._isUTC && this._offset === 0;
|
||
}
|
||
|
||
var aspNetRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/;
|
||
|
||
// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
|
||
// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
|
||
var create__isoRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;
|
||
|
||
function create__createDuration (input, key) {
|
||
var duration = input,
|
||
// matching against regexp is expensive, do it on demand
|
||
match = null,
|
||
sign,
|
||
ret,
|
||
diffRes;
|
||
|
||
if (isDuration(input)) {
|
||
duration = {
|
||
ms : input._milliseconds,
|
||
d : input._days,
|
||
M : input._months
|
||
};
|
||
} else if (typeof input === 'number') {
|
||
duration = {};
|
||
if (key) {
|
||
duration[key] = input;
|
||
} else {
|
||
duration.milliseconds = input;
|
||
}
|
||
} else if (!!(match = aspNetRegex.exec(input))) {
|
||
sign = (match[1] === '-') ? -1 : 1;
|
||
duration = {
|
||
y : 0,
|
||
d : toInt(match[DATE]) * sign,
|
||
h : toInt(match[HOUR]) * sign,
|
||
m : toInt(match[MINUTE]) * sign,
|
||
s : toInt(match[SECOND]) * sign,
|
||
ms : toInt(match[MILLISECOND]) * sign
|
||
};
|
||
} else if (!!(match = create__isoRegex.exec(input))) {
|
||
sign = (match[1] === '-') ? -1 : 1;
|
||
duration = {
|
||
y : parseIso(match[2], sign),
|
||
M : parseIso(match[3], sign),
|
||
d : parseIso(match[4], sign),
|
||
h : parseIso(match[5], sign),
|
||
m : parseIso(match[6], sign),
|
||
s : parseIso(match[7], sign),
|
||
w : parseIso(match[8], sign)
|
||
};
|
||
} else if (duration == null) {// checks for null or undefined
|
||
duration = {};
|
||
} else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
|
||
diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to));
|
||
|
||
duration = {};
|
||
duration.ms = diffRes.milliseconds;
|
||
duration.M = diffRes.months;
|
||
}
|
||
|
||
ret = new Duration(duration);
|
||
|
||
if (isDuration(input) && hasOwnProp(input, '_locale')) {
|
||
ret._locale = input._locale;
|
||
}
|
||
|
||
return ret;
|
||
}
|
||
|
||
create__createDuration.fn = Duration.prototype;
|
||
|
||
function parseIso (inp, sign) {
|
||
// We'd normally use ~~inp for this, but unfortunately it also
|
||
// converts floats to ints.
|
||
// inp may be undefined, so careful calling replace on it.
|
||
var res = inp && parseFloat(inp.replace(',', '.'));
|
||
// apply sign while we're at it
|
||
return (isNaN(res) ? 0 : res) * sign;
|
||
}
|
||
|
||
function positiveMomentsDifference(base, other) {
|
||
var res = {milliseconds: 0, months: 0};
|
||
|
||
res.months = other.month() - base.month() +
|
||
(other.year() - base.year()) * 12;
|
||
if (base.clone().add(res.months, 'M').isAfter(other)) {
|
||
--res.months;
|
||
}
|
||
|
||
res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
|
||
|
||
return res;
|
||
}
|
||
|
||
function momentsDifference(base, other) {
|
||
var res;
|
||
other = cloneWithOffset(other, base);
|
||
if (base.isBefore(other)) {
|
||
res = positiveMomentsDifference(base, other);
|
||
} else {
|
||
res = positiveMomentsDifference(other, base);
|
||
res.milliseconds = -res.milliseconds;
|
||
res.months = -res.months;
|
||
}
|
||
|
||
return res;
|
||
}
|
||
|
||
function createAdder(direction, name) {
|
||
return function (val, period) {
|
||
var dur, tmp;
|
||
//invert the arguments, but complain about it
|
||
if (period !== null && !isNaN(+period)) {
|
||
deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).');
|
||
tmp = val; val = period; period = tmp;
|
||
}
|
||
|
||
val = typeof val === 'string' ? +val : val;
|
||
dur = create__createDuration(val, period);
|
||
add_subtract__addSubtract(this, dur, direction);
|
||
return this;
|
||
};
|
||
}
|
||
|
||
function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) {
|
||
var milliseconds = duration._milliseconds,
|
||
days = duration._days,
|
||
months = duration._months;
|
||
updateOffset = updateOffset == null ? true : updateOffset;
|
||
|
||
if (milliseconds) {
|
||
mom._d.setTime(+mom._d + milliseconds * isAdding);
|
||
}
|
||
if (days) {
|
||
get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding);
|
||
}
|
||
if (months) {
|
||
setMonth(mom, get_set__get(mom, 'Month') + months * isAdding);
|
||
}
|
||
if (updateOffset) {
|
||
utils_hooks__hooks.updateOffset(mom, days || months);
|
||
}
|
||
}
|
||
|
||
var add_subtract__add = createAdder(1, 'add');
|
||
var add_subtract__subtract = createAdder(-1, 'subtract');
|
||
|
||
function moment_calendar__calendar (time) {
|
||
// We want to compare the start of today, vs this.
|
||
// Getting start-of-today depends on whether we're local/utc/offset or not.
|
||
var now = time || local__createLocal(),
|
||
sod = cloneWithOffset(now, this).startOf('day'),
|
||
diff = this.diff(sod, 'days', true),
|
||
format = diff < -6 ? 'sameElse' :
|
||
diff < -1 ? 'lastWeek' :
|
||
diff < 0 ? 'lastDay' :
|
||
diff < 1 ? 'sameDay' :
|
||
diff < 2 ? 'nextDay' :
|
||
diff < 7 ? 'nextWeek' : 'sameElse';
|
||
return this.format(this.localeData().calendar(format, this, local__createLocal(now)));
|
||
}
|
||
|
||
function clone () {
|
||
return new Moment(this);
|
||
}
|
||
|
||
function isAfter (input, units) {
|
||
var inputMs;
|
||
units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
|
||
if (units === 'millisecond') {
|
||
input = isMoment(input) ? input : local__createLocal(input);
|
||
return +this > +input;
|
||
} else {
|
||
inputMs = isMoment(input) ? +input : +local__createLocal(input);
|
||
return inputMs < +this.clone().startOf(units);
|
||
}
|
||
}
|
||
|
||
function isBefore (input, units) {
|
||
var inputMs;
|
||
units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
|
||
if (units === 'millisecond') {
|
||
input = isMoment(input) ? input : local__createLocal(input);
|
||
return +this < +input;
|
||
} else {
|
||
inputMs = isMoment(input) ? +input : +local__createLocal(input);
|
||
return +this.clone().endOf(units) < inputMs;
|
||
}
|
||
}
|
||
|
||
function isBetween (from, to, units) {
|
||
return this.isAfter(from, units) && this.isBefore(to, units);
|
||
}
|
||
|
||
function isSame (input, units) {
|
||
var inputMs;
|
||
units = normalizeUnits(units || 'millisecond');
|
||
if (units === 'millisecond') {
|
||
input = isMoment(input) ? input : local__createLocal(input);
|
||
return +this === +input;
|
||
} else {
|
||
inputMs = +local__createLocal(input);
|
||
return +(this.clone().startOf(units)) <= inputMs && inputMs <= +(this.clone().endOf(units));
|
||
}
|
||
}
|
||
|
||
function absFloor (number) {
|
||
if (number < 0) {
|
||
return Math.ceil(number);
|
||
} else {
|
||
return Math.floor(number);
|
||
}
|
||
}
|
||
|
||
function diff (input, units, asFloat) {
|
||
var that = cloneWithOffset(input, this),
|
||
zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4,
|
||
delta, output;
|
||
|
||
units = normalizeUnits(units);
|
||
|
||
if (units === 'year' || units === 'month' || units === 'quarter') {
|
||
output = monthDiff(this, that);
|
||
if (units === 'quarter') {
|
||
output = output / 3;
|
||
} else if (units === 'year') {
|
||
output = output / 12;
|
||
}
|
||
} else {
|
||
delta = this - that;
|
||
output = units === 'second' ? delta / 1e3 : // 1000
|
||
units === 'minute' ? delta / 6e4 : // 1000 * 60
|
||
units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
|
||
units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
|
||
units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
|
||
delta;
|
||
}
|
||
return asFloat ? output : absFloor(output);
|
||
}
|
||
|
||
function monthDiff (a, b) {
|
||
// difference in months
|
||
var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
|
||
// b is in (anchor - 1 month, anchor + 1 month)
|
||
anchor = a.clone().add(wholeMonthDiff, 'months'),
|
||
anchor2, adjust;
|
||
|
||
if (b - anchor < 0) {
|
||
anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
|
||
// linear across the month
|
||
adjust = (b - anchor) / (anchor - anchor2);
|
||
} else {
|
||
anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
|
||
// linear across the month
|
||
adjust = (b - anchor) / (anchor2 - anchor);
|
||
}
|
||
|
||
return -(wholeMonthDiff + adjust);
|
||
}
|
||
|
||
utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
|
||
|
||
function toString () {
|
||
return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
|
||
}
|
||
|
||
function moment_format__toISOString () {
|
||
var m = this.clone().utc();
|
||
if (0 < m.year() && m.year() <= 9999) {
|
||
if ('function' === typeof Date.prototype.toISOString) {
|
||
// native implementation is ~50x faster, use it when we can
|
||
return this.toDate().toISOString();
|
||
} else {
|
||
return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
|
||
}
|
||
} else {
|
||
return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
|
||
}
|
||
}
|
||
|
||
function format (inputString) {
|
||
var output = formatMoment(this, inputString || utils_hooks__hooks.defaultFormat);
|
||
return this.localeData().postformat(output);
|
||
}
|
||
|
||
function from (time, withoutSuffix) {
|
||
if (!this.isValid()) {
|
||
return this.localeData().invalidDate();
|
||
}
|
||
return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
|
||
}
|
||
|
||
function fromNow (withoutSuffix) {
|
||
return this.from(local__createLocal(), withoutSuffix);
|
||
}
|
||
|
||
function to (time, withoutSuffix) {
|
||
if (!this.isValid()) {
|
||
return this.localeData().invalidDate();
|
||
}
|
||
return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
|
||
}
|
||
|
||
function toNow (withoutSuffix) {
|
||
return this.to(local__createLocal(), withoutSuffix);
|
||
}
|
||
|
||
function locale (key) {
|
||
var newLocaleData;
|
||
|
||
if (key === undefined) {
|
||
return this._locale._abbr;
|
||
} else {
|
||
newLocaleData = locale_locales__getLocale(key);
|
||
if (newLocaleData != null) {
|
||
this._locale = newLocaleData;
|
||
}
|
||
return this;
|
||
}
|
||
}
|
||
|
||
var lang = deprecate(
|
||
'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
|
||
function (key) {
|
||
if (key === undefined) {
|
||
return this.localeData();
|
||
} else {
|
||
return this.locale(key);
|
||
}
|
||
}
|
||
);
|
||
|
||
function localeData () {
|
||
return this._locale;
|
||
}
|
||
|
||
function startOf (units) {
|
||
units = normalizeUnits(units);
|
||
// the following switch intentionally omits break keywords
|
||
// to utilize falling through the cases.
|
||
switch (units) {
|
||
case 'year':
|
||
this.month(0);
|
||
/* falls through */
|
||
case 'quarter':
|
||
case 'month':
|
||
this.date(1);
|
||
/* falls through */
|
||
case 'week':
|
||
case 'isoWeek':
|
||
case 'day':
|
||
this.hours(0);
|
||
/* falls through */
|
||
case 'hour':
|
||
this.minutes(0);
|
||
/* falls through */
|
||
case 'minute':
|
||
this.seconds(0);
|
||
/* falls through */
|
||
case 'second':
|
||
this.milliseconds(0);
|
||
}
|
||
|
||
// weeks are a special case
|
||
if (units === 'week') {
|
||
this.weekday(0);
|
||
}
|
||
if (units === 'isoWeek') {
|
||
this.isoWeekday(1);
|
||
}
|
||
|
||
// quarters are also special
|
||
if (units === 'quarter') {
|
||
this.month(Math.floor(this.month() / 3) * 3);
|
||
}
|
||
|
||
return this;
|
||
}
|
||
|
||
function endOf (units) {
|
||
units = normalizeUnits(units);
|
||
if (units === undefined || units === 'millisecond') {
|
||
return this;
|
||
}
|
||
return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
|
||
}
|
||
|
||
function to_type__valueOf () {
|
||
return +this._d - ((this._offset || 0) * 60000);
|
||
}
|
||
|
||
function unix () {
|
||
return Math.floor(+this / 1000);
|
||
}
|
||
|
||
function toDate () {
|
||
return this._offset ? new Date(+this) : this._d;
|
||
}
|
||
|
||
function toArray () {
|
||
var m = this;
|
||
return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
|
||
}
|
||
|
||
function moment_valid__isValid () {
|
||
return valid__isValid(this);
|
||
}
|
||
|
||
function parsingFlags () {
|
||
return extend({}, getParsingFlags(this));
|
||
}
|
||
|
||
function invalidAt () {
|
||
return getParsingFlags(this).overflow;
|
||
}
|
||
|
||
addFormatToken(0, ['gg', 2], 0, function () {
|
||
return this.weekYear() % 100;
|
||
});
|
||
|
||
addFormatToken(0, ['GG', 2], 0, function () {
|
||
return this.isoWeekYear() % 100;
|
||
});
|
||
|
||
function addWeekYearFormatToken (token, getter) {
|
||
addFormatToken(0, [token, token.length], 0, getter);
|
||
}
|
||
|
||
addWeekYearFormatToken('gggg', 'weekYear');
|
||
addWeekYearFormatToken('ggggg', 'weekYear');
|
||
addWeekYearFormatToken('GGGG', 'isoWeekYear');
|
||
addWeekYearFormatToken('GGGGG', 'isoWeekYear');
|
||
|
||
// ALIASES
|
||
|
||
addUnitAlias('weekYear', 'gg');
|
||
addUnitAlias('isoWeekYear', 'GG');
|
||
|
||
// PARSING
|
||
|
||
addRegexToken('G', matchSigned);
|
||
addRegexToken('g', matchSigned);
|
||
addRegexToken('GG', match1to2, match2);
|
||
addRegexToken('gg', match1to2, match2);
|
||
addRegexToken('GGGG', match1to4, match4);
|
||
addRegexToken('gggg', match1to4, match4);
|
||
addRegexToken('GGGGG', match1to6, match6);
|
||
addRegexToken('ggggg', match1to6, match6);
|
||
|
||
addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
|
||
week[token.substr(0, 2)] = toInt(input);
|
||
});
|
||
|
||
addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
|
||
week[token] = utils_hooks__hooks.parseTwoDigitYear(input);
|
||
});
|
||
|
||
// HELPERS
|
||
|
||
function weeksInYear(year, dow, doy) {
|
||
return weekOfYear(local__createLocal([year, 11, 31 + dow - doy]), dow, doy).week;
|
||
}
|
||
|
||
// MOMENTS
|
||
|
||
function getSetWeekYear (input) {
|
||
var year = weekOfYear(this, this.localeData()._week.dow, this.localeData()._week.doy).year;
|
||
return input == null ? year : this.add((input - year), 'y');
|
||
}
|
||
|
||
function getSetISOWeekYear (input) {
|
||
var year = weekOfYear(this, 1, 4).year;
|
||
return input == null ? year : this.add((input - year), 'y');
|
||
}
|
||
|
||
function getISOWeeksInYear () {
|
||
return weeksInYear(this.year(), 1, 4);
|
||
}
|
||
|
||
function getWeeksInYear () {
|
||
var weekInfo = this.localeData()._week;
|
||
return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
|
||
}
|
||
|
||
addFormatToken('Q', 0, 0, 'quarter');
|
||
|
||
// ALIASES
|
||
|
||
addUnitAlias('quarter', 'Q');
|
||
|
||
// PARSING
|
||
|
||
addRegexToken('Q', match1);
|
||
addParseToken('Q', function (input, array) {
|
||
array[MONTH] = (toInt(input) - 1) * 3;
|
||
});
|
||
|
||
// MOMENTS
|
||
|
||
function getSetQuarter (input) {
|
||
return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
|
||
}
|
||
|
||
addFormatToken('D', ['DD', 2], 'Do', 'date');
|
||
|
||
// ALIASES
|
||
|
||
addUnitAlias('date', 'D');
|
||
|
||
// PARSING
|
||
|
||
addRegexToken('D', match1to2);
|
||
addRegexToken('DD', match1to2, match2);
|
||
addRegexToken('Do', function (isStrict, locale) {
|
||
return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
|
||
});
|
||
|
||
addParseToken(['D', 'DD'], DATE);
|
||
addParseToken('Do', function (input, array) {
|
||
array[DATE] = toInt(input.match(match1to2)[0], 10);
|
||
});
|
||
|
||
// MOMENTS
|
||
|
||
var getSetDayOfMonth = makeGetSet('Date', true);
|
||
|
||
addFormatToken('d', 0, 'do', 'day');
|
||
|
||
addFormatToken('dd', 0, 0, function (format) {
|
||
return this.localeData().weekdaysMin(this, format);
|
||
});
|
||
|
||
addFormatToken('ddd', 0, 0, function (format) {
|
||
return this.localeData().weekdaysShort(this, format);
|
||
});
|
||
|
||
addFormatToken('dddd', 0, 0, function (format) {
|
||
return this.localeData().weekdays(this, format);
|
||
});
|
||
|
||
addFormatToken('e', 0, 0, 'weekday');
|
||
addFormatToken('E', 0, 0, 'isoWeekday');
|
||
|
||
// ALIASES
|
||
|
||
addUnitAlias('day', 'd');
|
||
addUnitAlias('weekday', 'e');
|
||
addUnitAlias('isoWeekday', 'E');
|
||
|
||
// PARSING
|
||
|
||
addRegexToken('d', match1to2);
|
||
addRegexToken('e', match1to2);
|
||
addRegexToken('E', match1to2);
|
||
addRegexToken('dd', matchWord);
|
||
addRegexToken('ddd', matchWord);
|
||
addRegexToken('dddd', matchWord);
|
||
|
||
addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config) {
|
||
var weekday = config._locale.weekdaysParse(input);
|
||
// if we didn't get a weekday name, mark the date as invalid
|
||
if (weekday != null) {
|
||
week.d = weekday;
|
||
} else {
|
||
getParsingFlags(config).invalidWeekday = input;
|
||
}
|
||
});
|
||
|
||
addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
|
||
week[token] = toInt(input);
|
||
});
|
||
|
||
// HELPERS
|
||
|
||
function parseWeekday(input, locale) {
|
||
if (typeof input === 'string') {
|
||
if (!isNaN(input)) {
|
||
input = parseInt(input, 10);
|
||
}
|
||
else {
|
||
input = locale.weekdaysParse(input);
|
||
if (typeof input !== 'number') {
|
||
return null;
|
||
}
|
||
}
|
||
}
|
||
return input;
|
||
}
|
||
|
||
// LOCALES
|
||
|
||
var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
|
||
function localeWeekdays (m) {
|
||
return this._weekdays[m.day()];
|
||
}
|
||
|
||
var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
|
||
function localeWeekdaysShort (m) {
|
||
return this._weekdaysShort[m.day()];
|
||
}
|
||
|
||
var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
|
||
function localeWeekdaysMin (m) {
|
||
return this._weekdaysMin[m.day()];
|
||
}
|
||
|
||
function localeWeekdaysParse (weekdayName) {
|
||
var i, mom, regex;
|
||
|
||
if (!this._weekdaysParse) {
|
||
this._weekdaysParse = [];
|
||
}
|
||
|
||
for (i = 0; i < 7; i++) {
|
||
// make the regex if we don't have it already
|
||
if (!this._weekdaysParse[i]) {
|
||
mom = local__createLocal([2000, 1]).day(i);
|
||
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
|
||
this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
|
||
}
|
||
// test the regex
|
||
if (this._weekdaysParse[i].test(weekdayName)) {
|
||
return i;
|
||
}
|
||
}
|
||
}
|
||
|
||
// MOMENTS
|
||
|
||
function getSetDayOfWeek (input) {
|
||
var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
|
||
if (input != null) {
|
||
input = parseWeekday(input, this.localeData());
|
||
return this.add(input - day, 'd');
|
||
} else {
|
||
return day;
|
||
}
|
||
}
|
||
|
||
function getSetLocaleDayOfWeek (input) {
|
||
var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
|
||
return input == null ? weekday : this.add(input - weekday, 'd');
|
||
}
|
||
|
||
function getSetISODayOfWeek (input) {
|
||
// behaves the same as moment#day except
|
||
// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
|
||
// as a setter, sunday should belong to the previous week.
|
||
return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
|
||
}
|
||
|
||
addFormatToken('H', ['HH', 2], 0, 'hour');
|
||
addFormatToken('h', ['hh', 2], 0, function () {
|
||
return this.hours() % 12 || 12;
|
||
});
|
||
|
||
function meridiem (token, lowercase) {
|
||
addFormatToken(token, 0, 0, function () {
|
||
return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
|
||
});
|
||
}
|
||
|
||
meridiem('a', true);
|
||
meridiem('A', false);
|
||
|
||
// ALIASES
|
||
|
||
addUnitAlias('hour', 'h');
|
||
|
||
// PARSING
|
||
|
||
function matchMeridiem (isStrict, locale) {
|
||
return locale._meridiemParse;
|
||
}
|
||
|
||
addRegexToken('a', matchMeridiem);
|
||
addRegexToken('A', matchMeridiem);
|
||
addRegexToken('H', match1to2);
|
||
addRegexToken('h', match1to2);
|
||
addRegexToken('HH', match1to2, match2);
|
||
addRegexToken('hh', match1to2, match2);
|
||
|
||
addParseToken(['H', 'HH'], HOUR);
|
||
addParseToken(['a', 'A'], function (input, array, config) {
|
||
config._isPm = config._locale.isPM(input);
|
||
config._meridiem = input;
|
||
});
|
||
addParseToken(['h', 'hh'], function (input, array, config) {
|
||
array[HOUR] = toInt(input);
|
||
getParsingFlags(config).bigHour = true;
|
||
});
|
||
|
||
// LOCALES
|
||
|
||
function localeIsPM (input) {
|
||
// IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
|
||
// Using charAt should be more compatible.
|
||
return ((input + '').toLowerCase().charAt(0) === 'p');
|
||
}
|
||
|
||
var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
|
||
function localeMeridiem (hours, minutes, isLower) {
|
||
if (hours > 11) {
|
||
return isLower ? 'pm' : 'PM';
|
||
} else {
|
||
return isLower ? 'am' : 'AM';
|
||
}
|
||
}
|
||
|
||
|
||
// MOMENTS
|
||
|
||
// Setting the hour should keep the time, because the user explicitly
|
||
// specified which hour he wants. So trying to maintain the same hour (in
|
||
// a new timezone) makes sense. Adding/subtracting hours does not follow
|
||
// this rule.
|
||
var getSetHour = makeGetSet('Hours', true);
|
||
|
||
addFormatToken('m', ['mm', 2], 0, 'minute');
|
||
|
||
// ALIASES
|
||
|
||
addUnitAlias('minute', 'm');
|
||
|
||
// PARSING
|
||
|
||
addRegexToken('m', match1to2);
|
||
addRegexToken('mm', match1to2, match2);
|
||
addParseToken(['m', 'mm'], MINUTE);
|
||
|
||
// MOMENTS
|
||
|
||
var getSetMinute = makeGetSet('Minutes', false);
|
||
|
||
addFormatToken('s', ['ss', 2], 0, 'second');
|
||
|
||
// ALIASES
|
||
|
||
addUnitAlias('second', 's');
|
||
|
||
// PARSING
|
||
|
||
addRegexToken('s', match1to2);
|
||
addRegexToken('ss', match1to2, match2);
|
||
addParseToken(['s', 'ss'], SECOND);
|
||
|
||
// MOMENTS
|
||
|
||
var getSetSecond = makeGetSet('Seconds', false);
|
||
|
||
addFormatToken('S', 0, 0, function () {
|
||
return ~~(this.millisecond() / 100);
|
||
});
|
||
|
||
addFormatToken(0, ['SS', 2], 0, function () {
|
||
return ~~(this.millisecond() / 10);
|
||
});
|
||
|
||
function millisecond__milliseconds (token) {
|
||
addFormatToken(0, [token, 3], 0, 'millisecond');
|
||
}
|
||
|
||
millisecond__milliseconds('SSS');
|
||
millisecond__milliseconds('SSSS');
|
||
|
||
// ALIASES
|
||
|
||
addUnitAlias('millisecond', 'ms');
|
||
|
||
// PARSING
|
||
|
||
addRegexToken('S', match1to3, match1);
|
||
addRegexToken('SS', match1to3, match2);
|
||
addRegexToken('SSS', match1to3, match3);
|
||
addRegexToken('SSSS', matchUnsigned);
|
||
addParseToken(['S', 'SS', 'SSS', 'SSSS'], function (input, array) {
|
||
array[MILLISECOND] = toInt(('0.' + input) * 1000);
|
||
});
|
||
|
||
// MOMENTS
|
||
|
||
var getSetMillisecond = makeGetSet('Milliseconds', false);
|
||
|
||
addFormatToken('z', 0, 0, 'zoneAbbr');
|
||
addFormatToken('zz', 0, 0, 'zoneName');
|
||
|
||
// MOMENTS
|
||
|
||
function getZoneAbbr () {
|
||
return this._isUTC ? 'UTC' : '';
|
||
}
|
||
|
||
function getZoneName () {
|
||
return this._isUTC ? 'Coordinated Universal Time' : '';
|
||
}
|
||
|
||
var momentPrototype__proto = Moment.prototype;
|
||
|
||
momentPrototype__proto.add = add_subtract__add;
|
||
momentPrototype__proto.calendar = moment_calendar__calendar;
|
||
momentPrototype__proto.clone = clone;
|
||
momentPrototype__proto.diff = diff;
|
||
momentPrototype__proto.endOf = endOf;
|
||
momentPrototype__proto.format = format;
|
||
momentPrototype__proto.from = from;
|
||
momentPrototype__proto.fromNow = fromNow;
|
||
momentPrototype__proto.to = to;
|
||
momentPrototype__proto.toNow = toNow;
|
||
momentPrototype__proto.get = getSet;
|
||
momentPrototype__proto.invalidAt = invalidAt;
|
||
momentPrototype__proto.isAfter = isAfter;
|
||
momentPrototype__proto.isBefore = isBefore;
|
||
momentPrototype__proto.isBetween = isBetween;
|
||
momentPrototype__proto.isSame = isSame;
|
||
momentPrototype__proto.isValid = moment_valid__isValid;
|
||
momentPrototype__proto.lang = lang;
|
||
momentPrototype__proto.locale = locale;
|
||
momentPrototype__proto.localeData = localeData;
|
||
momentPrototype__proto.max = prototypeMax;
|
||
momentPrototype__proto.min = prototypeMin;
|
||
momentPrototype__proto.parsingFlags = parsingFlags;
|
||
momentPrototype__proto.set = getSet;
|
||
momentPrototype__proto.startOf = startOf;
|
||
momentPrototype__proto.subtract = add_subtract__subtract;
|
||
momentPrototype__proto.toArray = toArray;
|
||
momentPrototype__proto.toDate = toDate;
|
||
momentPrototype__proto.toISOString = moment_format__toISOString;
|
||
momentPrototype__proto.toJSON = moment_format__toISOString;
|
||
momentPrototype__proto.toString = toString;
|
||
momentPrototype__proto.unix = unix;
|
||
momentPrototype__proto.valueOf = to_type__valueOf;
|
||
|
||
// Year
|
||
momentPrototype__proto.year = getSetYear;
|
||
momentPrototype__proto.isLeapYear = getIsLeapYear;
|
||
|
||
// Week Year
|
||
momentPrototype__proto.weekYear = getSetWeekYear;
|
||
momentPrototype__proto.isoWeekYear = getSetISOWeekYear;
|
||
|
||
// Quarter
|
||
momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter;
|
||
|
||
// Month
|
||
momentPrototype__proto.month = getSetMonth;
|
||
momentPrototype__proto.daysInMonth = getDaysInMonth;
|
||
|
||
// Week
|
||
momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek;
|
||
momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek;
|
||
momentPrototype__proto.weeksInYear = getWeeksInYear;
|
||
momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear;
|
||
|
||
// Day
|
||
momentPrototype__proto.date = getSetDayOfMonth;
|
||
momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek;
|
||
momentPrototype__proto.weekday = getSetLocaleDayOfWeek;
|
||
momentPrototype__proto.isoWeekday = getSetISODayOfWeek;
|
||
momentPrototype__proto.dayOfYear = getSetDayOfYear;
|
||
|
||
// Hour
|
||
momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour;
|
||
|
||
// Minute
|
||
momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute;
|
||
|
||
// Second
|
||
momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond;
|
||
|
||
// Millisecond
|
||
momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond;
|
||
|
||
// Offset
|
||
momentPrototype__proto.utcOffset = getSetOffset;
|
||
momentPrototype__proto.utc = setOffsetToUTC;
|
||
momentPrototype__proto.local = setOffsetToLocal;
|
||
momentPrototype__proto.parseZone = setOffsetToParsedOffset;
|
||
momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset;
|
||
momentPrototype__proto.isDST = isDaylightSavingTime;
|
||
momentPrototype__proto.isDSTShifted = isDaylightSavingTimeShifted;
|
||
momentPrototype__proto.isLocal = isLocal;
|
||
momentPrototype__proto.isUtcOffset = isUtcOffset;
|
||
momentPrototype__proto.isUtc = isUtc;
|
||
momentPrototype__proto.isUTC = isUtc;
|
||
|
||
// Timezone
|
||
momentPrototype__proto.zoneAbbr = getZoneAbbr;
|
||
momentPrototype__proto.zoneName = getZoneName;
|
||
|
||
// Deprecations
|
||
momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
|
||
momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
|
||
momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
|
||
momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone);
|
||
|
||
var momentPrototype = momentPrototype__proto;
|
||
|
||
function moment__createUnix (input) {
|
||
return local__createLocal(input * 1000);
|
||
}
|
||
|
||
function moment__createInZone () {
|
||
return local__createLocal.apply(null, arguments).parseZone();
|
||
}
|
||
|
||
var defaultCalendar = {
|
||
sameDay : '[Today at] LT',
|
||
nextDay : '[Tomorrow at] LT',
|
||
nextWeek : 'dddd [at] LT',
|
||
lastDay : '[Yesterday at] LT',
|
||
lastWeek : '[Last] dddd [at] LT',
|
||
sameElse : 'L'
|
||
};
|
||
|
||
function locale_calendar__calendar (key, mom, now) {
|
||
var output = this._calendar[key];
|
||
return typeof output === 'function' ? output.call(mom, now) : output;
|
||
}
|
||
|
||
var defaultLongDateFormat = {
|
||
LTS : 'h:mm:ss A',
|
||
LT : 'h:mm A',
|
||
L : 'MM/DD/YYYY',
|
||
LL : 'MMMM D, YYYY',
|
||
LLL : 'MMMM D, YYYY LT',
|
||
LLLL : 'dddd, MMMM D, YYYY LT'
|
||
};
|
||
|
||
function longDateFormat (key) {
|
||
var output = this._longDateFormat[key];
|
||
if (!output && this._longDateFormat[key.toUpperCase()]) {
|
||
output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) {
|
||
return val.slice(1);
|
||
});
|
||
this._longDateFormat[key] = output;
|
||
}
|
||
return output;
|
||
}
|
||
|
||
var defaultInvalidDate = 'Invalid date';
|
||
|
||
function invalidDate () {
|
||
return this._invalidDate;
|
||
}
|
||
|
||
var defaultOrdinal = '%d';
|
||
var defaultOrdinalParse = /\d{1,2}/;
|
||
|
||
function ordinal (number) {
|
||
return this._ordinal.replace('%d', number);
|
||
}
|
||
|
||
function preParsePostFormat (string) {
|
||
return string;
|
||
}
|
||
|
||
var defaultRelativeTime = {
|
||
future : 'in %s',
|
||
past : '%s ago',
|
||
s : 'a few seconds',
|
||
m : 'a minute',
|
||
mm : '%d minutes',
|
||
h : 'an hour',
|
||
hh : '%d hours',
|
||
d : 'a day',
|
||
dd : '%d days',
|
||
M : 'a month',
|
||
MM : '%d months',
|
||
y : 'a year',
|
||
yy : '%d years'
|
||
};
|
||
|
||
function relative__relativeTime (number, withoutSuffix, string, isFuture) {
|
||
var output = this._relativeTime[string];
|
||
return (typeof output === 'function') ?
|
||
output(number, withoutSuffix, string, isFuture) :
|
||
output.replace(/%d/i, number);
|
||
}
|
||
|
||
function pastFuture (diff, output) {
|
||
var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
|
||
return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
|
||
}
|
||
|
||
function locale_set__set (config) {
|
||
var prop, i;
|
||
for (i in config) {
|
||
prop = config[i];
|
||
if (typeof prop === 'function') {
|
||
this[i] = prop;
|
||
} else {
|
||
this['_' + i] = prop;
|
||
}
|
||
}
|
||
// Lenient ordinal parsing accepts just a number in addition to
|
||
// number + (possibly) stuff coming from _ordinalParseLenient.
|
||
this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
|
||
}
|
||
|
||
var prototype__proto = Locale.prototype;
|
||
|
||
prototype__proto._calendar = defaultCalendar;
|
||
prototype__proto.calendar = locale_calendar__calendar;
|
||
prototype__proto._longDateFormat = defaultLongDateFormat;
|
||
prototype__proto.longDateFormat = longDateFormat;
|
||
prototype__proto._invalidDate = defaultInvalidDate;
|
||
prototype__proto.invalidDate = invalidDate;
|
||
prototype__proto._ordinal = defaultOrdinal;
|
||
prototype__proto.ordinal = ordinal;
|
||
prototype__proto._ordinalParse = defaultOrdinalParse;
|
||
prototype__proto.preparse = preParsePostFormat;
|
||
prototype__proto.postformat = preParsePostFormat;
|
||
prototype__proto._relativeTime = defaultRelativeTime;
|
||
prototype__proto.relativeTime = relative__relativeTime;
|
||
prototype__proto.pastFuture = pastFuture;
|
||
prototype__proto.set = locale_set__set;
|
||
|
||
// Month
|
||
prototype__proto.months = localeMonths;
|
||
prototype__proto._months = defaultLocaleMonths;
|
||
prototype__proto.monthsShort = localeMonthsShort;
|
||
prototype__proto._monthsShort = defaultLocaleMonthsShort;
|
||
prototype__proto.monthsParse = localeMonthsParse;
|
||
|
||
// Week
|
||
prototype__proto.week = localeWeek;
|
||
prototype__proto._week = defaultLocaleWeek;
|
||
prototype__proto.firstDayOfYear = localeFirstDayOfYear;
|
||
prototype__proto.firstDayOfWeek = localeFirstDayOfWeek;
|
||
|
||
// Day of Week
|
||
prototype__proto.weekdays = localeWeekdays;
|
||
prototype__proto._weekdays = defaultLocaleWeekdays;
|
||
prototype__proto.weekdaysMin = localeWeekdaysMin;
|
||
prototype__proto._weekdaysMin = defaultLocaleWeekdaysMin;
|
||
prototype__proto.weekdaysShort = localeWeekdaysShort;
|
||
prototype__proto._weekdaysShort = defaultLocaleWeekdaysShort;
|
||
prototype__proto.weekdaysParse = localeWeekdaysParse;
|
||
|
||
// Hours
|
||
prototype__proto.isPM = localeIsPM;
|
||
prototype__proto._meridiemParse = defaultLocaleMeridiemParse;
|
||
prototype__proto.meridiem = localeMeridiem;
|
||
|
||
function lists__get (format, index, field, setter) {
|
||
var locale = locale_locales__getLocale();
|
||
var utc = create_utc__createUTC().set(setter, index);
|
||
return locale[field](utc, format);
|
||
}
|
||
|
||
function list (format, index, field, count, setter) {
|
||
if (typeof format === 'number') {
|
||
index = format;
|
||
format = undefined;
|
||
}
|
||
|
||
format = format || '';
|
||
|
||
if (index != null) {
|
||
return lists__get(format, index, field, setter);
|
||
}
|
||
|
||
var i;
|
||
var out = [];
|
||
for (i = 0; i < count; i++) {
|
||
out[i] = lists__get(format, i, field, setter);
|
||
}
|
||
return out;
|
||
}
|
||
|
||
function lists__listMonths (format, index) {
|
||
return list(format, index, 'months', 12, 'month');
|
||
}
|
||
|
||
function lists__listMonthsShort (format, index) {
|
||
return list(format, index, 'monthsShort', 12, 'month');
|
||
}
|
||
|
||
function lists__listWeekdays (format, index) {
|
||
return list(format, index, 'weekdays', 7, 'day');
|
||
}
|
||
|
||
function lists__listWeekdaysShort (format, index) {
|
||
return list(format, index, 'weekdaysShort', 7, 'day');
|
||
}
|
||
|
||
function lists__listWeekdaysMin (format, index) {
|
||
return list(format, index, 'weekdaysMin', 7, 'day');
|
||
}
|
||
|
||
locale_locales__getSetGlobalLocale('en', {
|
||
ordinalParse: /\d{1,2}(th|st|nd|rd)/,
|
||
ordinal : function (number) {
|
||
var b = number % 10,
|
||
output = (toInt(number % 100 / 10) === 1) ? 'th' :
|
||
(b === 1) ? 'st' :
|
||
(b === 2) ? 'nd' :
|
||
(b === 3) ? 'rd' : 'th';
|
||
return number + output;
|
||
}
|
||
});
|
||
|
||
// Side effect imports
|
||
utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale);
|
||
utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale);
|
||
|
||
var mathAbs = Math.abs;
|
||
|
||
function duration_abs__abs () {
|
||
var data = this._data;
|
||
|
||
this._milliseconds = mathAbs(this._milliseconds);
|
||
this._days = mathAbs(this._days);
|
||
this._months = mathAbs(this._months);
|
||
|
||
data.milliseconds = mathAbs(data.milliseconds);
|
||
data.seconds = mathAbs(data.seconds);
|
||
data.minutes = mathAbs(data.minutes);
|
||
data.hours = mathAbs(data.hours);
|
||
data.months = mathAbs(data.months);
|
||
data.years = mathAbs(data.years);
|
||
|
||
return this;
|
||
}
|
||
|
||
function duration_add_subtract__addSubtract (duration, input, value, direction) {
|
||
var other = create__createDuration(input, value);
|
||
|
||
duration._milliseconds += direction * other._milliseconds;
|
||
duration._days += direction * other._days;
|
||
duration._months += direction * other._months;
|
||
|
||
return duration._bubble();
|
||
}
|
||
|
||
// supports only 2.0-style add(1, 's') or add(duration)
|
||
function duration_add_subtract__add (input, value) {
|
||
return duration_add_subtract__addSubtract(this, input, value, 1);
|
||
}
|
||
|
||
// supports only 2.0-style subtract(1, 's') or subtract(duration)
|
||
function duration_add_subtract__subtract (input, value) {
|
||
return duration_add_subtract__addSubtract(this, input, value, -1);
|
||
}
|
||
|
||
function bubble () {
|
||
var milliseconds = this._milliseconds;
|
||
var days = this._days;
|
||
var months = this._months;
|
||
var data = this._data;
|
||
var seconds, minutes, hours, years = 0;
|
||
|
||
// The following code bubbles up values, see the tests for
|
||
// examples of what that means.
|
||
data.milliseconds = milliseconds % 1000;
|
||
|
||
seconds = absFloor(milliseconds / 1000);
|
||
data.seconds = seconds % 60;
|
||
|
||
minutes = absFloor(seconds / 60);
|
||
data.minutes = minutes % 60;
|
||
|
||
hours = absFloor(minutes / 60);
|
||
data.hours = hours % 24;
|
||
|
||
days += absFloor(hours / 24);
|
||
|
||
// Accurately convert days to years, assume start from year 0.
|
||
years = absFloor(daysToYears(days));
|
||
days -= absFloor(yearsToDays(years));
|
||
|
||
// 30 days to a month
|
||
// TODO (iskren): Use anchor date (like 1st Jan) to compute this.
|
||
months += absFloor(days / 30);
|
||
days %= 30;
|
||
|
||
// 12 months -> 1 year
|
||
years += absFloor(months / 12);
|
||
months %= 12;
|
||
|
||
data.days = days;
|
||
data.months = months;
|
||
data.years = years;
|
||
|
||
return this;
|
||
}
|
||
|
||
function daysToYears (days) {
|
||
// 400 years have 146097 days (taking into account leap year rules)
|
||
return days * 400 / 146097;
|
||
}
|
||
|
||
function yearsToDays (years) {
|
||
// years * 365 + absFloor(years / 4) -
|
||
// absFloor(years / 100) + absFloor(years / 400);
|
||
return years * 146097 / 400;
|
||
}
|
||
|
||
function as (units) {
|
||
var days;
|
||
var months;
|
||
var milliseconds = this._milliseconds;
|
||
|
||
units = normalizeUnits(units);
|
||
|
||
if (units === 'month' || units === 'year') {
|
||
days = this._days + milliseconds / 864e5;
|
||
months = this._months + daysToYears(days) * 12;
|
||
return units === 'month' ? months : months / 12;
|
||
} else {
|
||
// handle milliseconds separately because of floating point math errors (issue #1867)
|
||
days = this._days + Math.round(yearsToDays(this._months / 12));
|
||
switch (units) {
|
||
case 'week' : return days / 7 + milliseconds / 6048e5;
|
||
case 'day' : return days + milliseconds / 864e5;
|
||
case 'hour' : return days * 24 + milliseconds / 36e5;
|
||
case 'minute' : return days * 1440 + milliseconds / 6e4;
|
||
case 'second' : return days * 86400 + milliseconds / 1000;
|
||
// Math.floor prevents floating point math errors here
|
||
case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
|
||
default: throw new Error('Unknown unit ' + units);
|
||
}
|
||
}
|
||
}
|
||
|
||
// TODO: Use this.as('ms')?
|
||
function duration_as__valueOf () {
|
||
return (
|
||
this._milliseconds +
|
||
this._days * 864e5 +
|
||
(this._months % 12) * 2592e6 +
|
||
toInt(this._months / 12) * 31536e6
|
||
);
|
||
}
|
||
|
||
function makeAs (alias) {
|
||
return function () {
|
||
return this.as(alias);
|
||
};
|
||
}
|
||
|
||
var asMilliseconds = makeAs('ms');
|
||
var asSeconds = makeAs('s');
|
||
var asMinutes = makeAs('m');
|
||
var asHours = makeAs('h');
|
||
var asDays = makeAs('d');
|
||
var asWeeks = makeAs('w');
|
||
var asMonths = makeAs('M');
|
||
var asYears = makeAs('y');
|
||
|
||
function duration_get__get (units) {
|
||
units = normalizeUnits(units);
|
||
return this[units + 's']();
|
||
}
|
||
|
||
function makeGetter(name) {
|
||
return function () {
|
||
return this._data[name];
|
||
};
|
||
}
|
||
|
||
var duration_get__milliseconds = makeGetter('milliseconds');
|
||
var seconds = makeGetter('seconds');
|
||
var minutes = makeGetter('minutes');
|
||
var hours = makeGetter('hours');
|
||
var days = makeGetter('days');
|
||
var months = makeGetter('months');
|
||
var years = makeGetter('years');
|
||
|
||
function weeks () {
|
||
return absFloor(this.days() / 7);
|
||
}
|
||
|
||
var round = Math.round;
|
||
var thresholds = {
|
||
s: 45, // seconds to minute
|
||
m: 45, // minutes to hour
|
||
h: 22, // hours to day
|
||
d: 26, // days to month
|
||
M: 11 // months to year
|
||
};
|
||
|
||
// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
|
||
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
|
||
return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
|
||
}
|
||
|
||
function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) {
|
||
var duration = create__createDuration(posNegDuration).abs();
|
||
var seconds = round(duration.as('s'));
|
||
var minutes = round(duration.as('m'));
|
||
var hours = round(duration.as('h'));
|
||
var days = round(duration.as('d'));
|
||
var months = round(duration.as('M'));
|
||
var years = round(duration.as('y'));
|
||
|
||
var a = seconds < thresholds.s && ['s', seconds] ||
|
||
minutes === 1 && ['m'] ||
|
||
minutes < thresholds.m && ['mm', minutes] ||
|
||
hours === 1 && ['h'] ||
|
||
hours < thresholds.h && ['hh', hours] ||
|
||
days === 1 && ['d'] ||
|
||
days < thresholds.d && ['dd', days] ||
|
||
months === 1 && ['M'] ||
|
||
months < thresholds.M && ['MM', months] ||
|
||
years === 1 && ['y'] || ['yy', years];
|
||
|
||
a[2] = withoutSuffix;
|
||
a[3] = +posNegDuration > 0;
|
||
a[4] = locale;
|
||
return substituteTimeAgo.apply(null, a);
|
||
}
|
||
|
||
// This function allows you to set a threshold for relative time strings
|
||
function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) {
|
||
if (thresholds[threshold] === undefined) {
|
||
return false;
|
||
}
|
||
if (limit === undefined) {
|
||
return thresholds[threshold];
|
||
}
|
||
thresholds[threshold] = limit;
|
||
return true;
|
||
}
|
||
|
||
function humanize (withSuffix) {
|
||
var locale = this.localeData();
|
||
var output = duration_humanize__relativeTime(this, !withSuffix, locale);
|
||
|
||
if (withSuffix) {
|
||
output = locale.pastFuture(+this, output);
|
||
}
|
||
|
||
return locale.postformat(output);
|
||
}
|
||
|
||
var iso_string__abs = Math.abs;
|
||
|
||
function iso_string__toISOString() {
|
||
// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
|
||
var Y = iso_string__abs(this.years());
|
||
var M = iso_string__abs(this.months());
|
||
var D = iso_string__abs(this.days());
|
||
var h = iso_string__abs(this.hours());
|
||
var m = iso_string__abs(this.minutes());
|
||
var s = iso_string__abs(this.seconds() + this.milliseconds() / 1000);
|
||
var total = this.asSeconds();
|
||
|
||
if (!total) {
|
||
// this is the same as C#'s (Noda) and python (isodate)...
|
||
// but not other JS (goog.date)
|
||
return 'P0D';
|
||
}
|
||
|
||
return (total < 0 ? '-' : '') +
|
||
'P' +
|
||
(Y ? Y + 'Y' : '') +
|
||
(M ? M + 'M' : '') +
|
||
(D ? D + 'D' : '') +
|
||
((h || m || s) ? 'T' : '') +
|
||
(h ? h + 'H' : '') +
|
||
(m ? m + 'M' : '') +
|
||
(s ? s + 'S' : '');
|
||
}
|
||
|
||
var duration_prototype__proto = Duration.prototype;
|
||
|
||
duration_prototype__proto.abs = duration_abs__abs;
|
||
duration_prototype__proto.add = duration_add_subtract__add;
|
||
duration_prototype__proto.subtract = duration_add_subtract__subtract;
|
||
duration_prototype__proto.as = as;
|
||
duration_prototype__proto.asMilliseconds = asMilliseconds;
|
||
duration_prototype__proto.asSeconds = asSeconds;
|
||
duration_prototype__proto.asMinutes = asMinutes;
|
||
duration_prototype__proto.asHours = asHours;
|
||
duration_prototype__proto.asDays = asDays;
|
||
duration_prototype__proto.asWeeks = asWeeks;
|
||
duration_prototype__proto.asMonths = asMonths;
|
||
duration_prototype__proto.asYears = asYears;
|
||
duration_prototype__proto.valueOf = duration_as__valueOf;
|
||
duration_prototype__proto._bubble = bubble;
|
||
duration_prototype__proto.get = duration_get__get;
|
||
duration_prototype__proto.milliseconds = duration_get__milliseconds;
|
||
duration_prototype__proto.seconds = seconds;
|
||
duration_prototype__proto.minutes = minutes;
|
||
duration_prototype__proto.hours = hours;
|
||
duration_prototype__proto.days = days;
|
||
duration_prototype__proto.weeks = weeks;
|
||
duration_prototype__proto.months = months;
|
||
duration_prototype__proto.years = years;
|
||
duration_prototype__proto.humanize = humanize;
|
||
duration_prototype__proto.toISOString = iso_string__toISOString;
|
||
duration_prototype__proto.toString = iso_string__toISOString;
|
||
duration_prototype__proto.toJSON = iso_string__toISOString;
|
||
duration_prototype__proto.locale = locale;
|
||
duration_prototype__proto.localeData = localeData;
|
||
|
||
// Deprecations
|
||
duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString);
|
||
duration_prototype__proto.lang = lang;
|
||
|
||
// Side effect imports
|
||
|
||
addFormatToken('X', 0, 0, 'unix');
|
||
addFormatToken('x', 0, 0, 'valueOf');
|
||
|
||
// PARSING
|
||
|
||
addRegexToken('x', matchSigned);
|
||
addRegexToken('X', matchTimestamp);
|
||
addParseToken('X', function (input, array, config) {
|
||
config._d = new Date(parseFloat(input, 10) * 1000);
|
||
});
|
||
addParseToken('x', function (input, array, config) {
|
||
config._d = new Date(toInt(input));
|
||
});
|
||
|
||
// Side effect imports
|
||
|
||
|
||
utils_hooks__hooks.version = '2.10.3';
|
||
|
||
setHookCallback(local__createLocal);
|
||
|
||
utils_hooks__hooks.fn = momentPrototype;
|
||
utils_hooks__hooks.min = min;
|
||
utils_hooks__hooks.max = max;
|
||
utils_hooks__hooks.utc = create_utc__createUTC;
|
||
utils_hooks__hooks.unix = moment__createUnix;
|
||
utils_hooks__hooks.months = lists__listMonths;
|
||
utils_hooks__hooks.isDate = isDate;
|
||
utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale;
|
||
utils_hooks__hooks.invalid = valid__createInvalid;
|
||
utils_hooks__hooks.duration = create__createDuration;
|
||
utils_hooks__hooks.isMoment = isMoment;
|
||
utils_hooks__hooks.weekdays = lists__listWeekdays;
|
||
utils_hooks__hooks.parseZone = moment__createInZone;
|
||
utils_hooks__hooks.localeData = locale_locales__getLocale;
|
||
utils_hooks__hooks.isDuration = isDuration;
|
||
utils_hooks__hooks.monthsShort = lists__listMonthsShort;
|
||
utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin;
|
||
utils_hooks__hooks.defineLocale = defineLocale;
|
||
utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort;
|
||
utils_hooks__hooks.normalizeUnits = normalizeUnits;
|
||
utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold;
|
||
|
||
var _moment = utils_hooks__hooks;
|
||
|
||
return _moment;
|
||
|
||
}));</script>
|
||
|
||
<script>
|
||
window.hass.uiUtil.formatTime = function(dateObj) {
|
||
return moment(dateObj).format('LT');
|
||
};
|
||
|
||
window.hass.uiUtil.formatDateTime = function(dateObj) {
|
||
return moment(dateObj).format('lll');
|
||
};
|
||
|
||
window.hass.uiUtil.formatDate = function(dateObj) {
|
||
return moment(dateObj).format('ll');
|
||
};
|
||
|
||
</script>
|
||
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
// monostate data
|
||
var metaDatas = {};
|
||
var metaArrays = {};
|
||
|
||
Polymer.IronMeta = Polymer({
|
||
|
||
is: 'iron-meta',
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The type of meta-data. All meta-data of the same type is stored
|
||
* together.
|
||
*
|
||
* @attribute type
|
||
* @type String
|
||
* @default 'default'
|
||
*/
|
||
type: {
|
||
type: String,
|
||
value: 'default',
|
||
observer: '_typeChanged'
|
||
},
|
||
|
||
/**
|
||
* The key used to store `value` under the `type` namespace.
|
||
*
|
||
* @attribute key
|
||
* @type String
|
||
* @default ''
|
||
*/
|
||
key: {
|
||
type: String,
|
||
observer: '_keyChanged'
|
||
},
|
||
|
||
/**
|
||
* The meta-data to store or retrieve.
|
||
*
|
||
* @attribute value
|
||
* @type *
|
||
* @default this
|
||
*/
|
||
value: {
|
||
type: Object,
|
||
notify: true,
|
||
observer: '_valueChanged'
|
||
},
|
||
|
||
/**
|
||
* If true, `value` is set to the iron-meta instance itself.
|
||
*
|
||
* @attribute self
|
||
* @type Boolean
|
||
* @default false
|
||
*/
|
||
self: {
|
||
type: Boolean,
|
||
observer: '_selfChanged'
|
||
},
|
||
|
||
/**
|
||
* Array of all meta-data values for the given type.
|
||
*
|
||
* @property list
|
||
* @type Array
|
||
*/
|
||
list: {
|
||
type: Array,
|
||
notify: true
|
||
}
|
||
|
||
},
|
||
|
||
/**
|
||
* Only runs if someone invokes the factory/constructor directly
|
||
* e.g. `new Polymer.IronMeta()`
|
||
*/
|
||
factoryImpl: function(config) {
|
||
if (config) {
|
||
for (var n in config) {
|
||
switch(n) {
|
||
case 'type':
|
||
case 'key':
|
||
case 'value':
|
||
this[n] = config[n];
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
created: function() {
|
||
// TODO(sjmiles): good for debugging?
|
||
this._metaDatas = metaDatas;
|
||
this._metaArrays = metaArrays;
|
||
},
|
||
|
||
_keyChanged: function(key, old) {
|
||
this._resetRegistration(old);
|
||
},
|
||
|
||
_valueChanged: function(value) {
|
||
this._resetRegistration(this.key);
|
||
},
|
||
|
||
_selfChanged: function(self) {
|
||
if (self) {
|
||
this.value = this;
|
||
}
|
||
},
|
||
|
||
_typeChanged: function(type) {
|
||
this._unregisterKey(this.key);
|
||
if (!metaDatas[type]) {
|
||
metaDatas[type] = {};
|
||
}
|
||
this._metaData = metaDatas[type];
|
||
if (!metaArrays[type]) {
|
||
metaArrays[type] = [];
|
||
}
|
||
this.list = metaArrays[type];
|
||
this._registerKeyValue(this.key, this.value);
|
||
},
|
||
|
||
/**
|
||
* Retrieves meta data value by key.
|
||
*
|
||
* @method byKey
|
||
* @param {String} key The key of the meta-data to be returned.
|
||
* @returns *
|
||
*/
|
||
byKey: function(key) {
|
||
return this._metaData && this._metaData[key];
|
||
},
|
||
|
||
_resetRegistration: function(oldKey) {
|
||
this._unregisterKey(oldKey);
|
||
this._registerKeyValue(this.key, this.value);
|
||
},
|
||
|
||
_unregisterKey: function(key) {
|
||
this._unregister(key, this._metaData, this.list);
|
||
},
|
||
|
||
_registerKeyValue: function(key, value) {
|
||
this._register(key, value, this._metaData, this.list);
|
||
},
|
||
|
||
_register: function(key, value, data, list) {
|
||
if (key && data && value !== undefined) {
|
||
data[key] = value;
|
||
list.push(value);
|
||
}
|
||
},
|
||
|
||
_unregister: function(key, data, list) {
|
||
if (key && data) {
|
||
if (key in data) {
|
||
var value = data[key];
|
||
delete data[key];
|
||
this.arrayDelete(list, value);
|
||
}
|
||
}
|
||
}
|
||
|
||
});
|
||
|
||
/**
|
||
`iron-meta-query` can be used to access infomation stored in `iron-meta`.
|
||
|
||
Examples:
|
||
|
||
If I create an instance like this:
|
||
|
||
<iron-meta key="info" value="foo/bar"></iron-meta>
|
||
|
||
Note that keyUrl="foo/bar" is the metadata I've defined. I could define more
|
||
attributes or use child nodes to define additional metadata.
|
||
|
||
Now I can access that element (and it's metadata) from any `iron-meta-query` instance:
|
||
|
||
var value = new Polymer.IronMetaQuery({key: 'info'}).value;
|
||
|
||
@group Polymer Iron Elements
|
||
@element iron-meta-query
|
||
*/
|
||
Polymer.IronMetaQuery = Polymer({
|
||
|
||
is: 'iron-meta-query',
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The type of meta-data. All meta-data of the same type is stored
|
||
* together.
|
||
*
|
||
* @attribute type
|
||
* @type String
|
||
* @default 'default'
|
||
*/
|
||
type: {
|
||
type: String,
|
||
value: 'default',
|
||
observer: '_typeChanged'
|
||
},
|
||
|
||
/**
|
||
* Specifies a key to use for retrieving `value` from the `type`
|
||
* namespace.
|
||
*
|
||
* @attribute key
|
||
* @type String
|
||
*/
|
||
key: {
|
||
type: String,
|
||
observer: '_keyChanged'
|
||
},
|
||
|
||
/**
|
||
* The meta-data to store or retrieve.
|
||
*
|
||
* @attribute value
|
||
* @type *
|
||
* @default this
|
||
*/
|
||
value: {
|
||
type: Object,
|
||
notify: true,
|
||
readOnly: true
|
||
},
|
||
|
||
/**
|
||
* Array of all meta-data values for the given type.
|
||
*
|
||
* @property list
|
||
* @type Array
|
||
*/
|
||
list: {
|
||
type: Array,
|
||
notify: true
|
||
}
|
||
|
||
},
|
||
|
||
/**
|
||
* Actually a factory method, not a true constructor. Only runs if
|
||
* someone invokes it directly (via `new Polymer.IronMeta()`);
|
||
*/
|
||
constructor: function(config) {
|
||
if (config) {
|
||
for (var n in config) {
|
||
switch(n) {
|
||
case 'type':
|
||
case 'key':
|
||
this[n] = config[n];
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
created: function() {
|
||
// TODO(sjmiles): good for debugging?
|
||
this._metaDatas = metaDatas;
|
||
this._metaArrays = metaArrays;
|
||
},
|
||
|
||
_keyChanged: function(key) {
|
||
this._setValue(this._metaData && this._metaData[key]);
|
||
},
|
||
|
||
_typeChanged: function(type) {
|
||
this._metaData = metaDatas[type];
|
||
this.list = metaArrays[type];
|
||
if (this.key) {
|
||
this._keyChanged(this.key);
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Retrieves meta data value by key.
|
||
*
|
||
* @method byKey
|
||
* @param {String} key The key of the meta-data to be returned.
|
||
* @returns *
|
||
*/
|
||
byKey: function(key) {
|
||
return this._metaData && this._metaData[key];
|
||
}
|
||
|
||
});
|
||
|
||
})();
|
||
</script>
|
||
<script>
|
||
/**
|
||
* The `iron-iconset-svg` element allows users to define their own icon sets
|
||
* that contain svg icons. The svg icon elements should be children of the
|
||
* `iron-iconset-svg` element. Multiple icons should be given distinct id's.
|
||
*
|
||
* Using svg elements to create icons has a few advantages over traditional
|
||
* bitmap graphics like jpg or png. Icons that use svg are vector based so they
|
||
* are resolution independent and should look good on any device. They are
|
||
* stylable via css. Icons can be themed, colorized, and even animated.
|
||
*
|
||
* Example:
|
||
*
|
||
* <iron-iconset-svg id="my-svg-icons" iconSize="24">
|
||
* <svg>
|
||
* <defs>
|
||
* <g id="shape">
|
||
* <rect x="50" y="50" width="50" height="50" />
|
||
* <circle cx="50" cy="50" r="50" />
|
||
* </g>
|
||
* </defs>
|
||
* </svg>
|
||
* </iron-iconset-svg>
|
||
*
|
||
* This will automatically register the icon set "my-svg-icons" to the iconset
|
||
* database. To use these icons from within another element, make a
|
||
* `iron-iconset` element and call the `byId` method
|
||
* to retrieve a given iconset. To apply a particular icon inside an
|
||
* element use the `applyIcon` method. For example:
|
||
*
|
||
* iconset.applyIcon(iconNode, 'car');
|
||
*
|
||
* @element iron-iconset-svg
|
||
* @demo demo/index.html
|
||
*/
|
||
Polymer({
|
||
|
||
is: 'iron-iconset-svg',
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The name of the iconset.
|
||
*
|
||
* @attribute name
|
||
* @type string
|
||
*/
|
||
name: {
|
||
type: String,
|
||
observer: '_nameChanged'
|
||
},
|
||
|
||
/**
|
||
* The size of an individual icon. Note that icons must be square.
|
||
*
|
||
* @attribute iconSize
|
||
* @type number
|
||
* @default 24
|
||
*/
|
||
size: {
|
||
type: Number,
|
||
value: 24
|
||
}
|
||
|
||
},
|
||
|
||
/**
|
||
* Construct an array of all icon names in this iconset.
|
||
*
|
||
* @return {!Array} Array of icon names.
|
||
*/
|
||
getIconNames: function() {
|
||
this._icons = this._createIconMap();
|
||
return Object.keys(this._icons).map(function(n) {
|
||
return this.name + ':' + n;
|
||
}, this);
|
||
},
|
||
|
||
/**
|
||
* Applies an icon to the given element.
|
||
*
|
||
* An svg icon is prepended to the element's shadowRoot if it exists,
|
||
* otherwise to the element itself.
|
||
*
|
||
* @method applyIcon
|
||
* @param {Element} element Element to which the icon is applied.
|
||
* @param {string} iconName Name of the icon to apply.
|
||
* @return {Element} The svg element which renders the icon.
|
||
*/
|
||
applyIcon: function(element, iconName) {
|
||
// insert svg element into shadow root, if it exists
|
||
element = element.root || element;
|
||
// Remove old svg element
|
||
this.removeIcon(element);
|
||
// install new svg element
|
||
var svg = this._cloneIcon(iconName);
|
||
if (svg) {
|
||
var pde = Polymer.dom(element);
|
||
pde.insertBefore(svg, pde.childNodes[0]);
|
||
return element._svgIcon = svg;
|
||
}
|
||
return null;
|
||
},
|
||
|
||
/**
|
||
* Remove an icon from the given element by undoing the changes effected
|
||
* by `applyIcon`.
|
||
*
|
||
* @param {Element} element The element from which the icon is removed.
|
||
*/
|
||
removeIcon: function(element) {
|
||
// Remove old svg element
|
||
if (element._svgIcon) {
|
||
Polymer.dom(element).removeChild(element._svgIcon);
|
||
element._svgIcon = null;
|
||
}
|
||
},
|
||
|
||
/**
|
||
*
|
||
* When name is changed, register iconset metadata
|
||
*
|
||
*/
|
||
_nameChanged: function() {
|
||
new Polymer.IronMeta({type: 'iconset', key: this.name, value: this});
|
||
},
|
||
|
||
/**
|
||
* Create a map of child SVG elements by id.
|
||
*
|
||
* @return {!Object} Map of id's to SVG elements.
|
||
*/
|
||
_createIconMap: function() {
|
||
// Objects chained to Object.prototype (`{}`) have members. Specifically,
|
||
// on FF there is a `watch` method that confuses the icon map, so we
|
||
// need to use a null-based object here.
|
||
var icons = Object.create(null);
|
||
Polymer.dom(this).querySelectorAll('[id]')
|
||
.forEach(function(icon) {
|
||
icons[icon.id] = icon;
|
||
});
|
||
return icons;
|
||
},
|
||
|
||
/**
|
||
* Produce installable clone of the SVG element matching `id` in this
|
||
* iconset, or `undefined` if there is no matching element.
|
||
*
|
||
* @return {Element} Returns an installable clone of the SVG element
|
||
* matching `id`.
|
||
*/
|
||
_cloneIcon: function(id) {
|
||
// create the icon map on-demand, since the iconset itself has no discrete
|
||
// signal to know when it's children are fully parsed
|
||
this._icons = this._icons || this._createIconMap();
|
||
return this._prepareSvgClone(this._icons[id], this.size);
|
||
},
|
||
|
||
/**
|
||
* @param {Element} sourceSvg
|
||
* @param {number} size
|
||
* @return {Element}
|
||
*/
|
||
_prepareSvgClone: function(sourceSvg, size) {
|
||
if (sourceSvg) {
|
||
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
||
svg.setAttribute('viewBox', ['0', '0', size, size].join(' '));
|
||
svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');
|
||
// TODO(dfreedm): `pointer-events: none` works around https://crbug.com/370136
|
||
// TODO(sjmiles): inline style may not be ideal, but avoids requiring a shadow-root
|
||
svg.style.cssText = 'pointer-events: none; display: block; width: 100%; height: 100%;';
|
||
svg.appendChild(sourceSvg.cloneNode(true)).removeAttribute('id');
|
||
return svg;
|
||
}
|
||
return null;
|
||
}
|
||
|
||
});
|
||
</script>
|
||
<style is="custom-style">
|
||
|
||
:root {
|
||
|
||
--layout: {
|
||
display: -ms-flexbox;
|
||
display: -webkit-flex;
|
||
display: flex;
|
||
};
|
||
|
||
--layout-inline: {
|
||
display: -ms-inline-flexbox;
|
||
display: -webkit-inline-flex;
|
||
display: inline-flex;
|
||
};
|
||
|
||
--layout-horizontal: {
|
||
/* @apply(--layout); */
|
||
display: -ms-flexbox;
|
||
display: -webkit-flex;
|
||
display: flex;
|
||
|
||
-ms-flex-direction: row;
|
||
-webkit-flex-direction: row;
|
||
flex-direction: row;
|
||
};
|
||
|
||
--layout-horizontal-reverse: {
|
||
-ms-flex-direction: row-reverse;
|
||
-webkit-flex-direction: row-reverse;
|
||
flex-direction: row-reverse;
|
||
};
|
||
|
||
--layout-vertical: {
|
||
/* @apply(--layout); */
|
||
display: -ms-flexbox;
|
||
display: -webkit-flex;
|
||
display: flex;
|
||
|
||
-ms-flex-direction: column;
|
||
-webkit-flex-direction: column;
|
||
flex-direction: column;
|
||
};
|
||
|
||
--layout-vertical-reverse: {
|
||
-ms-flex-direction: column-reverse;
|
||
-webkit-flex-direction: column-reverse;
|
||
flex-direction: column-reverse;
|
||
};
|
||
|
||
--layout-wrap: {
|
||
-ms-flex-wrap: wrap;
|
||
-webkit-flex-wrap: wrap;
|
||
flex-wrap: wrap;
|
||
};
|
||
|
||
--layout-wrap-reverse: {
|
||
-ms-flex-wrap: wrap-reverse;
|
||
-webkit-flex-wrap: wrap-reverse;
|
||
flex-wrap: wrap-reverse;
|
||
};
|
||
|
||
--layout-flex-auto: {
|
||
-ms-flex: 1 1 auto;
|
||
-webkit-flex: 1 1 auto;
|
||
flex: 1 1 auto;
|
||
};
|
||
|
||
--layout-flex-none: {
|
||
-ms-flex: none;
|
||
-webkit-flex: none;
|
||
flex: none;
|
||
};
|
||
|
||
--layout-flex: {
|
||
-ms-flex: 1 1 0.000000001px;
|
||
-webkit-flex: 1;
|
||
flex: 1;
|
||
-webkit-flex-basis: 0.000000001px;
|
||
flex-basis: 0.000000001px;
|
||
};
|
||
|
||
--layout-flex-2: {
|
||
-ms-flex: 2;
|
||
-webkit-flex: 2;
|
||
flex: 2;
|
||
};
|
||
|
||
--layout-flex-3: {
|
||
-ms-flex: 3;
|
||
-webkit-flex: 3;
|
||
flex: 3;
|
||
};
|
||
|
||
--layout-flex-4: {
|
||
-ms-flex: 4;
|
||
-webkit-flex: 4;
|
||
flex: 4;
|
||
};
|
||
|
||
--layout-flex-5: {
|
||
-ms-flex: 5;
|
||
-webkit-flex: 5;
|
||
flex: 5;
|
||
};
|
||
|
||
--layout-flex-6: {
|
||
-ms-flex: 6;
|
||
-webkit-flex: 6;
|
||
flex: 6;
|
||
};
|
||
|
||
--layout-flex-7: {
|
||
-ms-flex: 7;
|
||
-webkit-flex: 7;
|
||
flex: 7;
|
||
};
|
||
|
||
--layout-flex-8: {
|
||
-ms-flex: 8;
|
||
-webkit-flex: 8;
|
||
flex: 8;
|
||
};
|
||
|
||
--layout-flex-9: {
|
||
-ms-flex: 9;
|
||
-webkit-flex: 9;
|
||
flex: 9;
|
||
};
|
||
|
||
--layout-flex-10: {
|
||
-ms-flex: 10;
|
||
-webkit-flex: 10;
|
||
flex: 10;
|
||
};
|
||
|
||
--layout-flex-11: {
|
||
-ms-flex: 11;
|
||
-webkit-flex: 11;
|
||
flex: 11;
|
||
};
|
||
|
||
--layout-flex-12: {
|
||
-ms-flex: 12;
|
||
-webkit-flex: 12;
|
||
flex: 12;
|
||
};
|
||
|
||
/* alignment in cross axis */
|
||
|
||
--layout-start: {
|
||
-ms-flex-align: start;
|
||
-webkit-align-items: flex-start;
|
||
align-items: flex-start;
|
||
};
|
||
|
||
--layout-center: {
|
||
-ms-flex-align: center;
|
||
-webkit-align-items: center;
|
||
align-items: center;
|
||
};
|
||
|
||
--layout-end: {
|
||
-ms-flex-align: end;
|
||
-webkit-align-items: flex-end;
|
||
align-items: flex-end;
|
||
};
|
||
|
||
/* alignment in main axis */
|
||
|
||
--layout-start-justified: {
|
||
-ms-flex-pack: start;
|
||
-webkit-justify-content: flex-start;
|
||
justify-content: flex-start;
|
||
};
|
||
|
||
--layout-center-justified: {
|
||
-ms-flex-pack: center;
|
||
-webkit-justify-content: center;
|
||
justify-content: center;
|
||
};
|
||
|
||
--layout-end-justified: {
|
||
-ms-flex-pack: end;
|
||
-webkit-justify-content: flex-end;
|
||
justify-content: flex-end;
|
||
};
|
||
|
||
--layout-around-justified: {
|
||
-ms-flex-pack: around;
|
||
-webkit-justify-content: space-around;
|
||
justify-content: space-around;
|
||
};
|
||
|
||
--layout-justified: {
|
||
-ms-flex-pack: justify;
|
||
-webkit-justify-content: space-between;
|
||
justify-content: space-between;
|
||
};
|
||
|
||
--layout-center-center: {
|
||
/* @apply(--layout-center --layout-center-justified); */
|
||
-ms-flex-align: center;
|
||
-webkit-align-items: center;
|
||
align-items: center;
|
||
-ms-flex-pack: center;
|
||
-webkit-justify-content: center;
|
||
justify-content: center;
|
||
};
|
||
|
||
/* self alignment */
|
||
|
||
--layout-self-start: {
|
||
-ms-align-self: flex-start;
|
||
-webkit-align-self: flex-start;
|
||
align-self: flex-start;
|
||
};
|
||
|
||
--layout-self-center: {
|
||
-ms-align-self: center;
|
||
-webkit-align-self: center;
|
||
align-self: center;
|
||
};
|
||
|
||
--layout-self-end: {
|
||
-ms-align-self: flex-end;
|
||
-webkit-align-self: flex-end;
|
||
align-self: flex-end;
|
||
};
|
||
|
||
--layout-self-stretch: {
|
||
-ms-align-self: stretch;
|
||
-webkit-align-self: stretch;
|
||
align-self: stretch;
|
||
};
|
||
|
||
/*******************************
|
||
Other Layout
|
||
*******************************/
|
||
|
||
--layout-block: {
|
||
display: block;
|
||
};
|
||
|
||
--layout-invisible: {
|
||
visibility: hidden !important;
|
||
};
|
||
|
||
--layout-relative: {
|
||
position: relative;
|
||
};
|
||
|
||
--layout-fit: {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
};
|
||
|
||
--layout-scroll: {
|
||
-webkit-overflow-scrolling: touch;
|
||
overflow: auto;
|
||
};
|
||
|
||
/* fixed position */
|
||
|
||
--layout-fixed-bottom:,
|
||
--layout-fixed-left:,
|
||
--layout-fixed-right:,
|
||
--layout-fixed-top: {
|
||
position: fixed;
|
||
};
|
||
|
||
--layout-fixed-top: {
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
};
|
||
|
||
--layout-fixed-right: {
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
};
|
||
|
||
--layout-fixed-bottom: {
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
};
|
||
|
||
--layout-fixed-left: {
|
||
top: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
};
|
||
|
||
}
|
||
|
||
</style>
|
||
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
var StoreListenerMixIn = window.hass.storeListenerMixIn;
|
||
|
||
window.StoreListenerBehavior = {
|
||
|
||
attached: function() {
|
||
StoreListenerMixIn.listenToStores(true, this);
|
||
},
|
||
|
||
detached: function() {
|
||
StoreListenerMixIn.stopListeningToStores(this);
|
||
},
|
||
|
||
};
|
||
|
||
})();
|
||
|
||
</script>
|
||
<style>
|
||
|
||
/*******************************
|
||
Flex Layout
|
||
*******************************/
|
||
|
||
html /deep/ .layout.horizontal,
|
||
html /deep/ .layout.horizontal-reverse,
|
||
html /deep/ .layout.vertical,
|
||
html /deep/ .layout.vertical-reverse {
|
||
display: -ms-flexbox;
|
||
display: -webkit-flex;
|
||
display: flex;
|
||
}
|
||
|
||
html /deep/ .layout.inline {
|
||
display: -ms-inline-flexbox;
|
||
display: -webkit-inline-flex;
|
||
display: inline-flex;
|
||
}
|
||
|
||
html /deep/ .layout.horizontal {
|
||
-ms-flex-direction: row;
|
||
-webkit-flex-direction: row;
|
||
flex-direction: row;
|
||
}
|
||
|
||
html /deep/ .layout.horizontal-reverse {
|
||
-ms-flex-direction: row-reverse;
|
||
-webkit-flex-direction: row-reverse;
|
||
flex-direction: row-reverse;
|
||
}
|
||
|
||
html /deep/ .layout.vertical {
|
||
-ms-flex-direction: column;
|
||
-webkit-flex-direction: column;
|
||
flex-direction: column;
|
||
}
|
||
|
||
html /deep/ .layout.vertical-reverse {
|
||
-ms-flex-direction: column-reverse;
|
||
-webkit-flex-direction: column-reverse;
|
||
flex-direction: column-reverse;
|
||
}
|
||
|
||
html /deep/ .layout.wrap {
|
||
-ms-flex-wrap: wrap;
|
||
-webkit-flex-wrap: wrap;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
html /deep/ .layout.wrap-reverse {
|
||
-ms-flex-wrap: wrap-reverse;
|
||
-webkit-flex-wrap: wrap-reverse;
|
||
flex-wrap: wrap-reverse;
|
||
}
|
||
|
||
html /deep/ .flex-auto {
|
||
-ms-flex: 1 1 auto;
|
||
-webkit-flex: 1 1 auto;
|
||
flex: 1 1 auto;
|
||
}
|
||
|
||
html /deep/ .flex-none {
|
||
-ms-flex: none;
|
||
-webkit-flex: none;
|
||
flex: none;
|
||
}
|
||
|
||
html /deep/ .flex,
|
||
html /deep/ .flex-1 {
|
||
-ms-flex: 1;
|
||
-webkit-flex: 1;
|
||
flex: 1;
|
||
}
|
||
|
||
html /deep/ .flex-2 {
|
||
-ms-flex: 2;
|
||
-webkit-flex: 2;
|
||
flex: 2;
|
||
}
|
||
|
||
html /deep/ .flex-3 {
|
||
-ms-flex: 3;
|
||
-webkit-flex: 3;
|
||
flex: 3;
|
||
}
|
||
|
||
html /deep/ .flex-4 {
|
||
-ms-flex: 4;
|
||
-webkit-flex: 4;
|
||
flex: 4;
|
||
}
|
||
|
||
html /deep/ .flex-5 {
|
||
-ms-flex: 5;
|
||
-webkit-flex: 5;
|
||
flex: 5;
|
||
}
|
||
|
||
html /deep/ .flex-6 {
|
||
-ms-flex: 6;
|
||
-webkit-flex: 6;
|
||
flex: 6;
|
||
}
|
||
|
||
html /deep/ .flex-7 {
|
||
-ms-flex: 7;
|
||
-webkit-flex: 7;
|
||
flex: 7;
|
||
}
|
||
|
||
html /deep/ .flex-8 {
|
||
-ms-flex: 8;
|
||
-webkit-flex: 8;
|
||
flex: 8;
|
||
}
|
||
|
||
html /deep/ .flex-9 {
|
||
-ms-flex: 9;
|
||
-webkit-flex: 9;
|
||
flex: 9;
|
||
}
|
||
|
||
html /deep/ .flex-10 {
|
||
-ms-flex: 10;
|
||
-webkit-flex: 10;
|
||
flex: 10;
|
||
}
|
||
|
||
html /deep/ .flex-11 {
|
||
-ms-flex: 11;
|
||
-webkit-flex: 11;
|
||
flex: 11;
|
||
}
|
||
|
||
html /deep/ .flex-12 {
|
||
-ms-flex: 12;
|
||
-webkit-flex: 12;
|
||
flex: 12;
|
||
}
|
||
|
||
/* alignment in cross axis */
|
||
|
||
html /deep/ .layout.start {
|
||
-ms-flex-align: start;
|
||
-webkit-align-items: flex-start;
|
||
align-items: flex-start;
|
||
}
|
||
|
||
html /deep/ .layout.center,
|
||
html /deep/ .layout.center-center {
|
||
-ms-flex-align: center;
|
||
-webkit-align-items: center;
|
||
align-items: center;
|
||
}
|
||
|
||
html /deep/ .layout.end {
|
||
-ms-flex-align: end;
|
||
-webkit-align-items: flex-end;
|
||
align-items: flex-end;
|
||
}
|
||
|
||
/* alignment in main axis */
|
||
|
||
html /deep/ .layout.start-justified {
|
||
-ms-flex-pack: start;
|
||
-webkit-justify-content: flex-start;
|
||
justify-content: flex-start;
|
||
}
|
||
|
||
html /deep/ .layout.center-justified,
|
||
html /deep/ .layout.center-center {
|
||
-ms-flex-pack: center;
|
||
-webkit-justify-content: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
html /deep/ .layout.end-justified {
|
||
-ms-flex-pack: end;
|
||
-webkit-justify-content: flex-end;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
html /deep/ .layout.around-justified {
|
||
-ms-flex-pack: around;
|
||
-webkit-justify-content: space-around;
|
||
justify-content: space-around;
|
||
}
|
||
|
||
html /deep/ .layout.justified {
|
||
-ms-flex-pack: justify;
|
||
-webkit-justify-content: space-between;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
/* self alignment */
|
||
|
||
html /deep/ .self-start {
|
||
-ms-align-self: flex-start;
|
||
-webkit-align-self: flex-start;
|
||
align-self: flex-start;
|
||
}
|
||
|
||
html /deep/ .self-center {
|
||
-ms-align-self: center;
|
||
-webkit-align-self: center;
|
||
align-self: center;
|
||
}
|
||
|
||
html /deep/ .self-end {
|
||
-ms-align-self: flex-end;
|
||
-webkit-align-self: flex-end;
|
||
align-self: flex-end;
|
||
}
|
||
|
||
html /deep/ .self-stretch {
|
||
-ms-align-self: stretch;
|
||
-webkit-align-self: stretch;
|
||
align-self: stretch;
|
||
}
|
||
|
||
/*******************************
|
||
Other Layout
|
||
*******************************/
|
||
|
||
html /deep/ .block {
|
||
display: block;
|
||
}
|
||
|
||
/* IE 10 support for HTML5 hidden attr */
|
||
html /deep/ [hidden] {
|
||
display: none !important;
|
||
}
|
||
|
||
html /deep/ .invisible {
|
||
visibility: hidden !important;
|
||
}
|
||
|
||
html /deep/ .relative {
|
||
position: relative;
|
||
}
|
||
|
||
html /deep/ .fit {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
body.fullbleed {
|
||
margin: 0;
|
||
height: 100vh;
|
||
}
|
||
|
||
html /deep/ .scroll {
|
||
-webkit-overflow-scrolling: touch;
|
||
overflow: auto;
|
||
}
|
||
|
||
.fixed-bottom,
|
||
.fixed-left,
|
||
.fixed-right,
|
||
.fixed-top {
|
||
position: fixed;
|
||
}
|
||
|
||
html /deep/ .fixed-top {
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
}
|
||
|
||
html /deep/ .fixed-right {
|
||
top: 0;
|
||
right: 0;
|
||
botttom: 0;
|
||
}
|
||
|
||
html /deep/ .fixed-bottom {
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
html /deep/ .fixed-left {
|
||
top: 0;
|
||
botttom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
</style>
|
||
<style>
|
||
|
||
/*******************************
|
||
Flex Layout
|
||
*******************************/
|
||
|
||
.layout.horizontal,
|
||
.layout.horizontal-reverse,
|
||
.layout.vertical,
|
||
.layout.vertical-reverse {
|
||
display: -ms-flexbox;
|
||
display: -webkit-flex;
|
||
display: flex;
|
||
}
|
||
|
||
.layout.inline {
|
||
display: -ms-inline-flexbox;
|
||
display: -webkit-inline-flex;
|
||
display: inline-flex;
|
||
}
|
||
|
||
.layout.horizontal {
|
||
-ms-flex-direction: row;
|
||
-webkit-flex-direction: row;
|
||
flex-direction: row;
|
||
}
|
||
|
||
.layout.horizontal-reverse {
|
||
-ms-flex-direction: row-reverse;
|
||
-webkit-flex-direction: row-reverse;
|
||
flex-direction: row-reverse;
|
||
}
|
||
|
||
.layout.vertical {
|
||
-ms-flex-direction: column;
|
||
-webkit-flex-direction: column;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.layout.vertical-reverse {
|
||
-ms-flex-direction: column-reverse;
|
||
-webkit-flex-direction: column-reverse;
|
||
flex-direction: column-reverse;
|
||
}
|
||
|
||
.layout.wrap {
|
||
-ms-flex-wrap: wrap;
|
||
-webkit-flex-wrap: wrap;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.layout.wrap-reverse {
|
||
-ms-flex-wrap: wrap-reverse;
|
||
-webkit-flex-wrap: wrap-reverse;
|
||
flex-wrap: wrap-reverse;
|
||
}
|
||
|
||
.flex-auto {
|
||
-ms-flex: 1 1 auto;
|
||
-webkit-flex: 1 1 auto;
|
||
flex: 1 1 auto;
|
||
}
|
||
|
||
.flex-none {
|
||
-ms-flex: none;
|
||
-webkit-flex: none;
|
||
flex: none;
|
||
}
|
||
|
||
.flex,
|
||
.flex-1 {
|
||
-ms-flex: 1;
|
||
-webkit-flex: 1;
|
||
flex: 1;
|
||
}
|
||
|
||
.flex-2 {
|
||
-ms-flex: 2;
|
||
-webkit-flex: 2;
|
||
flex: 2;
|
||
}
|
||
|
||
.flex-3 {
|
||
-ms-flex: 3;
|
||
-webkit-flex: 3;
|
||
flex: 3;
|
||
}
|
||
|
||
.flex-4 {
|
||
-ms-flex: 4;
|
||
-webkit-flex: 4;
|
||
flex: 4;
|
||
}
|
||
|
||
.flex-5 {
|
||
-ms-flex: 5;
|
||
-webkit-flex: 5;
|
||
flex: 5;
|
||
}
|
||
|
||
.flex-6 {
|
||
-ms-flex: 6;
|
||
-webkit-flex: 6;
|
||
flex: 6;
|
||
}
|
||
|
||
.flex-7 {
|
||
-ms-flex: 7;
|
||
-webkit-flex: 7;
|
||
flex: 7;
|
||
}
|
||
|
||
.flex-8 {
|
||
-ms-flex: 8;
|
||
-webkit-flex: 8;
|
||
flex: 8;
|
||
}
|
||
|
||
.flex-9 {
|
||
-ms-flex: 9;
|
||
-webkit-flex: 9;
|
||
flex: 9;
|
||
}
|
||
|
||
.flex-10 {
|
||
-ms-flex: 10;
|
||
-webkit-flex: 10;
|
||
flex: 10;
|
||
}
|
||
|
||
.flex-11 {
|
||
-ms-flex: 11;
|
||
-webkit-flex: 11;
|
||
flex: 11;
|
||
}
|
||
|
||
.flex-12 {
|
||
-ms-flex: 12;
|
||
-webkit-flex: 12;
|
||
flex: 12;
|
||
}
|
||
|
||
/* alignment in cross axis */
|
||
|
||
.layout.start {
|
||
-ms-flex-align: start;
|
||
-webkit-align-items: flex-start;
|
||
align-items: flex-start;
|
||
}
|
||
|
||
.layout.center,
|
||
.layout.center-center {
|
||
-ms-flex-align: center;
|
||
-webkit-align-items: center;
|
||
align-items: center;
|
||
}
|
||
|
||
.layout.end {
|
||
-ms-flex-align: end;
|
||
-webkit-align-items: flex-end;
|
||
align-items: flex-end;
|
||
}
|
||
|
||
/* alignment in main axis */
|
||
|
||
.layout.start-justified {
|
||
-ms-flex-pack: start;
|
||
-webkit-justify-content: flex-start;
|
||
justify-content: flex-start;
|
||
}
|
||
|
||
.layout.center-justified,
|
||
.layout.center-center {
|
||
-ms-flex-pack: center;
|
||
-webkit-justify-content: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.layout.end-justified {
|
||
-ms-flex-pack: end;
|
||
-webkit-justify-content: flex-end;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.layout.around-justified {
|
||
-ms-flex-pack: around;
|
||
-webkit-justify-content: space-around;
|
||
justify-content: space-around;
|
||
}
|
||
|
||
.layout.justified {
|
||
-ms-flex-pack: justify;
|
||
-webkit-justify-content: space-between;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
/* self alignment */
|
||
|
||
.self-start {
|
||
-ms-align-self: flex-start;
|
||
-webkit-align-self: flex-start;
|
||
align-self: flex-start;
|
||
}
|
||
|
||
.self-center {
|
||
-ms-align-self: center;
|
||
-webkit-align-self: center;
|
||
align-self: center;
|
||
}
|
||
|
||
.self-end {
|
||
-ms-align-self: flex-end;
|
||
-webkit-align-self: flex-end;
|
||
align-self: flex-end;
|
||
}
|
||
|
||
.self-stretch {
|
||
-ms-align-self: stretch;
|
||
-webkit-align-self: stretch;
|
||
align-self: stretch;
|
||
}
|
||
|
||
/*******************************
|
||
Other Layout
|
||
*******************************/
|
||
|
||
.block {
|
||
display: block;
|
||
}
|
||
|
||
/* IE 10 support for HTML5 hidden attr */
|
||
[hidden] {
|
||
display: none !important;
|
||
}
|
||
|
||
.invisible {
|
||
visibility: hidden !important;
|
||
}
|
||
|
||
.relative {
|
||
position: relative;
|
||
}
|
||
|
||
.fit {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
body.fullbleed {
|
||
margin: 0;
|
||
height: 100vh;
|
||
}
|
||
|
||
.scroll {
|
||
-webkit-overflow-scrolling: touch;
|
||
overflow: auto;
|
||
}
|
||
|
||
/* fixed position */
|
||
|
||
.fixed-bottom,
|
||
.fixed-left,
|
||
.fixed-right,
|
||
.fixed-top {
|
||
position: fixed;
|
||
}
|
||
|
||
.fixed-top {
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
}
|
||
|
||
.fixed-right {
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
}
|
||
|
||
.fixed-bottom {
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
.fixed-left {
|
||
top: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
</style>
|
||
|
||
<script>
|
||
(function() {
|
||
'use strict';
|
||
|
||
/**
|
||
* Chrome uses an older version of DOM Level 3 Keyboard Events
|
||
*
|
||
* Most keys are labeled as text, but some are Unicode codepoints.
|
||
* Values taken from: http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/keyset.html#KeySet-Set
|
||
*/
|
||
var KEY_IDENTIFIER = {
|
||
'U+0009': 'tab',
|
||
'U+001B': 'esc',
|
||
'U+0020': 'space',
|
||
'U+002A': '*',
|
||
'U+0030': '0',
|
||
'U+0031': '1',
|
||
'U+0032': '2',
|
||
'U+0033': '3',
|
||
'U+0034': '4',
|
||
'U+0035': '5',
|
||
'U+0036': '6',
|
||
'U+0037': '7',
|
||
'U+0038': '8',
|
||
'U+0039': '9',
|
||
'U+0041': 'a',
|
||
'U+0042': 'b',
|
||
'U+0043': 'c',
|
||
'U+0044': 'd',
|
||
'U+0045': 'e',
|
||
'U+0046': 'f',
|
||
'U+0047': 'g',
|
||
'U+0048': 'h',
|
||
'U+0049': 'i',
|
||
'U+004A': 'j',
|
||
'U+004B': 'k',
|
||
'U+004C': 'l',
|
||
'U+004D': 'm',
|
||
'U+004E': 'n',
|
||
'U+004F': 'o',
|
||
'U+0050': 'p',
|
||
'U+0051': 'q',
|
||
'U+0052': 'r',
|
||
'U+0053': 's',
|
||
'U+0054': 't',
|
||
'U+0055': 'u',
|
||
'U+0056': 'v',
|
||
'U+0057': 'w',
|
||
'U+0058': 'x',
|
||
'U+0059': 'y',
|
||
'U+005A': 'z',
|
||
'U+007F': 'del'
|
||
};
|
||
|
||
/**
|
||
* Special table for KeyboardEvent.keyCode.
|
||
* KeyboardEvent.keyIdentifier is better, and KeyBoardEvent.key is even better
|
||
* than that.
|
||
*
|
||
* Values from: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.keyCode#Value_of_keyCode
|
||
*/
|
||
var KEY_CODE = {
|
||
9: 'tab',
|
||
13: 'enter',
|
||
27: 'esc',
|
||
33: 'pageup',
|
||
34: 'pagedown',
|
||
35: 'end',
|
||
36: 'home',
|
||
32: 'space',
|
||
37: 'left',
|
||
38: 'up',
|
||
39: 'right',
|
||
40: 'down',
|
||
46: 'del',
|
||
106: '*'
|
||
};
|
||
|
||
/**
|
||
* MODIFIER_KEYS maps the short name for modifier keys used in a key
|
||
* combo string to the property name that references those same keys
|
||
* in a KeyboardEvent instance.
|
||
*/
|
||
var MODIFIER_KEYS = {
|
||
shift: 'shiftKey',
|
||
ctrl: 'ctrlKey',
|
||
alt: 'altKey',
|
||
meta: 'metaKey'
|
||
};
|
||
|
||
/**
|
||
* KeyboardEvent.key is mostly represented by printable character made by
|
||
* the keyboard, with unprintable keys labeled nicely.
|
||
*
|
||
* However, on OS X, Alt+char can make a Unicode character that follows an
|
||
* Apple-specific mapping. In this case, we
|
||
* fall back to .keyCode.
|
||
*/
|
||
var KEY_CHAR = /[a-z0-9*]/;
|
||
|
||
/**
|
||
* Matches a keyIdentifier string.
|
||
*/
|
||
var IDENT_CHAR = /U\+/;
|
||
|
||
/**
|
||
* Matches arrow keys in Gecko 27.0+
|
||
*/
|
||
var ARROW_KEY = /^arrow/;
|
||
|
||
/**
|
||
* Matches space keys everywhere (notably including IE10's exceptional name
|
||
* `spacebar`).
|
||
*/
|
||
var SPACE_KEY = /^space(bar)?/;
|
||
|
||
function transformKey(key) {
|
||
var validKey = '';
|
||
if (key) {
|
||
var lKey = key.toLowerCase();
|
||
if (lKey.length == 1) {
|
||
if (KEY_CHAR.test(lKey)) {
|
||
validKey = lKey;
|
||
}
|
||
} else if (ARROW_KEY.test(lKey)) {
|
||
validKey = lKey.replace('arrow', '');
|
||
} else if (SPACE_KEY.test(lKey)) {
|
||
validKey = 'space';
|
||
} else if (lKey == 'multiply') {
|
||
// numpad '*' can map to Multiply on IE/Windows
|
||
validKey = '*';
|
||
} else {
|
||
validKey = lKey;
|
||
}
|
||
}
|
||
return validKey;
|
||
}
|
||
|
||
function transformKeyIdentifier(keyIdent) {
|
||
var validKey = '';
|
||
if (keyIdent) {
|
||
if (IDENT_CHAR.test(keyIdent)) {
|
||
validKey = KEY_IDENTIFIER[keyIdent];
|
||
} else {
|
||
validKey = keyIdent.toLowerCase();
|
||
}
|
||
}
|
||
return validKey;
|
||
}
|
||
|
||
function transformKeyCode(keyCode) {
|
||
var validKey = '';
|
||
if (Number(keyCode)) {
|
||
if (keyCode >= 65 && keyCode <= 90) {
|
||
// ascii a-z
|
||
// lowercase is 32 offset from uppercase
|
||
validKey = String.fromCharCode(32 + keyCode);
|
||
} else if (keyCode >= 112 && keyCode <= 123) {
|
||
// function keys f1-f12
|
||
validKey = 'f' + (keyCode - 112);
|
||
} else if (keyCode >= 48 && keyCode <= 57) {
|
||
// top 0-9 keys
|
||
validKey = String(48 - keyCode);
|
||
} else if (keyCode >= 96 && keyCode <= 105) {
|
||
// num pad 0-9
|
||
validKey = String(96 - keyCode);
|
||
} else {
|
||
validKey = KEY_CODE[keyCode];
|
||
}
|
||
}
|
||
return validKey;
|
||
}
|
||
|
||
function normalizedKeyForEvent(keyEvent) {
|
||
// fall back from .key, to .keyIdentifier, to .keyCode, and then to
|
||
// .detail.key to support artificial keyboard events
|
||
return transformKey(keyEvent.key) ||
|
||
transformKeyIdentifier(keyEvent.keyIdentifier) ||
|
||
transformKeyCode(keyEvent.keyCode) ||
|
||
transformKey(keyEvent.detail.key) || '';
|
||
}
|
||
|
||
function keyComboMatchesEvent(keyCombo, keyEvent) {
|
||
return normalizedKeyForEvent(keyEvent) === keyCombo.key &&
|
||
!!keyEvent.shiftKey === !!keyCombo.shiftKey &&
|
||
!!keyEvent.ctrlKey === !!keyCombo.ctrlKey &&
|
||
!!keyEvent.altKey === !!keyCombo.altKey &&
|
||
!!keyEvent.metaKey === !!keyCombo.metaKey;
|
||
}
|
||
|
||
function parseKeyComboString(keyComboString) {
|
||
return keyComboString.split('+').reduce(function(parsedKeyCombo, keyComboPart) {
|
||
var eventParts = keyComboPart.split(':');
|
||
var keyName = eventParts[0];
|
||
var event = eventParts[1];
|
||
|
||
if (keyName in MODIFIER_KEYS) {
|
||
parsedKeyCombo[MODIFIER_KEYS[keyName]] = true;
|
||
} else {
|
||
parsedKeyCombo.key = keyName;
|
||
parsedKeyCombo.event = event || 'keydown';
|
||
}
|
||
|
||
return parsedKeyCombo;
|
||
}, {
|
||
combo: keyComboString.split(':').shift()
|
||
});
|
||
}
|
||
|
||
function parseEventString(eventString) {
|
||
return eventString.split(' ').map(function(keyComboString) {
|
||
return parseKeyComboString(keyComboString);
|
||
});
|
||
}
|
||
|
||
|
||
/**
|
||
* `Polymer.IronA11yKeysBehavior` provides a normalized interface for processing
|
||
* keyboard commands that pertain to [WAI-ARIA best practices](http://www.w3.org/TR/wai-aria-practices/#kbd_general_binding).
|
||
* The element takes care of browser differences with respect to Keyboard events
|
||
* and uses an expressive syntax to filter key presses.
|
||
*
|
||
* Use the `keyBindings` prototype property to express what combination of keys
|
||
* will trigger the event to fire.
|
||
*
|
||
* Use the `key-event-target` attribute to set up event handlers on a specific
|
||
* node.
|
||
* The `keys-pressed` event will fire when one of the key combinations set with the
|
||
* `keys` property is pressed.
|
||
*
|
||
* @demo demo/index.html
|
||
* @polymerBehavior IronA11yKeysBehavior
|
||
*/
|
||
Polymer.IronA11yKeysBehavior = {
|
||
properties: {
|
||
/**
|
||
* The HTMLElement that will be firing relevant KeyboardEvents.
|
||
*/
|
||
keyEventTarget: {
|
||
type: Object,
|
||
value: function() {
|
||
return this;
|
||
}
|
||
},
|
||
|
||
_boundKeyHandlers: {
|
||
type: Array,
|
||
value: function() {
|
||
return [];
|
||
}
|
||
},
|
||
|
||
// We use this due to a limitation in IE10 where instances will have
|
||
// own properties of everything on the "prototype".
|
||
_imperativeKeyBindings: {
|
||
type: Object,
|
||
value: function() {
|
||
return {};
|
||
}
|
||
}
|
||
},
|
||
|
||
observers: [
|
||
'_resetKeyEventListeners(keyEventTarget, _boundKeyHandlers)'
|
||
],
|
||
|
||
keyBindings: {},
|
||
|
||
registered: function() {
|
||
this._prepKeyBindings();
|
||
},
|
||
|
||
attached: function() {
|
||
this._listenKeyEventListeners();
|
||
},
|
||
|
||
detached: function() {
|
||
this._unlistenKeyEventListeners();
|
||
},
|
||
|
||
/**
|
||
* Can be used to imperatively add a key binding to the implementing
|
||
* element. This is the imperative equivalent of declaring a keybinding
|
||
* in the `keyBindings` prototype property.
|
||
*/
|
||
addOwnKeyBinding: function(eventString, handlerName) {
|
||
this._imperativeKeyBindings[eventString] = handlerName;
|
||
this._prepKeyBindings();
|
||
this._resetKeyEventListeners();
|
||
},
|
||
|
||
/**
|
||
* When called, will remove all imperatively-added key bindings.
|
||
*/
|
||
removeOwnKeyBindings: function() {
|
||
this._imperativeKeyBindings = {};
|
||
this._prepKeyBindings();
|
||
this._resetKeyEventListeners();
|
||
},
|
||
|
||
keyboardEventMatchesKeys: function(event, eventString) {
|
||
var keyCombos = parseEventString(eventString);
|
||
var index;
|
||
|
||
for (index = 0; index < keyCombos.length; ++index) {
|
||
if (keyComboMatchesEvent(keyCombos[index], event)) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
},
|
||
|
||
_collectKeyBindings: function() {
|
||
var keyBindings = this.behaviors.map(function(behavior) {
|
||
return behavior.keyBindings;
|
||
});
|
||
|
||
if (keyBindings.indexOf(this.keyBindings) === -1) {
|
||
keyBindings.push(this.keyBindings);
|
||
}
|
||
|
||
return keyBindings;
|
||
},
|
||
|
||
_prepKeyBindings: function() {
|
||
this._keyBindings = {};
|
||
|
||
this._collectKeyBindings().forEach(function(keyBindings) {
|
||
for (var eventString in keyBindings) {
|
||
this._addKeyBinding(eventString, keyBindings[eventString]);
|
||
}
|
||
}, this);
|
||
|
||
for (var eventString in this._imperativeKeyBindings) {
|
||
this._addKeyBinding(eventString, this._imperativeKeyBindings[eventString]);
|
||
}
|
||
},
|
||
|
||
_addKeyBinding: function(eventString, handlerName) {
|
||
parseEventString(eventString).forEach(function(keyCombo) {
|
||
this._keyBindings[keyCombo.event] =
|
||
this._keyBindings[keyCombo.event] || [];
|
||
|
||
this._keyBindings[keyCombo.event].push([
|
||
keyCombo,
|
||
handlerName
|
||
]);
|
||
}, this);
|
||
},
|
||
|
||
_resetKeyEventListeners: function() {
|
||
this._unlistenKeyEventListeners();
|
||
|
||
if (this.isAttached) {
|
||
this._listenKeyEventListeners();
|
||
}
|
||
},
|
||
|
||
_listenKeyEventListeners: function() {
|
||
Object.keys(this._keyBindings).forEach(function(eventName) {
|
||
var keyBindings = this._keyBindings[eventName];
|
||
var boundKeyHandler = this._onKeyBindingEvent.bind(this, keyBindings);
|
||
|
||
this._boundKeyHandlers.push([this.keyEventTarget, eventName, boundKeyHandler]);
|
||
|
||
this.keyEventTarget.addEventListener(eventName, boundKeyHandler);
|
||
}, this);
|
||
},
|
||
|
||
_unlistenKeyEventListeners: function() {
|
||
var keyHandlerTuple;
|
||
var keyEventTarget;
|
||
var eventName;
|
||
var boundKeyHandler;
|
||
|
||
while (this._boundKeyHandlers.length) {
|
||
// My kingdom for block-scope binding and destructuring assignment..
|
||
keyHandlerTuple = this._boundKeyHandlers.pop();
|
||
keyEventTarget = keyHandlerTuple[0];
|
||
eventName = keyHandlerTuple[1];
|
||
boundKeyHandler = keyHandlerTuple[2];
|
||
|
||
keyEventTarget.removeEventListener(eventName, boundKeyHandler);
|
||
}
|
||
},
|
||
|
||
_onKeyBindingEvent: function(keyBindings, event) {
|
||
keyBindings.forEach(function(keyBinding) {
|
||
var keyCombo = keyBinding[0];
|
||
var handlerName = keyBinding[1];
|
||
|
||
if (!event.defaultPrevented && keyComboMatchesEvent(keyCombo, event)) {
|
||
this._triggerKeyHandler(keyCombo, handlerName, event);
|
||
}
|
||
}, this);
|
||
},
|
||
|
||
_triggerKeyHandler: function(keyCombo, handlerName, keyboardEvent) {
|
||
var detail = Object.create(keyCombo);
|
||
detail.keyboardEvent = keyboardEvent;
|
||
|
||
this[handlerName].call(this, new CustomEvent(keyCombo.event, {
|
||
detail: detail
|
||
}));
|
||
}
|
||
};
|
||
})();
|
||
</script>
|
||
|
||
|
||
<style is="custom-style">
|
||
|
||
:root {
|
||
|
||
--dark-primary-color: #303f9f;
|
||
|
||
--default-primary-color: #3f51b5;
|
||
|
||
--light-primary-color: #c5cae9;
|
||
|
||
--text-primary-color: #ffffff;
|
||
|
||
--accent-color: #ff4081;
|
||
|
||
--primary-background-color: #ffffff;
|
||
|
||
--primary-text-color: #212121;
|
||
|
||
--secondary-text-color: #757575;
|
||
|
||
--disabled-text-color: #bdbdbd;
|
||
|
||
--divider-color: #e0e0e0;
|
||
|
||
}
|
||
|
||
</style>
|
||
<script>
|
||
|
||
/**
|
||
* @demo demo/index.html
|
||
* @polymerBehavior
|
||
*/
|
||
Polymer.IronControlState = {
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* If true, the element currently has focus.
|
||
*/
|
||
focused: {
|
||
type: Boolean,
|
||
value: false,
|
||
notify: true,
|
||
readOnly: true,
|
||
reflectToAttribute: true
|
||
},
|
||
|
||
/**
|
||
* If true, the user cannot interact with this element.
|
||
*/
|
||
disabled: {
|
||
type: Boolean,
|
||
value: false,
|
||
notify: true,
|
||
observer: '_disabledChanged',
|
||
reflectToAttribute: true
|
||
},
|
||
|
||
_oldTabIndex: {
|
||
type: Number
|
||
},
|
||
|
||
_boundFocusBlurHandler: {
|
||
type: Function,
|
||
value: function() {
|
||
return this._focusBlurHandler.bind(this);
|
||
}
|
||
}
|
||
|
||
},
|
||
|
||
observers: [
|
||
'_changedControlState(focused, disabled)'
|
||
],
|
||
|
||
ready: function() {
|
||
// TODO(sjmiles): ensure read-only property is valued so the compound
|
||
// observer will fire
|
||
if (this.focused === undefined) {
|
||
this._setFocused(false);
|
||
}
|
||
this.addEventListener('focus', this._boundFocusBlurHandler, true);
|
||
this.addEventListener('blur', this._boundFocusBlurHandler, true);
|
||
},
|
||
|
||
_focusBlurHandler: function(event) {
|
||
var target = event.path ? event.path[0] : event.target;
|
||
if (target === this) {
|
||
var focused = event.type === 'focus';
|
||
this._setFocused(focused);
|
||
} else if (!this.shadowRoot) {
|
||
event.stopPropagation();
|
||
this.fire(event.type, {sourceEvent: event}, {
|
||
node: this,
|
||
bubbles: event.bubbles,
|
||
cancelable: event.cancelable
|
||
});
|
||
}
|
||
},
|
||
|
||
_disabledChanged: function(disabled, old) {
|
||
this.setAttribute('aria-disabled', disabled ? 'true' : 'false');
|
||
this.style.pointerEvents = disabled ? 'none' : '';
|
||
if (disabled) {
|
||
this._oldTabIndex = this.tabIndex;
|
||
this.focused = false;
|
||
this.tabIndex = -1;
|
||
} else if (this._oldTabIndex !== undefined) {
|
||
this.tabIndex = this._oldTabIndex;
|
||
}
|
||
},
|
||
|
||
_changedControlState: function() {
|
||
// _controlStateChanged is abstract, follow-on behaviors may implement it
|
||
if (this._controlStateChanged) {
|
||
this._controlStateChanged();
|
||
}
|
||
}
|
||
|
||
};
|
||
|
||
</script>
|
||
<script>
|
||
|
||
/**
|
||
* @demo demo/index.html
|
||
* @polymerBehavior
|
||
*/
|
||
Polymer.IronButtonStateImpl = {
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* If true, the user is currently holding down the button.
|
||
*/
|
||
pressed: {
|
||
type: Boolean,
|
||
readOnly: true,
|
||
value: false,
|
||
reflectToAttribute: true,
|
||
observer: '_pressedChanged'
|
||
},
|
||
|
||
/**
|
||
* If true, the button toggles the active state with each tap or press
|
||
* of the spacebar.
|
||
*/
|
||
toggles: {
|
||
type: Boolean,
|
||
value: false,
|
||
reflectToAttribute: true
|
||
},
|
||
|
||
/**
|
||
* If true, the button is a toggle and is currently in the active state.
|
||
*/
|
||
active: {
|
||
type: Boolean,
|
||
value: false,
|
||
notify: true,
|
||
reflectToAttribute: true,
|
||
observer: '_activeChanged'
|
||
},
|
||
|
||
/**
|
||
* True if the element is currently being pressed by a "pointer," which
|
||
* is loosely defined as mouse or touch input (but specifically excluding
|
||
* keyboard input).
|
||
*/
|
||
pointerDown: {
|
||
type: Boolean,
|
||
readOnly: true,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* True if the input device that caused the element to receive focus
|
||
* was a keyboard.
|
||
*/
|
||
receivedFocusFromKeyboard: {
|
||
type: Boolean,
|
||
readOnly: true
|
||
}
|
||
},
|
||
|
||
listeners: {
|
||
down: '_downHandler',
|
||
up: '_upHandler',
|
||
tap: '_tapHandler'
|
||
},
|
||
|
||
observers: [
|
||
'_detectKeyboardFocus(focused)'
|
||
],
|
||
|
||
keyBindings: {
|
||
'enter:keydown': '_asyncClick',
|
||
'space:keydown': '_spaceKeyDownHandler',
|
||
'space:keyup': '_spaceKeyUpHandler',
|
||
},
|
||
|
||
_tapHandler: function() {
|
||
if (this.toggles) {
|
||
// a tap is needed to toggle the active state
|
||
this._userActivate(!this.active);
|
||
} else {
|
||
this.active = false;
|
||
}
|
||
},
|
||
|
||
_detectKeyboardFocus: function(focused) {
|
||
this._setReceivedFocusFromKeyboard(!this.pointerDown && focused);
|
||
},
|
||
|
||
// to emulate native checkbox, (de-)activations from a user interaction fire
|
||
// 'change' events
|
||
_userActivate: function(active) {
|
||
this.active = active;
|
||
this.fire('change');
|
||
},
|
||
|
||
_downHandler: function() {
|
||
this._setPointerDown(true);
|
||
this._setPressed(true);
|
||
this._setReceivedFocusFromKeyboard(false);
|
||
},
|
||
|
||
_upHandler: function() {
|
||
this._setPointerDown(false);
|
||
this._setPressed(false);
|
||
},
|
||
|
||
_spaceKeyDownHandler: function(event) {
|
||
var keyboardEvent = event.detail.keyboardEvent;
|
||
keyboardEvent.preventDefault();
|
||
keyboardEvent.stopImmediatePropagation();
|
||
this._setPressed(true);
|
||
},
|
||
|
||
_spaceKeyUpHandler: function() {
|
||
if (this.pressed) {
|
||
this._asyncClick();
|
||
}
|
||
this._setPressed(false);
|
||
},
|
||
|
||
// trigger click asynchronously, the asynchrony is useful to allow one
|
||
// event handler to unwind before triggering another event
|
||
_asyncClick: function() {
|
||
this.async(function() {
|
||
this.click();
|
||
}, 1);
|
||
},
|
||
|
||
// any of these changes are considered a change to button state
|
||
|
||
_pressedChanged: function(pressed) {
|
||
this._changedButtonState();
|
||
},
|
||
|
||
_activeChanged: function(active) {
|
||
if (this.toggles) {
|
||
this.setAttribute('aria-pressed', active ? 'true' : 'false');
|
||
} else {
|
||
this.removeAttribute('aria-pressed');
|
||
}
|
||
this._changedButtonState();
|
||
},
|
||
|
||
_controlStateChanged: function() {
|
||
if (this.disabled) {
|
||
this._setPressed(false);
|
||
} else {
|
||
this._changedButtonState();
|
||
}
|
||
},
|
||
|
||
// provide hook for follow-on behaviors to react to button-state
|
||
|
||
_changedButtonState: function() {
|
||
if (this._buttonStateChanged) {
|
||
this._buttonStateChanged(); // abstract
|
||
}
|
||
}
|
||
|
||
};
|
||
|
||
/** @polymerBehavior Polymer.IronButtonState */
|
||
Polymer.IronButtonState = [
|
||
Polymer.IronA11yKeysBehavior,
|
||
Polymer.IronButtonStateImpl
|
||
];
|
||
|
||
</script>
|
||
<script>
|
||
|
||
/**
|
||
* `Polymer.PaperInkyFocusBehavior` implements a ripple when the element has keyboard focus.
|
||
*
|
||
* @polymerBehavior Polymer.PaperInkyFocusBehavior
|
||
*/
|
||
Polymer.PaperInkyFocusBehaviorImpl = {
|
||
|
||
observers: [
|
||
'_focusedChanged(receivedFocusFromKeyboard)'
|
||
],
|
||
|
||
_focusedChanged: function(receivedFocusFromKeyboard) {
|
||
if (!this.$.ink) {
|
||
return;
|
||
}
|
||
|
||
this.$.ink.holdDown = receivedFocusFromKeyboard;
|
||
}
|
||
|
||
};
|
||
|
||
/** @polymerBehavior Polymer.PaperInkyFocusBehavior */
|
||
Polymer.PaperInkyFocusBehavior = [
|
||
Polymer.IronButtonState,
|
||
Polymer.IronControlState,
|
||
Polymer.PaperInkyFocusBehaviorImpl
|
||
];
|
||
|
||
</script>
|
||
|
||
|
||
<style is="custom-style">
|
||
|
||
:root {
|
||
|
||
--shadow-transition: {
|
||
transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
|
||
};
|
||
|
||
/* from http://codepen.io/shyndman/pen/c5394ddf2e8b2a5c9185904b57421cdb */
|
||
|
||
--shadow-elevation-2dp: {
|
||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14),
|
||
0 1px 5px 0 rgba(0, 0, 0, 0.12),
|
||
0 3px 1px -2px rgba(0, 0, 0, 0.2);
|
||
};
|
||
|
||
--shadow-elevation-3dp: {
|
||
box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.14),
|
||
0 1px 8px 0 rgba(0, 0, 0, 0.12),
|
||
0 3px 3px -2px rgba(0, 0, 0, 0.4);
|
||
};
|
||
|
||
--shadow-elevation-4dp: {
|
||
box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14),
|
||
0 1px 10px 0 rgba(0, 0, 0, 0.12),
|
||
0 2px 4px -1px rgba(0, 0, 0, 0.4);
|
||
};
|
||
|
||
--shadow-elevation-6dp: {
|
||
box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.14),
|
||
0 1px 18px 0 rgba(0, 0, 0, 0.12),
|
||
0 3px 5px -1px rgba(0, 0, 0, 0.4);
|
||
};
|
||
|
||
--shadow-elevation-8dp: {
|
||
box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),
|
||
0 3px 14px 2px rgba(0, 0, 0, 0.12),
|
||
0 5px 5px -3px rgba(0, 0, 0, 0.4);
|
||
};
|
||
|
||
--shadow-elevation-16dp: {
|
||
box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14),
|
||
0 6px 30px 5px rgba(0, 0, 0, 0.12),
|
||
0 8px 10px -5px rgba(0, 0, 0, 0.4);
|
||
};
|
||
|
||
}
|
||
|
||
</style>
|
||
|
||
|
||
<script>
|
||
|
||
/** @polymerBehavior */
|
||
Polymer.PaperButtonBehaviorImpl = {
|
||
|
||
properties: {
|
||
|
||
_elevation: {
|
||
type: Number
|
||
}
|
||
|
||
},
|
||
|
||
observers: [
|
||
'_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)'
|
||
],
|
||
|
||
hostAttributes: {
|
||
role: 'button',
|
||
tabindex: '0'
|
||
},
|
||
|
||
_calculateElevation: function() {
|
||
var e = 1;
|
||
if (this.disabled) {
|
||
e = 0;
|
||
} else if (this.active || this.pressed) {
|
||
e = 4;
|
||
} else if (this.receivedFocusFromKeyboard) {
|
||
e = 3;
|
||
}
|
||
this._elevation = e;
|
||
}
|
||
};
|
||
|
||
/** @polymerBehavior */
|
||
Polymer.PaperButtonBehavior = [
|
||
Polymer.IronButtonState,
|
||
Polymer.IronControlState,
|
||
Polymer.PaperButtonBehaviorImpl
|
||
];
|
||
|
||
</script>
|
||
|
||
|
||
<style>
|
||
|
||
/*******************************
|
||
Flex Layout
|
||
*******************************/
|
||
|
||
html /deep/ .layout.horizontal,
|
||
html /deep/ .layout.horizontal-reverse,
|
||
html /deep/ .layout.vertical,
|
||
html /deep/ .layout.vertical-reverse {
|
||
display: -ms-flexbox;
|
||
display: -webkit-flex;
|
||
display: flex;
|
||
}
|
||
|
||
html /deep/ .layout.inline {
|
||
display: -ms-inline-flexbox;
|
||
display: -webkit-inline-flex;
|
||
display: inline-flex;
|
||
}
|
||
|
||
html /deep/ .layout.horizontal {
|
||
-ms-flex-direction: row;
|
||
-webkit-flex-direction: row;
|
||
flex-direction: row;
|
||
}
|
||
|
||
html /deep/ .layout.horizontal-reverse {
|
||
-ms-flex-direction: row-reverse;
|
||
-webkit-flex-direction: row-reverse;
|
||
flex-direction: row-reverse;
|
||
}
|
||
|
||
html /deep/ .layout.vertical {
|
||
-ms-flex-direction: column;
|
||
-webkit-flex-direction: column;
|
||
flex-direction: column;
|
||
}
|
||
|
||
html /deep/ .layout.vertical-reverse {
|
||
-ms-flex-direction: column-reverse;
|
||
-webkit-flex-direction: column-reverse;
|
||
flex-direction: column-reverse;
|
||
}
|
||
|
||
html /deep/ .layout.wrap {
|
||
-ms-flex-wrap: wrap;
|
||
-webkit-flex-wrap: wrap;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
html /deep/ .layout.wrap-reverse {
|
||
-ms-flex-wrap: wrap-reverse;
|
||
-webkit-flex-wrap: wrap-reverse;
|
||
flex-wrap: wrap-reverse;
|
||
}
|
||
|
||
html /deep/ .flex-auto {
|
||
-ms-flex: 1 1 auto;
|
||
-webkit-flex: 1 1 auto;
|
||
flex: 1 1 auto;
|
||
}
|
||
|
||
html /deep/ .flex-none {
|
||
-ms-flex: none;
|
||
-webkit-flex: none;
|
||
flex: none;
|
||
}
|
||
|
||
html /deep/ .flex,
|
||
html /deep/ .flex-1 {
|
||
-ms-flex: 1;
|
||
-webkit-flex: 1;
|
||
flex: 1;
|
||
}
|
||
|
||
html /deep/ .flex-2 {
|
||
-ms-flex: 2;
|
||
-webkit-flex: 2;
|
||
flex: 2;
|
||
}
|
||
|
||
html /deep/ .flex-3 {
|
||
-ms-flex: 3;
|
||
-webkit-flex: 3;
|
||
flex: 3;
|
||
}
|
||
|
||
html /deep/ .flex-4 {
|
||
-ms-flex: 4;
|
||
-webkit-flex: 4;
|
||
flex: 4;
|
||
}
|
||
|
||
html /deep/ .flex-5 {
|
||
-ms-flex: 5;
|
||
-webkit-flex: 5;
|
||
flex: 5;
|
||
}
|
||
|
||
html /deep/ .flex-6 {
|
||
-ms-flex: 6;
|
||
-webkit-flex: 6;
|
||
flex: 6;
|
||
}
|
||
|
||
html /deep/ .flex-7 {
|
||
-ms-flex: 7;
|
||
-webkit-flex: 7;
|
||
flex: 7;
|
||
}
|
||
|
||
html /deep/ .flex-8 {
|
||
-ms-flex: 8;
|
||
-webkit-flex: 8;
|
||
flex: 8;
|
||
}
|
||
|
||
html /deep/ .flex-9 {
|
||
-ms-flex: 9;
|
||
-webkit-flex: 9;
|
||
flex: 9;
|
||
}
|
||
|
||
html /deep/ .flex-10 {
|
||
-ms-flex: 10;
|
||
-webkit-flex: 10;
|
||
flex: 10;
|
||
}
|
||
|
||
html /deep/ .flex-11 {
|
||
-ms-flex: 11;
|
||
-webkit-flex: 11;
|
||
flex: 11;
|
||
}
|
||
|
||
html /deep/ .flex-12 {
|
||
-ms-flex: 12;
|
||
-webkit-flex: 12;
|
||
flex: 12;
|
||
}
|
||
|
||
/* alignment in cross axis */
|
||
|
||
html /deep/ .layout.start {
|
||
-ms-flex-align: start;
|
||
-webkit-align-items: flex-start;
|
||
align-items: flex-start;
|
||
}
|
||
|
||
html /deep/ .layout.center,
|
||
html /deep/ .layout.center-center {
|
||
-ms-flex-align: center;
|
||
-webkit-align-items: center;
|
||
align-items: center;
|
||
}
|
||
|
||
html /deep/ .layout.end {
|
||
-ms-flex-align: end;
|
||
-webkit-align-items: flex-end;
|
||
align-items: flex-end;
|
||
}
|
||
|
||
/* alignment in main axis */
|
||
|
||
html /deep/ .layout.start-justified {
|
||
-ms-flex-pack: start;
|
||
-webkit-justify-content: flex-start;
|
||
justify-content: flex-start;
|
||
}
|
||
|
||
html /deep/ .layout.center-justified,
|
||
html /deep/ .layout.center-center {
|
||
-ms-flex-pack: center;
|
||
-webkit-justify-content: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
html /deep/ .layout.end-justified {
|
||
-ms-flex-pack: end;
|
||
-webkit-justify-content: flex-end;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
html /deep/ .layout.around-justified {
|
||
-ms-flex-pack: around;
|
||
-webkit-justify-content: space-around;
|
||
justify-content: space-around;
|
||
}
|
||
|
||
html /deep/ .layout.justified {
|
||
-ms-flex-pack: justify;
|
||
-webkit-justify-content: space-between;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
/* self alignment */
|
||
|
||
html /deep/ .self-start {
|
||
-ms-align-self: flex-start;
|
||
-webkit-align-self: flex-start;
|
||
align-self: flex-start;
|
||
}
|
||
|
||
html /deep/ .self-center {
|
||
-ms-align-self: center;
|
||
-webkit-align-self: center;
|
||
align-self: center;
|
||
}
|
||
|
||
html /deep/ .self-end {
|
||
-ms-align-self: flex-end;
|
||
-webkit-align-self: flex-end;
|
||
align-self: flex-end;
|
||
}
|
||
|
||
html /deep/ .self-stretch {
|
||
-ms-align-self: stretch;
|
||
-webkit-align-self: stretch;
|
||
align-self: stretch;
|
||
}
|
||
|
||
/*******************************
|
||
Other Layout
|
||
*******************************/
|
||
|
||
html /deep/ .block {
|
||
display: block;
|
||
}
|
||
|
||
/* IE 10 support for HTML5 hidden attr */
|
||
html /deep/ [hidden] {
|
||
display: none !important;
|
||
}
|
||
|
||
html /deep/ .invisible {
|
||
visibility: hidden !important;
|
||
}
|
||
|
||
html /deep/ .relative {
|
||
position: relative;
|
||
}
|
||
|
||
html /deep/ .fit {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
body.fullbleed {
|
||
margin: 0;
|
||
height: 100vh;
|
||
}
|
||
|
||
html /deep/ .scroll {
|
||
-webkit-overflow-scrolling: touch;
|
||
overflow: auto;
|
||
}
|
||
|
||
.fixed-bottom,
|
||
.fixed-left,
|
||
.fixed-right,
|
||
.fixed-top {
|
||
position: fixed;
|
||
}
|
||
|
||
html /deep/ .fixed-top {
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
}
|
||
|
||
html /deep/ .fixed-right {
|
||
top: 0;
|
||
right: 0;
|
||
botttom: 0;
|
||
}
|
||
|
||
html /deep/ .fixed-bottom {
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
html /deep/ .fixed-left {
|
||
top: 0;
|
||
botttom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
</style>
|
||
<style>
|
||
|
||
/*******************************
|
||
Flex Layout
|
||
*******************************/
|
||
|
||
.layout.horizontal,
|
||
.layout.horizontal-reverse,
|
||
.layout.vertical,
|
||
.layout.vertical-reverse {
|
||
display: -ms-flexbox;
|
||
display: -webkit-flex;
|
||
display: flex;
|
||
}
|
||
|
||
.layout.inline {
|
||
display: -ms-inline-flexbox;
|
||
display: -webkit-inline-flex;
|
||
display: inline-flex;
|
||
}
|
||
|
||
.layout.horizontal {
|
||
-ms-flex-direction: row;
|
||
-webkit-flex-direction: row;
|
||
flex-direction: row;
|
||
}
|
||
|
||
.layout.horizontal-reverse {
|
||
-ms-flex-direction: row-reverse;
|
||
-webkit-flex-direction: row-reverse;
|
||
flex-direction: row-reverse;
|
||
}
|
||
|
||
.layout.vertical {
|
||
-ms-flex-direction: column;
|
||
-webkit-flex-direction: column;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.layout.vertical-reverse {
|
||
-ms-flex-direction: column-reverse;
|
||
-webkit-flex-direction: column-reverse;
|
||
flex-direction: column-reverse;
|
||
}
|
||
|
||
.layout.wrap {
|
||
-ms-flex-wrap: wrap;
|
||
-webkit-flex-wrap: wrap;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.layout.wrap-reverse {
|
||
-ms-flex-wrap: wrap-reverse;
|
||
-webkit-flex-wrap: wrap-reverse;
|
||
flex-wrap: wrap-reverse;
|
||
}
|
||
|
||
.flex-auto {
|
||
-ms-flex: 1 1 auto;
|
||
-webkit-flex: 1 1 auto;
|
||
flex: 1 1 auto;
|
||
}
|
||
|
||
.flex-none {
|
||
-ms-flex: none;
|
||
-webkit-flex: none;
|
||
flex: none;
|
||
}
|
||
|
||
.flex,
|
||
.flex-1 {
|
||
-ms-flex: 1;
|
||
-webkit-flex: 1;
|
||
flex: 1;
|
||
}
|
||
|
||
.flex-2 {
|
||
-ms-flex: 2;
|
||
-webkit-flex: 2;
|
||
flex: 2;
|
||
}
|
||
|
||
.flex-3 {
|
||
-ms-flex: 3;
|
||
-webkit-flex: 3;
|
||
flex: 3;
|
||
}
|
||
|
||
.flex-4 {
|
||
-ms-flex: 4;
|
||
-webkit-flex: 4;
|
||
flex: 4;
|
||
}
|
||
|
||
.flex-5 {
|
||
-ms-flex: 5;
|
||
-webkit-flex: 5;
|
||
flex: 5;
|
||
}
|
||
|
||
.flex-6 {
|
||
-ms-flex: 6;
|
||
-webkit-flex: 6;
|
||
flex: 6;
|
||
}
|
||
|
||
.flex-7 {
|
||
-ms-flex: 7;
|
||
-webkit-flex: 7;
|
||
flex: 7;
|
||
}
|
||
|
||
.flex-8 {
|
||
-ms-flex: 8;
|
||
-webkit-flex: 8;
|
||
flex: 8;
|
||
}
|
||
|
||
.flex-9 {
|
||
-ms-flex: 9;
|
||
-webkit-flex: 9;
|
||
flex: 9;
|
||
}
|
||
|
||
.flex-10 {
|
||
-ms-flex: 10;
|
||
-webkit-flex: 10;
|
||
flex: 10;
|
||
}
|
||
|
||
.flex-11 {
|
||
-ms-flex: 11;
|
||
-webkit-flex: 11;
|
||
flex: 11;
|
||
}
|
||
|
||
.flex-12 {
|
||
-ms-flex: 12;
|
||
-webkit-flex: 12;
|
||
flex: 12;
|
||
}
|
||
|
||
/* alignment in cross axis */
|
||
|
||
.layout.start {
|
||
-ms-flex-align: start;
|
||
-webkit-align-items: flex-start;
|
||
align-items: flex-start;
|
||
}
|
||
|
||
.layout.center,
|
||
.layout.center-center {
|
||
-ms-flex-align: center;
|
||
-webkit-align-items: center;
|
||
align-items: center;
|
||
}
|
||
|
||
.layout.end {
|
||
-ms-flex-align: end;
|
||
-webkit-align-items: flex-end;
|
||
align-items: flex-end;
|
||
}
|
||
|
||
/* alignment in main axis */
|
||
|
||
.layout.start-justified {
|
||
-ms-flex-pack: start;
|
||
-webkit-justify-content: flex-start;
|
||
justify-content: flex-start;
|
||
}
|
||
|
||
.layout.center-justified,
|
||
.layout.center-center {
|
||
-ms-flex-pack: center;
|
||
-webkit-justify-content: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.layout.end-justified {
|
||
-ms-flex-pack: end;
|
||
-webkit-justify-content: flex-end;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.layout.around-justified {
|
||
-ms-flex-pack: around;
|
||
-webkit-justify-content: space-around;
|
||
justify-content: space-around;
|
||
}
|
||
|
||
.layout.justified {
|
||
-ms-flex-pack: justify;
|
||
-webkit-justify-content: space-between;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
/* self alignment */
|
||
|
||
.self-start {
|
||
-ms-align-self: flex-start;
|
||
-webkit-align-self: flex-start;
|
||
align-self: flex-start;
|
||
}
|
||
|
||
.self-center {
|
||
-ms-align-self: center;
|
||
-webkit-align-self: center;
|
||
align-self: center;
|
||
}
|
||
|
||
.self-end {
|
||
-ms-align-self: flex-end;
|
||
-webkit-align-self: flex-end;
|
||
align-self: flex-end;
|
||
}
|
||
|
||
.self-stretch {
|
||
-ms-align-self: stretch;
|
||
-webkit-align-self: stretch;
|
||
align-self: stretch;
|
||
}
|
||
|
||
/*******************************
|
||
Other Layout
|
||
*******************************/
|
||
|
||
.block {
|
||
display: block;
|
||
}
|
||
|
||
/* IE 10 support for HTML5 hidden attr */
|
||
[hidden] {
|
||
display: none !important;
|
||
}
|
||
|
||
.invisible {
|
||
visibility: hidden !important;
|
||
}
|
||
|
||
.relative {
|
||
position: relative;
|
||
}
|
||
|
||
.fit {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
body.fullbleed {
|
||
margin: 0;
|
||
height: 100vh;
|
||
}
|
||
|
||
.scroll {
|
||
-webkit-overflow-scrolling: touch;
|
||
overflow: auto;
|
||
}
|
||
|
||
/* fixed position */
|
||
|
||
.fixed-bottom,
|
||
.fixed-left,
|
||
.fixed-right,
|
||
.fixed-top {
|
||
position: fixed;
|
||
}
|
||
|
||
.fixed-top {
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
}
|
||
|
||
.fixed-right {
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
}
|
||
|
||
.fixed-bottom {
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
.fixed-left {
|
||
top: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
</style>
|
||
<style is="custom-style">
|
||
|
||
:root {
|
||
|
||
/* Material Design color palette for Google products */
|
||
|
||
--google-red-100: #f4c7c3;
|
||
--google-red-300: #e67c73;
|
||
--google-red-500: #db4437;
|
||
--google-red-700: #c53929;
|
||
|
||
--google-blue-100: #c6dafc;
|
||
--google-blue-300: #7baaf7;
|
||
--google-blue-500: #4285f4;
|
||
--google-blue-700: #3367d6;
|
||
|
||
--google-green-100: #b7e1cd;
|
||
--google-green-300: #57bb8a;
|
||
--google-green-500: #0f9d58;
|
||
--google-green-700: #0b8043;
|
||
|
||
--google-yellow-100: #fce8b2;
|
||
--google-yellow-300: #f7cb4d;
|
||
--google-yellow-500: #f4b400;
|
||
--google-yellow-700: #f09300;
|
||
|
||
--google-grey-100: #f5f5f5;
|
||
--google-grey-300: #e0e0e0;
|
||
--google-grey-500: #9e9e9e;
|
||
--google-grey-700: #616161;
|
||
|
||
/* Material Design color palette from online spec document */
|
||
|
||
--paper-red-50: #ffebee;
|
||
--paper-red-100: #ffcdd2;
|
||
--paper-red-200: #ef9a9a;
|
||
--paper-red-300: #e57373;
|
||
--paper-red-400: #ef5350;
|
||
--paper-red-500: #f44336;
|
||
--paper-red-600: #e53935;
|
||
--paper-red-700: #d32f2f;
|
||
--paper-red-800: #c62828;
|
||
--paper-red-900: #b71c1c;
|
||
--paper-red-a100: #ff8a80;
|
||
--paper-red-a200: #ff5252;
|
||
--paper-red-a400: #ff1744;
|
||
--paper-red-a700: #d50000;
|
||
|
||
--paper-pink-50: #fce4ec;
|
||
--paper-pink-100: #f8bbd0;
|
||
--paper-pink-200: #f48fb1;
|
||
--paper-pink-300: #f06292;
|
||
--paper-pink-400: #ec407a;
|
||
--paper-pink-500: #e91e63;
|
||
--paper-pink-600: #d81b60;
|
||
--paper-pink-700: #c2185b;
|
||
--paper-pink-800: #ad1457;
|
||
--paper-pink-900: #880e4f;
|
||
--paper-pink-a100: #ff80ab;
|
||
--paper-pink-a200: #ff4081;
|
||
--paper-pink-a400: #f50057;
|
||
--paper-pink-a700: #c51162;
|
||
|
||
--paper-purple-50: #f3e5f5;
|
||
--paper-purple-100: #e1bee7;
|
||
--paper-purple-200: #ce93d8;
|
||
--paper-purple-300: #ba68c8;
|
||
--paper-purple-400: #ab47bc;
|
||
--paper-purple-500: #9c27b0;
|
||
--paper-purple-600: #8e24aa;
|
||
--paper-purple-700: #7b1fa2;
|
||
--paper-purple-800: #6a1b9a;
|
||
--paper-purple-900: #4a148c;
|
||
--paper-purple-a100: #ea80fc;
|
||
--paper-purple-a200: #e040fb;
|
||
--paper-purple-a400: #d500f9;
|
||
--paper-purple-a700: #aa00ff;
|
||
|
||
--paper-deep-purple-50: #ede7f6;
|
||
--paper-deep-purple-100: #d1c4e9;
|
||
--paper-deep-purple-200: #b39ddb;
|
||
--paper-deep-purple-300: #9575cd;
|
||
--paper-deep-purple-400: #7e57c2;
|
||
--paper-deep-purple-500: #673ab7;
|
||
--paper-deep-purple-600: #5e35b1;
|
||
--paper-deep-purple-700: #512da8;
|
||
--paper-deep-purple-800: #4527a0;
|
||
--paper-deep-purple-900: #311b92;
|
||
--paper-deep-purple-a100: #b388ff;
|
||
--paper-deep-purple-a200: #7c4dff;
|
||
--paper-deep-purple-a400: #651fff;
|
||
--paper-deep-purple-a700: #6200ea;
|
||
|
||
--paper-indigo-50: #e8eaf6;
|
||
--paper-indigo-100: #c5cae9;
|
||
--paper-indigo-200: #9fa8da;
|
||
--paper-indigo-300: #7986cb;
|
||
--paper-indigo-400: #5c6bc0;
|
||
--paper-indigo-500: #3f51b5;
|
||
--paper-indigo-600: #3949ab;
|
||
--paper-indigo-700: #303f9f;
|
||
--paper-indigo-800: #283593;
|
||
--paper-indigo-900: #1a237e;
|
||
--paper-indigo-a100: #8c9eff;
|
||
--paper-indigo-a200: #536dfe;
|
||
--paper-indigo-a400: #3d5afe;
|
||
--paper-indigo-a700: #304ffe;
|
||
|
||
--paper-blue-50: #e3f2fd;
|
||
--paper-blue-100: #bbdefb;
|
||
--paper-blue-200: #90caf9;
|
||
--paper-blue-300: #64b5f6;
|
||
--paper-blue-400: #42a5f5;
|
||
--paper-blue-500: #2196f3;
|
||
--paper-blue-600: #1e88e5;
|
||
--paper-blue-700: #1976d2;
|
||
--paper-blue-800: #1565c0;
|
||
--paper-blue-900: #0d47a1;
|
||
--paper-blue-a100: #82b1ff;
|
||
--paper-blue-a200: #448aff;
|
||
--paper-blue-a400: #2979ff;
|
||
--paper-blue-a700: #2962ff;
|
||
|
||
--paper-light-blue-50: #e1f5fe;
|
||
--paper-light-blue-100: #b3e5fc;
|
||
--paper-light-blue-200: #81d4fa;
|
||
--paper-light-blue-300: #4fc3f7;
|
||
--paper-light-blue-400: #29b6f6;
|
||
--paper-light-blue-500: #03a9f4;
|
||
--paper-light-blue-600: #039be5;
|
||
--paper-light-blue-700: #0288d1;
|
||
--paper-light-blue-800: #0277bd;
|
||
--paper-light-blue-900: #01579b;
|
||
--paper-light-blue-a100: #80d8ff;
|
||
--paper-light-blue-a200: #40c4ff;
|
||
--paper-light-blue-a400: #00b0ff;
|
||
--paper-light-blue-a700: #0091ea;
|
||
|
||
--paper-cyan-50: #e0f7fa;
|
||
--paper-cyan-100: #b2ebf2;
|
||
--paper-cyan-200: #80deea;
|
||
--paper-cyan-300: #4dd0e1;
|
||
--paper-cyan-400: #26c6da;
|
||
--paper-cyan-500: #00bcd4;
|
||
--paper-cyan-600: #00acc1;
|
||
--paper-cyan-700: #0097a7;
|
||
--paper-cyan-800: #00838f;
|
||
--paper-cyan-900: #006064;
|
||
--paper-cyan-a100: #84ffff;
|
||
--paper-cyan-a200: #18ffff;
|
||
--paper-cyan-a400: #00e5ff;
|
||
--paper-cyan-a700: #00b8d4;
|
||
|
||
--paper-teal-50: #e0f2f1;
|
||
--paper-teal-100: #b2dfdb;
|
||
--paper-teal-200: #80cbc4;
|
||
--paper-teal-300: #4db6ac;
|
||
--paper-teal-400: #26a69a;
|
||
--paper-teal-500: #009688;
|
||
--paper-teal-600: #00897b;
|
||
--paper-teal-700: #00796b;
|
||
--paper-teal-800: #00695c;
|
||
--paper-teal-900: #004d40;
|
||
--paper-teal-a100: #a7ffeb;
|
||
--paper-teal-a200: #64ffda;
|
||
--paper-teal-a400: #1de9b6;
|
||
--paper-teal-a700: #00bfa5;
|
||
|
||
--paper-green-50: #e8f5e9;
|
||
--paper-green-100: #c8e6c9;
|
||
--paper-green-200: #a5d6a7;
|
||
--paper-green-300: #81c784;
|
||
--paper-green-400: #66bb6a;
|
||
--paper-green-500: #4caf50;
|
||
--paper-green-600: #43a047;
|
||
--paper-green-700: #388e3c;
|
||
--paper-green-800: #2e7d32;
|
||
--paper-green-900: #1b5e20;
|
||
--paper-green-a100: #b9f6ca;
|
||
--paper-green-a200: #69f0ae;
|
||
--paper-green-a400: #00e676;
|
||
--paper-green-a700: #00c853;
|
||
|
||
--paper-light-green-50: #f1f8e9;
|
||
--paper-light-green-100: #dcedc8;
|
||
--paper-light-green-200: #c5e1a5;
|
||
--paper-light-green-300: #aed581;
|
||
--paper-light-green-400: #9ccc65;
|
||
--paper-light-green-500: #8bc34a;
|
||
--paper-light-green-600: #7cb342;
|
||
--paper-light-green-700: #689f38;
|
||
--paper-light-green-800: #558b2f;
|
||
--paper-light-green-900: #33691e;
|
||
--paper-light-green-a100: #ccff90;
|
||
--paper-light-green-a200: #b2ff59;
|
||
--paper-light-green-a400: #76ff03;
|
||
--paper-light-green-a700: #64dd17;
|
||
|
||
--paper-lime-50: #f9fbe7;
|
||
--paper-lime-100: #f0f4c3;
|
||
--paper-lime-200: #e6ee9c;
|
||
--paper-lime-300: #dce775;
|
||
--paper-lime-400: #d4e157;
|
||
--paper-lime-500: #cddc39;
|
||
--paper-lime-600: #c0ca33;
|
||
--paper-lime-700: #afb42b;
|
||
--paper-lime-800: #9e9d24;
|
||
--paper-lime-900: #827717;
|
||
--paper-lime-a100: #f4ff81;
|
||
--paper-lime-a200: #eeff41;
|
||
--paper-lime-a400: #c6ff00;
|
||
--paper-lime-a700: #aeea00;
|
||
|
||
--paper-yellow-50: #fffde7;
|
||
--paper-yellow-100: #fff9c4;
|
||
--paper-yellow-200: #fff59d;
|
||
--paper-yellow-300: #fff176;
|
||
--paper-yellow-400: #ffee58;
|
||
--paper-yellow-500: #ffeb3b;
|
||
--paper-yellow-600: #fdd835;
|
||
--paper-yellow-700: #fbc02d;
|
||
--paper-yellow-800: #f9a825;
|
||
--paper-yellow-900: #f57f17;
|
||
--paper-yellow-a100: #ffff8d;
|
||
--paper-yellow-a200: #ffff00;
|
||
--paper-yellow-a400: #ffea00;
|
||
--paper-yellow-a700: #ffd600;
|
||
|
||
--paper-amber-50: #fff8e1;
|
||
--paper-amber-100: #ffecb3;
|
||
--paper-amber-200: #ffe082;
|
||
--paper-amber-300: #ffd54f;
|
||
--paper-amber-400: #ffca28;
|
||
--paper-amber-500: #ffc107;
|
||
--paper-amber-600: #ffb300;
|
||
--paper-amber-700: #ffa000;
|
||
--paper-amber-800: #ff8f00;
|
||
--paper-amber-900: #ff6f00;
|
||
--paper-amber-a100: #ffe57f;
|
||
--paper-amber-a200: #ffd740;
|
||
--paper-amber-a400: #ffc400;
|
||
--paper-amber-a700: #ffab00;
|
||
|
||
--paper-orange-50: #fff3e0;
|
||
--paper-orange-100: #ffe0b2;
|
||
--paper-orange-200: #ffcc80;
|
||
--paper-orange-300: #ffb74d;
|
||
--paper-orange-400: #ffa726;
|
||
--paper-orange-500: #ff9800;
|
||
--paper-orange-600: #fb8c00;
|
||
--paper-orange-700: #f57c00;
|
||
--paper-orange-800: #ef6c00;
|
||
--paper-orange-900: #e65100;
|
||
--paper-orange-a100: #ffd180;
|
||
--paper-orange-a200: #ffab40;
|
||
--paper-orange-a400: #ff9100;
|
||
--paper-orange-a700: #ff6500;
|
||
|
||
--paper-deep-orange-50: #ff5722;
|
||
--paper-deep-orange-100: #fbe9e7;
|
||
--paper-deep-orange-200: #ffccbc;
|
||
--paper-deep-orange-300: #ff8a65;
|
||
--paper-deep-orange-400: #ff7043;
|
||
--paper-deep-orange-500: #ff5722;
|
||
--paper-deep-orange-600: #f4511e;
|
||
--paper-deep-orange-700: #e64a19;
|
||
--paper-deep-orange-800: #d84315;
|
||
--paper-deep-orange-900: #bf360c;
|
||
--paper-deep-orange-a100: #ff9e80;
|
||
--paper-deep-orange-a200: #ff6e40;
|
||
--paper-deep-orange-a400: #ff3d00;
|
||
--paper-deep-orange-a700: #dd2c00;
|
||
|
||
--paper-brown-50: #efebe9;
|
||
--paper-brown-100: #d7ccc8;
|
||
--paper-brown-200: #bcaaa4;
|
||
--paper-brown-300: #a1887f;
|
||
--paper-brown-400: #8d6e63;
|
||
--paper-brown-500: #795548;
|
||
--paper-brown-600: #6d4c41;
|
||
--paper-brown-700: #5d4037;
|
||
--paper-brown-800: #4e342e;
|
||
--paper-brown-900: #3e2723;
|
||
|
||
--paper-grey-50: #fafafa;
|
||
--paper-grey-100: #f5f5f5;
|
||
--paper-grey-200: #eeeeee;
|
||
--paper-grey-300: #e0e0e0;
|
||
--paper-grey-400: #bdbdbd;
|
||
--paper-grey-500: #9e9e9e;
|
||
--paper-grey-600: #757575;
|
||
--paper-grey-700: #616161;
|
||
--paper-grey-800: #424242;
|
||
--paper-grey-900: #212121;
|
||
|
||
--paper-blue-grey-50: #eceff1;
|
||
--paper-blue-grey-100: #cfd8dc;
|
||
--paper-blue-grey-200: #b0bec5;
|
||
--paper-blue-grey-300: #90a4ae;
|
||
--paper-blue-grey-400: #78909c;
|
||
--paper-blue-grey-500: #607d8b;
|
||
--paper-blue-grey-600: #546e7a;
|
||
--paper-blue-grey-700: #455a64;
|
||
--paper-blue-grey-800: #37474f;
|
||
--paper-blue-grey-900: #263238;
|
||
|
||
/* opacity for dark text on a light background */
|
||
--dark-divider-opacity: 0.12;
|
||
--dark-disabled-opacity: 0.26; /* or hint text */
|
||
--dark-secondary-opacity: 0.54; /* or icon */
|
||
--dark-primary-opacity: 0.87;
|
||
|
||
/* opacity for light text on a dark background */
|
||
--light-divider-opacity: 0.12;
|
||
--light-disabled-opacity: 0.3; /* or hint text */
|
||
--light-secondary-opacity: 0.7; /* or icon */
|
||
--light-primary-opacity: 1.0;
|
||
|
||
}
|
||
|
||
</style>
|
||
|
||
<script>
|
||
|
||
/**
|
||
* Use `Polymer.PaperInputAddonBehavior` to implement an add-on for `<paper-input-container>`. A
|
||
* add-on appears below the input, and may display information based on the input value and
|
||
* validity such as a character counter or an error message.
|
||
* @polymerBehavior
|
||
*/
|
||
Polymer.PaperInputAddonBehavior = {
|
||
|
||
hostAttributes: {
|
||
'add-on': ''
|
||
},
|
||
|
||
attached: function() {
|
||
this.fire('addon-attached');
|
||
},
|
||
|
||
/**
|
||
* The function called by `<paper-input-container>` when the input value or validity changes.
|
||
* @param {{
|
||
* inputElement: (Node|undefined),
|
||
* value: (string|undefined),
|
||
* invalid: (boolean|undefined)
|
||
* }} state All properties are optional -
|
||
* inputElement: The input element.
|
||
* value: The input value.
|
||
* invalid: True if the input value is invalid.
|
||
*/
|
||
update: function(state) {
|
||
}
|
||
|
||
};
|
||
|
||
</script>
|
||
|
||
<script>
|
||
|
||
/**
|
||
* Use `Polymer.IronValidatableBehavior` to implement an element that validates user input.
|
||
*
|
||
* ### Accessiblity
|
||
*
|
||
* Changing the `invalid` property, either manually or by calling `validate()` will update the
|
||
* `aria-invalid` attribute.
|
||
*
|
||
* @demo demo/index.html
|
||
* @polymerBehavior
|
||
*/
|
||
Polymer.IronValidatableBehavior = {
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* Namespace for this validator.
|
||
*/
|
||
validatorType: {
|
||
type: String,
|
||
value: 'validator'
|
||
},
|
||
|
||
/**
|
||
* Name of the validator to use.
|
||
*/
|
||
validator: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* True if the last call to `validate` is invalid.
|
||
*/
|
||
invalid: {
|
||
notify: true,
|
||
reflectToAttribute: true,
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
_validatorMeta: {
|
||
type: Object
|
||
}
|
||
|
||
},
|
||
|
||
observers: [
|
||
'_invalidChanged(invalid)'
|
||
],
|
||
|
||
get _validator() {
|
||
return this._validatorMeta && this._validatorMeta.byKey(this.validator);
|
||
},
|
||
|
||
ready: function() {
|
||
this._validatorMeta = new Polymer.IronMeta({type: this.validatorType});
|
||
},
|
||
|
||
_invalidChanged: function() {
|
||
if (this.invalid) {
|
||
this.setAttribute('aria-invalid', 'true');
|
||
} else {
|
||
this.removeAttribute('aria-invalid');
|
||
}
|
||
},
|
||
|
||
/**
|
||
* @return {boolean} True if the validator `validator` exists.
|
||
*/
|
||
hasValidator: function() {
|
||
return this._validator != null;
|
||
},
|
||
|
||
/**
|
||
* @param {Object} values Passed to the validator's `validate()` function.
|
||
* @return {boolean} True if `values` is valid.
|
||
*/
|
||
validate: function(values) {
|
||
var valid = this._validator && this._validator.validate(values);
|
||
this.invalid = !valid;
|
||
return valid;
|
||
}
|
||
|
||
};
|
||
|
||
</script>
|
||
<script>
|
||
|
||
/*
|
||
`<iron-input>` adds two-way binding and custom validators using `Polymer.IronValidatorBehavior`
|
||
to `<input>`.
|
||
|
||
### Two-way binding
|
||
|
||
By default you can only get notified of changes to an `input`'s `value` due to user input:
|
||
|
||
<input value="{{myValue::input}}">
|
||
|
||
`iron-input` adds the `bind-value` property that mirrors the `value` property, and can be used
|
||
for two-way data binding. `bind-value` will notify if it is changed either by user input or by script.
|
||
|
||
<input is="iron-input" bind-value="{{myValue}}">
|
||
|
||
### Custom validators
|
||
|
||
You can use custom validators that implement `Polymer.IronValidatorBehavior` with `<iron-input>`.
|
||
|
||
<input is="iron-input" validator="my-custom-validator">
|
||
|
||
### Stopping invalid input
|
||
|
||
It may be desirable to only allow users to enter certain characters. You can use the
|
||
`prevent-invalid-input` and `allowed-pattern` attributes together to accomplish this. This feature
|
||
is separate from validation, and `allowed-pattern` does not affect how the input is validated.
|
||
|
||
<!-- only allow characters that match [0-9] -->
|
||
<input is="iron-input" prevent-invaild-input allowed-pattern="[0-9]">
|
||
|
||
@hero hero.svg
|
||
@demo demo/index.html
|
||
*/
|
||
|
||
Polymer({
|
||
|
||
is: 'iron-input',
|
||
|
||
extends: 'input',
|
||
|
||
behaviors: [
|
||
Polymer.IronValidatableBehavior
|
||
],
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* Use this property instead of `value` for two-way data binding.
|
||
*/
|
||
bindValue: {
|
||
observer: '_bindValueChanged',
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* Set to true to prevent the user from entering invalid input. The new input characters are
|
||
* matched with `allowedPattern` if it is set, otherwise it will use the `pattern` attribute if
|
||
* set, or the `type` attribute (only supported for `type=number`).
|
||
*/
|
||
preventInvalidInput: {
|
||
type: Boolean
|
||
},
|
||
|
||
/**
|
||
* Regular expression to match valid input characters.
|
||
*/
|
||
allowedPattern: {
|
||
type: String
|
||
},
|
||
|
||
_previousValidInput: {
|
||
type: String,
|
||
value: ''
|
||
},
|
||
|
||
_patternAlreadyChecked: {
|
||
type: Boolean,
|
||
value: false
|
||
}
|
||
|
||
},
|
||
|
||
listeners: {
|
||
'input': '_onInput',
|
||
'keypress': '_onKeypress'
|
||
},
|
||
|
||
get _patternRegExp() {
|
||
var pattern;
|
||
if (this.allowedPattern) {
|
||
pattern = new RegExp(this.allowedPattern);
|
||
} else if (this.pattern) {
|
||
pattern = new RegExp(this.pattern);
|
||
} else {
|
||
switch (this.type) {
|
||
case 'number':
|
||
pattern = /[0-9.,e-]/;
|
||
break;
|
||
}
|
||
}
|
||
return pattern;
|
||
},
|
||
|
||
ready: function() {
|
||
this.bindValue = this.value;
|
||
},
|
||
|
||
_bindValueChanged: function() {
|
||
if (this.value !== this.bindValue) {
|
||
this.value = !this.bindValue ? '' : this.bindValue;
|
||
}
|
||
// manually notify because we don't want to notify until after setting value
|
||
this.fire('bind-value-changed', {value: this.bindValue});
|
||
},
|
||
|
||
_onInput: function() {
|
||
// Need to validate each of the characters pasted if they haven't
|
||
// been validated inside `_onKeypress` already.
|
||
if (this.preventInvalidInput && !this._patternAlreadyChecked) {
|
||
var valid = this._checkPatternValidity();
|
||
if (!valid) {
|
||
this.value = this._previousValidInput;
|
||
}
|
||
}
|
||
|
||
this.bindValue = this.value;
|
||
this._previousValidInput = this.value;
|
||
this._patternAlreadyChecked = false;
|
||
},
|
||
|
||
_isPrintable: function(event) {
|
||
// What a control/printable character is varies wildly based on the browser.
|
||
// - most control characters (arrows, backspace) do not send a `keypress` event
|
||
// in Chrome, but the *do* on Firefox
|
||
// - in Firefox, when they do send a `keypress` event, control chars have
|
||
// a charCode = 0, keyCode = xx (for ex. 40 for down arrow)
|
||
// - printable characters always send a keypress event.
|
||
// - in Firefox, printable chars always have a keyCode = 0. In Chrome, the keyCode
|
||
// always matches the charCode.
|
||
// None of this makes any sense.
|
||
|
||
var nonPrintable =
|
||
(event.keyCode == 8) || // backspace
|
||
(event.keyCode == 19) || // pause
|
||
(event.keyCode == 20) || // caps lock
|
||
(event.keyCode == 27) || // escape
|
||
(event.keyCode == 45) || // insert
|
||
(event.keyCode == 46) || // delete
|
||
(event.keyCode == 144) || // num lock
|
||
(event.keyCode == 145) || // scroll lock
|
||
(event.keyCode > 32 && event.keyCode < 41) || // page up/down, end, home, arrows
|
||
(event.keyCode > 111 && event.keyCode < 124); // fn keys
|
||
|
||
return !(event.charCode == 0 && nonPrintable);
|
||
},
|
||
|
||
_onKeypress: function(event) {
|
||
if (!this.preventInvalidInput && this.type !== 'number') {
|
||
return;
|
||
}
|
||
var regexp = this._patternRegExp;
|
||
if (!regexp) {
|
||
return;
|
||
}
|
||
|
||
// Handle special keys and backspace
|
||
if (event.metaKey || event.ctrlKey || event.altKey)
|
||
return;
|
||
|
||
// Check the pattern either here or in `_onInput`, but not in both.
|
||
this._patternAlreadyChecked = true;
|
||
|
||
var thisChar = String.fromCharCode(event.charCode);
|
||
if (this._isPrintable(event) && !regexp.test(thisChar)) {
|
||
event.preventDefault();
|
||
}
|
||
},
|
||
|
||
_checkPatternValidity: function() {
|
||
var regexp = this._patternRegExp;
|
||
if (!regexp) {
|
||
return true;
|
||
}
|
||
for (var i = 0; i < this.value.length; i++) {
|
||
if (!regexp.test(this.value[i])) {
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
},
|
||
|
||
/**
|
||
* Returns true if `value` is valid. The validator provided in `validator` will be used first,
|
||
* then any constraints.
|
||
* @return {boolean} True if the value is valid.
|
||
*/
|
||
validate: function() {
|
||
// Empty, non-required input is valid.
|
||
if (!this.required && this.value == '') {
|
||
this.invalid = false;
|
||
return true;
|
||
}
|
||
|
||
var valid;
|
||
if (this.hasValidator()) {
|
||
valid = Polymer.IronValidatableBehavior.validate.call(this, this.value);
|
||
} else {
|
||
this.invalid = !this.validity.valid;
|
||
valid = this.validity.valid;
|
||
}
|
||
this.fire('iron-input-validate');
|
||
return valid;
|
||
}
|
||
|
||
});
|
||
|
||
/*
|
||
The `iron-input-validate` event is fired whenever `validate()` is called.
|
||
@event iron-input-validate
|
||
*/
|
||
|
||
</script>
|
||
|
||
|
||
|
||
|
||
<script>
|
||
|
||
Polymer({
|
||
|
||
is: 'iron-media-query',
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The Boolean return value of the media query.
|
||
*
|
||
* @attribute queryMatches
|
||
* @type Boolean
|
||
* @default false
|
||
*/
|
||
queryMatches: {
|
||
type: Boolean,
|
||
value: false,
|
||
readOnly: true,
|
||
notify: true
|
||
},
|
||
|
||
/**
|
||
* The CSS media query to evaluate.
|
||
*
|
||
* @attribute query
|
||
* @type String
|
||
*/
|
||
query: {
|
||
type: String,
|
||
observer: 'queryChanged'
|
||
}
|
||
|
||
},
|
||
|
||
created: function() {
|
||
this._mqHandler = this.queryHandler.bind(this);
|
||
},
|
||
|
||
queryChanged: function(query) {
|
||
if (this._mq) {
|
||
this._mq.removeListener(this._mqHandler);
|
||
}
|
||
if (query[0] !== '(') {
|
||
query = '(' + query + ')';
|
||
}
|
||
this._mq = window.matchMedia(query);
|
||
this._mq.addListener(this._mqHandler);
|
||
this.queryHandler(this._mq);
|
||
},
|
||
|
||
queryHandler: function(mq) {
|
||
this._setQueryMatches(mq.matches);
|
||
}
|
||
|
||
});
|
||
|
||
</script>
|
||
<script>
|
||
|
||
/**
|
||
* @param {!Function} selectCallback
|
||
* @constructor
|
||
*/
|
||
Polymer.IronSelection = function(selectCallback) {
|
||
this.selection = [];
|
||
this.selectCallback = selectCallback;
|
||
};
|
||
|
||
Polymer.IronSelection.prototype = {
|
||
|
||
/**
|
||
* Retrieves the selected item(s).
|
||
*
|
||
* @method get
|
||
* @returns Returns the selected item(s). If the multi property is true,
|
||
* `get` will return an array, otherwise it will return
|
||
* the selected item or undefined if there is no selection.
|
||
*/
|
||
get: function() {
|
||
return this.multi ? this.selection : this.selection[0];
|
||
},
|
||
|
||
/**
|
||
* Clears all the selection except the ones indicated.
|
||
*
|
||
* @method clear
|
||
* @param {Array} excludes items to be excluded.
|
||
*/
|
||
clear: function(excludes) {
|
||
this.selection.slice().forEach(function(item) {
|
||
if (!excludes || excludes.indexOf(item) < 0) {
|
||
this.setItemSelected(item, false);
|
||
}
|
||
}, this);
|
||
},
|
||
|
||
/**
|
||
* Indicates if a given item is selected.
|
||
*
|
||
* @method isSelected
|
||
* @param {*} item The item whose selection state should be checked.
|
||
* @returns Returns true if `item` is selected.
|
||
*/
|
||
isSelected: function(item) {
|
||
return this.selection.indexOf(item) >= 0;
|
||
},
|
||
|
||
/**
|
||
* Sets the selection state for a given item to either selected or deselected.
|
||
*
|
||
* @method setItemSelected
|
||
* @param {*} item The item to select.
|
||
* @param {boolean} isSelected True for selected, false for deselected.
|
||
*/
|
||
setItemSelected: function(item, isSelected) {
|
||
if (item != null) {
|
||
if (isSelected) {
|
||
this.selection.push(item);
|
||
} else {
|
||
var i = this.selection.indexOf(item);
|
||
if (i >= 0) {
|
||
this.selection.splice(i, 1);
|
||
}
|
||
}
|
||
if (this.selectCallback) {
|
||
this.selectCallback(item, isSelected);
|
||
}
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Sets the selection state for a given item. If the `multi` property
|
||
* is true, then the selected state of `item` will be toggled; otherwise
|
||
* the `item` will be selected.
|
||
*
|
||
* @method select
|
||
* @param {*} item The item to select.
|
||
*/
|
||
select: function(item) {
|
||
if (this.multi) {
|
||
this.toggle(item);
|
||
} else if (this.get() !== item) {
|
||
this.setItemSelected(this.get(), false);
|
||
this.setItemSelected(item, true);
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Toggles the selection state for `item`.
|
||
*
|
||
* @method toggle
|
||
* @param {*} item The item to toggle.
|
||
*/
|
||
toggle: function(item) {
|
||
this.setItemSelected(item, !this.isSelected(item));
|
||
}
|
||
|
||
};
|
||
|
||
</script>
|
||
<script>
|
||
|
||
/** @polymerBehavior */
|
||
Polymer.IronSelectableBehavior = {
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* If you want to use the attribute value of an element for `selected` instead of the index,
|
||
* set this to the name of the attribute.
|
||
*
|
||
* @attribute attrForSelected
|
||
* @type {string}
|
||
*/
|
||
attrForSelected: {
|
||
type: String,
|
||
value: null
|
||
},
|
||
|
||
/**
|
||
* Gets or sets the selected element. The default is to use the index of the item.
|
||
*
|
||
* @attribute selected
|
||
* @type {string}
|
||
*/
|
||
selected: {
|
||
type: String,
|
||
notify: true
|
||
},
|
||
|
||
/**
|
||
* Returns the currently selected item.
|
||
*
|
||
* @attribute selectedItem
|
||
* @type {Object}
|
||
*/
|
||
selectedItem: {
|
||
type: Object,
|
||
readOnly: true,
|
||
notify: true
|
||
},
|
||
|
||
/**
|
||
* The event that fires from items when they are selected. Selectable
|
||
* will listen for this event from items and update the selection state.
|
||
* Set to empty string to listen to no events.
|
||
*
|
||
* @attribute activateEvent
|
||
* @type {string}
|
||
* @default 'tap'
|
||
*/
|
||
activateEvent: {
|
||
type: String,
|
||
value: 'tap',
|
||
observer: '_activateEventChanged'
|
||
},
|
||
|
||
/**
|
||
* This is a CSS selector sting. If this is set, only items that matches the CSS selector
|
||
* are selectable.
|
||
*
|
||
* @attribute selectable
|
||
* @type {string}
|
||
*/
|
||
selectable: String,
|
||
|
||
/**
|
||
* The class to set on elements when selected.
|
||
*
|
||
* @attribute selectedClass
|
||
* @type {string}
|
||
*/
|
||
selectedClass: {
|
||
type: String,
|
||
value: 'iron-selected'
|
||
},
|
||
|
||
/**
|
||
* The attribute to set on elements when selected.
|
||
*
|
||
* @attribute selectedAttribute
|
||
* @type {string}
|
||
*/
|
||
selectedAttribute: {
|
||
type: String,
|
||
value: null
|
||
}
|
||
|
||
},
|
||
|
||
observers: [
|
||
'_updateSelected(attrForSelected, selected)'
|
||
],
|
||
|
||
excludedLocalNames: {
|
||
'template': 1
|
||
},
|
||
|
||
created: function() {
|
||
this._bindFilterItem = this._filterItem.bind(this);
|
||
this._selection = new Polymer.IronSelection(this._applySelection.bind(this));
|
||
},
|
||
|
||
attached: function() {
|
||
this._observer = this._observeItems(this);
|
||
this._contentObserver = this._observeContent(this);
|
||
},
|
||
|
||
detached: function() {
|
||
if (this._observer) {
|
||
this._observer.disconnect();
|
||
}
|
||
if (this._contentObserver) {
|
||
this._contentObserver.disconnect();
|
||
}
|
||
this._removeListener(this.activateEvent);
|
||
},
|
||
|
||
/**
|
||
* Returns an array of selectable items.
|
||
*
|
||
* @property items
|
||
* @type Array
|
||
*/
|
||
get items() {
|
||
var nodes = Polymer.dom(this).queryDistributedElements(this.selectable || '*');
|
||
return Array.prototype.filter.call(nodes, this._bindFilterItem);
|
||
},
|
||
|
||
/**
|
||
* Returns the index of the given item.
|
||
*
|
||
* @method indexOf
|
||
* @param {Object} item
|
||
* @returns Returns the index of the item
|
||
*/
|
||
indexOf: function(item) {
|
||
return this.items.indexOf(item);
|
||
},
|
||
|
||
/**
|
||
* Selects the given value.
|
||
*
|
||
* @method select
|
||
* @param {string} value the value to select.
|
||
*/
|
||
select: function(value) {
|
||
this.selected = value;
|
||
},
|
||
|
||
/**
|
||
* Selects the previous item.
|
||
*
|
||
* @method selectPrevious
|
||
*/
|
||
selectPrevious: function() {
|
||
var length = this.items.length;
|
||
var index = (Number(this._valueToIndex(this.selected)) - 1 + length) % length;
|
||
this.selected = this._indexToValue(index);
|
||
},
|
||
|
||
/**
|
||
* Selects the next item.
|
||
*
|
||
* @method selectNext
|
||
*/
|
||
selectNext: function() {
|
||
var index = (Number(this._valueToIndex(this.selected)) + 1) % this.items.length;
|
||
this.selected = this._indexToValue(index);
|
||
},
|
||
|
||
_addListener: function(eventName) {
|
||
this.listen(this, eventName, '_activateHandler');
|
||
},
|
||
|
||
_removeListener: function(eventName) {
|
||
// There is no unlisten yet...
|
||
// https://github.com/Polymer/polymer/issues/1639
|
||
//this.removeEventListener(eventName, this._bindActivateHandler);
|
||
},
|
||
|
||
_activateEventChanged: function(eventName, old) {
|
||
this._removeListener(old);
|
||
this._addListener(eventName);
|
||
},
|
||
|
||
_updateSelected: function() {
|
||
this._selectSelected(this.selected);
|
||
},
|
||
|
||
_selectSelected: function(selected) {
|
||
this._selection.select(this._valueToItem(this.selected));
|
||
},
|
||
|
||
_filterItem: function(node) {
|
||
return !this.excludedLocalNames[node.localName];
|
||
},
|
||
|
||
_valueToItem: function(value) {
|
||
return (value == null) ? null : this.items[this._valueToIndex(value)];
|
||
},
|
||
|
||
_valueToIndex: function(value) {
|
||
if (this.attrForSelected) {
|
||
for (var i = 0, item; item = this.items[i]; i++) {
|
||
if (this._valueForItem(item) == value) {
|
||
return i;
|
||
}
|
||
}
|
||
} else {
|
||
return Number(value);
|
||
}
|
||
},
|
||
|
||
_indexToValue: function(index) {
|
||
if (this.attrForSelected) {
|
||
var item = this.items[index];
|
||
if (item) {
|
||
return this._valueForItem(item);
|
||
}
|
||
} else {
|
||
return index;
|
||
}
|
||
},
|
||
|
||
_valueForItem: function(item) {
|
||
return item[this.attrForSelected] || item.getAttribute(this.attrForSelected);
|
||
},
|
||
|
||
_applySelection: function(item, isSelected) {
|
||
if (this.selectedClass) {
|
||
this.toggleClass(this.selectedClass, isSelected, item);
|
||
}
|
||
if (this.selectedAttribute) {
|
||
this.toggleAttribute(this.selectedAttribute, isSelected, item);
|
||
}
|
||
this._selectionChange();
|
||
this.fire('iron-' + (isSelected ? 'select' : 'deselect'), {item: item});
|
||
},
|
||
|
||
_selectionChange: function() {
|
||
this._setSelectedItem(this._selection.get());
|
||
},
|
||
|
||
// observe content changes under the given node.
|
||
_observeContent: function(node) {
|
||
var content = node.querySelector('content');
|
||
if (content && content.parentElement === node) {
|
||
return this._observeItems(node.domHost);
|
||
}
|
||
},
|
||
|
||
// observe items change under the given node.
|
||
_observeItems: function(node) {
|
||
var observer = new MutationObserver(function() {
|
||
if (this.selected != null) {
|
||
this._updateSelected();
|
||
}
|
||
}.bind(this));
|
||
observer.observe(node, {
|
||
childList: true,
|
||
subtree: true
|
||
});
|
||
return observer;
|
||
},
|
||
|
||
_activateHandler: function(e) {
|
||
// TODO: remove this when https://github.com/Polymer/polymer/issues/1639 is fixed so we
|
||
// can just remove the old event listener.
|
||
if (e.type !== this.activateEvent) {
|
||
return;
|
||
}
|
||
var t = e.target;
|
||
var items = this.items;
|
||
while (t && t != this) {
|
||
var i = items.indexOf(t);
|
||
if (i >= 0) {
|
||
var value = this._indexToValue(i);
|
||
this._itemActivate(value, t);
|
||
return;
|
||
}
|
||
t = t.parentNode;
|
||
}
|
||
},
|
||
|
||
_itemActivate: function(value, item) {
|
||
if (!this.fire('iron-activate',
|
||
{selected: value, item: item}, {cancelable: true}).defaultPrevented) {
|
||
this.select(value);
|
||
}
|
||
}
|
||
|
||
};
|
||
|
||
</script>
|
||
<script>
|
||
/** @polymerBehavior Polymer.IronMultiSelectableBehavior */
|
||
Polymer.IronMultiSelectableBehaviorImpl = {
|
||
properties: {
|
||
|
||
/**
|
||
* If true, multiple selections are allowed.
|
||
*/
|
||
multi: {
|
||
type: Boolean,
|
||
value: false,
|
||
observer: 'multiChanged'
|
||
},
|
||
|
||
/**
|
||
* Gets or sets the selected elements. This is used instead of `selected` when `multi`
|
||
* is true.
|
||
*/
|
||
selectedValues: {
|
||
type: Array,
|
||
notify: true
|
||
},
|
||
|
||
/**
|
||
* Returns an array of currently selected items.
|
||
*/
|
||
selectedItems: {
|
||
type: Array,
|
||
readOnly: true,
|
||
notify: true
|
||
},
|
||
|
||
},
|
||
|
||
observers: [
|
||
'_updateSelected(attrForSelected, selectedValues)'
|
||
],
|
||
|
||
/**
|
||
* Selects the given value. If the `multi` property is true, then the selected state of the
|
||
* `value` will be toggled; otherwise the `value` will be selected.
|
||
*
|
||
* @method select
|
||
* @param {string} value the value to select.
|
||
*/
|
||
select: function(value) {
|
||
if (this.multi) {
|
||
if (this.selectedValues) {
|
||
this._toggleSelected(value);
|
||
} else {
|
||
this.selectedValues = [value];
|
||
}
|
||
} else {
|
||
this.selected = value;
|
||
}
|
||
},
|
||
|
||
multiChanged: function(multi) {
|
||
this._selection.multi = multi;
|
||
},
|
||
|
||
_updateSelected: function() {
|
||
if (this.multi) {
|
||
this._selectMulti(this.selectedValues);
|
||
} else {
|
||
this._selectSelected(this.selected);
|
||
}
|
||
},
|
||
|
||
_selectMulti: function(values) {
|
||
this._selection.clear();
|
||
if (values) {
|
||
for (var i = 0; i < values.length; i++) {
|
||
this._selection.setItemSelected(this._valueToItem(values[i]), true);
|
||
}
|
||
}
|
||
},
|
||
|
||
_selectionChange: function() {
|
||
var s = this._selection.get();
|
||
if (this.multi) {
|
||
this._setSelectedItems(s);
|
||
} else {
|
||
this._setSelectedItems([s]);
|
||
this._setSelectedItem(s);
|
||
}
|
||
},
|
||
|
||
_toggleSelected: function(value) {
|
||
var i = this.selectedValues.indexOf(value);
|
||
var unselected = i < 0;
|
||
if (unselected) {
|
||
this.selectedValues.push(value);
|
||
} else {
|
||
this.selectedValues.splice(i, 1);
|
||
}
|
||
this._selection.setItemSelected(this._valueToItem(value), unselected);
|
||
}
|
||
};
|
||
|
||
/** @polymerBehavior */
|
||
Polymer.IronMultiSelectableBehavior = [
|
||
Polymer.IronSelectableBehavior,
|
||
Polymer.IronMultiSelectableBehaviorImpl
|
||
];
|
||
|
||
</script>
|
||
<script>
|
||
/**
|
||
`iron-selector` is an element which can be used to manage a list of elements
|
||
that can be selected. Tapping on the item will make the item selected. The `selected` indicates
|
||
which item is being selected. The default is to use the index of the item.
|
||
|
||
Example:
|
||
|
||
<iron-selector selected="0">
|
||
<div>Item 1</div>
|
||
<div>Item 2</div>
|
||
<div>Item 3</div>
|
||
</iron-selector>
|
||
|
||
If you want to use the attribute value of an element for `selected` instead of the index,
|
||
set `attrForSelected` to the name of the attribute. For example, if you want to select item by
|
||
`name`, set `attrForSelected` to `name`.
|
||
|
||
Example:
|
||
|
||
<iron-selector attr-for-selected="name" selected="foo">
|
||
<div name="foo">Foo</div>
|
||
<div name="bar">Bar</div>
|
||
<div name="zot">Zot</div>
|
||
</iron-selector>
|
||
|
||
`iron-selector` is not styled. Use the `iron-selected` CSS class to style the selected element.
|
||
|
||
Example:
|
||
|
||
<style>
|
||
.iron-selected {
|
||
background: #eee;
|
||
}
|
||
</style>
|
||
|
||
...
|
||
|
||
<iron-selector selected="0">
|
||
<div>Item 1</div>
|
||
<div>Item 2</div>
|
||
<div>Item 3</div>
|
||
</iron-selector>
|
||
|
||
@demo demo/index.html
|
||
*/
|
||
|
||
Polymer({
|
||
|
||
is: 'iron-selector',
|
||
|
||
behaviors: [
|
||
Polymer.IronMultiSelectableBehavior
|
||
]
|
||
|
||
});
|
||
|
||
</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<script>
|
||
|
||
/**
|
||
* `Polymer.IronMenuBehavior` implements accessible menu behavior.
|
||
*
|
||
* @demo demo/index.html
|
||
* @polymerBehavior Polymer.IronMenuBehavior
|
||
*/
|
||
Polymer.IronMenuBehaviorImpl = {
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* Returns the currently focused item.
|
||
*
|
||
* @attribute focusedItem
|
||
* @type Object
|
||
*/
|
||
focusedItem: {
|
||
observer: '_focusedItemChanged',
|
||
readOnly: true,
|
||
type: Object
|
||
},
|
||
|
||
/**
|
||
* The attribute to use on menu items to look up the item title. Typing the first
|
||
* letter of an item when the menu is open focuses that item. If unset, `textContent`
|
||
* will be used.
|
||
*
|
||
* @attribute attrForItemTitle
|
||
* @type String
|
||
*/
|
||
attrForItemTitle: {
|
||
type: String
|
||
}
|
||
},
|
||
|
||
hostAttributes: {
|
||
'role': 'menu',
|
||
'tabindex': '0'
|
||
},
|
||
|
||
observers: [
|
||
'_updateMultiselectable(multi)'
|
||
],
|
||
|
||
listeners: {
|
||
'focus': '_onFocus',
|
||
'keydown': '_onKeydown'
|
||
},
|
||
|
||
keyBindings: {
|
||
'up': '_onUpKey',
|
||
'down': '_onDownKey',
|
||
'esc': '_onEscKey',
|
||
'enter': '_onEnterKey',
|
||
'shift+tab:keydown': '_onShiftTabDown'
|
||
},
|
||
|
||
_updateMultiselectable: function(multi) {
|
||
if (multi) {
|
||
this.setAttribute('aria-multiselectable', 'true');
|
||
} else {
|
||
this.removeAttribute('aria-multiselectable');
|
||
}
|
||
},
|
||
|
||
_onShiftTabDown: function() {
|
||
var oldTabIndex;
|
||
|
||
Polymer.IronMenuBehaviorImpl._shiftTabPressed = true;
|
||
|
||
oldTabIndex = this.getAttribute('tabindex');
|
||
|
||
this.setAttribute('tabindex', '-1');
|
||
|
||
this.async(function() {
|
||
this.setAttribute('tabindex', oldTabIndex);
|
||
Polymer.IronMenuBehaviorImpl._shiftTabPressed = false;
|
||
// Note: polymer/polymer#1305
|
||
}, 1);
|
||
},
|
||
|
||
_applySelection: function(item, isSelected) {
|
||
if (isSelected) {
|
||
item.setAttribute('aria-selected', 'true');
|
||
} else {
|
||
item.removeAttribute('aria-selected');
|
||
}
|
||
|
||
Polymer.IronSelectableBehavior._applySelection.apply(this, arguments);
|
||
},
|
||
|
||
_focusedItemChanged: function(focusedItem, old) {
|
||
old && old.setAttribute('tabindex', '-1');
|
||
if (focusedItem) {
|
||
focusedItem.setAttribute('tabindex', '0');
|
||
focusedItem.focus();
|
||
}
|
||
},
|
||
|
||
select: function(value) {
|
||
if (this._defaultFocusAsync) {
|
||
this.cancelAsync(this._defaultFocusAsync);
|
||
this._defaultFocusAsync = null;
|
||
}
|
||
var item = this._valueToItem(value);
|
||
this._setFocusedItem(item);
|
||
Polymer.IronMultiSelectableBehaviorImpl.select.apply(this, arguments);
|
||
},
|
||
|
||
_onFocus: function(event) {
|
||
if (Polymer.IronMenuBehaviorImpl._shiftTabPressed) {
|
||
return;
|
||
}
|
||
// do not focus the menu itself
|
||
this.blur();
|
||
// clear the cached focus item
|
||
this._setFocusedItem(null);
|
||
this._defaultFocusAsync = this.async(function() {
|
||
// focus the selected item when the menu receives focus, or the first item
|
||
// if no item is selected
|
||
var selectedItem = this.multi ? (this.selectedItems && this.selectedItems[0]) : this.selectedItem;
|
||
if (selectedItem) {
|
||
this._setFocusedItem(selectedItem);
|
||
} else {
|
||
this._setFocusedItem(this.items[0]);
|
||
}
|
||
// async 100ms to wait for `select` to get called from `_itemActivate`
|
||
}, 100);
|
||
},
|
||
|
||
_onUpKey: function() {
|
||
// up and down arrows moves the focus
|
||
this._focusPrevious();
|
||
},
|
||
|
||
_onDownKey: function() {
|
||
this._focusNext();
|
||
},
|
||
|
||
_onEscKey: function() {
|
||
// esc blurs the control
|
||
this.focusedItem.blur();
|
||
},
|
||
|
||
_onEnterKey: function(event) {
|
||
// enter activates the item unless it is disabled
|
||
this._activateFocused(event.detail.keyboardEvent);
|
||
},
|
||
|
||
_onKeydown: function(event) {
|
||
if (this.keyboardEventMatchesKeys(event, 'up down esc enter')) {
|
||
return;
|
||
}
|
||
|
||
// all other keys focus the menu item starting with that character
|
||
this._focusWithKeyboardEvent(event);
|
||
},
|
||
|
||
_focusWithKeyboardEvent: function(event) {
|
||
for (var i = 0, item; item = this.items[i]; i++) {
|
||
var attr = this.attrForItemTitle || 'textContent';
|
||
var title = item[attr] || item.getAttribute(attr);
|
||
if (title && title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.keyCode).toLowerCase()) {
|
||
this._setFocusedItem(item);
|
||
break;
|
||
}
|
||
}
|
||
},
|
||
|
||
_activateFocused: function(event) {
|
||
if (!this.focusedItem.hasAttribute('disabled')) {
|
||
this._activateHandler(event);
|
||
}
|
||
},
|
||
|
||
_focusPrevious: function() {
|
||
var length = this.items.length;
|
||
var index = (Number(this.indexOf(this.focusedItem)) - 1 + length) % length;
|
||
this._setFocusedItem(this.items[index]);
|
||
},
|
||
|
||
_focusNext: function() {
|
||
var index = (Number(this.indexOf(this.focusedItem)) + 1) % this.items.length;
|
||
this._setFocusedItem(this.items[index]);
|
||
}
|
||
|
||
};
|
||
|
||
Polymer.IronMenuBehaviorImpl._shiftTabPressed = false;
|
||
|
||
/** @polymerBehavior Polymer.IronMenuBehavior */
|
||
Polymer.IronMenuBehavior = [
|
||
Polymer.IronMultiSelectableBehavior,
|
||
Polymer.IronA11yKeysBehavior,
|
||
Polymer.IronMenuBehaviorImpl
|
||
];
|
||
|
||
</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<script>
|
||
/**
|
||
* `IronResizableBehavior` is a behavior that can be used in Polymer elements to
|
||
* coordinate the flow of resize events between "resizers" (elements that control the
|
||
* size or hidden state of their children) and "resizables" (elements that need to be
|
||
* notified when they are resized or un-hidden by their parents in order to take
|
||
* action on their new measurements).
|
||
* Elements that perform measurement should add the `IronResizableBehavior` behavior to
|
||
* their element definition and listen for the `iron-resize` event on themselves.
|
||
* This event will be fired when they become showing after having been hidden,
|
||
* when they are resized explicitly by another resizable, or when the window has been
|
||
* resized.
|
||
* Note, the `iron-resize` event is non-bubbling.
|
||
*
|
||
* @polymerBehavior Polymer.IronResizableBehavior
|
||
* @demo demo/index.html
|
||
**/
|
||
Polymer.IronResizableBehavior = {
|
||
properties: {
|
||
_parentResizable: {
|
||
type: Object,
|
||
observer: '_parentResizableChanged'
|
||
}
|
||
},
|
||
|
||
listeners: {
|
||
'iron-request-resize-notifications': '_onIronRequestResizeNotifications'
|
||
},
|
||
|
||
created: function() {
|
||
// We don't really need property effects on these, and also we want them
|
||
// to be created before the `_parentResizable` observer fires:
|
||
this._interestedResizables = [];
|
||
this._boundNotifyResize = this.notifyResize.bind(this);
|
||
},
|
||
|
||
attached: function() {
|
||
this.fire('iron-request-resize-notifications', null, {
|
||
node: this,
|
||
bubbles: true
|
||
});
|
||
|
||
if (!this._parentResizable) {
|
||
window.addEventListener('resize', this._boundNotifyResize);
|
||
this.notifyResize();
|
||
}
|
||
},
|
||
|
||
detached: function() {
|
||
if (this._parentResizable) {
|
||
this._parentResizable.stopResizeNotificationsFor(this);
|
||
} else {
|
||
window.removeEventListener('resize', this._boundNotifyResize);
|
||
}
|
||
|
||
this._parentResizable = null;
|
||
},
|
||
|
||
/**
|
||
* Can be called to manually notify a resizable and its descendant
|
||
* resizables of a resize change.
|
||
*/
|
||
notifyResize: function() {
|
||
if (!this.isAttached) {
|
||
return;
|
||
}
|
||
|
||
this._interestedResizables.forEach(function(resizable) {
|
||
// TODO(cdata): Currently behaviors cannot define "abstract" methods..
|
||
if (!this.resizerShouldNotify || this.resizerShouldNotify(resizable)) {
|
||
resizable.notifyResize();
|
||
}
|
||
}, this);
|
||
|
||
this.fire('iron-resize', null, {
|
||
node: this,
|
||
bubbles: false
|
||
});
|
||
},
|
||
|
||
/**
|
||
* Used to assign the closest resizable ancestor to this resizable
|
||
* if the ancestor detects a request for notifications.
|
||
*/
|
||
assignParentResizable: function(parentResizable) {
|
||
this._parentResizable = parentResizable;
|
||
},
|
||
|
||
/**
|
||
* Used to remove a resizable descendant from the list of descendants
|
||
* that should be notified of a resize change.
|
||
*/
|
||
stopResizeNotificationsFor: function(target) {
|
||
var index = this._interestedResizables.indexOf(target);
|
||
|
||
if (index > -1) {
|
||
this._interestedResizables.splice(index, 1);
|
||
}
|
||
},
|
||
|
||
// TODO(cdata): Currently behaviors cannot define "abstract" methods.
|
||
// resizerShouldNotify: function(el) { return true; },
|
||
|
||
_parentResizableChanged: function(parentResizable) {
|
||
if (parentResizable) {
|
||
window.removeEventListener('resize', this._boundNotifyResize);
|
||
}
|
||
},
|
||
|
||
_onIronRequestResizeNotifications: function(event) {
|
||
var target = event.path ? event.path[0] : event.target;
|
||
|
||
if (target === this) {
|
||
return;
|
||
}
|
||
|
||
if (this._interestedResizables.indexOf(target) === -1) {
|
||
this._interestedResizables.push(target);
|
||
}
|
||
|
||
target.assignParentResizable(this);
|
||
|
||
event.stopPropagation();
|
||
}
|
||
};
|
||
</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<script>
|
||
(function() {
|
||
var uiUtil = window.hass.uiUtil;
|
||
|
||
Polymer({
|
||
is: 'state-card-content',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
observer: 'stateObjChanged',
|
||
}
|
||
},
|
||
|
||
stateObjChanged: function(newVal, oldVal) {
|
||
var root = Polymer.dom(this);
|
||
|
||
if (!newVal) {
|
||
if (root.lastChild) {
|
||
root.removeChild(root.lastChild);
|
||
}
|
||
return;
|
||
}
|
||
|
||
var newCardType = uiUtil.stateCardType(newVal);
|
||
|
||
if (!oldVal || uiUtil.stateCardType(oldVal) != newCardType) {
|
||
if (root.lastChild) {
|
||
root.removeChild(root.lastChild);
|
||
}
|
||
|
||
var stateCard = document.createElement("state-card-" + newCardType);
|
||
stateCard.stateObj = newVal;
|
||
root.appendChild(stateCard);
|
||
} else {
|
||
root.lastChild.stateObj = newVal;
|
||
}
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
|
||
<script>
|
||
|
||
/**
|
||
|
||
@demo demo/index.html
|
||
@polymerBehavior
|
||
|
||
*/
|
||
Polymer.IronFormElementBehavior = {
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The name of this element.
|
||
*/
|
||
name: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* The value for this element.
|
||
*/
|
||
value: {
|
||
notify: true,
|
||
type: String
|
||
},
|
||
},
|
||
|
||
attached: function() {
|
||
this.fire('iron-form-element-register');
|
||
}
|
||
|
||
};
|
||
|
||
</script>
|
||
<script>
|
||
|
||
/**
|
||
* Use `Polymer.PaperInputBehavior` to implement inputs with `<paper-input-container>`. This
|
||
* behavior is implemented by `<paper-input>`. It exposes a number of properties from
|
||
* `<paper-input-container>` and `<input is="iron-input">` and they should be bound in your
|
||
* template.
|
||
*
|
||
* The input element can be accessed by the `inputElement` property if you need to access
|
||
* properties or methods that are not exposed.
|
||
* @polymerBehavior
|
||
*/
|
||
Polymer.PaperInputBehavior = {
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The label for this input. Bind this to `<paper-input-container>`'s `label` property.
|
||
*/
|
||
label: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* The value for this input. Bind this to the `<input is="iron-input">`'s `bindValue`
|
||
* property, or the value property of your input that is `notify:true`.
|
||
*/
|
||
value: {
|
||
notify: true,
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* Set to true to disable this input. Bind this to both the `<paper-input-container>`'s
|
||
* and the input's `disabled` property.
|
||
*/
|
||
disabled: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Returns true if the value is invalid. Bind this to both the `<paper-input-container>`'s
|
||
* and the input's `invalid` property.
|
||
*/
|
||
invalid: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Set to true to prevent the user from entering invalid input. Bind this to the
|
||
* `<input is="iron-input">`'s `preventInvalidInput` property.
|
||
*/
|
||
preventInvalidInput: {
|
||
type: Boolean
|
||
},
|
||
|
||
/**
|
||
* Set this to specify the pattern allowed by `preventInvalidInput`. Bind this to the
|
||
* `<input is="iron-input">`'s `allowedPattern` property.
|
||
*/
|
||
allowedPattern: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* The type of the input. The supported types are `text`, `number` and `password`. Bind this
|
||
* to the `<input is="iron-input">`'s `type` property.
|
||
*/
|
||
type: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* A pattern to validate the `input` with. Bind this to the `<input is="iron-input">`'s
|
||
* `pattern` property.
|
||
*/
|
||
pattern: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* Set to true to mark the input as required. Bind this to the `<input is="iron-input">`'s
|
||
* `required` property.
|
||
*/
|
||
required: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* The maximum length of the input value. Bind this to the `<input is="iron-input">`'s
|
||
* `maxlength` property.
|
||
*/
|
||
maxlength: {
|
||
type: Number
|
||
},
|
||
|
||
/**
|
||
* The error message to display when the input is invalid. Bind this to the
|
||
* `<paper-input-error>`'s content, if using.
|
||
*/
|
||
errorMessage: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* Set to true to show a character counter.
|
||
*/
|
||
charCounter: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Set to true to disable the floating label. Bind this to the `<paper-input-container>`'s
|
||
* `noLabelFloat` property.
|
||
*/
|
||
noLabelFloat: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Set to true to always float the label. Bind this to the `<paper-input-container>`'s
|
||
* `alwaysFloatLabel` property.
|
||
*/
|
||
alwaysFloatLabel: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Set to true to auto-validate the input value. Bind this to the `<paper-input-container>`'s
|
||
* `autoValidate` property.
|
||
*/
|
||
autoValidate: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Name of the validator to use. Bind this to the `<input is="iron-input">`'s `validator`
|
||
* property.
|
||
*/
|
||
validator: {
|
||
type: String
|
||
},
|
||
|
||
// HTMLInputElement attributes for binding if needed
|
||
|
||
/**
|
||
* Bind this to the `<input is="iron-input">`'s `autocomplete` property.
|
||
*/
|
||
autocomplete: {
|
||
type: String,
|
||
value: 'off'
|
||
},
|
||
|
||
/**
|
||
* Bind this to the `<input is="iron-input">`'s `autofocus` property.
|
||
*/
|
||
autofocus: {
|
||
type: Boolean
|
||
},
|
||
|
||
/**
|
||
* Bind this to the `<input is="iron-input">`'s `inputmode` property.
|
||
*/
|
||
inputmode: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* Bind this to the `<input is="iron-input">`'s `minlength` property.
|
||
*/
|
||
minlength: {
|
||
type: Number
|
||
},
|
||
|
||
/**
|
||
* Bind this to the `<input is="iron-input">`'s `name` property.
|
||
*/
|
||
name: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* A placeholder string in addition to the label. If this is set, the label will always float.
|
||
*/
|
||
placeholder: {
|
||
type: String,
|
||
// need to set a default so _computeAlwaysFloatLabel is run
|
||
value: ''
|
||
},
|
||
|
||
/**
|
||
* Bind this to the `<input is="iron-input">`'s `readonly` property.
|
||
*/
|
||
readonly: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Bind this to the `<input is="iron-input">`'s `size` property.
|
||
*/
|
||
size: {
|
||
type: Number
|
||
},
|
||
|
||
_ariaDescribedBy: {
|
||
type: String,
|
||
value: ''
|
||
}
|
||
|
||
},
|
||
|
||
listeners: {
|
||
'addon-attached': '_onAddonAttached'
|
||
},
|
||
|
||
/**
|
||
* Returns a reference to the input element.
|
||
*/
|
||
get inputElement() {
|
||
return this.$.input;
|
||
},
|
||
|
||
attached: function() {
|
||
this._updateAriaLabelledBy();
|
||
},
|
||
|
||
_appendStringWithSpace: function(str, more) {
|
||
if (str) {
|
||
str = str + ' ' + more;
|
||
} else {
|
||
str = more;
|
||
}
|
||
return str;
|
||
},
|
||
|
||
_onAddonAttached: function(event) {
|
||
var target = event.path ? event.path[0] : event.target;
|
||
if (target.id) {
|
||
this._ariaDescribedBy = this._appendStringWithSpace(this._ariaDescribedBy, target.id);
|
||
} else {
|
||
var id = 'paper-input-add-on-' + Math.floor((Math.random() * 100000));
|
||
target.id = id;
|
||
this._ariaDescribedBy = this._appendStringWithSpace(this._ariaDescribedBy, id);
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Validates the input element and sets an error style if needed.
|
||
*/
|
||
validate: function() {
|
||
return this.inputElement.validate();
|
||
},
|
||
|
||
/**
|
||
* Restores the cursor to its original position after updating the value.
|
||
* @param {string} newValue The value that should be saved.
|
||
*/
|
||
updateValueAndPreserveCaret: function(newValue) {
|
||
// Not all elements might have selection, and even if they have the
|
||
// right properties, accessing them might throw an exception (like for
|
||
// <input type=number>)
|
||
try {
|
||
var start = this.inputElement.selectionStart;
|
||
this.value = newValue;
|
||
|
||
// The cursor automatically jumps to the end after re-setting the value,
|
||
// so restore it to its original position.
|
||
this.inputElement.selectionStart = start;
|
||
this.inputElement.selectionEnd = start;
|
||
} catch (e) {
|
||
// Just set the value and give up on the caret.
|
||
this.value = newValue;
|
||
}
|
||
},
|
||
|
||
_computeAlwaysFloatLabel: function(alwaysFloatLabel, placeholder) {
|
||
return placeholder || alwaysFloatLabel;
|
||
},
|
||
|
||
_updateAriaLabelledBy: function() {
|
||
var label = Polymer.dom(this.root).querySelector('label');
|
||
if (!label) {
|
||
this._ariaLabelledBy = '';
|
||
return;
|
||
}
|
||
var labelledBy;
|
||
if (label.id) {
|
||
labelledBy = label.id;
|
||
} else {
|
||
labelledBy = 'paper-input-label-' + new Date().getUTCMilliseconds();
|
||
label.id = labelledBy;
|
||
}
|
||
this._ariaLabelledBy = labelledBy;
|
||
}
|
||
|
||
};
|
||
|
||
</script>
|
||
|
||
|
||
|
||
<script>
|
||
(function() {
|
||
"use strict";
|
||
/**
|
||
`Polymer.IronJsonpLibraryBehavior` loads a jsonp library.
|
||
Multiple components can request same library, only one copy will load.
|
||
|
||
Some libraries require a specific global function be defined.
|
||
If this is the case, specify the `callbackName` property.
|
||
|
||
You should use an HTML Import to load library dependencies
|
||
when possible instead of using this element.
|
||
*/
|
||
Polymer.IronJsonpLibraryBehavior = {
|
||
/** loads the library, and fires this.notifyEvent upon completion */
|
||
properties: {
|
||
/**
|
||
* True if library has been successfully loaded
|
||
*/
|
||
libraryLoaded: {
|
||
type: Boolean,
|
||
value: false,
|
||
notify: true,
|
||
readOnly: true
|
||
},
|
||
/**
|
||
* Not null if library has failed to load
|
||
*/
|
||
libraryErrorMessage: {
|
||
type: String,
|
||
value: null,
|
||
notify: true,
|
||
readOnly: true
|
||
},
|
||
/**
|
||
* @attribute libraryUrl
|
||
* url of the library to load. Must contain string '%callback_name%'
|
||
* This string will be substituted with automatically generated callback name
|
||
* for loading.
|
||
* Ex: https://maps.googleapis.com/maps/api/js?callback=%callback%
|
||
*/
|
||
/**
|
||
* @attribute callbackName
|
||
* specify this attribute if library requires specific callback name.
|
||
*/
|
||
/**
|
||
* @attribute notifyEvent
|
||
* name of event to be emitted when library loads
|
||
*/
|
||
/**
|
||
* @event 'notifyEvent'
|
||
* event with name specified in 'notifyEvent' attribute
|
||
* will fire upon successful load
|
||
*/
|
||
},
|
||
|
||
_libraryLoadCallback: function(err, result) {
|
||
if (err) {
|
||
console.error("Library load failed:", err.message);
|
||
this._setLibraryErrorMessage(err.message);
|
||
}
|
||
else {
|
||
this._setLibraryErrorMessage(null);
|
||
this._setLibraryLoaded(true);
|
||
if (this.notifyEvent)
|
||
this.fire( this.notifyEvent, result);
|
||
}
|
||
},
|
||
_loadLibrary: function() {
|
||
LoaderMap.require(
|
||
this.libraryUrl,
|
||
this._libraryLoadCallback.bind(this),
|
||
this.callbackName
|
||
);
|
||
},
|
||
ready: function() {
|
||
this._loadLibrary();
|
||
}
|
||
};
|
||
|
||
/*
|
||
* LoaderMap keeps track of all Loaders
|
||
*/
|
||
var LoaderMap = {
|
||
apiMap: {}, // { hash -> Loader }
|
||
|
||
/*
|
||
* @param {function} notifyCallback loaded callback fn(result)
|
||
* @param {string} jsonpCallbackName name of jsonpcallback. If API does not provide it, leave empty. Optional.
|
||
*/
|
||
require: function(url, notifyCallback, jsonpCallbackName) {
|
||
|
||
// make hashable string form url
|
||
var name = this.nameFromUrl(url);
|
||
|
||
// create a loader as needed
|
||
if (!this.apiMap[name])
|
||
this.apiMap[name] = new Loader(name, url, jsonpCallbackName);
|
||
|
||
// ask for notification
|
||
this.apiMap[name].requestNotify(notifyCallback);
|
||
},
|
||
|
||
nameFromUrl: function(url) {
|
||
return url.replace(/[\:\/\%\?\&\.\=\-\,]/g, '_') + '_api';
|
||
}
|
||
};
|
||
|
||
var Loader = function(name, url, callbackName) {
|
||
this.notifiers = []; // array of notifyFn [ notifyFn* ]
|
||
|
||
// callback is specified either as callback name
|
||
// or computed dynamically if url has callbackMacro in it
|
||
if (!callbackName) {
|
||
if (url.indexOf(this.callbackMacro) >= 0) {
|
||
callbackName = name + '_loaded';
|
||
url = url.replace(this.callbackMacro, callbackName);
|
||
} else {
|
||
this.error = new Error('IronJsonpLibraryBehavior a %callback_name% parameter is required in libraryUrl');
|
||
// TODO(sjmiles): we should probably fallback to listening to script.load
|
||
return;
|
||
}
|
||
}
|
||
this.callbackName = callbackName;
|
||
window[this.callbackName] = this.success.bind(this);
|
||
this.addScript(url);
|
||
};
|
||
|
||
Loader.prototype = {
|
||
|
||
callbackMacro: '%callback%',
|
||
loaded: false,
|
||
|
||
addScript: function(src) {
|
||
var script = document.createElement('script');
|
||
script.src = src;
|
||
script.onerror = this.handleError.bind(this);
|
||
var s = document.querySelector('script') || document.body;
|
||
s.parentNode.insertBefore(script, s);
|
||
this.script = script;
|
||
},
|
||
|
||
removeScript: function() {
|
||
if (this.script.parentNode) {
|
||
this.script.parentNode.removeChild(this.script);
|
||
}
|
||
this.script = null;
|
||
},
|
||
|
||
handleError: function(ev) {
|
||
this.error = new Error("Library failed to load");
|
||
this.notifyAll();
|
||
this.cleanup();
|
||
},
|
||
|
||
success: function() {
|
||
this.loaded = true;
|
||
this.result = Array.prototype.slice.call(arguments);
|
||
this.notifyAll();
|
||
this.cleanup();
|
||
},
|
||
|
||
cleanup: function() {
|
||
delete window[this.callbackName];
|
||
},
|
||
|
||
notifyAll: function(notifyCallback) {
|
||
this.notifiers.forEach( function(notifyCallback) {
|
||
notifyCallback(this.error, this.result);
|
||
}.bind(this));
|
||
this.notifiers = [];
|
||
},
|
||
|
||
requestNotify: function(notifyCallback) {
|
||
if (this.loaded || this.error) {
|
||
notifyCallback( this.error, this.result);
|
||
} else {
|
||
this.notifiers.push(notifyCallback);
|
||
}
|
||
}
|
||
};
|
||
})();
|
||
</script>
|
||
|
||
|
||
<script>
|
||
Polymer({
|
||
|
||
is: 'iron-jsonp-library',
|
||
|
||
behaviors: [ Polymer.IronJsonpLibraryBehavior ],
|
||
properties: {
|
||
/**
|
||
* url of the library to load. Must contain string '%callback_name%'.
|
||
* callbackName attribute is not specified.
|
||
* this string will be substituted with automatically generated callback name
|
||
* for loading
|
||
* Ex: https://maps.googleapis.com/maps/api/js?callback=%callback%
|
||
*/
|
||
libraryUrl: String,
|
||
/**
|
||
* specify callbackName if library requires specific callback name.
|
||
* Otherwise, specify '%callback_name%' inside libraryUrl
|
||
*/
|
||
callbackName: String,
|
||
/**
|
||
* @event 'notifyEvent'
|
||
* event with name specified in 'notifyEvent' attribute
|
||
* will fire upon successful load
|
||
*/
|
||
notifyEvent: String
|
||
}
|
||
});
|
||
|
||
</script>
|
||
<script>
|
||
/**
|
||
Dynamically loads the legacy Google JavaScript API Loader (https://developers.google.com/loader/).
|
||
|
||
Fires `api-load` event when ready.
|
||
*/
|
||
Polymer({
|
||
|
||
is: 'google-legacy-loader',
|
||
|
||
behaviors: [
|
||
Polymer.IronJsonpLibraryBehavior
|
||
],
|
||
|
||
properties: {
|
||
|
||
/** @private */
|
||
libraryUrl: {
|
||
type: String,
|
||
value: 'https://www.google.com/jsapi?callback=%callback%'
|
||
},
|
||
|
||
/**
|
||
* Fired when the API library is loaded and available.
|
||
* @event js-api-load
|
||
*/
|
||
/**
|
||
* Name of event fired when library is loaded and available.
|
||
*/
|
||
notifyEvent: {
|
||
type: String,
|
||
value: 'api-load'
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Wrapper for `google` API namespace.
|
||
*/
|
||
get api() {
|
||
return google;
|
||
}
|
||
});
|
||
</script>
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'state-history-chart-line',
|
||
|
||
properties: {
|
||
data: {
|
||
type: Object,
|
||
observer: 'dataChanged',
|
||
},
|
||
|
||
unit: {
|
||
type: String,
|
||
},
|
||
|
||
isSingleDevice: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
isAttached: {
|
||
type: Boolean,
|
||
value: false,
|
||
observer: 'dataChanged',
|
||
},
|
||
},
|
||
|
||
created: function() {
|
||
this.style.display = 'block';
|
||
},
|
||
|
||
attached: function() {
|
||
this.isAttached = true;
|
||
},
|
||
|
||
dataChanged: function() {
|
||
this.drawChart();
|
||
},
|
||
|
||
/**************************************************
|
||
The following code gererates line line graphs for devices with continuous
|
||
values(which are devices that have a unit_of_measurement values defined).
|
||
On each graph the devices are grouped by their unit of measurement, eg. all
|
||
sensors measuring MB will be a separate line on single graph. The google
|
||
chart API takes data as a 2 dimensional array in the format:
|
||
|
||
DateTime, device1, device2, device3
|
||
2015-04-01, 1, 2, 0
|
||
2015-04-01, 0, 1, 0
|
||
2015-04-01, 2, 1, 1
|
||
|
||
NOTE: the first column is a javascript date objects.
|
||
|
||
The first thing we do is build up the data with rows for each time of a state
|
||
change and initialise the values to 0. THen we loop through each device and
|
||
fill in its data.
|
||
|
||
**************************************************/
|
||
drawChart: function() {
|
||
if (!this.isAttached) {
|
||
return;
|
||
}
|
||
|
||
var root = Polymer.dom(this);
|
||
var unit = this.unit;
|
||
var deviceStates = this.data;
|
||
|
||
while (root.lastChild) {
|
||
root.removeChild(root.lastChild);
|
||
}
|
||
|
||
if (deviceStates.length === 0) {
|
||
return;
|
||
}
|
||
|
||
var chart = new google.visualization.LineChart(this);
|
||
var dataTable = new google.visualization.DataTable();
|
||
|
||
dataTable.addColumn({ type: 'datetime', id: 'Time' });
|
||
|
||
var options = {
|
||
legend: { position: 'top' },
|
||
titlePosition: 'none',
|
||
vAxes: {
|
||
// Adds units to the left hand side of the graph
|
||
0: {title: unit}
|
||
},
|
||
hAxis: {
|
||
format: 'H:mm'
|
||
},
|
||
lineWidth: 1,
|
||
chartArea:{left:'60',width:"95%"},
|
||
explorer: {
|
||
actions: ['dragToZoom', 'rightClickToReset', 'dragToPan'],
|
||
keepInBounds: true,
|
||
axis: 'horizontal',
|
||
maxZoomIn: 0.1
|
||
}
|
||
};
|
||
|
||
if(this.isSingleDevice) {
|
||
options.legend.position = 'none';
|
||
options.vAxes[0].title = null;
|
||
options.chartArea.left = 40;
|
||
options.chartArea.height = '80%';
|
||
options.chartArea.top = 5;
|
||
options.enableInteractivity = false;
|
||
}
|
||
|
||
// Get a unique list of times of state changes for all the device
|
||
// for a particular unit of measureent.
|
||
var times = _.pluck(_.flatten(deviceStates), "lastChangedAsDate");
|
||
times = _.uniq(times, function(e) {
|
||
return e.getTime();
|
||
});
|
||
|
||
times = _.sortBy(times, function(o) { return o; });
|
||
|
||
var data = [];
|
||
var empty = new Array(deviceStates.length);
|
||
for(var i = 0; i < empty.length; i++) {
|
||
empty[i] = 0;
|
||
}
|
||
|
||
var timeIndex = 1;
|
||
var endDate = new Date();
|
||
var prevDate = times[0];
|
||
|
||
for(i = 0; i < times.length; i++) {
|
||
var currentDate = new Date(prevDate);
|
||
|
||
// because we only have state changes we add an extra point at the same time
|
||
// that holds the previous state which makes the line display correctly
|
||
var beforePoint = new Date(times[i]);
|
||
data.push([beforePoint].concat(empty));
|
||
|
||
data.push([times[i]].concat(empty));
|
||
prevDate = times[i];
|
||
timeIndex++;
|
||
}
|
||
data.push([endDate].concat(empty));
|
||
|
||
|
||
var deviceCount = 0;
|
||
deviceStates.forEach(function(device) {
|
||
var attributes = device[device.length - 1].attributes;
|
||
dataTable.addColumn('number', attributes.friendly_name);
|
||
|
||
var currentState = 0;
|
||
var previousState = 0;
|
||
var lastIndex = 0;
|
||
var count = 0;
|
||
var prevTime = data[0][0];
|
||
device.forEach(function(state) {
|
||
|
||
currentState = state.state;
|
||
var start = state.lastChangedAsDate;
|
||
if(state.state == 'None') {
|
||
currentState = previousState;
|
||
}
|
||
for(var i = lastIndex; i < data.length; i++) {
|
||
data[i][1 + deviceCount] = parseFloat(previousState);
|
||
// this is where data gets filled in for each time for the particular device
|
||
// because for each time two entries were create we fill the first one with the
|
||
// previous value and the second one with the new value
|
||
if(prevTime.getTime() == data[i][0].getTime() && data[i][0].getTime() == start.getTime()) {
|
||
data[i][1 + deviceCount] = parseFloat(currentState);
|
||
lastIndex = i;
|
||
prevTime = data[i][0];
|
||
break;
|
||
}
|
||
prevTime = data[i][0];
|
||
}
|
||
|
||
previousState = currentState;
|
||
|
||
count++;
|
||
}.bind(this));
|
||
|
||
//fill in the rest of the Array
|
||
for(var i = lastIndex; i < data.length; i++) {
|
||
data[i][1 + deviceCount] = parseFloat(previousState);
|
||
}
|
||
|
||
deviceCount++;
|
||
}.bind(this));
|
||
|
||
dataTable.addRows(data);
|
||
chart.draw(dataTable, options);
|
||
},
|
||
});
|
||
})();
|
||
|
||
</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<script>
|
||
|
||
/**
|
||
* `Polymer.NeonAnimatableBehavior` is implemented by elements containing animations for use with
|
||
* elements implementing `Polymer.NeonAnimationRunnerBehavior`.
|
||
* @polymerBehavior
|
||
*/
|
||
Polymer.NeonAnimatableBehavior = {
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* Animation configuration. See README for more info.
|
||
*/
|
||
animationConfig: {
|
||
type: Object
|
||
},
|
||
|
||
/**
|
||
* Convenience property for setting an 'entry' animation. Do not set `animationConfig.entry`
|
||
* manually if using this. The animated node is set to `this` if using this property.
|
||
*/
|
||
entryAnimation: {
|
||
observer: '_entryAnimationChanged',
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* Convenience property for setting an 'exit' animation. Do not set `animationConfig.exit`
|
||
* manually if using this. The animated node is set to `this` if using this property.
|
||
*/
|
||
exitAnimation: {
|
||
observer: '_exitAnimationChanged',
|
||
type: String
|
||
}
|
||
|
||
},
|
||
|
||
_entryAnimationChanged: function() {
|
||
this.animationConfig = this.animationConfig || {};
|
||
if (this.entryAnimation !== 'fade-in-animation') {
|
||
// insert polyfill hack
|
||
this.animationConfig['entry'] = [{
|
||
name: 'opaque-animation',
|
||
node: this
|
||
}, {
|
||
name: this.entryAnimation,
|
||
node: this
|
||
}];
|
||
} else {
|
||
this.animationConfig['entry'] = [{
|
||
name: this.entryAnimation,
|
||
node: this
|
||
}];
|
||
}
|
||
},
|
||
|
||
_exitAnimationChanged: function() {
|
||
this.animationConfig = this.animationConfig || {};
|
||
this.animationConfig['exit'] = [{
|
||
name: this.exitAnimation,
|
||
node: this
|
||
}];
|
||
},
|
||
|
||
_copyProperties: function(config1, config2) {
|
||
// shallowly copy properties from config2 to config1
|
||
for (var property in config2) {
|
||
config1[property] = config2[property];
|
||
}
|
||
},
|
||
|
||
_cloneConfig: function(config) {
|
||
var clone = {
|
||
isClone: true
|
||
};
|
||
this._copyProperties(clone, config);
|
||
return clone;
|
||
},
|
||
|
||
_getAnimationConfigRecursive: function(type, map, allConfigs) {
|
||
if (!this.animationConfig) {
|
||
return;
|
||
}
|
||
|
||
// type is optional
|
||
var thisConfig;
|
||
if (type) {
|
||
thisConfig = this.animationConfig[type];
|
||
} else {
|
||
thisConfig = this.animationConfig;
|
||
}
|
||
|
||
if (!Array.isArray(thisConfig)) {
|
||
thisConfig = [thisConfig];
|
||
}
|
||
|
||
// iterate animations and recurse to process configurations from child nodes
|
||
if (thisConfig) {
|
||
for (var config, index = 0; config = thisConfig[index]; index++) {
|
||
if (config.animatable) {
|
||
config.animatable._getAnimationConfigRecursive(config.type || type, map, allConfigs);
|
||
} else {
|
||
if (config.id) {
|
||
var cachedConfig = map[config.id];
|
||
if (cachedConfig) {
|
||
// merge configurations with the same id, making a clone lazily
|
||
if (!cachedConfig.isClone) {
|
||
map[config.id] = this._cloneConfig(cachedConfig)
|
||
cachedConfig = map[config.id];
|
||
}
|
||
this._copyProperties(cachedConfig, config);
|
||
} else {
|
||
// put any configs with an id into a map
|
||
map[config.id] = config;
|
||
}
|
||
} else {
|
||
allConfigs.push(config);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
/**
|
||
* An element implementing `Polymer.NeonAnimationRunnerBehavior` calls this method to configure
|
||
* an animation with an optional type. Elements implementing `Polymer.NeonAnimatableBehavior`
|
||
* should define the property `animationConfig`, which is either a configuration object
|
||
* or a map of animation type to array of configuration objects.
|
||
*/
|
||
getAnimationConfig: function(type) {
|
||
var map = [];
|
||
var allConfigs = [];
|
||
this._getAnimationConfigRecursive(type, map, allConfigs);
|
||
// append the configurations saved in the map to the array
|
||
for (var key in map) {
|
||
allConfigs.push(map[key]);
|
||
}
|
||
return allConfigs;
|
||
}
|
||
|
||
};
|
||
|
||
</script>
|
||
<script>
|
||
|
||
/**
|
||
* `Polymer.NeonAnimationRunnerBehavior` adds a method to run animations.
|
||
* @polymerBehavior
|
||
*/
|
||
Polymer.NeonAnimationRunnerBehavior = [Polymer.NeonAnimatableBehavior, {
|
||
|
||
properties: {
|
||
|
||
_animationMeta: {
|
||
type: Object,
|
||
value: function() {
|
||
return new Polymer.IronMeta({type: 'animation'});
|
||
}
|
||
},
|
||
|
||
_player: {
|
||
type: Object
|
||
}
|
||
|
||
},
|
||
|
||
_configureAnimationEffects: function(allConfigs) {
|
||
var allAnimations = [];
|
||
if (allConfigs.length > 0) {
|
||
for (var config, index = 0; config = allConfigs[index]; index++) {
|
||
var animationConstructor = this._animationMeta.byKey(config.name);
|
||
if (animationConstructor) {
|
||
var animation = animationConstructor && new animationConstructor();
|
||
var effect = animation.configure(config);
|
||
if (effect) {
|
||
allAnimations.push({
|
||
animation: animation,
|
||
config: config,
|
||
effect: effect
|
||
});
|
||
}
|
||
} else {
|
||
console.warn(this.is + ':', config.name, 'not found!');
|
||
}
|
||
}
|
||
}
|
||
return allAnimations;
|
||
},
|
||
|
||
_runAnimationEffects: function(allEffects) {
|
||
return player = document.timeline.play(new GroupEffect(allEffects));
|
||
},
|
||
|
||
_completeAnimations: function(allAnimations) {
|
||
for (var animation, index = 0; animation = allAnimations[index]; index++) {
|
||
animation.animation.complete(animation.config);
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Plays an animation with an optional `type`.
|
||
*/
|
||
playAnimation: function(type, cookie) {
|
||
var allConfigs = this.getAnimationConfig(type);
|
||
if (!allConfigs) {
|
||
return;
|
||
}
|
||
var allAnimations = this._configureAnimationEffects(allConfigs);
|
||
var allEffects = allAnimations.map(function(animation) {
|
||
return animation.effect;
|
||
});
|
||
|
||
if (allEffects.length > 0) {
|
||
this._player = this._runAnimationEffects(allEffects);
|
||
this._player.onfinish = function() {
|
||
this._completeAnimations(allAnimations);
|
||
|
||
if (this._player) {
|
||
this._player.cancel();
|
||
this._player = null;
|
||
}
|
||
|
||
this.fire('neon-animation-finish', cookie, {bubbles: false});
|
||
}.bind(this);
|
||
|
||
} else {
|
||
this.fire('neon-animation-finish', cookie, {bubbles: false});
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Cancels the currently running animation.
|
||
*/
|
||
cancelAnimation: function() {
|
||
if (this._player) {
|
||
this._player.cancel();
|
||
}
|
||
}
|
||
|
||
}];
|
||
</script>
|
||
<script>
|
||
|
||
/**
|
||
Polymer.IronFitBehavior fits an element in another element using `max-height` and `max-width`, and
|
||
optionally centers it in the window or another element.
|
||
|
||
The element will only be sized and/or positioned if it has not already been sized and/or positioned
|
||
by CSS.
|
||
|
||
CSS properties | Action
|
||
-----------------------------|-------------------------------------------
|
||
`position` set | Element is not centered horizontally or vertically
|
||
`top` or `bottom` set | Element is not vertically centered
|
||
`left` or `right` set | Element is not horizontally centered
|
||
`max-height` or `height` set | Element respects `max-height` or `height`
|
||
`max-width` or `width` set | Element respects `max-width` or `width`
|
||
|
||
@demo demo/index.html
|
||
@polymerBehavior
|
||
*/
|
||
|
||
Polymer.IronFitBehavior = {
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The element that will receive a `max-height`/`width`. By default it is the same as `this`,
|
||
* but it can be set to a child element. This is useful, for example, for implementing a
|
||
* scrolling region inside the element.
|
||
*/
|
||
sizingTarget: {
|
||
type: Object,
|
||
value: function() {
|
||
return this;
|
||
}
|
||
},
|
||
|
||
/**
|
||
* The element to fit `this` into.
|
||
*/
|
||
fitInto: {
|
||
type: Object,
|
||
value: window
|
||
},
|
||
|
||
/**
|
||
* Set to true to auto-fit on attach.
|
||
*/
|
||
autoFitOnAttach: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
_fitInfo: {
|
||
type: Object
|
||
}
|
||
|
||
},
|
||
|
||
get _fitWidth() {
|
||
var fitWidth;
|
||
if (this.fitInto === window) {
|
||
fitWidth = this.fitInto.innerWidth;
|
||
} else {
|
||
fitWidth = this.fitInto.getBoundingClientRect().width;
|
||
}
|
||
return fitWidth;
|
||
},
|
||
|
||
get _fitHeight() {
|
||
var fitHeight;
|
||
if (this.fitInto === window) {
|
||
fitHeight = this.fitInto.innerHeight;
|
||
} else {
|
||
fitHeight = this.fitInto.getBoundingClientRect().height;
|
||
}
|
||
return fitHeight;
|
||
},
|
||
|
||
attached: function() {
|
||
if (this.autoFitOnAttach) {
|
||
if (window.getComputedStyle(this).display === 'none') {
|
||
setTimeout(function() {
|
||
this.fit();
|
||
}.bind(this));
|
||
} else {
|
||
this.fit();
|
||
}
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Fits and optionally centers the element into the window, or `fitInfo` if specified.
|
||
*/
|
||
fit: function() {
|
||
this._discoverInfo();
|
||
this.constrain();
|
||
this.center();
|
||
},
|
||
|
||
/**
|
||
* Memoize information needed to position and size the target element.
|
||
*/
|
||
_discoverInfo: function() {
|
||
if (this._fitInfo) {
|
||
return;
|
||
}
|
||
var target = window.getComputedStyle(this);
|
||
var sizer = window.getComputedStyle(this.sizingTarget);
|
||
this._fitInfo = {
|
||
positionedBy: {
|
||
vertically: target.top !== 'auto' ? 'top' : (target.bottom !== 'auto' ?
|
||
'bottom' : null),
|
||
horizontally: target.left !== 'auto' ? 'left' : (target.right !== 'auto' ?
|
||
'right' : null),
|
||
css: target.position
|
||
},
|
||
sizedBy: {
|
||
height: sizer.maxHeight !== 'none',
|
||
width: sizer.maxWidth !== 'none'
|
||
},
|
||
margin: {
|
||
top: parseInt(target.marginTop, 10) || 0,
|
||
right: parseInt(target.marginRight, 10) || 0,
|
||
bottom: parseInt(target.marginBottom, 10) || 0,
|
||
left: parseInt(target.marginLeft, 10) || 0
|
||
}
|
||
};
|
||
},
|
||
|
||
/**
|
||
* Resets the target element's position and size constraints, and clear
|
||
* the memoized data.
|
||
*/
|
||
resetFit: function() {
|
||
if (!this._fitInfo || !this._fitInfo.sizedBy.height) {
|
||
this.sizingTarget.style.maxHeight = '';
|
||
this.style.top = '';
|
||
}
|
||
if (!this._fitInfo || !this._fitInfo.sizedBy.width) {
|
||
this.sizingTarget.style.maxWidth = '';
|
||
this.style.left = '';
|
||
}
|
||
if (this._fitInfo) {
|
||
this.style.position = this._fitInfo.positionedBy.css;
|
||
}
|
||
this._fitInfo = null;
|
||
},
|
||
|
||
/**
|
||
* Equivalent to calling `resetFit()` and `fit()`. Useful to call this after the element,
|
||
* the window, or the `fitInfo` element has been resized.
|
||
*/
|
||
refit: function() {
|
||
this.resetFit();
|
||
this.fit();
|
||
},
|
||
|
||
/**
|
||
* Constrains the size of the element to the window or `fitInfo` by setting `max-height`
|
||
* and/or `max-width`.
|
||
*/
|
||
constrain: function() {
|
||
var info = this._fitInfo;
|
||
// position at (0px, 0px) if not already positioned, so we can measure the natural size.
|
||
if (!this._fitInfo.positionedBy.vertically) {
|
||
this.style.top = '0px';
|
||
}
|
||
if (!this._fitInfo.positionedBy.horizontally) {
|
||
this.style.left = '0px';
|
||
}
|
||
// need border-box for margin/padding
|
||
this.sizingTarget.style.boxSizing = 'border-box';
|
||
// constrain the width and height if not already set
|
||
var rect = this.getBoundingClientRect();
|
||
if (!info.sizedBy.height) {
|
||
this._sizeDimension(rect, info.positionedBy.vertically, 'top', 'bottom', 'Height');
|
||
}
|
||
if (!info.sizedBy.width) {
|
||
this._sizeDimension(rect, info.positionedBy.horizontally, 'left', 'right', 'Width');
|
||
}
|
||
},
|
||
|
||
_sizeDimension: function(rect, positionedBy, start, end, extent) {
|
||
var info = this._fitInfo;
|
||
var max = extent === 'Width' ? this._fitWidth : this._fitHeight;
|
||
var flip = (positionedBy === end);
|
||
var offset = flip ? max - rect[end] : rect[start];
|
||
var margin = info.margin[flip ? start : end];
|
||
var offsetExtent = 'offset' + extent;
|
||
var sizingOffset = this[offsetExtent] - this.sizingTarget[offsetExtent];
|
||
this.sizingTarget.style['max' + extent] = (max - margin - offset - sizingOffset) + 'px';
|
||
},
|
||
|
||
/**
|
||
* Centers horizontally and vertically if not already positioned. This also sets
|
||
* `position:fixed`.
|
||
*/
|
||
center: function() {
|
||
if (!this._fitInfo.positionedBy.vertically || !this._fitInfo.positionedBy.horizontally) {
|
||
// need position:fixed to center
|
||
this.style.position = 'fixed';
|
||
}
|
||
if (!this._fitInfo.positionedBy.vertically) {
|
||
var top = (this._fitHeight - this.offsetHeight) / 2;
|
||
top -= this._fitInfo.margin.top;
|
||
this.style.top = top + 'px';
|
||
}
|
||
if (!this._fitInfo.positionedBy.horizontally) {
|
||
var left = (this._fitWidth - this.offsetWidth) / 2;
|
||
left -= this._fitInfo.margin.left;
|
||
this.style.left = left + 'px';
|
||
}
|
||
}
|
||
|
||
};
|
||
|
||
</script>
|
||
|
||
|
||
<script>
|
||
|
||
Polymer.IronOverlayManager = (function() {
|
||
|
||
var overlays = [];
|
||
var DEFAULT_Z = 10;
|
||
var backdrops = [];
|
||
|
||
// track overlays for z-index and focus managemant
|
||
function addOverlay(overlay) {
|
||
var z0 = currentOverlayZ();
|
||
overlays.push(overlay);
|
||
var z1 = currentOverlayZ();
|
||
if (z1 <= z0) {
|
||
applyOverlayZ(overlay, z0);
|
||
}
|
||
}
|
||
|
||
function removeOverlay(overlay) {
|
||
var i = overlays.indexOf(overlay);
|
||
if (i >= 0) {
|
||
overlays.splice(i, 1);
|
||
setZ(overlay, '');
|
||
}
|
||
}
|
||
|
||
function applyOverlayZ(overlay, aboveZ) {
|
||
setZ(overlay, aboveZ + 2);
|
||
}
|
||
|
||
function setZ(element, z) {
|
||
element.style.zIndex = z;
|
||
}
|
||
|
||
function currentOverlay() {
|
||
return overlays[overlays.length-1];
|
||
}
|
||
|
||
function currentOverlayZ() {
|
||
var z;
|
||
var current = currentOverlay();
|
||
if (current) {
|
||
var z1 = window.getComputedStyle(current).zIndex;
|
||
if (!isNaN(z1)) {
|
||
z = Number(z1);
|
||
}
|
||
}
|
||
return z || DEFAULT_Z;
|
||
}
|
||
|
||
function focusOverlay() {
|
||
var current = currentOverlay();
|
||
// We have to be careful to focus the next overlay _after_ any current
|
||
// transitions are complete (due to the state being toggled prior to the
|
||
// transition). Otherwise, we risk infinite recursion when a transitioning
|
||
// (closed) overlay becomes the current overlay.
|
||
//
|
||
// NOTE: We make the assumption that any overlay that completes a transition
|
||
// will call into focusOverlay to kick the process back off. Currently:
|
||
// transitionend -> _applyFocus -> focusOverlay.
|
||
if (current && !current.transitioning) {
|
||
current._applyFocus();
|
||
}
|
||
}
|
||
|
||
function trackBackdrop(element) {
|
||
// backdrops contains the overlays with a backdrop that are currently
|
||
// visible
|
||
if (element.opened) {
|
||
backdrops.push(element);
|
||
} else {
|
||
var index = backdrops.indexOf(element);
|
||
if (index >= 0) {
|
||
backdrops.splice(index, 1);
|
||
}
|
||
}
|
||
}
|
||
|
||
function getBackdrops() {
|
||
return backdrops;
|
||
}
|
||
|
||
return {
|
||
addOverlay: addOverlay,
|
||
removeOverlay: removeOverlay,
|
||
currentOverlay: currentOverlay,
|
||
currentOverlayZ: currentOverlayZ,
|
||
focusOverlay: focusOverlay,
|
||
trackBackdrop: trackBackdrop,
|
||
getBackdrops: getBackdrops
|
||
};
|
||
|
||
})();
|
||
|
||
</script>
|
||
<script>
|
||
|
||
/**
|
||
Use `Polymer.IronOverlayBehavior` to implement an element that can be hidden or shown, and displays
|
||
on top of other content. It includes an optional backdrop, and can be used to implement a variety
|
||
of UI controls including dialogs and drop downs. Multiple overlays may be displayed at once.
|
||
|
||
### Closing and canceling
|
||
|
||
A dialog may be hidden by closing or canceling. The difference between close and cancel is user
|
||
intent. Closing generally implies that the user acknowledged the content on the overlay. By default,
|
||
it will cancel whenever the user taps outside it or presses the escape key. This behavior is
|
||
configurable with the `no-cancel-on-esc-key` and the `no-cancel-on-outside-click` properties.
|
||
`close()` should be called explicitly by the implementer when the user interacts with a control
|
||
in the overlay element.
|
||
|
||
### Positioning
|
||
|
||
By default the element is sized and positioned to fit and centered inside the window. You can
|
||
position and size it manually using CSS. See `Polymer.IronFitBehavior`.
|
||
|
||
### Backdrop
|
||
|
||
Set the `with-backdrop` attribute to display a backdrop behind the overlay. The backdrop is
|
||
appended to `<body>` and is of type `<iron-overlay-backdrop>`. See its doc page for styling
|
||
options.
|
||
|
||
### Limitations
|
||
|
||
The element is styled to appear on top of other content by setting its `z-index` property. You
|
||
must ensure no element has a stacking context with a higher `z-index` than its parent stacking
|
||
context. You should place this element as a child of `<body>` whenever possible.
|
||
|
||
@demo demo/index.html
|
||
@polymerBehavior Polymer.IronOverlayBehavior
|
||
*/
|
||
|
||
Polymer.IronOverlayBehaviorImpl = {
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* True if the overlay is currently displayed.
|
||
*/
|
||
opened: {
|
||
observer: '_openedChanged',
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* True if the overlay was canceled when it was last closed.
|
||
*/
|
||
canceled: {
|
||
observer: '_canceledChanged',
|
||
readOnly: true,
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Set to true to display a backdrop behind the overlay.
|
||
*/
|
||
withBackdrop: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Set to true to disable auto-focusing the overlay or child nodes with
|
||
* the `autofocus` attribute` when the overlay is opened.
|
||
*/
|
||
noAutoFocus: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Set to true to disable canceling the overlay with the ESC key.
|
||
*/
|
||
noCancelOnEscKey: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Set to true to disable canceling the overlay by clicking outside it.
|
||
*/
|
||
noCancelOnOutsideClick: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Returns the reason this dialog was last closed.
|
||
*/
|
||
closingReason: {
|
||
// was a getter before, but needs to be a property so other
|
||
// behaviors can override this.
|
||
type: Object
|
||
},
|
||
|
||
_manager: {
|
||
type: Object,
|
||
value: Polymer.IronOverlayManager
|
||
},
|
||
|
||
_boundOnCaptureClick: {
|
||
type: Function,
|
||
value: function() {
|
||
return this._onCaptureClick.bind(this);
|
||
}
|
||
},
|
||
|
||
_boundOnCaptureKeydown: {
|
||
type: Function,
|
||
value: function() {
|
||
return this._onCaptureKeydown.bind(this);
|
||
}
|
||
}
|
||
|
||
},
|
||
|
||
/**
|
||
* Fired after the `iron-overlay` opens.
|
||
* @event iron-overlay-opened
|
||
*/
|
||
|
||
/**
|
||
* Fired after the `iron-overlay` closes.
|
||
* @event iron-overlay-closed {{canceled: boolean}} detail -
|
||
* canceled: True if the overlay was canceled.
|
||
*/
|
||
|
||
listeners: {
|
||
'click': '_onClick',
|
||
'iron-resize': '_onIronResize'
|
||
},
|
||
|
||
/**
|
||
* The backdrop element.
|
||
* @type Node
|
||
*/
|
||
get backdropElement() {
|
||
return this._backdrop;
|
||
},
|
||
|
||
get _focusNode() {
|
||
return Polymer.dom(this).querySelector('[autofocus]') || this;
|
||
},
|
||
|
||
registered: function() {
|
||
this._backdrop = document.createElement('iron-overlay-backdrop');
|
||
},
|
||
|
||
ready: function() {
|
||
this._ensureSetup();
|
||
if (this._callOpenedWhenReady) {
|
||
this._openedChanged();
|
||
}
|
||
},
|
||
|
||
detached: function() {
|
||
this.opened = false;
|
||
this._completeBackdrop();
|
||
this._manager.removeOverlay(this);
|
||
},
|
||
|
||
/**
|
||
* Toggle the opened state of the overlay.
|
||
*/
|
||
toggle: function() {
|
||
this.opened = !this.opened;
|
||
},
|
||
|
||
/**
|
||
* Open the overlay.
|
||
*/
|
||
open: function() {
|
||
this.opened = true;
|
||
this.closingReason = {canceled: false};
|
||
},
|
||
|
||
/**
|
||
* Close the overlay.
|
||
*/
|
||
close: function() {
|
||
this.opened = false;
|
||
this._setCanceled(false);
|
||
},
|
||
|
||
/**
|
||
* Cancels the overlay.
|
||
*/
|
||
cancel: function() {
|
||
this.opened = false,
|
||
this._setCanceled(true);
|
||
},
|
||
|
||
_ensureSetup: function() {
|
||
if (this._overlaySetup) {
|
||
return;
|
||
}
|
||
this._overlaySetup = true;
|
||
this.style.outline = 'none';
|
||
this.style.display = 'none';
|
||
},
|
||
|
||
_openedChanged: function() {
|
||
if (this.opened) {
|
||
this.removeAttribute('aria-hidden');
|
||
} else {
|
||
this.setAttribute('aria-hidden', 'true');
|
||
}
|
||
|
||
// wait to call after ready only if we're initially open
|
||
if (!this._overlaySetup) {
|
||
this._callOpenedWhenReady = this.opened;
|
||
return;
|
||
}
|
||
if (this._openChangedAsync) {
|
||
this.cancelAsync(this._openChangedAsync);
|
||
}
|
||
|
||
this._toggleListeners();
|
||
|
||
if (this.opened) {
|
||
this._prepareRenderOpened();
|
||
}
|
||
|
||
// async here to allow overlay layer to become visible.
|
||
this._openChangedAsync = this.async(function() {
|
||
// overlay becomes visible here
|
||
this.style.display = '';
|
||
// force layout to ensure transitions will go
|
||
this.offsetWidth;
|
||
if (this.opened) {
|
||
this._renderOpened();
|
||
} else {
|
||
this._renderClosed();
|
||
}
|
||
this._openChangedAsync = null;
|
||
});
|
||
|
||
},
|
||
|
||
_canceledChanged: function() {
|
||
this.closingReason = this.closingReason || {};
|
||
this.closingReason.canceled = this.canceled;
|
||
},
|
||
|
||
_toggleListener: function(enable, node, event, boundListener, capture) {
|
||
if (enable) {
|
||
node.addEventListener(event, boundListener, capture);
|
||
} else {
|
||
node.removeEventListener(event, boundListener, capture);
|
||
}
|
||
},
|
||
|
||
_toggleListeners: function() {
|
||
if (this._toggleListenersAsync) {
|
||
this.cancelAsync(this._toggleListenersAsync);
|
||
}
|
||
// async so we don't auto-close immediately via a click.
|
||
this._toggleListenersAsync = this.async(function() {
|
||
this._toggleListener(this.opened, document, 'click', this._boundOnCaptureClick, true);
|
||
this._toggleListener(this.opened, document, 'keydown', this._boundOnCaptureKeydown, true);
|
||
this._toggleListenersAsync = null;
|
||
});
|
||
},
|
||
|
||
// tasks which must occur before opening; e.g. making the element visible
|
||
_prepareRenderOpened: function() {
|
||
this._manager.addOverlay(this);
|
||
|
||
if (this.withBackdrop) {
|
||
this.backdropElement.prepare();
|
||
this._manager.trackBackdrop(this);
|
||
}
|
||
|
||
this._preparePositioning();
|
||
this.fit();
|
||
this._finishPositioning();
|
||
},
|
||
|
||
// tasks which cause the overlay to actually open; typically play an
|
||
// animation
|
||
_renderOpened: function() {
|
||
if (this.withBackdrop) {
|
||
this.backdropElement.open();
|
||
}
|
||
this._finishRenderOpened();
|
||
},
|
||
|
||
_renderClosed: function() {
|
||
if (this.withBackdrop) {
|
||
this.backdropElement.close();
|
||
}
|
||
this._finishRenderClosed();
|
||
},
|
||
|
||
_onTransitionend: function(event) {
|
||
// make sure this is our transition event.
|
||
if (event && event.target !== this) {
|
||
return;
|
||
}
|
||
if (this.opened) {
|
||
this._finishRenderOpened();
|
||
} else {
|
||
this._finishRenderClosed();
|
||
}
|
||
},
|
||
|
||
_finishRenderOpened: function() {
|
||
// focus the child node with [autofocus]
|
||
if (!this.noAutoFocus) {
|
||
this._focusNode.focus();
|
||
}
|
||
|
||
this.fire('iron-overlay-opened');
|
||
|
||
this._squelchNextResize = true;
|
||
this.async(this.notifyResize);
|
||
},
|
||
|
||
_finishRenderClosed: function() {
|
||
// hide the overlay and remove the backdrop
|
||
this.resetFit();
|
||
this.style.display = 'none';
|
||
this._completeBackdrop();
|
||
this._manager.removeOverlay(this);
|
||
|
||
this._focusNode.blur();
|
||
// focus the next overlay, if there is one
|
||
this._manager.focusOverlay();
|
||
|
||
this.fire('iron-overlay-closed', this.closingReason);
|
||
|
||
this._squelchNextResize = true;
|
||
this.async(this.notifyResize);
|
||
},
|
||
|
||
_completeBackdrop: function() {
|
||
if (this.withBackdrop) {
|
||
this._manager.trackBackdrop(this);
|
||
this.backdropElement.complete();
|
||
}
|
||
},
|
||
|
||
_preparePositioning: function() {
|
||
this.style.transition = this.style.webkitTransition = 'none';
|
||
this.style.transform = this.style.webkitTransform = 'none';
|
||
this.style.display = '';
|
||
},
|
||
|
||
_finishPositioning: function(target) {
|
||
this.style.display = 'none';
|
||
this.style.transform = this.style.webkitTransform = '';
|
||
// force layout to avoid application of transform
|
||
this.offsetWidth;
|
||
this.style.transition = this.style.webkitTransition = '';
|
||
},
|
||
|
||
_applyFocus: function() {
|
||
if (this.opened) {
|
||
if (!this.noAutoFocus) {
|
||
this._focusNode.focus();
|
||
}
|
||
} else {
|
||
this._focusNode.blur();
|
||
this._manager.focusOverlay();
|
||
}
|
||
},
|
||
|
||
_onCaptureClick: function(event) {
|
||
// attempt to close asynchronously and prevent the close of a tap event is immediately heard
|
||
// on target. This is because in shadow dom due to event retargetting event.target is not
|
||
// useful.
|
||
if (!this.noCancelOnOutsideClick && (this._manager.currentOverlay() == this)) {
|
||
this._cancelJob = this.async(function() {
|
||
this.cancel();
|
||
}, 10);
|
||
}
|
||
},
|
||
|
||
_onClick: function(event) {
|
||
if (this._cancelJob) {
|
||
this.cancelAsync(this._cancelJob);
|
||
this._cancelJob = null;
|
||
}
|
||
},
|
||
|
||
_onCaptureKeydown: function(event) {
|
||
var ESC = 27;
|
||
if (!this.noCancelOnEscKey && (event.keyCode === ESC)) {
|
||
this.cancel();
|
||
event.stopPropagation();
|
||
}
|
||
},
|
||
|
||
_onIronResize: function() {
|
||
if (this._squelchNextResize) {
|
||
this._squelchNextResize = false;
|
||
return;
|
||
}
|
||
if (this.opened) {
|
||
this.refit();
|
||
}
|
||
}
|
||
|
||
};
|
||
|
||
/** @polymerBehavior */
|
||
Polymer.IronOverlayBehavior = [Polymer.IronFitBehavior, Polymer.IronResizableBehavior, Polymer.IronOverlayBehaviorImpl];
|
||
|
||
|
||
</script>
|
||
<script>
|
||
|
||
/**
|
||
Use `Polymer.PaperDialogBehavior` and `paper-dialog-common.css` to implement a Material Design
|
||
dialog.
|
||
|
||
For example, if `<paper-dialog-impl>` implements this behavior:
|
||
|
||
<paper-dialog-impl>
|
||
<h2>Header</h2>
|
||
<div>Dialog body</div>
|
||
<div class="buttons">
|
||
<paper-button dialog-dismiss>Cancel</paper-button>
|
||
<paper-button dialog-confirm>Accept</paper-button>
|
||
</div>
|
||
</paper-dialog-impl>
|
||
|
||
`paper-dialog-common.css` provide styles for a header, content area, and an action area for buttons.
|
||
Use the `<h2>` tag for the header and the `buttons` class for the action area. You can use the
|
||
`paper-dialog-scrollable` element (in its own repository) if you need a scrolling content area.
|
||
|
||
Use the `dialog-dismiss` and `dialog-confirm` attributes on interactive controls to close the
|
||
dialog. If the user dismisses the dialog with `dialog-confirm`, the `closingReason` will update
|
||
to include `confirmed: true`.
|
||
|
||
### Styling
|
||
|
||
The following custom properties and mixins are available for styling.
|
||
|
||
Custom property | Description | Default
|
||
----------------|-------------|----------
|
||
`--paper-dialog-background-color` | Dialog background color | `--primary-background-color`
|
||
`--paper-dialog-color` | Dialog foreground color | `--primary-text-color`
|
||
`--paper-dialog` | Mixin applied to the dialog | `{}`
|
||
`--paper-dialog-title` | Mixin applied to the title (`<h2>`) element | `{}`
|
||
`--paper-dialog-button-color` | Button area foreground color | `--default-primary-color`
|
||
|
||
### Accessibility
|
||
|
||
This element has `role="dialog"` by default. Depending on the context, it may be more appropriate
|
||
to override this attribute with `role="alertdialog"`. The header (a `<h2>` element) will
|
||
|
||
If `modal` is set, the element will set `aria-modal` and prevent the focus from exiting the element.
|
||
It will also ensure that focus remains in the dialog.
|
||
|
||
The `aria-labelledby` attribute will be set to the header element, if one exists.
|
||
|
||
@hero hero.svg
|
||
@demo demo/index.html
|
||
@polymerBehavior Polymer.PaperDialogBehavior
|
||
*/
|
||
|
||
Polymer.PaperDialogBehaviorImpl = {
|
||
|
||
hostAttributes: {
|
||
'role': 'dialog',
|
||
'tabindex': '-1'
|
||
},
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* If `modal` is true, this implies `no-cancel-on-outside-click` and `with-backdrop`.
|
||
*/
|
||
modal: {
|
||
observer: '_modalChanged',
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/** @type {?Node} */
|
||
_lastFocusedElement: {
|
||
type: Object
|
||
},
|
||
|
||
_boundOnFocus: {
|
||
type: Function,
|
||
value: function() {
|
||
return this._onFocus.bind(this);
|
||
}
|
||
},
|
||
|
||
_boundOnBackdropClick: {
|
||
type: Function,
|
||
value: function() {
|
||
return this._onBackdropClick.bind(this);
|
||
}
|
||
}
|
||
|
||
},
|
||
|
||
listeners: {
|
||
'click': '_onDialogClick',
|
||
'iron-overlay-opened': '_onIronOverlayOpened',
|
||
'iron-overlay-closed': '_onIronOverlayClosed'
|
||
},
|
||
|
||
attached: function() {
|
||
this._observer = this._observe(this);
|
||
this._updateAriaLabelledBy();
|
||
},
|
||
|
||
detached: function() {
|
||
if (this._observer) {
|
||
this._observer.disconnect();
|
||
}
|
||
},
|
||
|
||
_observe: function(node) {
|
||
var observer = new MutationObserver(function() {
|
||
this._updateAriaLabelledBy();
|
||
}.bind(this));
|
||
observer.observe(node, {
|
||
childList: true,
|
||
subtree: true
|
||
});
|
||
return observer;
|
||
},
|
||
|
||
_modalChanged: function() {
|
||
if (this.modal) {
|
||
this.setAttribute('aria-modal', 'true');
|
||
} else {
|
||
this.setAttribute('aria-modal', 'false');
|
||
}
|
||
// modal implies noCancelOnOutsideClick and withBackdrop if true, don't overwrite
|
||
// those properties otherwise.
|
||
if (this.modal) {
|
||
this.noCancelOnOutsideClick = true;
|
||
this.withBackdrop = true;
|
||
}
|
||
},
|
||
|
||
_updateAriaLabelledBy: function() {
|
||
var header = Polymer.dom(this).querySelector('h2');
|
||
if (!header) {
|
||
this.removeAttribute('aria-labelledby');
|
||
return;
|
||
}
|
||
var headerId = header.getAttribute('id');
|
||
if (headerId && this.getAttribute('aria-labelledby') === headerId) {
|
||
return;
|
||
}
|
||
// set aria-describedBy to the header element
|
||
var labelledById;
|
||
if (headerId) {
|
||
labelledById = headerId;
|
||
} else {
|
||
labelledById = 'paper-dialog-header-' + new Date().getUTCMilliseconds();
|
||
header.setAttribute('id', labelledById);
|
||
}
|
||
this.setAttribute('aria-labelledby', labelledById);
|
||
},
|
||
|
||
_updateClosingReasonConfirmed: function(confirmed) {
|
||
this.closingReason = this.closingReason || {};
|
||
this.closingReason.confirmed = confirmed;
|
||
},
|
||
|
||
_onDialogClick: function(event) {
|
||
var target = event.target;
|
||
while (target !== this) {
|
||
if (target.hasAttribute('dialog-dismiss')) {
|
||
this._updateClosingReasonConfirmed(false);
|
||
this.close();
|
||
break;
|
||
} else if (target.hasAttribute('dialog-confirm')) {
|
||
this._updateClosingReasonConfirmed(true);
|
||
this.close();
|
||
break;
|
||
}
|
||
target = target.parentNode;
|
||
}
|
||
},
|
||
|
||
_onIronOverlayOpened: function() {
|
||
if (this.modal) {
|
||
document.body.addEventListener('focus', this._boundOnFocus, true);
|
||
this.backdropElement.addEventListener('click', this._boundOnBackdropClick);
|
||
}
|
||
},
|
||
|
||
_onIronOverlayClosed: function() {
|
||
document.body.removeEventListener('focus', this._boundOnFocus, true);
|
||
this.backdropElement.removeEventListener('click', this._boundOnBackdropClick);
|
||
},
|
||
|
||
_onFocus: function(event) {
|
||
if (this.modal) {
|
||
var target = event.target;
|
||
while (target && target !== this && target !== document.body) {
|
||
target = target.parentNode;
|
||
}
|
||
if (target) {
|
||
if (target === document.body) {
|
||
if (this._lastFocusedElement) {
|
||
this._lastFocusedElement.focus();
|
||
} else {
|
||
this._focusNode.focus();
|
||
}
|
||
} else {
|
||
this._lastFocusedElement = event.target;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
_onBackdropClick: function() {
|
||
if (this.modal) {
|
||
if (this._lastFocusedElement) {
|
||
this._lastFocusedElement.focus();
|
||
} else {
|
||
this._focusNode.focus();
|
||
}
|
||
}
|
||
}
|
||
|
||
};
|
||
|
||
/** @polymerBehavior */
|
||
Polymer.PaperDialogBehavior = [Polymer.IronOverlayBehavior, Polymer.PaperDialogBehaviorImpl];
|
||
|
||
</script>
|
||
|
||
|
||
<script>
|
||
|
||
/**
|
||
* Use `Polymer.NeonAnimationBehavior` to implement an animation.
|
||
* @polymerBehavior
|
||
*/
|
||
Polymer.NeonAnimationBehavior = {
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* Defines the animation timing.
|
||
*/
|
||
animationTiming: {
|
||
type: Object,
|
||
value: function() {
|
||
return {
|
||
duration: 500,
|
||
easing: 'cubic-bezier(0.4, 0, 0.2, 1)',
|
||
fill: 'both'
|
||
}
|
||
}
|
||
}
|
||
|
||
},
|
||
|
||
registered: function() {
|
||
new Polymer.IronMeta({type: 'animation', key: this.is, value: this.constructor});
|
||
},
|
||
|
||
/**
|
||
* Do any animation configuration here.
|
||
*/
|
||
// configure: function(config) {
|
||
// },
|
||
|
||
/**
|
||
* Returns the animation timing by mixing in properties from `config` to the defaults defined
|
||
* by the animation.
|
||
*/
|
||
timingFromConfig: function(config) {
|
||
if (config.timing) {
|
||
for (var property in config.timing) {
|
||
this.animationTiming[property] = config.timing[property];
|
||
}
|
||
}
|
||
return this.animationTiming;
|
||
},
|
||
|
||
/**
|
||
* Sets `transform` and `transformOrigin` properties along with the prefixed versions.
|
||
*/
|
||
setPrefixedProperty: function(node, property, value) {
|
||
var map = {
|
||
'transform': ['webkitTransform'],
|
||
'transformOrigin': ['mozTransformOrigin', 'webkitTransformOrigin']
|
||
};
|
||
var prefixes = map[property];
|
||
for (var prefix, index = 0; prefix = prefixes[index]; index++) {
|
||
node.style[prefix] = value;
|
||
}
|
||
node.style[property] = value;
|
||
},
|
||
|
||
/**
|
||
* Called when the animation finishes.
|
||
*/
|
||
complete: function() {
|
||
// FIXME not sure about non-bubbling event
|
||
this.fire(this.animationEndEvent, null, {bubbles: false});
|
||
}
|
||
|
||
};
|
||
|
||
</script>
|
||
<script>// Copyright 2014 Google Inc. All rights reserved.
|
||
//
|
||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||
// you may not use this file except in compliance with the License.
|
||
// You may obtain a copy of the License at
|
||
//
|
||
// http://www.apache.org/licenses/LICENSE-2.0
|
||
//
|
||
// Unless required by applicable law or agreed to in writing, software
|
||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
// See the License for the specific language governing permissions and
|
||
// limitations under the License.
|
||
|
||
!function(a,b){b["true"]=a;var c={},d={},e={},f=null;!function(a){function b(b,c){var d={delay:0,endDelay:0,fill:c?"both":"none",iterationStart:0,iterations:1,duration:c?"auto":0,playbackRate:1,direction:"normal",easing:"linear"};return"number"!=typeof b||isNaN(b)?void 0!==b&&Object.getOwnPropertyNames(b).forEach(function(c){if("auto"!=b[c]){if(("number"==typeof d[c]||"duration"==c)&&("number"!=typeof b[c]||isNaN(b[c])))return;if("fill"==c&&-1==p.indexOf(b[c]))return;if("direction"==c&&-1==q.indexOf(b[c]))return;if("playbackRate"==c&&1!==b[c]&&a.isDeprecated("AnimationEffectTiming.playbackRate","2014-11-28","Use Animation.playbackRate instead."))return;d[c]=b[c]}}):d.duration=b,d}function c(a,c){var d=b(a,c);return d.easing=f(d.easing),d}function d(a,b,c,d){return 0>a||a>1||0>c||c>1?y:function(e){function f(a,b,c){return 3*a*(1-c)*(1-c)*c+3*b*(1-c)*c*c+c*c*c}for(var g=0,h=1;;){var i=(g+h)/2,j=f(a,c,i);if(Math.abs(e-j)<.001)return f(b,d,i);e>j?g=i:h=i}}}function e(a,b){return function(c){if(c>=1)return 1;var d=1/a;return c+=b*d,c-c%d}}function f(a){var b=w.exec(a);if(b)return d.apply(this,b.slice(1).map(Number));var c=x.exec(a);if(c)return e(Number(c[1]),{start:r,middle:s,end:t}[c[2]]);var f=u[a];return f?f:y}function g(a){return Math.abs(h(a)/a.playbackRate)}function h(a){return a.duration*a.iterations}function i(a,b,c){return null==b?z:b<c.delay?A:b>=c.delay+a?B:C}function j(a,b,c,d,e){switch(d){case A:return"backwards"==b||"both"==b?0:null;case C:return c-e;case B:return"forwards"==b||"both"==b?a:null;case z:return null}}function k(a,b,c,d){return(d.playbackRate<0?b-a:b)*d.playbackRate+c}function l(a,b,c,d,e){return 1/0===c||c===-1/0||c-d==b&&e.iterations&&(e.iterations+e.iterationStart)%1==0?a:c%a}function m(a,b,c,d){return 0===c?0:b==a?d.iterationStart+d.iterations-1:Math.floor(c/a)}function n(a,b,c,d){var e=a%2>=1,f="normal"==d.direction||d.direction==(e?"alternate-reverse":"alternate"),g=f?c:b-c,h=g/b;return b*d.easing(h)}function o(a,b,c){var d=i(a,b,c),e=j(a,c.fill,b,d,c.delay);if(null===e)return null;if(0===a)return d===A?0:1;var f=c.iterationStart*c.duration,g=k(a,e,f,c),o=l(c.duration,h(c),g,f,c),p=m(c.duration,o,g,c);return n(p,c.duration,o,c)/c.duration}var p="backwards|forwards|both|none".split("|"),q="reverse|alternate|alternate-reverse".split("|"),r=1,s=.5,t=0,u={ease:d(.25,.1,.25,1),"ease-in":d(.42,0,1,1),"ease-out":d(0,0,.58,1),"ease-in-out":d(.42,0,.58,1),"step-start":e(1,r),"step-middle":e(1,s),"step-end":e(1,t)},v="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",w=new RegExp("cubic-bezier\\("+v+","+v+","+v+","+v+"\\)"),x=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/,y=function(a){return a},z=0,A=1,B=2,C=3;a.makeTiming=b,a.normalizeTimingInput=c,a.calculateActiveDuration=g,a.calculateTimeFraction=o,a.calculatePhase=i,a.toTimingFunction=f}(c,f),function(a){function b(a,b){return a in h?h[a][b]||b:b}function c(a,c,d){var g=e[a];if(g){f.style[a]=c;for(var h in g){var i=g[h],j=f.style[i];d[i]=b(i,j)}}else d[a]=b(a,c)}function d(b){function d(){var a=e.length;null==e[a-1].offset&&(e[a-1].offset=1),a>1&&null==e[0].offset&&(e[0].offset=0);for(var b=0,c=e[0].offset,d=1;a>d;d++){var f=e[d].offset;if(null!=f){for(var g=1;d-b>g;g++)e[b+g].offset=c+(f-c)*g/(d-b);b=d,c=f}}}if(!Array.isArray(b)&&null!==b)throw new TypeError("Keyframes must be null or an array of keyframes");if(null==b)return[];for(var e=b.map(function(b){var d={};for(var e in b){var f=b[e];if("offset"==e){if(null!=f&&(f=Number(f),!isFinite(f)))throw new TypeError("keyframe offsets must be numbers.")}else{if("composite"==e)throw{type:DOMException.NOT_SUPPORTED_ERR,name:"NotSupportedError",message:"add compositing is not supported"};f="easing"==e?a.toTimingFunction(f):""+f}c(e,f,d)}return void 0==d.offset&&(d.offset=null),void 0==d.easing&&(d.easing=a.toTimingFunction("linear")),d}),f=!0,g=-1/0,h=0;h<e.length;h++){var i=e[h].offset;if(null!=i){if(g>i)throw{code:DOMException.INVALID_MODIFICATION_ERR,name:"InvalidModificationError",message:"Keyframes are not loosely sorted by offset. Sort or specify offsets."};g=i}else f=!1}return e=e.filter(function(a){return a.offset>=0&&a.offset<=1}),f||d(),e}var e={background:["backgroundImage","backgroundPosition","backgroundSize","backgroundRepeat","backgroundAttachment","backgroundOrigin","backgroundClip","backgroundColor"],border:["borderTopColor","borderTopStyle","borderTopWidth","borderRightColor","borderRightStyle","borderRightWidth","borderBottomColor","borderBottomStyle","borderBottomWidth","borderLeftColor","borderLeftStyle","borderLeftWidth"],borderBottom:["borderBottomWidth","borderBottomStyle","borderBottomColor"],borderColor:["borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"],borderLeft:["borderLeftWidth","borderLeftStyle","borderLeftColor"],borderRadius:["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],borderRight:["borderRightWidth","borderRightStyle","borderRightColor"],borderTop:["borderTopWidth","borderTopStyle","borderTopColor"],borderWidth:["borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"],flex:["flexGrow","flexShrink","flexBasis"],font:["fontFamily","fontSize","fontStyle","fontVariant","fontWeight","lineHeight"],margin:["marginTop","marginRight","marginBottom","marginLeft"],outline:["outlineColor","outlineStyle","outlineWidth"],padding:["paddingTop","paddingRight","paddingBottom","paddingLeft"]},f=document.createElementNS("http://www.w3.org/1999/xhtml","div"),g={thin:"1px",medium:"3px",thick:"5px"},h={borderBottomWidth:g,borderLeftWidth:g,borderRightWidth:g,borderTopWidth:g,fontSize:{"xx-small":"60%","x-small":"75%",small:"89%",medium:"100%",large:"120%","x-large":"150%","xx-large":"200%"},fontWeight:{normal:"400",bold:"700"},outlineWidth:g,textShadow:{none:"0px 0px 0px transparent"},boxShadow:{none:"0px 0px 0px 0px transparent"}};a.normalizeKeyframes=d}(c,f),function(a){var b={};a.isDeprecated=function(a,c,d,e){var f=e?"are":"is",g=new Date,h=new Date(c);return h.setMonth(h.getMonth()+3),h>g?(a in b||console.warn("Web Animations: "+a+" "+f+" deprecated and will stop working on "+h.toDateString()+". "+d),b[a]=!0,!1):!0},a.deprecated=function(b,c,d,e){var f=e?"are":"is";if(a.isDeprecated(b,c,d,e))throw new Error(b+" "+f+" no longer supported. "+d)}}(c),function(){if(document.documentElement.animate){var a=document.documentElement.animate([],0),b=!0;if(a&&(b=!1,"play|currentTime|pause|reverse|playbackRate|cancel|finish|startTime|playState".split("|").forEach(function(c){void 0===a[c]&&(b=!0)})),!b)return}!function(a,b){function c(a){for(var b={},c=0;c<a.length;c++)for(var d in a[c])if("offset"!=d&&"easing"!=d&&"composite"!=d){var e={offset:a[c].offset,easing:a[c].easing,value:a[c][d]};b[d]=b[d]||[],b[d].push(e)}for(var f in b){var g=b[f];if(0!=g[0].offset||1!=g[g.length-1].offset)throw{type:DOMException.NOT_SUPPORTED_ERR,name:"NotSupportedError",message:"Partial keyframes are not supported"}}return b}function d(a){var c=[];for(var d in a)for(var e=a[d],f=0;f<e.length-1;f++){var g=e[f].offset,h=e[f+1].offset,i=e[f].value,j=e[f+1].value;g==h&&(1==h?i=j:j=i),c.push({startTime:g,endTime:h,easing:e[f].easing,property:d,interpolation:b.propertyInterpolation(d,i,j)})}return c.sort(function(a,b){return a.startTime-b.startTime}),c}b.convertEffectInput=function(e){var f=a.normalizeKeyframes(e),g=c(f),h=d(g);return function(a,c){if(null!=c)h.filter(function(a){return 0>=c&&0==a.startTime||c>=1&&1==a.endTime||c>=a.startTime&&c<=a.endTime}).forEach(function(d){var e=c-d.startTime,f=d.endTime-d.startTime,g=0==f?0:d.easing(e/f);b.apply(a,d.property,d.interpolation(g))});else for(var d in g)"offset"!=d&&"easing"!=d&&"composite"!=d&&b.clear(a,d)}}}(c,d,f),function(a){function b(a,b,c){e[c]=e[c]||[],e[c].push([a,b])}function c(a,c,d){for(var e=0;e<d.length;e++){var f=d[e];b(a,c,f),/-/.test(f)&&b(a,c,f.replace(/-(.)/g,function(a,b){return b.toUpperCase()}))}}function d(b,c,d){for(var f=c==d?[]:e[b],g=0;f&&g<f.length;g++){var h=f[g][0](c),i=f[g][0](d);if(void 0!==h&&void 0!==i){var j=f[g][1](h,i);if(j){var k=a.Interpolation.apply(null,j);return function(a){return 0==a?c:1==a?d:k(a)}}}}return a.Interpolation(!1,!0,function(a){return a?d:c})}var e={};a.addPropertiesHandler=c,a.propertyInterpolation=d}(d,f),function(a,b){function c(b){var c=a.calculateActiveDuration(b),d=function(d){return a.calculateTimeFraction(c,d,b)};return d._totalDuration=b.delay+c+b.endDelay,d._isCurrent=function(d){var e=a.calculatePhase(c,d,b);return e===PhaseActive||e===PhaseBefore},d}b.KeyframeEffect=function(d,e,f){var g,h=c(a.normalizeTimingInput(f)),i=b.convertEffectInput(e),j=function(){i(d,g)};return j._update=function(a){return g=h(a),null!==g},j._clear=function(){i(d,null)},j._hasSameTarget=function(a){return d===a},j._isCurrent=h._isCurrent,j._totalDuration=h._totalDuration,j},b.NullEffect=function(a){var b=function(){a&&(a(),a=null)};return b._update=function(){return null},b._totalDuration=0,b._isCurrent=function(){return!1},b._hasSameTarget=function(){return!1},b}}(c,d,f),function(a){a.apply=function(b,c,d){b.style[a.propertyName(c)]=d},a.clear=function(b,c){b.style[a.propertyName(c)]=""}}(d,f),function(a){window.Element.prototype.animate=function(b,c){return a.timeline._play(a.KeyframeEffect(this,b,c))}}(d),function(a){function b(a,c,d){if("number"==typeof a&&"number"==typeof c)return a*(1-d)+c*d;if("boolean"==typeof a&&"boolean"==typeof c)return.5>d?a:c;if(a.length==c.length){for(var e=[],f=0;f<a.length;f++)e.push(b(a[f],c[f],d));return e}throw"Mismatched interpolation arguments "+a+":"+c}a.Interpolation=function(a,c,d){return function(e){return d(b(a,c,e))}}}(d,f),function(a){var b=0,c=function(a,b,c){this.target=a,this.currentTime=b,this.timelineTime=c,this.type="finish",this.bubbles=!1,this.cancelable=!1,this.currentTarget=a,this.defaultPrevented=!1,this.eventPhase=Event.AT_TARGET,this.timeStamp=Date.now()};a.Animation=function(a){this._sequenceNumber=b++,this._currentTime=0,this._startTime=null,this.paused=!1,this._playbackRate=1,this._inTimeline=!0,this._finishedFlag=!1,this.onfinish=null,this._finishHandlers=[],this._effect=a,this._inEffect=this._effect._update(0),this._idle=!0,this._currentTimePending=!1},a.Animation.prototype={_ensureAlive:function(){this._inEffect=this._effect._update(this.playbackRate<0&&0===this.currentTime?-1:this.currentTime),this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,a.timeline._animations.push(this))},_tickCurrentTime:function(a,b){a!=this._currentTime&&(this._currentTime=a,this.finished&&!b&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this._ensureAlive())},get currentTime(){return this._idle||this._currentTimePending?null:this._currentTime},set currentTime(b){b=+b,isNaN(b)||(a.restart(),this.paused||null==this._startTime||(this._startTime=this._timeline.currentTime-b/this._playbackRate),this._currentTimePending=!1,this._currentTime!=b&&(this._tickCurrentTime(b,!0),a.invalidateEffects()))},get startTime(){return this._startTime},set startTime(b){b=+b,isNaN(b)||this.paused||this._idle||(this._startTime=b,this._tickCurrentTime((this._timeline.currentTime-this._startTime)*this.playbackRate),a.invalidateEffects())},get playbackRate(){return this._playbackRate},set playbackRate(a){if(a!=this._playbackRate){var b=this.currentTime;this._playbackRate=a,this._startTime=null,"paused"!=this.playState&&"idle"!=this.playState&&this.play(),null!=b&&(this.currentTime=b)}},get finished(){return!this._idle&&(this._playbackRate>0&&this._currentTime>=this._totalDuration||this._playbackRate<0&&this._currentTime<=0)},get _totalDuration(){return this._effect._totalDuration},get playState(){return this._idle?"idle":null==this._startTime&&!this.paused&&0!=this.playbackRate||this._currentTimePending?"pending":this.paused?"paused":this.finished?"finished":"running"},play:function(){this.paused=!1,(this.finished||this._idle)&&(this._currentTime=this._playbackRate>0?0:this._totalDuration,this._startTime=null,a.invalidateEffects()),this._finishedFlag=!1,a.restart(),this._idle=!1,this._ensureAlive()},pause:function(){this.finished||this.paused||this._idle||(this._currentTimePending=!0),this._startTime=null,this.paused=!0},finish:function(){this._idle||(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this._currentTimePending=!1)},cancel:function(){this._inEffect=!1,this._idle=!0,this.currentTime=0,this._startTime=null},reverse:function(){this.playbackRate*=-1,this.play()},addEventListener:function(a,b){"function"==typeof b&&"finish"==a&&this._finishHandlers.push(b)},removeEventListener:function(a,b){if("finish"==a){var c=this._finishHandlers.indexOf(b);c>=0&&this._finishHandlers.splice(c,1)}},_fireEvents:function(a){var b=this.finished;if((b||this._idle)&&!this._finishedFlag){var d=new c(this,this._currentTime,a),e=this._finishHandlers.concat(this.onfinish?[this.onfinish]:[]);setTimeout(function(){e.forEach(function(a){a.call(d.target,d)})},0)}this._finishedFlag=b},_tick:function(a){return this._idle||this.paused||(null==this._startTime?this.startTime=a-this._currentTime/this.playbackRate:this.finished||this._tickCurrentTime((a-this._startTime)*this.playbackRate)),this._currentTimePending=!1,this._fireEvents(a),!this._idle&&(this._inEffect||!this._finishedFlag)}}}(d,f),function(a,b){function c(a){var b=i;i=[],g(a),b.forEach(function(b){b[1](a)}),m&&g(a),f()}function d(a,b){return a._sequenceNumber-b._sequenceNumber}function e(){this._animations=[],this.currentTime=window.performance&&performance.now?performance.now():0}function f(){n.forEach(function(a){a()}),n.length=0}function g(a){l=!1;var c=b.timeline;c.currentTime=a,c._animations.sort(d),k=!1;var e=c._animations;c._animations=[];var f=[],g=[];e=e.filter(function(b){return b._inTimeline=b._tick(a),b._inEffect?g.push(b._effect):f.push(b._effect),b.finished||b.paused||b._idle||(k=!0),b._inTimeline}),n.push.apply(n,f),n.push.apply(n,g),c._animations.push.apply(c._animations,e),m=!1,k&&requestAnimationFrame(function(){})}var h=window.requestAnimationFrame,i=[],j=0;window.requestAnimationFrame=function(a){var b=j++;return 0==i.length&&h(c),i.push([b,a]),b},window.cancelAnimationFrame=function(a){i.forEach(function(b){b[0]==a&&(b[1]=function(){})})},e.prototype={_play:function(c){c._timing=a.normalizeTimingInput(c.timing);var d=new b.Animation(c);return d._idle=!1,d._timeline=this,this._animations.push(d),b.restart(),b.invalidateEffects(),d}};var k=!1,l=!1;b.restart=function(){return k||(k=!0,requestAnimationFrame(function(){}),l=!0),l};var m=!1;b.invalidateEffects=function(){m=!0};var n=[],o=window.getComputedStyle;Object.defineProperty(window,"getComputedStyle",{configurable:!0,enumerable:!0,value:function(){return m&&g(p.currentTime),f(),o.apply(this,arguments)}});var p=new e;b.timeline=p}(c,d,f),function(a){function b(a,b){var c=a.exec(b);return c?(c=a.ignoreCase?c[0].toLowerCase():c[0],[c,b.substr(c.length)]):void 0}function c(a,b){b=b.replace(/^\s*/,"");var c=a(b);return c?[c[0],c[1].replace(/^\s*/,"")]:void 0}function d(a,d,e){a=c.bind(null,a);for(var f=[];;){var g=a(e);if(!g)return[f,e];if(f.push(g[0]),e=g[1],g=b(d,e),!g||""==g[1])return[f,e];e=g[1]}}function e(a,b){for(var c=0,d=0;d<b.length&&(!/\s|,/.test(b[d])||0!=c);d++)if("("==b[d])c++;else if(")"==b[d]&&(c--,0==c&&d++,0>=c))break;var e=a(b.substr(0,d));return void 0==e?void 0:[e,b.substr(d)]}function f(a,b){for(var c=a,d=b;c&&d;)c>d?c%=d:d%=c;return c=a*b/(c+d)}function g(a){return function(b){var c=a(b);return c&&(c[0]=void 0),c}}function h(a,b){return function(c){var d=a(c);return d?d:[b,c]}}function i(b,c){for(var d=[],e=0;e<b.length;e++){var f=a.consumeTrimmed(b[e],c);if(!f||""==f[0])return;void 0!==f[0]&&d.push(f[0]),c=f[1]}return""==c?d:void 0}function j(a,b,c,d,e){for(var g=[],h=[],i=[],j=f(d.length,e.length),k=0;j>k;k++){var l=b(d[k%d.length],e[k%e.length]);if(!l)return;g.push(l[0]),h.push(l[1]),i.push(l[2])}return[g,h,function(b){var d=b.map(function(a,b){return i[b](a)}).join(c);return a?a(d):d}]}function k(a,b,c){for(var d=[],e=[],f=[],g=0,h=0;h<c.length;h++)if("function"==typeof c[h]){var i=c[h](a[g],b[g++]);d.push(i[0]),e.push(i[1]),f.push(i[2])}else!function(a){d.push(!1),e.push(!1),f.push(function(){return c[a]})}(h);return[d,e,function(a){for(var b="",c=0;c<a.length;c++)b+=f[c](a[c]);return b}]}a.consumeToken=b,a.consumeTrimmed=c,a.consumeRepeated=d,a.consumeParenthesised=e,a.ignore=g,a.optional=h,a.consumeList=i,a.mergeNestedRepeated=j.bind(null,null),a.mergeWrappedNestedRepeated=j,a.mergeList=k}(d),function(a){function b(b){function c(b){var c=a.consumeToken(/^inset/i,b);if(c)return d.inset=!0,c;var c=a.consumeLengthOrPercent(b);if(c)return d.lengths.push(c[0]),c;var c=a.consumeColor(b);return c?(d.color=c[0],c):void 0}var d={inset:!1,lengths:[],color:null},e=a.consumeRepeated(c,/^/,b);return e&&e[0].length?[d,e[1]]:void 0}function c(c){var d=a.consumeRepeated(b,/^,/,c);return d&&""==d[1]?d[0]:void 0}function d(b,c){for(;b.lengths.length<Math.max(b.lengths.length,c.lengths.length);)b.lengths.push({px:0});for(;c.lengths.length<Math.max(b.lengths.length,c.lengths.length);)c.lengths.push({px:0});if(b.inset==c.inset&&!!b.color==!!c.color){for(var d,e=[],f=[[],0],g=[[],0],h=0;h<b.lengths.length;h++){var i=a.mergeDimensions(b.lengths[h],c.lengths[h],2==h);f[0].push(i[0]),g[0].push(i[1]),e.push(i[2])}if(b.color&&c.color){var j=a.mergeColors(b.color,c.color);f[1]=j[0],g[1]=j[1],d=j[2]}return[f,g,function(a){for(var c=b.inset?"inset ":" ",f=0;f<e.length;f++)c+=e[f](a[0][f])+" ";return d&&(c+=d(a[1])),c}]}}function e(b,c,d,e){function f(a){return{inset:a,color:[0,0,0,0],lengths:[{px:0},{px:0},{px:0},{px:0}]}}for(var g=[],h=[],i=0;i<d.length||i<e.length;i++){var j=d[i]||f(e[i].inset),k=e[i]||f(d[i].inset);g.push(j),h.push(k)}return a.mergeNestedRepeated(b,c,g,h)}var f=e.bind(null,d,", ");a.addPropertiesHandler(c,f,["box-shadow","text-shadow"])}(d),function(a){function b(a){return a.toFixed(3).replace(".000","")}function c(a,b,c){return Math.min(b,Math.max(a,c))}function d(a){return/^\s*[-+]?(\d*\.)?\d+\s*$/.test(a)?Number(a):void 0}function e(a,c){return[a,c,b]}function f(a,b){return 0!=a?h(0,1/0)(a,b):void 0}function g(a,b){return[a,b,function(a){return Math.round(c(1,1/0,a))}]}function h(a,d){return function(e,f){return[e,f,function(e){return b(c(a,d,e))}]}}function i(a,b){return[a,b,Math.round]}a.clamp=c,a.addPropertiesHandler(d,h(0,1/0),["border-image-width","line-height"]),a.addPropertiesHandler(d,h(0,1),["opacity","shape-image-threshold"]),a.addPropertiesHandler(d,f,["flex-grow","flex-shrink"]),a.addPropertiesHandler(d,g,["orphans","widows"]),a.addPropertiesHandler(d,i,["z-index"]),a.parseNumber=d,a.mergeNumbers=e,a.numberToString=b}(d,f),function(a){function b(a,b){return"visible"==a||"visible"==b?[0,1,function(c){return 0>=c?a:c>=1?b:"visible"}]:void 0}a.addPropertiesHandler(String,b,["visibility"])}(d),function(a){function b(a){a=a.trim(),e.fillStyle="#000",e.fillStyle=a;var b=e.fillStyle;if(e.fillStyle="#fff",e.fillStyle=a,b==e.fillStyle){e.fillRect(0,0,1,1);var c=e.getImageData(0,0,1,1).data;e.clearRect(0,0,1,1);var d=c[3]/255;return[c[0]*d,c[1]*d,c[2]*d,d]}}function c(b,c){return[b,c,function(b){function c(a){return Math.max(0,Math.min(255,a))}if(b[3])for(var d=0;3>d;d++)b[d]=Math.round(c(b[d]/b[3]));return b[3]=a.numberToString(a.clamp(0,1,b[3])),"rgba("+b.join(",")+")"}]}var d=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");d.width=d.height=1;var e=d.getContext("2d");a.addPropertiesHandler(b,c,["background-color","border-bottom-color","border-left-color","border-right-color","border-top-color","color","outline-color","text-decoration-color"]),a.consumeColor=a.consumeParenthesised.bind(null,b),a.mergeColors=c}(d,f),function(a,b){function c(a,b){if(b=b.trim().toLowerCase(),"0"==b&&"px".search(a)>=0)return{px:0};if(/^[^(]*$|^calc/.test(b)){b=b.replace(/calc\(/g,"(");var c={};b=b.replace(a,function(a){return c[a]=null,"U"+a});for(var d="U("+a.source+")",e=b.replace(/[-+]?(\d*\.)?\d+/g,"N").replace(new RegExp("N"+d,"g"),"D").replace(/\s[+-]\s/g,"O").replace(/\s/g,""),f=[/N\*(D)/g,/(N|D)[*/]N/g,/(N|D)O\1/g,/\((N|D)\)/g],g=0;g<f.length;)f[g].test(e)?(e=e.replace(f[g],"$1"),g=0):g++;if("D"==e){for(var h in c){var i=eval(b.replace(new RegExp("U"+h,"g"),"").replace(new RegExp(d,"g"),"*0"));if(!isFinite(i))return;c[h]=i}return c}}}function d(a,b){return e(a,b,!0)}function e(b,c,d){var e,f=[];for(e in b)f.push(e);for(e in c)f.indexOf(e)<0&&f.push(e);return b=f.map(function(a){return b[a]||0}),c=f.map(function(a){return c[a]||0}),[b,c,function(b){var c=b.map(function(c,e){return 1==b.length&&d&&(c=Math.max(c,0)),a.numberToString(c)+f[e]}).join(" + ");return b.length>1?"calc("+c+")":c}]}var f="px|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc",g=c.bind(null,new RegExp(f,"g")),h=c.bind(null,new RegExp(f+"|%","g")),i=c.bind(null,/deg|rad|grad|turn/g);a.parseLength=g,a.parseLengthOrPercent=h,a.consumeLengthOrPercent=a.consumeParenthesised.bind(null,h),a.parseAngle=i,a.mergeDimensions=e;var j=a.consumeParenthesised.bind(null,g),k=a.consumeRepeated.bind(void 0,j,/^/),l=a.consumeRepeated.bind(void 0,k,/^,/);a.consumeSizePairList=l;var m=function(a){var b=l(a);return b&&""==b[1]?b[0]:void 0},n=a.mergeNestedRepeated.bind(void 0,d," "),o=a.mergeNestedRepeated.bind(void 0,n,",");a.mergeNonNegativeSizePair=n,a.addPropertiesHandler(m,o,["background-size"]),a.addPropertiesHandler(h,d,["border-bottom-width","border-image-width","border-left-width","border-right-width","border-top-width","flex-basis","font-size","height","line-height","max-height","max-width","outline-width","width"]),a.addPropertiesHandler(h,e,["border-bottom-left-radius","border-bottom-right-radius","border-top-left-radius","border-top-right-radius","bottom","left","letter-spacing","margin-bottom","margin-left","margin-right","margin-top","min-height","min-width","outline-offset","padding-bottom","padding-left","padding-right","padding-top","perspective","right","shape-margin","text-indent","top","vertical-align","word-spacing"])}(d,f),function(a){function b(b){return a.consumeLengthOrPercent(b)||a.consumeToken(/^auto/,b)}function c(c){var d=a.consumeList([a.ignore(a.consumeToken.bind(null,/^rect/)),a.ignore(a.consumeToken.bind(null,/^\(/)),a.consumeRepeated.bind(null,b,/^,/),a.ignore(a.consumeToken.bind(null,/^\)/))],c);return d&&4==d[0].length?d[0]:void 0}function d(b,c){return"auto"==b||"auto"==c?[!0,!1,function(d){var e=d?b:c;if("auto"==e)return"auto";var f=a.mergeDimensions(e,e);return f[2](f[0])}]:a.mergeDimensions(b,c)}function e(a){return"rect("+a+")"}var f=a.mergeWrappedNestedRepeated.bind(null,e,d,", ");a.parseBox=c,a.mergeBoxes=f,a.addPropertiesHandler(c,f,["clip"])}(d,f),function(a){function b(a){return function(b){var c=0;return a.map(function(a){return a===j?b[c++]:a})}}function c(a){return a}function d(b){if(b=b.toLowerCase().trim(),"none"==b)return[];for(var c,d=/\s*(\w+)\(([^)]*)\)/g,e=[],f=0;c=d.exec(b);){if(c.index!=f)return;f=c.index+c[0].length;var g=c[1],h=m[g];if(!h)return;var i=c[2].split(","),j=h[0];if(j.length<i.length)return;for(var n=[],o=0;o<j.length;o++){var p,q=i[o],r=j[o];if(p=q?{A:function(b){return"0"==b.trim()?l:a.parseAngle(b)},N:a.parseNumber,T:a.parseLengthOrPercent,L:a.parseLength}[r.toUpperCase()](q):{a:l,n:n[0],t:k}[r],void 0===p)return;n.push(p)}if(e.push({t:g,d:n}),d.lastIndex==b.length)return e}}function e(a){return a.toFixed(6).replace(".000000","")}function f(b,c){if(b.decompositionPair!==c){b.decompositionPair=c;var d=a.makeMatrixDecomposition(b)}if(c.decompositionPair!==b){c.decompositionPair=b;var f=a.makeMatrixDecomposition(c)}return null==d[0]||null==f[0]?[[!1],[!0],function(a){return a?c[0].d:b[0].d}]:(d[0].push(0),f[0].push(1),[d,f,function(b){var c=a.quat(d[0][3],f[0][3],b[5]),g=a.composeMatrix(b[0],b[1],b[2],c,b[4]),h=g.map(e).join(",");return h}])}function g(a){return a.replace(/[xy]/,"")}function h(a){return a.replace(/(x|y|z|3d)?$/,"3d")}function i(b,c){var d=a.makeMatrixDecomposition&&!0,e=!1;if(!b.length||!c.length){b.length||(e=!0,b=c,c=[]);for(var i=0;i<b.length;i++){var j=b[i].t,k=b[i].d,l="scale"==j.substr(0,5)?1:0;c.push({t:j,d:k.map(function(a){if("number"==typeof a)return l;var b={};for(var c in a)b[c]=l;return b})})}}var n=function(a,b){return"perspective"==a&&"perspective"==b||("matrix"==a||"matrix3d"==a)&&("matrix"==b||"matrix3d"==b)},o=[],p=[],q=[];if(b.length!=c.length){if(!d)return;var r=f(b,c);o=[r[0]],p=[r[1]],q=[["matrix",[r[2]]]]}else for(var i=0;i<b.length;i++){var j,s=b[i].t,t=c[i].t,u=b[i].d,v=c[i].d,w=m[s],x=m[t];if(n(s,t)){if(!d)return;var r=f([b[i]],[c[i]]);o.push(r[0]),p.push(r[1]),q.push(["matrix",[r[2]]])}else{if(s==t)j=s;else if(w[2]&&x[2]&&g(s)==g(t))j=g(s),u=w[2](u),v=x[2](v);else{if(!w[1]||!x[1]||h(s)!=h(t)){if(!d)return;var r=f(b,c);o=[r[0]],p=[r[1]],q=[["matrix",[r[2]]]];break}j=h(s),u=w[1](u),v=x[1](v)}for(var y=[],z=[],A=[],B=0;B<u.length;B++){var C="number"==typeof u[B]?a.mergeNumbers:a.mergeDimensions,r=C(u[B],v[B]);y[B]=r[0],z[B]=r[1],A.push(r[2])}o.push(y),p.push(z),q.push([j,A])}}if(e){var D=o;o=p,p=D}return[o,p,function(a){return a.map(function(a,b){var c=a.map(function(a,c){return q[b][1][c](a)}).join(",");return"matrix"==q[b][0]&&16==c.split(",").length&&(q[b][0]="matrix3d"),q[b][0]+"("+c+")"}).join(" ")}]}var j=null,k={px:0},l={deg:0},m={matrix:["NNNNNN",[j,j,0,0,j,j,0,0,0,0,1,0,j,j,0,1],c],matrix3d:["NNNNNNNNNNNNNNNN",c],rotate:["A"],rotatex:["A"],rotatey:["A"],rotatez:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",b([j,j,1]),c],scalex:["N",b([j,1,1]),b([j,1])],scaley:["N",b([1,j,1]),b([1,j])],scalez:["N",b([1,1,j])],scale3d:["NNN",c],skew:["Aa",null,c],skewx:["A",null,b([j,l])],skewy:["A",null,b([l,j])],translate:["Tt",b([j,j,k]),c],translatex:["T",b([j,k,k]),b([j,k])],translatey:["T",b([k,j,k]),b([k,j])],translatez:["L",b([k,k,j])],translate3d:["TTL",c]};a.addPropertiesHandler(d,i,["transform"])}(d,f),function(a){function b(a,b){b.concat([a]).forEach(function(b){b in document.documentElement.style&&(c[a]=b)})}var c={};b("transform",["webkitTransform","msTransform"]),b("transformOrigin",["webkitTransformOrigin"]),b("perspective",["webkitPerspective"]),b("perspectiveOrigin",["webkitPerspectiveOrigin"]),a.propertyName=function(a){return c[a]||a}}(d,f)}(),!function(a,b){function c(a){var b=window.document.timeline;b.currentTime=a,b._discardAnimations(),0==b._animations.length?d=!1:requestAnimationFrame(c)}b.AnimationTimeline=function(){this._animations=[],this.currentTime=void 0},b.AnimationTimeline.prototype={getAnimations:function(){return this._discardAnimations(),this._animations.slice()},getAnimationPlayers:function(){return a.deprecated("AnimationTimeline.getAnimationPlayers","2015-03-23","Use AnimationTimeline.getAnimations instead."),this.getAnimations()},_discardAnimations:function(){this._animations=this._animations.filter(function(a){return"finished"!=a.playState&&"idle"!=a.playState})},play:function(a){var c=new b.Animation(a);return this._animations.push(c),b.restartWebAnimationsNextTick(),c._animation.play(),c}};var d=!1;b.restartWebAnimationsNextTick=function(){d||(d=!0,requestAnimationFrame(c))};var e=new b.AnimationTimeline;b.timeline=e;try{Object.defineProperty(window.document,"timeline",{configurable:!0,get:function(){return e}})}catch(f){}try{window.document.timeline=e}catch(f){}}(c,e,f),function(a,b){b.Animation=function(a){this.effect=a,a&&(a.animation=this),this._isGroup=!1,this._animation=null,this._childAnimations=[],this._callback=null,this._rebuildUnderlyingAnimation(),this._animation.cancel()},b.Animation.prototype={_rebuildUnderlyingAnimation:function(){this._animation&&(this._animation.cancel(),this._animation=null),(!this.effect||this.effect instanceof window.KeyframeEffect)&&(this._animation=b.newUnderlyingAnimationForKeyframeEffect(this.effect),b.bindAnimationForKeyframeEffect(this)),(this.effect instanceof window.SequenceEffect||this.effect instanceof window.GroupEffect)&&(this._animation=b.newUnderlyingAnimationForGroup(this.effect),b.bindAnimationForGroup(this))},_updateChildren:function(){if(this.effect&&"idle"!=this.playState){var a=this.effect._timing.delay;this._childAnimations.forEach(function(c){this._arrangeChildren(c,a),this.effect instanceof window.SequenceEffect&&(a+=b.groupChildDuration(c.effect))}.bind(this))}},_setExternalAnimation:function(a){if(this.effect&&this._isGroup)for(var b=0;b<this.effect.children.length;b++)this.effect.children[b].animation=a,this._childAnimations[b]._setExternalAnimation(a)},_constructChildren:function(){if(this.effect&&this._isGroup){var a=this.effect._timing.delay;this.effect.children.forEach(function(c){var d=window.document.timeline.play(c);this._childAnimations.push(d),d.playbackRate=this.playbackRate,this.paused&&d.pause(),c.animation=this.effect.animation,this._arrangeChildren(d,a),this.effect instanceof window.SequenceEffect&&(a+=b.groupChildDuration(c))}.bind(this))}},_arrangeChildren:function(a,b){null===this.startTime?(a.currentTime=this.currentTime-b/this.playbackRate,a._startTime=null):a.startTime!==this.startTime+b/this.playbackRate&&(a.startTime=this.startTime+b/this.playbackRate)},get paused(){return this._animation.paused},get playState(){return this._animation.playState},get onfinish(){return this._onfinish},set onfinish(a){"function"==typeof a?(this._onfinish=a,this._animation.onfinish=function(b){b.target=this,a.call(this,b)}.bind(this)):(this._animation.onfinish=a,this.onfinish=this._animation.onfinish)},get currentTime(){return this._animation.currentTime},set currentTime(a){this._animation.currentTime=a,this._register(),this._forEachChild(function(b,c){b.currentTime=a-c})},get startTime(){return this._animation.startTime},set startTime(a){this._animation.startTime=a,this._register(),this._forEachChild(function(b,c){b.startTime=a+c})},get playbackRate(){return this._animation.playbackRate},set playbackRate(a){var b=this.currentTime;this._animation.playbackRate=a,this._forEachChild(function(b){b.playbackRate=a}),"paused"!=this.playState&&"idle"!=this.playState&&this.play(),null!==b&&(this.currentTime=b)},get finished(){return this._animation.finished},get source(){return a.deprecated("Animation.source","2015-03-23","Use Animation.effect instead."),this.effect},play:function(){this._animation.play(),this._register(),b.awaitStartTime(this),this._forEachChild(function(a){var b=a.currentTime;a.play(),a.currentTime=b})},pause:function(){this._animation.pause(),this._register(),this._forEachChild(function(a){a.pause()})},finish:function(){this._animation.finish(),this._register()},cancel:function(){this._animation.cancel(),this._register(),this._removeChildren()},reverse:function(){var a=this.currentTime;this._animation.reverse(),this._forEachChild(function(a){a.reverse()}),null!==a&&(this.currentTime=a)},addEventListener:function(a,b){var c=b;"function"==typeof b&&(c=function(a){a.target=this,b.call(this,a)}.bind(this),b._wrapper=c),this._animation.addEventListener(a,c)},removeEventListener:function(a,b){this._animation.removeEventListener(a,b&&b._wrapper||b)},_removeChildren:function(){for(;this._childAnimations.length;)this._childAnimations.pop().cancel()},_forEachChild:function(b){var c=0;if(this.effect.children&&this._childAnimations.length<this.effect.children.length&&this._constructChildren(),this._childAnimations.forEach(function(a){b.call(this,a,c),this.effect instanceof window.SequenceEffect&&(c+=a.effect.activeDuration)}.bind(this)),"pending"!=this._animation.playState){var d=this.effect._timing,e=this._animation.currentTime;null!==e&&(e=a.calculateTimeFraction(a.calculateActiveDuration(d),e,d)),(null==e||isNaN(e))&&this._removeChildren()}}}}(c,e,f),function(a,b){function c(b){this._frames=a.normalizeKeyframes(b)}function d(){for(var a=!1;g.length;)g.shift()._updateChildren(),a=!0;return a}b.KeyframeEffect=function(b,d,e){return this.target=b,this._timingInput=e,this._timing=a.normalizeTimingInput(e),this.timing=a.makeTiming(e),this._normalizedKeyframes="function"==typeof d?d:new c(d),this._keyframes=d,this.activeDuration=a.calculateActiveDuration(this._timing),this
|
||
},b.KeyframeEffect.prototype={getFrames:function(){return"function"==typeof this._normalizedKeyframes?this._normalizedKeyframes:this._normalizedKeyframes._frames},get effect(){return a.deprecated("KeyframeEffect.effect","2015-03-23","Use KeyframeEffect.getFrames() instead."),this._normalizedKeyframes}};var e=Element.prototype.animate;Element.prototype.animate=function(a,c){return b.timeline.play(new b.KeyframeEffect(this,a,c))};var f=document.createElementNS("http://www.w3.org/1999/xhtml","div");b.newUnderlyingAnimationForKeyframeEffect=function(a){var b=a.target||f,c=a._keyframes;return"function"==typeof c&&(c=[]),e.apply(b,[c,a._timingInput])},b.bindAnimationForKeyframeEffect=function(a){a.effect&&"function"==typeof a.effect._normalizedKeyframes&&b.bindAnimationForCustomEffect(a)};var g=[];b.awaitStartTime=function(a){null===a.startTime&&a._isGroup&&(0==g.length&&requestAnimationFrame(d),g.push(a))};var h=window.getComputedStyle;Object.defineProperty(window,"getComputedStyle",{configurable:!0,enumerable:!0,value:function(){var a=h.apply(this,arguments);return d()&&(a=h.apply(this,arguments)),a}}),window.KeyframeEffect=b.KeyframeEffect,window.Element.prototype.getAnimations=function(){return document.timeline.getAnimations().filter(function(a){return null!==a.effect&&a.effect.target==this}.bind(this))},window.Element.prototype.getAnimationPlayers=function(){return a.deprecated("Element.getAnimationPlayers","2015-03-23","Use Element.getAnimations instead."),this.getAnimations()},window.Animation=function(){a.deprecated("window.Animation","2015-03-23","Use window.KeyframeEffect instead."),window.KeyframeEffect.apply(this,arguments)},window.Animation.prototype=Object.create(window.KeyframeEffect.prototype),window.Animation.prototype.constructor=window.Animation}(c,e,f),function(a,b){function c(a){a._registered||(a._registered=!0,f.push(a),g||(g=!0,requestAnimationFrame(d)))}function d(){var a=f;f=[],a.sort(function(a,b){return a._sequenceNumber-b._sequenceNumber}),a=a.filter(function(a){a();var b=a._animation?a._animation.playState:"idle";return"running"!=b&&"pending"!=b&&(a._registered=!1),a._registered}),f.push.apply(f,a),f.length?(g=!0,requestAnimationFrame(d)):g=!1}var e=(document.createElementNS("http://www.w3.org/1999/xhtml","div"),0);b.bindAnimationForCustomEffect=function(b){var d=b.effect.target,f=b.effect._normalizedKeyframes,g=b.effect.timing,h=null;g=a.normalizeTimingInput(g);var i=function(){var c=i._animation?i._animation.currentTime:null;null!==c&&(c=a.calculateTimeFraction(a.calculateActiveDuration(g),c,g),isNaN(c)&&(c=null)),c!==h&&f(c,d,b.effect),h=c};i._animation=b,i._registered=!1,i._sequenceNumber=e++,b._callback=i,c(i)};var f=[],g=!1;b.Animation.prototype._register=function(){this._callback&&c(this._callback)}}(c,e,f),function(a,b){function c(a){return a._timing.delay+a.activeDuration+a._timing.endDelay}function d(b,c){this.children=b||[],this._timing=a.normalizeTimingInput(c,!0),this.timing=a.makeTiming(c,!0),"auto"===this._timing.duration&&(this._timing.duration=this.activeDuration)}window.SequenceEffect=function(){d.apply(this,arguments)},window.GroupEffect=function(){d.apply(this,arguments)},window.SequenceEffect.prototype={get activeDuration(){var a=0;return this.children.forEach(function(b){a+=c(b)}),Math.max(a,0)}},window.GroupEffect.prototype={get activeDuration(){var a=0;return this.children.forEach(function(b){a=Math.max(a,c(b))}),a}},b.newUnderlyingAnimationForGroup=function(c){var d,e=null,f=function(b){var c=d._wrapper;return"pending"!=c.playState&&c.effect?null==b?void c._removeChildren():0==b&&c.playbackRate<0&&(e||(e=a.normalizeTimingInput(c.effect.timing)),b=a.calculateTimeFraction(a.calculateActiveDuration(e),-1,e),isNaN(b)||null==b)?(c._forEachChild(function(a){a.currentTime=-1}),void c._removeChildren()):void 0:void 0};return d=b.timeline.play(new b.KeyframeEffect(null,f,c._timing))},b.bindAnimationForGroup=function(a){a._animation._wrapper=a,a._isGroup=!0,b.awaitStartTime(a),a._constructChildren(),a._setExternalAnimation(a)},b.groupChildDuration=c,window.AnimationSequence=function(){a.deprecated("window.AnimationSequence","2015-03-23","Use window.SequenceEffect instead."),window.SequenceEffect.apply(this,arguments)},window.AnimationSequence.prototype=Object.create(window.SequenceEffect.prototype),window.AnimationSequence.prototype.constructor=window.AnimationSequence,window.AnimationGroup=function(){a.deprecated("window.AnimationGroup","2015-03-23","Use window.GroupEffect instead."),window.GroupEffect.apply(this,arguments)},window.AnimationGroup.prototype=Object.create(window.GroupEffect.prototype),window.AnimationGroup.prototype.constructor=window.AnimationGroup}(c,e,f)}({},function(){return this}());
|
||
//# sourceMappingURL=web-animations-next-lite.min.js.map</script>
|
||
|
||
|
||
<script>
|
||
|
||
Polymer({
|
||
|
||
is: 'opaque-animation',
|
||
|
||
behaviors: [
|
||
Polymer.NeonAnimationBehavior
|
||
],
|
||
|
||
configure: function(config) {
|
||
var node = config.node;
|
||
node.style.opacity = '0';
|
||
this._effect = new KeyframeEffect(node, [
|
||
{'opacity': '1'},
|
||
{'opacity': '1'}
|
||
], this.timingFromConfig(config));
|
||
return this._effect;
|
||
},
|
||
|
||
complete: function(config) {
|
||
config.node.style.opacity = '';
|
||
}
|
||
|
||
});
|
||
|
||
</script>
|
||
|
||
|
||
|
||
|
||
|
||
<script>
|
||
|
||
Polymer({
|
||
|
||
is: 'fade-in-animation',
|
||
|
||
behaviors: [
|
||
Polymer.NeonAnimationBehavior
|
||
],
|
||
|
||
configure: function(config) {
|
||
var node = config.node;
|
||
this._effect = new KeyframeEffect(node, [
|
||
{'opacity': '0'},
|
||
{'opacity': '1'}
|
||
], this.timingFromConfig(config));
|
||
return this._effect;
|
||
}
|
||
|
||
});
|
||
|
||
</script>
|
||
|
||
|
||
<script>
|
||
|
||
Polymer({
|
||
|
||
is: 'fade-out-animation',
|
||
|
||
behaviors: [
|
||
Polymer.NeonAnimationBehavior
|
||
],
|
||
|
||
configure: function(config) {
|
||
var node = config.node;
|
||
this._effect = new KeyframeEffect(node, [
|
||
{'opacity': '1'},
|
||
{'opacity': '0'}
|
||
], this.timingFromConfig(config));
|
||
return this._effect;
|
||
}
|
||
|
||
});
|
||
|
||
</script>
|
||
|
||
|
||
|
||
<script>
|
||
|
||
/**
|
||
* `iron-range-behavior` provides the behavior for something with a minimum to maximum range.
|
||
*
|
||
* @demo demo/index.html
|
||
* @polymerBehavior
|
||
*/
|
||
Polymer.IronRangeBehavior = {
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The number that represents the current value.
|
||
*/
|
||
value: {
|
||
type: Number,
|
||
value: 0,
|
||
notify: true,
|
||
reflectToAttribute: true
|
||
},
|
||
|
||
/**
|
||
* The number that indicates the minimum value of the range.
|
||
*/
|
||
min: {
|
||
type: Number,
|
||
value: 0,
|
||
notify: true
|
||
},
|
||
|
||
/**
|
||
* The number that indicates the maximum value of the range.
|
||
*/
|
||
max: {
|
||
type: Number,
|
||
value: 100,
|
||
notify: true
|
||
},
|
||
|
||
/**
|
||
* Specifies the value granularity of the range's value.
|
||
*/
|
||
step: {
|
||
type: Number,
|
||
value: 1,
|
||
notify: true
|
||
},
|
||
|
||
/**
|
||
* Returns the ratio of the value.
|
||
*/
|
||
ratio: {
|
||
type: Number,
|
||
value: 0,
|
||
readOnly: true,
|
||
notify: true
|
||
},
|
||
},
|
||
|
||
observers: [
|
||
'_update(value, min, max, step)'
|
||
],
|
||
|
||
_calcRatio: function(value) {
|
||
return (this._clampValue(value) - this.min) / (this.max - this.min);
|
||
},
|
||
|
||
_clampValue: function(value) {
|
||
return Math.min(this.max, Math.max(this.min, this._calcStep(value)));
|
||
},
|
||
|
||
_calcStep: function(value) {
|
||
return this.step ? (Math.round(value / this.step) / (1 / this.step)) : value;
|
||
},
|
||
|
||
_validateValue: function() {
|
||
var v = this._clampValue(this.value);
|
||
this.value = this.oldValue = isNaN(v) ? this.oldValue : v;
|
||
return this.value !== v;
|
||
},
|
||
|
||
_update: function() {
|
||
this._validateValue();
|
||
this._setRatio(this._calcRatio(this.value) * 100);
|
||
}
|
||
|
||
};
|
||
</script>
|
||
|
||
|
||
|
||
|
||
<script>
|
||
|
||
/**
|
||
* color-picker custom element
|
||
*/
|
||
|
||
var colorPickerPrototype = Object.create(HTMLElement.prototype);
|
||
|
||
colorPickerPrototype.onMouseDown = function(e) {
|
||
this.onMouseMove(e);
|
||
this.addEventListener('mousemove', this.onMouseMove);
|
||
}
|
||
|
||
colorPickerPrototype.onMouseUp = function(e) {
|
||
this.removeEventListener('mousemove', this.onMouseMove);
|
||
}
|
||
|
||
colorPickerPrototype.onTouchStart = function(e) {
|
||
this.onTouchMove(e);
|
||
this.addEventListener('touchmove', this.onTouchMove);
|
||
}
|
||
|
||
colorPickerPrototype.onTouchEnd = function(e) {
|
||
this.removeEventListener('touchmove', this.onTouchMove);
|
||
}
|
||
|
||
colorPickerPrototype.onTouchMove = function(e) {
|
||
var touch = e.touches[0];
|
||
this.onColorSelect(e, {
|
||
x: touch.clientX,
|
||
y: touch.clientY
|
||
});
|
||
}
|
||
|
||
colorPickerPrototype.onMouseMove = function(e) {
|
||
e.preventDefault();
|
||
if (this.mouseMoveIsThrottled) {
|
||
this.mouseMoveIsThrottled = false;
|
||
this.onColorSelect(e);
|
||
setTimeout(function() {
|
||
this.mouseMoveIsThrottled = true;
|
||
}.bind(this), 100);
|
||
}
|
||
}
|
||
|
||
colorPickerPrototype.onColorSelect = function(e, coords) {
|
||
|
||
if (this.context) {
|
||
|
||
coords = coords || this.relativeMouseCoordinates(e);
|
||
var data = this.context.getImageData(coords.x, coords.y, 1, 1).data;
|
||
|
||
this.setColor({
|
||
r: data[0],
|
||
g: data[1],
|
||
b: data[2]
|
||
});
|
||
}
|
||
};
|
||
|
||
colorPickerPrototype.pickerDraw = function() {
|
||
|
||
this.canvas = document.createElement('canvas');
|
||
this.canvas.setAttribute("width", this.width);
|
||
this.canvas.setAttribute("height", this.height);
|
||
this.canvas.setAttribute("style", "cursor:crosshair");
|
||
this.canvas.setAttribute("class", "simpleColorPicker");
|
||
|
||
this.context = this.canvas.getContext('2d');
|
||
|
||
var colorGradient = this.context.createLinearGradient(0, 0, this.width, 0);
|
||
colorGradient.addColorStop(0, "rgb(255,0,0)");
|
||
colorGradient.addColorStop(0.16, "rgb(255,0,255)");
|
||
colorGradient.addColorStop(0.32, "rgb(0,0,255)");
|
||
colorGradient.addColorStop(0.48, "rgb(0,255,255)");
|
||
colorGradient.addColorStop(0.64, "rgb(0,255,0)");
|
||
colorGradient.addColorStop(0.80, "rgb(255,255,0)");
|
||
colorGradient.addColorStop(1, "rgb(255,0,0)");
|
||
this.context.fillStyle = colorGradient;
|
||
this.context.fillRect(0, 0, this.width, this.height);
|
||
|
||
var bwGradient = this.context.createLinearGradient(0, 0, 0, this.height);
|
||
bwGradient.addColorStop(0, "rgba(255,255,255,1)");
|
||
bwGradient.addColorStop(0.5, "rgba(255,255,255,0)");
|
||
bwGradient.addColorStop(0.5, "rgba(0,0,0,0)");
|
||
bwGradient.addColorStop(1, "rgba(0,0,0,1)");
|
||
|
||
this.context.fillStyle = bwGradient;
|
||
this.context.fillRect(0, 0, this.width, this.height);
|
||
|
||
}
|
||
|
||
colorPickerPrototype.setColor = function(rgb) {
|
||
|
||
//save calculated color
|
||
this.color = {
|
||
hex: this.rgbToHex(rgb),
|
||
rgb: rgb
|
||
};
|
||
|
||
//update element attribute
|
||
this.setAttribute('color', this.color.hex);
|
||
|
||
//broadcast color selected event
|
||
var event = new CustomEvent('colorselected', {
|
||
detail: {
|
||
rgb: this.color.rgb,
|
||
hex: this.color.hex
|
||
}
|
||
});
|
||
|
||
this.dispatchEvent(event);
|
||
}
|
||
|
||
/**
|
||
* given red, green, blue values, return the equivalent hexidecimal value
|
||
* base source: http://stackoverflow.com/a/5624139
|
||
*/
|
||
colorPickerPrototype.componentToHex = function(c) {
|
||
var hex = c.toString(16);
|
||
return hex.length == 1 ? "0" + hex : hex;
|
||
};
|
||
|
||
colorPickerPrototype.rgbToHex = function(color) {
|
||
return "#" + colorPickerPrototype.componentToHex(color.r) + colorPickerPrototype.componentToHex(color.g) + colorPickerPrototype.componentToHex(color.b);
|
||
};
|
||
|
||
/**
|
||
* given a mouse click event, return x,y coordinates relative to the clicked target
|
||
* @returns object with x, y values
|
||
*/
|
||
colorPickerPrototype.relativeMouseCoordinates = function(e) {
|
||
|
||
var x = 0, y = 0;
|
||
|
||
if (this.canvas) {
|
||
var rect = this.canvas.getBoundingClientRect();
|
||
x = e.clientX - rect.left;
|
||
y = e.clientY - rect.top;
|
||
}
|
||
|
||
return {
|
||
x: x,
|
||
y: y
|
||
};
|
||
};
|
||
|
||
colorPickerPrototype.createdCallback = function(e) {
|
||
|
||
//parse attributes
|
||
var attrs = {
|
||
width: this.getAttribute('width'),
|
||
height: this.getAttribute('height')
|
||
};
|
||
|
||
//initialization
|
||
this.canvas = null;
|
||
this.context = null;
|
||
this.color = null;
|
||
this.mouseMoveIsThrottled = true;
|
||
this.width = attrs.width || 300;
|
||
this.height = attrs.height || 300;
|
||
|
||
//create UI
|
||
this.shadowRoot = this.createShadowRoot();
|
||
this.pickerDraw();
|
||
this.shadowRoot.appendChild(this.canvas);
|
||
|
||
///event listeners
|
||
this.addEventListener('mousedown', this.onMouseDown);
|
||
this.addEventListener('mouseup', this.onMouseUp);
|
||
this.addEventListener('touchstart', this.onTouchStart);
|
||
this.addEventListener('touchend', this.onTouchEnd);
|
||
|
||
}
|
||
|
||
document.registerElement('color-picker', { prototype: colorPickerPrototype });
|
||
|
||
</script>
|
||
<style is="custom-style">
|
||
:root {
|
||
--dark-primary-color: #0288D1;
|
||
--default-primary-color: #03A9F4;
|
||
--light-primary-color: #B3E5FC;
|
||
--text-primary-color: #ffffff;
|
||
--accent-color: #FF9800;
|
||
--primary-background-color: #ffffff;
|
||
--primary-text-color: #212121;
|
||
--secondary-text-color: #727272;
|
||
--disabled-text-color: #bdbdbd;
|
||
--divider-color: #B6B6B6;
|
||
|
||
--paper-toggle-button-checked-ink-color: #039be5;
|
||
--paper-toggle-button-checked-button-color: #039be5;
|
||
--paper-toggle-button-checked-bar-color: #039be5;
|
||
}
|
||
|
||
@-webkit-keyframes ha-spin {
|
||
0% {
|
||
-webkit-transform: rotate(0deg);
|
||
transform: rotate(0deg);
|
||
}
|
||
100% {
|
||
-webkit-transform: rotate(359deg);
|
||
transform: rotate(359deg);
|
||
}
|
||
}
|
||
@keyframes ha-spin {
|
||
0% {
|
||
-webkit-transform: rotate(0deg);
|
||
transform: rotate(0deg);
|
||
}
|
||
100% {
|
||
-webkit-transform: rotate(359deg);
|
||
transform: rotate(359deg);
|
||
}
|
||
}
|
||
|
||
body /deep/ .ha-spin {
|
||
-webkit-animation: ha-spin 2s infinite linear;
|
||
animation: ha-spin 2s infinite linear;
|
||
}
|
||
</style>
|
||
</head><body><div hidden="" by-vulcanize=""><dom-module id="iron-icon" assetpath="bower_components/iron-icon/">
|
||
|
||
<style>
|
||
:host {
|
||
@apply(--layout-inline);
|
||
@apply(--layout-center-center);
|
||
position: relative;
|
||
|
||
vertical-align: middle;
|
||
|
||
fill: currentcolor;
|
||
|
||
width: var(--iron-icon-width, 24px);
|
||
height: var(--iron-icon-height, 24px);
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<iron-meta id="meta" type="iconset"></iron-meta>
|
||
</template>
|
||
|
||
<script>
|
||
|
||
Polymer({
|
||
|
||
is: 'iron-icon',
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The name of the icon to use. The name should be of the form:
|
||
* `iconset_name:icon_name`.
|
||
*/
|
||
icon: {
|
||
type: String,
|
||
observer: '_iconChanged'
|
||
},
|
||
|
||
/**
|
||
* The name of the theme to used, if one is specified by the
|
||
* iconset.
|
||
*/
|
||
theme: {
|
||
type: String,
|
||
observer: '_updateIcon'
|
||
},
|
||
|
||
/**
|
||
* If using iron-icon without an iconset, you can set the src to be
|
||
* the URL of an individual icon image file. Note that this will take
|
||
* precedence over a given icon attribute.
|
||
*/
|
||
src: {
|
||
type: String,
|
||
observer: '_srcChanged'
|
||
}
|
||
},
|
||
|
||
_DEFAULT_ICONSET: 'icons',
|
||
|
||
_iconChanged: function(icon) {
|
||
var parts = (icon || '').split(':');
|
||
this._iconName = parts.pop();
|
||
this._iconsetName = parts.pop() || this._DEFAULT_ICONSET;
|
||
this._updateIcon();
|
||
},
|
||
|
||
_srcChanged: function(src) {
|
||
this._updateIcon();
|
||
},
|
||
|
||
_usesIconset: function() {
|
||
return this.icon || !this.src;
|
||
},
|
||
|
||
_updateIcon: function() {
|
||
if (this._usesIconset()) {
|
||
if (this._iconsetName) {
|
||
this._iconset = this.$.meta.byKey(this._iconsetName);
|
||
if (this._iconset) {
|
||
this._iconset.applyIcon(this, this._iconName, this.theme);
|
||
} else {
|
||
this._warn(this._logf('_updateIcon', 'could not find iconset `'
|
||
+ this._iconsetName + '`, did you import the iconset?'));
|
||
}
|
||
}
|
||
} else {
|
||
if (!this._img) {
|
||
this._img = document.createElement('img');
|
||
this._img.style.width = '100%';
|
||
this._img.style.height = '100%';
|
||
}
|
||
this._img.src = this.src;
|
||
Polymer.dom(this.root).appendChild(this._img);
|
||
}
|
||
}
|
||
|
||
});
|
||
|
||
</script>
|
||
|
||
</dom-module>
|
||
<iron-iconset-svg name="icons" size="24">
|
||
<svg><defs>
|
||
<g id="3d-rotation"><path d="M7.52 21.48C4.25 19.94 1.91 16.76 1.55 13H.05C.56 19.16 5.71 24 12 24l.66-.03-3.81-3.81-1.33 1.32zm.89-6.52c-.19 0-.37-.03-.52-.08-.16-.06-.29-.13-.4-.24-.11-.1-.2-.22-.26-.37-.06-.14-.09-.3-.09-.47h-1.3c0 .36.07.68.21.95.14.27.33.5.56.69.24.18.51.32.82.41.3.1.62.15.96.15.37 0 .72-.05 1.03-.15.32-.1.6-.25.83-.44s.42-.43.55-.72c.13-.29.2-.61.2-.97 0-.19-.02-.38-.07-.56-.05-.18-.12-.35-.23-.51-.1-.16-.24-.3-.4-.43-.17-.13-.37-.23-.61-.31.2-.09.37-.2.52-.33.15-.13.27-.27.37-.42.1-.15.17-.3.22-.46.05-.16.07-.32.07-.48 0-.36-.06-.68-.18-.96-.12-.28-.29-.51-.51-.69-.2-.19-.47-.33-.77-.43C9.1 8.05 8.76 8 8.39 8c-.36 0-.69.05-1 .16-.3.11-.57.26-.79.45-.21.19-.38.41-.51.67-.12.26-.18.54-.18.85h1.3c0-.17.03-.32.09-.45s.14-.25.25-.34c.11-.09.23-.17.38-.22.15-.05.3-.08.48-.08.4 0 .7.1.89.31.19.2.29.49.29.86 0 .18-.03.34-.08.49-.05.15-.14.27-.25.37-.11.1-.25.18-.41.24-.16.06-.36.09-.58.09H7.5v1.03h.77c.22 0 .42.02.6.07s.33.13.45.23c.12.11.22.24.29.4.07.16.1.35.1.57 0 .41-.12.72-.35.93-.23.23-.55.33-.95.33zm8.55-5.92c-.32-.33-.7-.59-1.14-.77-.43-.18-.92-.27-1.46-.27H12v8h2.3c.55 0 1.06-.09 1.51-.27.45-.18.84-.43 1.16-.76.32-.33.57-.73.74-1.19.17-.47.26-.99.26-1.57v-.4c0-.58-.09-1.1-.26-1.57-.18-.47-.43-.87-.75-1.2zm-.39 3.16c0 .42-.05.79-.14 1.13-.1.33-.24.62-.43.85-.19.23-.43.41-.71.53-.29.12-.62.18-.99.18h-.91V9.12h.97c.72 0 1.27.23 1.64.69.38.46.57 1.12.57 1.99v.4zM12 0l-.66.03 3.81 3.81 1.33-1.33c3.27 1.55 5.61 4.72 5.96 8.48h1.5C23.44 4.84 18.29 0 12 0z"></path></g>
|
||
<g id="accessibility"><path d="M12 2c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm9 7h-6v13h-2v-6h-2v6H9V9H3V7h18v2z"></path></g>
|
||
<g id="account-balance"><path d="M4 10v7h3v-7H4zm6 0v7h3v-7h-3zM2 22h19v-3H2v3zm14-12v7h3v-7h-3zm-4.5-9L2 6v2h19V6l-9.5-5z"></path></g>
|
||
<g id="account-balance-wallet"><path d="M21 18v1c0 1.1-.9 2-2 2H5c-1.11 0-2-.9-2-2V5c0-1.1.89-2 2-2h14c1.1 0 2 .9 2 2v1h-9c-1.11 0-2 .9-2 2v8c0 1.1.89 2 2 2h9zm-9-2h10V8H12v8zm4-2.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"></path></g>
|
||
<g id="account-box"><path d="M3 5v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2zm12 4c0 1.66-1.34 3-3 3s-3-1.34-3-3 1.34-3 3-3 3 1.34 3 3zm-9 8c0-2 4-3.1 6-3.1s6 1.1 6 3.1v1H6v-1z"></path></g>
|
||
<g id="account-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"></path></g>
|
||
<g id="add"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path></g>
|
||
<g id="add-alert"><path d="M10.01 21.01c0 1.1.89 1.99 1.99 1.99s1.99-.89 1.99-1.99h-3.98zm8.87-4.19V11c0-3.25-2.25-5.97-5.29-6.69v-.72C13.59 2.71 12.88 2 12 2s-1.59.71-1.59 1.59v.72C7.37 5.03 5.12 7.75 5.12 11v5.82L3 18.94V20h18v-1.06l-2.12-2.12zM16 13.01h-3v3h-2v-3H8V11h3V8h2v3h3v2.01z"></path></g>
|
||
<g id="add-box"><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"></path></g>
|
||
<g id="add-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"></path></g>
|
||
<g id="add-circle-outline"><path d="M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4V7zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></g>
|
||
<g id="add-shopping-cart"><path d="M11 9h2V6h3V4h-3V1h-2v3H8v2h3v3zm-4 9c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2zm-9.83-3.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.86-7.01L19.42 4h-.01l-1.1 2-2.76 5H8.53l-.13-.27L6.16 6l-.95-2-.94-2H1v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.13 0-.25-.11-.25-.25z"></path></g>
|
||
<g id="alarm"><path d="M22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM12.5 8H11v6l4.75 2.85.75-1.23-4-2.37V8zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"></path></g>
|
||
<g id="alarm-add"><path d="M7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7zm1-11h-2v3H8v2h3v3h2v-3h3v-2h-3V9z"></path></g>
|
||
<g id="alarm-off"><path d="M12 6c3.87 0 7 3.13 7 7 0 .84-.16 1.65-.43 2.4l1.52 1.52c.58-1.19.91-2.51.91-3.92 0-4.97-4.03-9-9-9-1.41 0-2.73.33-3.92.91L9.6 6.43C10.35 6.16 11.16 6 12 6zm10-.28l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM2.92 2.29L1.65 3.57 2.98 4.9l-1.11.93 1.42 1.42 1.11-.94.8.8C3.83 8.69 3 10.75 3 13c0 4.97 4.02 9 9 9 2.25 0 4.31-.83 5.89-2.2l2.2 2.2 1.27-1.27L3.89 3.27l-.97-.98zm13.55 16.1C15.26 19.39 13.7 20 12 20c-3.87 0-7-3.13-7-7 0-1.7.61-3.26 1.61-4.47l9.86 9.86zM8.02 3.28L6.6 1.86l-.86.71 1.42 1.42.86-.71z"></path></g>
|
||
<g id="alarm-on"><path d="M22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7zm-1.46-5.47L8.41 12.4l-1.06 1.06 3.18 3.18 6-6-1.06-1.06-4.93 4.95z"></path></g>
|
||
<g id="android"><path d="M6 18c0 .55.45 1 1 1h1v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V19h2v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V19h1c.55 0 1-.45 1-1V8H6v10zM3.5 8C2.67 8 2 8.67 2 9.5v7c0 .83.67 1.5 1.5 1.5S5 17.33 5 16.5v-7C5 8.67 4.33 8 3.5 8zm17 0c-.83 0-1.5.67-1.5 1.5v7c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-7c0-.83-.67-1.5-1.5-1.5zm-4.97-5.84l1.3-1.3c.2-.2.2-.51 0-.71-.2-.2-.51-.2-.71 0l-1.48 1.48C13.85 1.23 12.95 1 12 1c-.96 0-1.86.23-2.66.63L7.85.15c-.2-.2-.51-.2-.71 0-.2.2-.2.51 0 .71l1.31 1.31C6.97 3.26 6 5.01 6 7h12c0-1.99-.97-3.75-2.47-4.84zM10 5H9V4h1v1zm5 0h-1V4h1v1z"></path></g>
|
||
<g id="announcement"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 9h-2V5h2v6zm0 4h-2v-2h2v2z"></path></g>
|
||
<g id="apps"><path d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"></path></g>
|
||
<g id="archive"><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"></path></g>
|
||
<g id="arrow-back"><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path></g>
|
||
<g id="arrow-drop-down"><path d="M7 10l5 5 5-5z"></path></g>
|
||
<g id="arrow-drop-down-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 12l-4-4h8l-4 4z"></path></g>
|
||
<g id="arrow-drop-up"><path d="M7 14l5-5 5 5z"></path></g>
|
||
<g id="arrow-forward"><path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"></path></g>
|
||
<g id="aspect-ratio"><path d="M19 12h-2v3h-3v2h5v-5zM7 9h3V7H5v5h2V9zm14-6H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02z"></path></g>
|
||
<g id="assessment"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z"></path></g>
|
||
<g id="assignment"><path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm2 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"></path></g>
|
||
<g id="assignment-ind"><path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm0 4c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm6 12H6v-1.4c0-2 4-3.1 6-3.1s6 1.1 6 3.1V19z"></path></g>
|
||
<g id="assignment-late"><path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-6 15h-2v-2h2v2zm0-4h-2V8h2v6zm-1-9c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"></path></g>
|
||
<g id="assignment-return"><path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm4 12h-4v3l-5-5 5-5v3h4v4z"></path></g>
|
||
<g id="assignment-returned"><path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm0 15l-5-5h3V9h4v4h3l-5 5z"></path></g>
|
||
<g id="assignment-turned-in"><path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm-2 14l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z"></path></g>
|
||
<g id="attachment"><path d="M7.5 18C4.46 18 2 15.54 2 12.5S4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5C8.12 15 7 13.88 7 12.5S8.12 10 9.5 10H17v1.5H9.5c-.55 0-1 .45-1 1s.45 1 1 1H18c1.38 0 2.5-1.12 2.5-2.5S19.38 8.5 18 8.5H7.5c-2.21 0-4 1.79-4 4s1.79 4 4 4H17V18H7.5z"></path></g>
|
||
<g id="autorenew"><path d="M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6zm6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26z"></path></g>
|
||
<g id="backspace"><path d="M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.9.89 1.59.89h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-3 12.59L17.59 17 14 13.41 10.41 17 9 15.59 12.59 12 9 8.41 10.41 7 14 10.59 17.59 7 19 8.41 15.41 12 19 15.59z"></path></g>
|
||
<g id="backup"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path></g>
|
||
<g id="block"><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"></path></g>
|
||
<g id="book"><path d="M18 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 4h5v8l-2.5-1.5L6 12V4z"></path></g>
|
||
<g id="bookmark"><path d="M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2z"></path></g>
|
||
<g id="bookmark-border"><path d="M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2zm0 15l-5-2.18L7 18V5h10v13z"></path></g>
|
||
<g id="bug-report"><path d="M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"></path></g>
|
||
<g id="build"><path d="M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z"></path></g>
|
||
<g id="cached"><path d="M19 8l-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3l-4-4zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4H6z"></path></g>
|
||
<g id="camera-enhance"><path d="M9 3L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2h-3.17L15 3H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zM12 17l1.25-2.75L16 13l-2.75-1.25L12 9l-1.25 2.75L8 13l2.75 1.25z"></path></g>
|
||
<g id="cancel"><path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"></path></g>
|
||
<g id="card-giftcard"><path d="M20 6h-2.18c.11-.31.18-.65.18-1 0-1.66-1.34-3-3-3-1.05 0-1.96.54-2.5 1.35l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zM9 4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm11 15H4v-2h16v2zm0-5H4V8h5.08L7 10.83 8.62 12 11 8.76l1-1.36 1 1.36L15.38 12 17 10.83 14.92 8H20v6z"></path></g>
|
||
<g id="card-membership"><path d="M20 2H4c-1.11 0-2 .89-2 2v11c0 1.11.89 2 2 2h4v5l4-2 4 2v-5h4c1.11 0 2-.89 2-2V4c0-1.11-.89-2-2-2zm0 13H4v-2h16v2zm0-5H4V4h16v6z"></path></g>
|
||
<g id="card-travel"><path d="M20 6h-3V4c0-1.11-.89-2-2-2H9c-1.11 0-2 .89-2 2v2H4c-1.11 0-2 .89-2 2v11c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zM9 4h6v2H9V4zm11 15H4v-2h16v2zm0-5H4V8h3v2h2V8h6v2h2V8h3v6z"></path></g>
|
||
<g id="change-history"><path d="M12 7.77L18.39 18H5.61L12 7.77M12 4L2 20h20L12 4z"></path></g>
|
||
<g id="check"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"></path></g>
|
||
<g id="check-box"><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"></path></g>
|
||
<g id="check-box-outline-blank"><path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path></g>
|
||
<g id="check-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"></path></g>
|
||
<g id="chevron-left"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"></path></g>
|
||
<g id="chevron-right"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path></g>
|
||
<g id="chrome-reader-mode"><path d="M13 12h7v1.5h-7zm0-2.5h7V11h-7zm0 5h7V16h-7zM21 4H3c-1.1 0-2 .9-2 2v13c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 15h-9V6h9v13z"></path></g>
|
||
<g id="class"><path d="M18 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 4h5v8l-2.5-1.5L6 12V4z"></path></g>
|
||
<g id="clear"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></g>
|
||
<g id="close"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></g>
|
||
<g id="cloud"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"></path></g>
|
||
<g id="cloud-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm4.5 14H8c-1.66 0-3-1.34-3-3s1.34-3 3-3l.14.01C8.58 8.28 10.13 7 12 7c2.21 0 4 1.79 4 4h.5c1.38 0 2.5 1.12 2.5 2.5S17.88 16 16.5 16z"></path></g>
|
||
<g id="cloud-done"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM10 17l-3.5-3.5 1.41-1.41L10 14.17 15.18 9l1.41 1.41L10 17z"></path></g>
|
||
<g id="cloud-download"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z"></path></g>
|
||
<g id="cloud-off"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4c-1.48 0-2.85.43-4.01 1.17l1.46 1.46C10.21 6.23 11.08 6 12 6c3.04 0 5.5 2.46 5.5 5.5v.5H19c1.66 0 3 1.34 3 3 0 1.13-.64 2.11-1.56 2.62l1.45 1.45C23.16 18.16 24 16.68 24 15c0-2.64-2.05-4.78-4.65-4.96zM3 5.27l2.75 2.74C2.56 8.15 0 10.77 0 14c0 3.31 2.69 6 6 6h11.73l2 2L21 20.73 4.27 4 3 5.27zM7.73 10l8 8H6c-2.21 0-4-1.79-4-4s1.79-4 4-4h1.73z"></path></g>
|
||
<g id="cloud-queue"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4s1.79-4 4-4h.71C7.37 7.69 9.48 6 12 6c3.04 0 5.5 2.46 5.5 5.5v.5H19c1.66 0 3 1.34 3 3s-1.34 3-3 3z"></path></g>
|
||
<g id="cloud-upload"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path></g>
|
||
<g id="code"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"></path></g>
|
||
<g id="content-copy"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"></path></g>
|
||
<g id="content-cut"><path d="M9.64 7.64c.23-.5.36-1.05.36-1.64 0-2.21-1.79-4-4-4S2 3.79 2 6s1.79 4 4 4c.59 0 1.14-.13 1.64-.36L10 12l-2.36 2.36C7.14 14.13 6.59 14 6 14c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4c0-.59-.13-1.14-.36-1.64L12 14l7 7h3v-1L9.64 7.64zM6 8c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm0 12c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm6-7.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5zM19 3l-6 6 2 2 7-7V3z"></path></g>
|
||
<g id="content-paste"><path d="M19 2h-4.18C14.4.84 13.3 0 12 0c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z"></path></g>
|
||
<g id="create"><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"></path></g>
|
||
<g id="credit-card"><path d="M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z"></path></g>
|
||
<g id="dashboard"><path d="M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"></path></g>
|
||
<g id="delete"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"></path></g>
|
||
<g id="description"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"></path></g>
|
||
<g id="dns"><path d="M20 13H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1zM7 19c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zM20 3H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1zM7 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"></path></g>
|
||
<g id="done"><path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"></path></g>
|
||
<g id="done-all"><path d="M18 7l-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41L6 19l1.41-1.41L1.83 12 .41 13.41z"></path></g>
|
||
<g id="drafts"><path d="M21.99 8c0-.72-.37-1.35-.94-1.7L12 1 2.95 6.3C2.38 6.65 2 7.28 2 8v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2l-.01-10zM12 13L3.74 7.84 12 3l8.26 4.84L12 13z"></path></g>
|
||
<g id="eject"><path d="M5 17h14v2H5zm7-12L5.33 15h13.34z"></path></g>
|
||
<g id="error"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"></path></g>
|
||
<g id="error-outline"><path d="M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></g>
|
||
<g id="event"><path d="M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z"></path></g>
|
||
<g id="event-seat"><defs><path id="a" d="M0 0h24v24H0V0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path d="M4 18v3h3v-3h10v3h3v-6H4zm15-8h3v3h-3zM2 10h3v3H2zm15 3H7V5c0-1.1.9-2 2-2h6c1.1 0 2 .9 2 2v8z" clip-path="url(#b)"></path></g>
|
||
<g id="exit-to-app"><path d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path></g>
|
||
<g id="expand-less"><path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"></path></g>
|
||
<g id="expand-more"><path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"></path></g>
|
||
<g id="explore"><path d="M12 10.9c-.61 0-1.1.49-1.1 1.1s.49 1.1 1.1 1.1c.61 0 1.1-.49 1.1-1.1s-.49-1.1-1.1-1.1zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm2.19 12.19L6 18l3.81-8.19L18 6l-3.81 8.19z"></path></g>
|
||
<g id="extension"><path d="M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11z"></path></g>
|
||
<g id="face"><path d="M9 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm6 0c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8 0-.29.02-.58.05-.86 2.36-1.05 4.23-2.98 5.21-5.37C11.07 8.33 14.05 10 17.42 10c.78 0 1.53-.09 2.25-.26.21.71.33 1.47.33 2.26 0 4.41-3.59 8-8 8z"></path></g>
|
||
<g id="favorite"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"></path></g>
|
||
<g id="favorite-border"><path d="M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"></path></g>
|
||
<g id="feedback"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 12h-2v-2h2v2zm0-4h-2V6h2v4z"></path></g>
|
||
<g id="file-download"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"></path></g>
|
||
<g id="file-upload"><path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"></path></g>
|
||
<g id="filter-list"><path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></g>
|
||
<g id="find-in-page"><path d="M20 19.59V8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75L20 19.59zM9 13c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3z"></path></g>
|
||
<g id="find-replace"><path d="M11 6c1.38 0 2.63.56 3.54 1.46L12 10h6V4l-2.05 2.05C14.68 4.78 12.93 4 11 4c-3.53 0-6.43 2.61-6.92 6H6.1c.46-2.28 2.48-4 4.9-4zm5.64 9.14c.66-.9 1.12-1.97 1.28-3.14H15.9c-.46 2.28-2.48 4-4.9 4-1.38 0-2.63-.56-3.54-1.46L10 12H4v6l2.05-2.05C7.32 17.22 9.07 18 11 18c1.55 0 2.98-.51 4.14-1.36L20 21.49 21.49 20l-4.85-4.86z"></path></g>
|
||
<g id="flag"><path d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z"></path></g>
|
||
<g id="flight-land"><defs><path id="a" d="M0 0h24v24H0V0z"></path></defs><defs><path id="c" d="M0 0h24v24H0V0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><clipPath id="d" clip-path="url(#b)"><use xlink:href="#c" overflow="visible"></use></clipPath><path d="M2.5 19h19v2h-19zm7.18-5.73l4.35 1.16 5.31 1.42c.8.21 1.62-.26 1.84-1.06.21-.8-.26-1.62-1.06-1.84l-5.31-1.42-2.76-9.02L10.12 2v8.28L5.15 8.95l-.93-2.32-1.45-.39v5.17l1.6.43 5.31 1.43z" clip-path="url(#d)"></path></g>
|
||
<g id="flight-takeoff"><defs><path id="a" d="M0 0h24v24H0V0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path d="M2.5 19h19v2h-19zm19.57-9.36c-.21-.8-1.04-1.28-1.84-1.06L14.92 10l-6.9-6.43-1.93.51 4.14 7.17-4.97 1.33-1.97-1.54-1.45.39 1.82 3.16.77 1.33 1.6-.43 5.31-1.42 4.35-1.16L21 11.49c.81-.23 1.28-1.05 1.07-1.85z" clip-path="url(#b)"></path></g>
|
||
<g id="flip-to-back"><path d="M9 7H7v2h2V7zm0 4H7v2h2v-2zm0-8c-1.11 0-2 .9-2 2h2V3zm4 12h-2v2h2v-2zm6-12v2h2c0-1.1-.9-2-2-2zm-6 0h-2v2h2V3zM9 17v-2H7c0 1.1.89 2 2 2zm10-4h2v-2h-2v2zm0-4h2V7h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2zM5 7H3v12c0 1.1.89 2 2 2h12v-2H5V7zm10-2h2V3h-2v2zm0 12h2v-2h-2v2z"></path></g>
|
||
<g id="flip-to-front"><path d="M3 13h2v-2H3v2zm0 4h2v-2H3v2zm2 4v-2H3c0 1.1.89 2 2 2zM3 9h2V7H3v2zm12 12h2v-2h-2v2zm4-18H9c-1.11 0-2 .9-2 2v10c0 1.1.89 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 12H9V5h10v10zm-8 6h2v-2h-2v2zm-4 0h2v-2H7v2z"></path></g>
|
||
<g id="folder"><path d="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"></path></g>
|
||
<g id="folder-open"><path d="M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"></path></g>
|
||
<g id="folder-shared"><path d="M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-5 3c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm4 8h-8v-1c0-1.33 2.67-2 4-2s4 .67 4 2v1z"></path></g>
|
||
<g id="font-download"><path d="M9.93 13.5h4.14L12 7.98zM20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-4.05 16.5l-1.14-3H9.17l-1.12 3H5.96l5.11-13h1.86l5.11 13h-2.09z"></path></g>
|
||
<g id="forward"><path d="M12 8V4l8 8-8 8v-4H4V8z"></path></g>
|
||
<g id="fullscreen"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"></path></g>
|
||
<g id="fullscreen-exit"><path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"></path></g>
|
||
<g id="gesture"><path d="M4.59 6.89c.7-.71 1.4-1.35 1.71-1.22.5.2 0 1.03-.3 1.52-.25.42-2.86 3.89-2.86 6.31 0 1.28.48 2.34 1.34 2.98.75.56 1.74.73 2.64.46 1.07-.31 1.95-1.4 3.06-2.77 1.21-1.49 2.83-3.44 4.08-3.44 1.63 0 1.65 1.01 1.76 1.79-3.78.64-5.38 3.67-5.38 5.37 0 1.7 1.44 3.09 3.21 3.09 1.63 0 4.29-1.33 4.69-6.1H21v-2.5h-2.47c-.15-1.65-1.09-4.2-4.03-4.2-2.25 0-4.18 1.91-4.94 2.84-.58.73-2.06 2.48-2.29 2.72-.25.3-.68.84-1.11.84-.45 0-.72-.83-.36-1.92.35-1.09 1.4-2.86 1.85-3.52.78-1.14 1.3-1.92 1.3-3.28C8.95 3.69 7.31 3 6.44 3 5.12 3 3.97 4 3.72 4.25c-.36.36-.66.66-.88.93l1.75 1.71zm9.29 11.66c-.31 0-.74-.26-.74-.72 0-.6.73-2.2 2.87-2.76-.3 2.69-1.43 3.48-2.13 3.48z"></path></g>
|
||
<g id="get-app"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"></path></g>
|
||
<g id="gif"><defs><path id="a" d="M24 24H0V0h24v24z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path d="M11.5 9H13v6h-1.5zM9 9H6c-.6 0-1 .5-1 1v4c0 .5.4 1 1 1h3c.6 0 1-.5 1-1v-2H8.5v1.5h-2v-3H10V10c0-.5-.4-1-1-1zm10 1.5V9h-4.5v6H16v-2h2v-1.5h-2v-1z" clip-path="url(#b)"></path></g>
|
||
<g id="grade"><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"></path></g>
|
||
<g id="group-work"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM8 17.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5zM9.5 8c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5S9.5 9.38 9.5 8zm6.5 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></g>
|
||
<g id="help"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"></path></g>
|
||
<g id="help-outline"><path d="M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z"></path></g>
|
||
<g id="highlight-off"><path d="M14.59 8L12 10.59 9.41 8 8 9.41 10.59 12 8 14.59 9.41 16 12 13.41 14.59 16 16 14.59 13.41 12 16 9.41 14.59 8zM12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></g>
|
||
<g id="history"><path opacity=".9" d="M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"></path></g>
|
||
<g id="home"><path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"></path></g>
|
||
<g id="hourglass-empty"><path d="M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2H6zm10 14.5V20H8v-3.5l4-4 4 4zm-4-5l-4-4V4h8v3.5l-4 4z"></path></g>
|
||
<g id="hourglass-full"><path d="M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2H6z"></path></g>
|
||
<g id="http"><path d="M4.5 11h-2V9H1v6h1.5v-2.5h2V15H6V9H4.5v2zm2.5-.5h1.5V15H10v-4.5h1.5V9H7v1.5zm5.5 0H14V15h1.5v-4.5H17V9h-4.5v1.5zm9-1.5H18v6h1.5v-2h2c.8 0 1.5-.7 1.5-1.5v-1c0-.8-.7-1.5-1.5-1.5zm0 2.5h-2v-1h2v1z"></path></g>
|
||
<g id="https"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"></path></g>
|
||
<g id="inbox"><path d="M19 3H4.99c-1.1 0-1.98.9-1.98 2L3 19c0 1.1.89 2 1.99 2H19c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 12h-4c0 1.66-1.34 3-3 3s-3-1.34-3-3H4.99V5H19v10zm-3-5h-2V7h-4v3H8l4 4 4-4z"></path></g>
|
||
<g id="indeterminate-check-box"><defs><path id="a" d="M0 0h24v24H0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path clip-path="url(#b)" d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"></path></g>
|
||
<g id="info"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"></path></g>
|
||
<g id="info-outline"><path d="M11 17h2v-6h-2v6zm1-15C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zM11 9h2V7h-2v2z"></path></g>
|
||
<g id="input"><path d="M21 3.01H3c-1.1 0-2 .9-2 2V9h2V4.99h18v14.03H3V15H1v4.01c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98v-14c0-1.11-.9-2-2-2zM11 16l4-4-4-4v3H1v2h10v3z"></path></g>
|
||
<g id="invert-colors"><path d="M17.66 7.93L12 2.27 6.34 7.93c-3.12 3.12-3.12 8.19 0 11.31C7.9 20.8 9.95 21.58 12 21.58c2.05 0 4.1-.78 5.66-2.34 3.12-3.12 3.12-8.19 0-11.31zM12 19.59c-1.6 0-3.11-.62-4.24-1.76C6.62 16.69 6 15.19 6 13.59s.62-3.11 1.76-4.24L12 5.1v14.49z"></path></g>
|
||
<g id="label"><path d="M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12l-4.37-6.16z"></path></g>
|
||
<g id="label-outline"><path d="M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12l-4.37-6.16zM16 17H5V7h11l3.55 5L16 17z"></path></g>
|
||
<g id="language"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"></path></g>
|
||
<g id="launch"><path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"></path></g>
|
||
<g id="link"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"></path></g>
|
||
<g id="list"><path d="M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z"></path></g>
|
||
<g id="lock"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"></path></g>
|
||
<g id="lock-open"><path d="M12 17c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm6-9h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6h1.9c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm0 12H6V10h12v10z"></path></g>
|
||
<g id="lock-outline"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6-5.1c1.71 0 3.1 1.39 3.1 3.1v2H9V6h-.1c0-1.71 1.39-3.1 3.1-3.1zM18 20H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"></path></g>
|
||
<g id="loyalty"><path d="M21.41 11.58l-9-9C12.05 2.22 11.55 2 11 2H4c-1.1 0-2 .9-2 2v7c0 .55.22 1.05.59 1.42l9 9c.36.36.86.58 1.41.58.55 0 1.05-.22 1.41-.59l7-7c.37-.36.59-.86.59-1.41 0-.55-.23-1.06-.59-1.42zM5.5 7C4.67 7 4 6.33 4 5.5S4.67 4 5.5 4 7 4.67 7 5.5 6.33 7 5.5 7zm11.77 8.27L13 19.54l-4.27-4.27C8.28 14.81 8 14.19 8 13.5c0-1.38 1.12-2.5 2.5-2.5.69 0 1.32.28 1.77.74l.73.72.73-.73c.45-.45 1.08-.73 1.77-.73 1.38 0 2.5 1.12 2.5 2.5 0 .69-.28 1.32-.73 1.77z"></path></g>
|
||
<g id="mail"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"></path></g>
|
||
<g id="markunread"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"></path></g>
|
||
<g id="markunread-mailbox"><path d="M20 6H10v6H8V4h6V0H6v6H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2z"></path></g>
|
||
<g id="menu"><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"></path></g>
|
||
<g id="more-horiz"><path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></g>
|
||
<g id="more-vert"><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></g>
|
||
<g id="note-add"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z"></path></g>
|
||
<g id="offline-pin"><defs><path id="a" d="M0 0h24v24H0V0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path clip-path="url(#b)" d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm5 16H7v-2h10v2zm-6.7-4L7 10.7l1.4-1.4 1.9 1.9 5.3-5.3L17 7.3 10.3 14z"></path></g>
|
||
<g id="open-in-browser"><path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h4v-2H5V8h14v10h-4v2h4c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm-7 6l-4 4h3v6h2v-6h3l-4-4z"></path></g>
|
||
<g id="open-in-new"><path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"></path></g>
|
||
<g id="open-with"><path d="M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H7l5 5 5-5h-3v-3z"></path></g>
|
||
<g id="pageview"><path d="M11.5 9C10.12 9 9 10.12 9 11.5s1.12 2.5 2.5 2.5 2.5-1.12 2.5-2.5S12.88 9 11.5 9zM20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-3.21 14.21l-2.91-2.91c-.69.44-1.51.7-2.39.7C9.01 16 7 13.99 7 11.5S9.01 7 11.5 7 16 9.01 16 11.5c0 .88-.26 1.69-.7 2.39l2.91 2.9-1.42 1.42z"></path></g>
|
||
<g id="payment"><path d="M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z"></path></g>
|
||
<g id="perm-camera-mic"><path d="M20 5h-3.17L15 3H9L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h7v-2.09c-2.83-.48-5-2.94-5-5.91h2c0 2.21 1.79 4 4 4s4-1.79 4-4h2c0 2.97-2.17 5.43-5 5.91V21h7c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-6 8c0 1.1-.9 2-2 2s-2-.9-2-2V9c0-1.1.9-2 2-2s2 .9 2 2v4z"></path></g>
|
||
<g id="perm-contact-calendar"><path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm6 12H6v-1c0-2 4-3.1 6-3.1s6 1.1 6 3.1v1z"></path></g>
|
||
<g id="perm-data-setting"><path d="M18.99 11.5c.34 0 .67.03 1 .07L20 0 0 20h11.56c-.04-.33-.07-.66-.07-1 0-4.14 3.36-7.5 7.5-7.5zm3.71 7.99c.02-.16.04-.32.04-.49 0-.17-.01-.33-.04-.49l1.06-.83c.09-.08.12-.21.06-.32l-1-1.73c-.06-.11-.19-.15-.31-.11l-1.24.5c-.26-.2-.54-.37-.85-.49l-.19-1.32c-.01-.12-.12-.21-.24-.21h-2c-.12 0-.23.09-.25.21l-.19 1.32c-.3.13-.59.29-.85.49l-1.24-.5c-.11-.04-.24 0-.31.11l-1 1.73c-.06.11-.04.24.06.32l1.06.83c-.02.16-.03.32-.03.49 0 .17.01.33.03.49l-1.06.83c-.09.08-.12.21-.06.32l1 1.73c.06.11.19.15.31.11l1.24-.5c.26.2.54.37.85.49l.19 1.32c.02.12.12.21.25.21h2c.12 0 .23-.09.25-.21l.19-1.32c.3-.13.59-.29.84-.49l1.25.5c.11.04.24 0 .31-.11l1-1.73c.06-.11.03-.24-.06-.32l-1.07-.83zm-3.71 1.01c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"></path></g>
|
||
<g id="perm-device-information"><path d="M13 7h-2v2h2V7zm0 4h-2v6h2v-6zm4-9.99L7 1c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99zM17 19H7V5h10v14z"></path></g>
|
||
<g id="perm-identity"><path d="M12 5.9c1.16 0 2.1.94 2.1 2.1s-.94 2.1-2.1 2.1S9.9 9.16 9.9 8s.94-2.1 2.1-2.1m0 9c2.97 0 6.1 1.46 6.1 2.1v1.1H5.9V17c0-.64 3.13-2.1 6.1-2.1M12 4C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4z"></path></g>
|
||
<g id="perm-media"><path d="M2 6H0v5h.01L0 20c0 1.1.9 2 2 2h18v-2H2V6zm20-2h-8l-2-2H6c-1.1 0-1.99.9-1.99 2L4 16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM7 15l4.5-6 3.5 4.51 2.5-3.01L21 15H7z"></path></g>
|
||
<g id="perm-phone-msg"><path d="M20 15.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.58l2.2-2.21c.28-.27.36-.66.25-1.01C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1zM12 3v10l3-3h6V3h-9z"></path></g>
|
||
<g id="perm-scan-wifi"><path d="M12 3C6.95 3 3.15 4.85 0 7.23L12 22 24 7.25C20.85 4.87 17.05 3 12 3zm1 13h-2v-6h2v6zm-2-8V6h2v2h-2z"></path></g>
|
||
<g id="picture-in-picture"><path d="M19 7h-8v6h8V7zm2-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98V5c0-1.1-.9-2-2-2zm0 16.01H3V4.98h18v14.03z"></path></g>
|
||
<g id="play-for-work"><path fill="#010101" d="M11 5v5.59H7.5l4.5 4.5 4.5-4.5H13V5h-2zm-5 9c0 3.31 2.69 6 6 6s6-2.69 6-6h-2c0 2.21-1.79 4-4 4s-4-1.79-4-4H6z"></path></g>
|
||
<g id="polymer"><path d="M19 4h-4L7.11 16.63 4.5 12 9 4H5L.5 12 5 20h4l7.89-12.63L19.5 12 15 20h4l4.5-8z"></path></g>
|
||
<g id="power-settings-new"><path d="M13 3h-2v10h2V3zm4.83 2.17l-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83z"></path></g>
|
||
<g id="print"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"></path></g>
|
||
<g id="query-builder"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zM12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"></path></g>
|
||
<g id="question-answer"><path d="M21 6h-2v9H6v2c0 .55.45 1 1 1h11l4 4V7c0-.55-.45-1-1-1zm-4 6V3c0-.55-.45-1-1-1H3c-.55 0-1 .45-1 1v14l4-4h10c.55 0 1-.45 1-1z"></path></g>
|
||
<g id="radio-button-checked"><path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></g>
|
||
<g id="radio-button-unchecked"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></g>
|
||
<g id="receipt"><path d="M18 17H6v-2h12v2zm0-4H6v-2h12v2zm0-4H6V7h12v2zM3 22l1.5-1.5L6 22l1.5-1.5L9 22l1.5-1.5L12 22l1.5-1.5L15 22l1.5-1.5L18 22l1.5-1.5L21 22V2l-1.5 1.5L18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2 4.5 3.5 3 2v20z"></path></g>
|
||
<g id="redeem"><path d="M20 6h-2.18c.11-.31.18-.65.18-1 0-1.66-1.34-3-3-3-1.05 0-1.96.54-2.5 1.35l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zM9 4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm11 15H4v-2h16v2zm0-5H4V8h5.08L7 10.83 8.62 12 11 8.76l1-1.36 1 1.36L15.38 12 17 10.83 14.92 8H20v6z"></path></g>
|
||
<g id="redo"><path d="M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"></path></g>
|
||
<g id="refresh"><path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"></path></g>
|
||
<g id="remove"><path d="M19 13H5v-2h14v2z"></path></g>
|
||
<g id="remove-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11H7v-2h10v2z"></path></g>
|
||
<g id="remove-circle-outline"><path d="M7 11v2h10v-2H7zm5-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></g>
|
||
<g id="reorder"><path d="M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z"></path></g>
|
||
<g id="reply"><path d="M10 9V5l-7 7 7 7v-4.1c5 0 8.5 1.6 11 5.1-1-5-4-10-11-11z"></path></g>
|
||
<g id="reply-all"><path d="M7 8V5l-7 7 7 7v-3l-4-4 4-4zm6 1V5l-7 7 7 7v-4.1c5 0 8.5 1.6 11 5.1-1-5-4-10-11-11z"></path></g>
|
||
<g id="report"><path d="M15.73 3H8.27L3 8.27v7.46L8.27 21h7.46L21 15.73V8.27L15.73 3zM12 17.3c-.72 0-1.3-.58-1.3-1.3 0-.72.58-1.3 1.3-1.3.72 0 1.3.58 1.3 1.3 0 .72-.58 1.3-1.3 1.3zm1-4.3h-2V7h2v6z"></path></g>
|
||
<g id="report-problem"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></g>
|
||
<g id="restore"><path d="M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"></path></g>
|
||
<g id="room"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></g>
|
||
<g id="save"><path d="M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z"></path></g>
|
||
<g id="schedule"><path fill-opacity=".9" d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zM12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"></path></g>
|
||
<g id="search"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path></g>
|
||
<g id="select-all"><path d="M3 5h2V3c-1.1 0-2 .9-2 2zm0 8h2v-2H3v2zm4 8h2v-2H7v2zM3 9h2V7H3v2zm10-6h-2v2h2V3zm6 0v2h2c0-1.1-.9-2-2-2zM5 21v-2H3c0 1.1.9 2 2 2zm-2-4h2v-2H3v2zM9 3H7v2h2V3zm2 18h2v-2h-2v2zm8-8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2zm0-12h2V7h-2v2zm0 8h2v-2h-2v2zm-4 4h2v-2h-2v2zm0-16h2V3h-2v2zM7 17h10V7H7v10zm2-8h6v6H9V9z"></path></g>
|
||
<g id="send"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"></path></g>
|
||
<g id="settings"><path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"></path></g>
|
||
<g id="settings-applications"><path d="M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm7-7H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-1.75 9c0 .23-.02.46-.05.68l1.48 1.16c.13.11.17.3.08.45l-1.4 2.42c-.09.15-.27.21-.43.15l-1.74-.7c-.36.28-.76.51-1.18.69l-.26 1.85c-.03.17-.18.3-.35.3h-2.8c-.17 0-.32-.13-.35-.29l-.26-1.85c-.43-.18-.82-.41-1.18-.69l-1.74.7c-.16.06-.34 0-.43-.15l-1.4-2.42c-.09-.15-.05-.34.08-.45l1.48-1.16c-.03-.23-.05-.46-.05-.69 0-.23.02-.46.05-.68l-1.48-1.16c-.13-.11-.17-.3-.08-.45l1.4-2.42c.09-.15.27-.21.43-.15l1.74.7c.36-.28.76-.51 1.18-.69l.26-1.85c.03-.17.18-.3.35-.3h2.8c.17 0 .32.13.35.29l.26 1.85c.43.18.82.41 1.18.69l1.74-.7c.16-.06.34 0 .43.15l1.4 2.42c.09.15.05.34-.08.45l-1.48 1.16c.03.23.05.46.05.69z"></path></g>
|
||
<g id="settings-backup-restore"><path d="M14 12c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2zm-2-9c-4.97 0-9 4.03-9 9H0l4 4 4-4H5c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.51 0-2.91-.49-4.06-1.3l-1.42 1.44C8.04 20.3 9.94 21 12 21c4.97 0 9-4.03 9-9s-4.03-9-9-9z"></path></g>
|
||
<g id="settings-bluetooth"><path d="M11 24h2v-2h-2v2zm-4 0h2v-2H7v2zm8 0h2v-2h-2v2zm2.71-18.29L12 0h-1v7.59L6.41 3 5 4.41 10.59 10 5 15.59 6.41 17 11 12.41V20h1l5.71-5.71-4.3-4.29 4.3-4.29zM13 3.83l1.88 1.88L13 7.59V3.83zm1.88 10.46L13 16.17v-3.76l1.88 1.88z"></path></g>
|
||
<g id="settings-brightness"><path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02zM8 16h2.5l1.5 1.5 1.5-1.5H16v-2.5l1.5-1.5-1.5-1.5V8h-2.5L12 6.5 10.5 8H8v2.5L6.5 12 8 13.5V16zm4-7c1.66 0 3 1.34 3 3s-1.34 3-3 3V9z"></path></g>
|
||
<g id="settings-cell"><path d="M7 24h2v-2H7v2zm4 0h2v-2h-2v2zm4 0h2v-2h-2v2zM16 .01L8 0C6.9 0 6 .9 6 2v16c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V2c0-1.1-.9-1.99-2-1.99zM16 16H8V4h8v12z"></path></g>
|
||
<g id="settings-ethernet"><path d="M7.77 6.76L6.23 5.48.82 12l5.41 6.52 1.54-1.28L3.42 12l4.35-5.24zM7 13h2v-2H7v2zm10-2h-2v2h2v-2zm-6 2h2v-2h-2v2zm6.77-7.52l-1.54 1.28L20.58 12l-4.35 5.24 1.54 1.28L23.18 12l-5.41-6.52z"></path></g>
|
||
<g id="settings-input-antenna"><path d="M12 5c-3.87 0-7 3.13-7 7h2c0-2.76 2.24-5 5-5s5 2.24 5 5h2c0-3.87-3.13-7-7-7zm1 9.29c.88-.39 1.5-1.26 1.5-2.29 0-1.38-1.12-2.5-2.5-2.5S9.5 10.62 9.5 12c0 1.02.62 1.9 1.5 2.29v3.3L7.59 21 9 22.41l3-3 3 3L16.41 21 13 17.59v-3.3zM12 1C5.93 1 1 5.93 1 12h2c0-4.97 4.03-9 9-9s9 4.03 9 9h2c0-6.07-4.93-11-11-11z"></path></g>
|
||
<g id="settings-input-component"><path d="M5 2c0-.55-.45-1-1-1s-1 .45-1 1v4H1v6h6V6H5V2zm4 14c0 1.3.84 2.4 2 2.82V23h2v-4.18c1.16-.41 2-1.51 2-2.82v-2H9v2zm-8 0c0 1.3.84 2.4 2 2.82V23h2v-4.18C6.16 18.4 7 17.3 7 16v-2H1v2zM21 6V2c0-.55-.45-1-1-1s-1 .45-1 1v4h-2v6h6V6h-2zm-8-4c0-.55-.45-1-1-1s-1 .45-1 1v4H9v6h6V6h-2V2zm4 14c0 1.3.84 2.4 2 2.82V23h2v-4.18c1.16-.41 2-1.51 2-2.82v-2h-6v2z"></path></g>
|
||
<g id="settings-input-composite"><path d="M5 2c0-.55-.45-1-1-1s-1 .45-1 1v4H1v6h6V6H5V2zm4 14c0 1.3.84 2.4 2 2.82V23h2v-4.18c1.16-.41 2-1.51 2-2.82v-2H9v2zm-8 0c0 1.3.84 2.4 2 2.82V23h2v-4.18C6.16 18.4 7 17.3 7 16v-2H1v2zM21 6V2c0-.55-.45-1-1-1s-1 .45-1 1v4h-2v6h6V6h-2zm-8-4c0-.55-.45-1-1-1s-1 .45-1 1v4H9v6h6V6h-2V2zm4 14c0 1.3.84 2.4 2 2.82V23h2v-4.18c1.16-.41 2-1.51 2-2.82v-2h-6v2z"></path></g>
|
||
<g id="settings-input-hdmi"><path d="M18 7V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v3H5v6l3 6v3h8v-3l3-6V7h-1zM8 4h8v3h-2V5h-1v2h-2V5h-1v2H8V4z"></path></g>
|
||
<g id="settings-input-svideo"><path d="M8 11.5c0-.83-.67-1.5-1.5-1.5S5 10.67 5 11.5 5.67 13 6.5 13 8 12.33 8 11.5zm7-5c0-.83-.67-1.5-1.5-1.5h-3C9.67 5 9 5.67 9 6.5S9.67 8 10.5 8h3c.83 0 1.5-.67 1.5-1.5zM8.5 15c-.83 0-1.5.67-1.5 1.5S7.67 18 8.5 18s1.5-.67 1.5-1.5S9.33 15 8.5 15zM12 1C5.93 1 1 5.93 1 12s4.93 11 11 11 11-4.93 11-11S18.07 1 12 1zm0 20c-4.96 0-9-4.04-9-9s4.04-9 9-9 9 4.04 9 9-4.04 9-9 9zm5.5-11c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm-2 5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5z"></path></g>
|
||
<g id="settings-overscan"><path d="M12.01 5.5L10 8h4l-1.99-2.5zM18 10v4l2.5-1.99L18 10zM6 10l-2.5 2.01L6 14v-4zm8 6h-4l2.01 2.5L14 16zm7-13H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02z"></path></g>
|
||
<g id="settings-phone"><path d="M13 9h-2v2h2V9zm4 0h-2v2h2V9zm3 6.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.58l2.2-2.21c.28-.27.36-.66.25-1.01C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1zM19 9v2h2V9h-2z"></path></g>
|
||
<g id="settings-power"><path d="M7 24h2v-2H7v2zm4 0h2v-2h-2v2zm2-22h-2v10h2V2zm3.56 2.44l-1.45 1.45C16.84 6.94 18 8.83 18 11c0 3.31-2.69 6-6 6s-6-2.69-6-6c0-2.17 1.16-4.06 2.88-5.12L7.44 4.44C5.36 5.88 4 8.28 4 11c0 4.42 3.58 8 8 8s8-3.58 8-8c0-2.72-1.36-5.12-3.44-6.56zM15 24h2v-2h-2v2z"></path></g>
|
||
<g id="settings-remote"><path d="M15 9H9c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V10c0-.55-.45-1-1-1zm-3 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zM7.05 6.05l1.41 1.41C9.37 6.56 10.62 6 12 6s2.63.56 3.54 1.46l1.41-1.41C15.68 4.78 13.93 4 12 4s-3.68.78-4.95 2.05zM12 0C8.96 0 6.21 1.23 4.22 3.22l1.41 1.41C7.26 3.01 9.51 2 12 2s4.74 1.01 6.36 2.64l1.41-1.41C17.79 1.23 15.04 0 12 0z"></path></g>
|
||
<g id="settings-voice"><path d="M7 24h2v-2H7v2zm5-11c1.66 0 2.99-1.34 2.99-3L15 4c0-1.66-1.34-3-3-3S9 2.34 9 4v6c0 1.66 1.34 3 3 3zm-1 11h2v-2h-2v2zm4 0h2v-2h-2v2zm4-14h-1.7c0 3-2.54 5.1-5.3 5.1S6.7 13 6.7 10H5c0 3.41 2.72 6.23 6 6.72V20h2v-3.28c3.28-.49 6-3.31 6-6.72z"></path></g>
|
||
<g id="shop"><path d="M16 6V4c0-1.11-.89-2-2-2h-4c-1.11 0-2 .89-2 2v2H2v13c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6h-6zm-6-2h4v2h-4V4zM9 18V9l7.5 4L9 18z"></path></g>
|
||
<g id="shop-two"><path d="M3 9H1v11c0 1.11.89 2 2 2h14c1.11 0 2-.89 2-2H3V9zm15-4V3c0-1.11-.89-2-2-2h-4c-1.11 0-2 .89-2 2v2H5v11c0 1.11.89 2 2 2h14c1.11 0 2-.89 2-2V5h-5zm-6-2h4v2h-4V3zm0 12V8l5.5 3-5.5 4z"></path></g>
|
||
<g id="shopping-basket"><path d="M17.21 9l-4.38-6.56c-.19-.28-.51-.42-.83-.42-.32 0-.64.14-.83.43L6.79 9H2c-.55 0-1 .45-1 1 0 .09.01.18.04.27l2.54 9.27c.23.84 1 1.46 1.92 1.46h13c.92 0 1.69-.62 1.93-1.46l2.54-9.27L23 10c0-.55-.45-1-1-1h-4.79zM9 9l3-4.4L15 9H9zm3 8c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"></path></g>
|
||
<g id="shopping-cart"><path d="M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.08-.14.12-.31.12-.48 0-.55-.45-1-1-1H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"></path></g>
|
||
<g id="sort"><path d="M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z"></path></g>
|
||
<g id="speaker-notes"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 14H6v-2h2v2zm0-3H6V9h2v2zm0-3H6V6h2v2zm7 6h-5v-2h5v2zm3-3h-8V9h8v2zm0-3h-8V6h8v2z"></path></g>
|
||
<g id="spellcheck"><path d="M12.45 16h2.09L9.43 3H7.57L2.46 16h2.09l1.12-3h5.64l1.14 3zm-6.02-5L8.5 5.48 10.57 11H6.43zm15.16.59l-8.09 8.09L9.83 16l-1.41 1.41 5.09 5.09L23 13l-1.41-1.41z"></path></g>
|
||
<g id="star"><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"></path></g>
|
||
<g id="star-border"><path d="M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"></path></g>
|
||
<g id="star-half"><path d="M22 9.74l-7.19-.62L12 2.5 9.19 9.13 2 9.74l5.46 4.73-1.64 7.03L12 17.77l6.18 3.73-1.63-7.03L22 9.74zM12 15.9V6.6l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.9z"></path></g>
|
||
<g id="stars"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23L16.23 18z"></path></g>
|
||
<g id="store"><path d="M20 4H4v2h16V4zm1 10v-2l-1-5H4l-1 5v2h1v6h10v-6h4v6h2v-6h1zm-9 4H6v-4h6v4z"></path></g>
|
||
<g id="subject"><path d="M14 17H4v2h10v-2zm6-8H4v2h16V9zM4 15h16v-2H4v2zM4 5v2h16V5H4z"></path></g>
|
||
<g id="supervisor-account"><path d="M16.5 12c1.38 0 2.49-1.12 2.49-2.5S17.88 7 16.5 7C15.12 7 14 8.12 14 9.5s1.12 2.5 2.5 2.5zM9 11c1.66 0 2.99-1.34 2.99-3S10.66 5 9 5C7.34 5 6 6.34 6 8s1.34 3 3 3zm7.5 3c-1.83 0-5.5.92-5.5 2.75V19h11v-2.25c0-1.83-3.67-2.75-5.5-2.75zM9 13c-2.33 0-7 1.17-7 3.5V19h7v-2.25c0-.85.33-2.34 2.37-3.47C10.5 13.1 9.66 13 9 13z"></path></g>
|
||
<g id="swap-horiz"><path d="M6.99 11L3 15l3.99 4v-3H14v-2H6.99v-3zM21 9l-3.99-4v3H10v2h7.01v3L21 9z"></path></g>
|
||
<g id="swap-vert"><path d="M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"></path></g>
|
||
<g id="swap-vertical-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM6.5 9L10 5.5 13.5 9H11v4H9V9H6.5zm11 6L14 18.5 10.5 15H13v-4h2v4h2.5z"></path></g>
|
||
<g id="system-update-alt"><path d="M12 16.5l4-4h-3v-9h-2v9H8l4 4zm9-13h-6v1.99h6v14.03H3V5.49h6V3.5H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2z"></path></g>
|
||
<g id="tab"><path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h10v4h8v10z"></path></g>
|
||
<g id="tab-unselected"><path d="M1 9h2V7H1v2zm0 4h2v-2H1v2zm0-8h2V3c-1.1 0-2 .9-2 2zm8 16h2v-2H9v2zm-8-4h2v-2H1v2zm2 4v-2H1c0 1.1.9 2 2 2zM21 3h-8v6h10V5c0-1.1-.9-2-2-2zm0 14h2v-2h-2v2zM9 5h2V3H9v2zM5 21h2v-2H5v2zM5 5h2V3H5v2zm16 16c1.1 0 2-.9 2-2h-2v2zm0-8h2v-2h-2v2zm-8 8h2v-2h-2v2zm4 0h2v-2h-2v2z"></path></g>
|
||
<g id="text-format"><path d="M5 17v2h14v-2H5zm4.5-4.2h5l.9 2.2h2.1L12.75 4h-1.5L6.5 15h2.1l.9-2.2zM12 5.98L13.87 11h-3.74L12 5.98z"></path></g>
|
||
<g id="theaters"><path d="M18 3v2h-2V3H8v2H6V3H4v18h2v-2h2v2h8v-2h2v2h2V3h-2zM8 17H6v-2h2v2zm0-4H6v-2h2v2zm0-4H6V7h2v2zm10 8h-2v-2h2v2zm0-4h-2v-2h2v2zm0-4h-2V7h2v2z"></path></g>
|
||
<g id="thumb-down"><path d="M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v1.91l.01.01L1 14c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm4 0v12h4V3h-4z"></path></g>
|
||
<g id="thumb-up"><path d="M1 21h4V9H1v12zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-1.91l-.01-.01L23 10z"></path></g>
|
||
<g id="thumbs-up-down"><path d="M12 6c0-.55-.45-1-1-1H5.82l.66-3.18.02-.23c0-.31-.13-.59-.33-.8L5.38 0 .44 4.94C.17 5.21 0 5.59 0 6v6.5c0 .83.67 1.5 1.5 1.5h6.75c.62 0 1.15-.38 1.38-.91l2.26-5.29c.07-.17.11-.36.11-.55V6zm10.5 4h-6.75c-.62 0-1.15.38-1.38.91l-2.26 5.29c-.07.17-.11.36-.11.55V18c0 .55.45 1 1 1h5.18l-.66 3.18-.02.24c0 .31.13.59.33.8l.79.78 4.94-4.94c.27-.27.44-.65.44-1.06v-6.5c0-.83-.67-1.5-1.5-1.5z"></path></g>
|
||
<g id="toc"><path d="M3 9h14V7H3v2zm0 4h14v-2H3v2zm0 4h14v-2H3v2zm16 0h2v-2h-2v2zm0-10v2h2V7h-2zm0 6h2v-2h-2v2z"></path></g>
|
||
<g id="today"><path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z"></path></g>
|
||
<g id="toll"><path d="M15 4c-4.42 0-8 3.58-8 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6zM3 12c0-2.61 1.67-4.83 4-5.65V4.26C3.55 5.15 1 8.27 1 12s2.55 6.85 6 7.74v-2.09c-2.33-.82-4-3.04-4-5.65z"></path></g>
|
||
<g id="track-changes"><path fill="#231F20" d="M19.07 4.93l-1.41 1.41C19.1 7.79 20 9.79 20 12c0 4.42-3.58 8-8 8s-8-3.58-8-8c0-4.08 3.05-7.44 7-7.93v2.02C8.16 6.57 6 9.03 6 12c0 3.31 2.69 6 6 6s6-2.69 6-6c0-1.66-.67-3.16-1.76-4.24l-1.41 1.41C15.55 9.9 16 10.9 16 12c0 2.21-1.79 4-4 4s-4-1.79-4-4c0-1.86 1.28-3.41 3-3.86v2.14c-.6.35-1 .98-1 1.72 0 1.1.9 2 2 2s2-.9 2-2c0-.74-.4-1.38-1-1.72V2h-1C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-2.76-1.12-5.26-2.93-7.07z"></path></g>
|
||
<g id="translate"><path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path></g>
|
||
<g id="trending-down"><path d="M16 18l2.29-2.29-4.88-4.88-4 4L2 7.41 3.41 6l6 6 4-4 6.3 6.29L22 12v6z"></path></g>
|
||
<g id="trending-flat"><path d="M22 12l-4-4v3H3v2h15v3z"></path></g>
|
||
<g id="trending-up"><path d="M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"></path></g>
|
||
<g id="turned-in"><path d="M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2z"></path></g>
|
||
<g id="turned-in-not"><path d="M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2zm0 15l-5-2.18L7 18V5h10v13z"></path></g>
|
||
<g id="undo"><path d="M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"></path></g>
|
||
<g id="unfold-less"><path d="M7.41 18.59L8.83 20 12 16.83 15.17 20l1.41-1.41L12 14l-4.59 4.59zm9.18-13.18L15.17 4 12 7.17 8.83 4 7.41 5.41 12 10l4.59-4.59z"></path></g>
|
||
<g id="unfold-more"><path d="M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z"></path></g>
|
||
<g id="verified-user"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm-2 16l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z"></path></g>
|
||
<g id="view-agenda"><path d="M20 13H3c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h17c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1zm0-10H3c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h17c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1z"></path></g>
|
||
<g id="view-array"><path d="M4 18h3V5H4v13zM18 5v13h3V5h-3zM8 18h9V5H8v13z"></path></g>
|
||
<g id="view-carousel"><path d="M7 19h10V4H7v15zm-5-2h4V6H2v11zM18 6v11h4V6h-4z"></path></g>
|
||
<g id="view-column"><path d="M10 18h5V5h-5v13zm-6 0h5V5H4v13zM16 5v13h5V5h-5z"></path></g>
|
||
<g id="view-day"><path d="M2 21h19v-3H2v3zM20 8H3c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h17c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1zM2 3v3h19V3H2z"></path></g>
|
||
<g id="view-headline"><path d="M4 15h16v-2H4v2zm0 4h16v-2H4v2zm0-8h16V9H4v2zm0-6v2h16V5H4z"></path></g>
|
||
<g id="view-list"><path d="M4 14h4v-4H4v4zm0 5h4v-4H4v4zM4 9h4V5H4v4zm5 5h12v-4H9v4zm0 5h12v-4H9v4zM9 5v4h12V5H9z"></path></g>
|
||
<g id="view-module"><path d="M4 11h5V5H4v6zm0 7h5v-6H4v6zm6 0h5v-6h-5v6zm6 0h5v-6h-5v6zm-6-7h5V5h-5v6zm6-6v6h5V5h-5z"></path></g>
|
||
<g id="view-quilt"><path d="M10 18h5v-6h-5v6zm-6 0h5V5H4v13zm12 0h5v-6h-5v6zM10 5v6h11V5H10z"></path></g>
|
||
<g id="view-stream"><path d="M4 18h17v-6H4v6zM4 5v6h17V5H4z"></path></g>
|
||
<g id="view-week"><path d="M6 5H3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h3c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1zm14 0h-3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h3c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1zm-7 0h-3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h3c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1z"></path></g>
|
||
<g id="visibility"><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"></path></g>
|
||
<g id="visibility-off"><path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"></path></g>
|
||
<g id="warning"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></g>
|
||
<g id="work"><path d="M20 6h-4V4c0-1.11-.89-2-2-2h-4c-1.11 0-2 .89-2 2v2H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-6 0h-4V4h4v2z"></path></g>
|
||
<g id="youtube-searched-for"><path d="M17.01 14h-.8l-.27-.27c.98-1.14 1.57-2.61 1.57-4.23 0-3.59-2.91-6.5-6.5-6.5s-6.5 3-6.5 6.5H2l3.84 4 4.16-4H6.51C6.51 7 8.53 5 11.01 5s4.5 2.01 4.5 4.5c0 2.48-2.02 4.5-4.5 4.5-.65 0-1.26-.14-1.82-.38L7.71 15.1c.97.57 2.09.9 3.3.9 1.61 0 3.08-.59 4.22-1.57l.27.27v.79l5.01 4.99L22 19l-4.99-5z"></path></g>
|
||
<g id="zoom-in"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"></path></g>
|
||
<g id="zoom-out"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"></path></g>
|
||
</defs></svg>
|
||
</iron-iconset-svg>
|
||
<iron-iconset-svg name="social" size="24">
|
||
<svg><defs>
|
||
<g id="cake"><path d="M12 6c1.11 0 2-.9 2-2 0-.38-.1-.73-.29-1.03L12 0l-1.71 2.97c-.19.3-.29.65-.29 1.03 0 1.1.9 2 2 2zm4.6 9.99l-1.07-1.07-1.08 1.07c-1.3 1.3-3.58 1.31-4.89 0l-1.07-1.07-1.09 1.07C6.75 16.64 5.88 17 4.96 17c-.73 0-1.4-.23-1.96-.61V21c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-4.61c-.56.38-1.23.61-1.96.61-.92 0-1.79-.36-2.44-1.01zM18 9h-5V7h-2v2H6c-1.66 0-3 1.34-3 3v1.54c0 1.08.88 1.96 1.96 1.96.52 0 1.02-.2 1.38-.57l2.14-2.13 2.13 2.13c.74.74 2.03.74 2.77 0l2.14-2.13 2.13 2.13c.37.37.86.57 1.38.57 1.08 0 1.96-.88 1.96-1.96V12C21 10.34 19.66 9 18 9z"></path></g>
|
||
<g id="domain"><path d="M12 7V3H2v18h20V7H12zM6 19H4v-2h2v2zm0-4H4v-2h2v2zm0-4H4V9h2v2zm0-4H4V5h2v2zm4 12H8v-2h2v2zm0-4H8v-2h2v2zm0-4H8V9h2v2zm0-4H8V5h2v2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8v10zm-2-8h-2v2h2v-2zm0 4h-2v2h2v-2z"></path></g>
|
||
<g id="group"><path d="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z"></path></g>
|
||
<g id="group-add"><path d="M8 10H5V7H3v3H0v2h3v3h2v-3h3v-2zm10 1c1.66 0 2.99-1.34 2.99-3S19.66 5 18 5c-.32 0-.63.05-.91.14.57.81.9 1.79.9 2.86s-.34 2.04-.9 2.86c.28.09.59.14.91.14zm-5 0c1.66 0 2.99-1.34 2.99-3S14.66 5 13 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm6.62 2.16c.83.73 1.38 1.66 1.38 2.84v2h3v-2c0-1.54-2.37-2.49-4.38-2.84zM13 13c-2 0-6 1-6 3v2h12v-2c0-2-4-3-6-3z"></path></g>
|
||
<g id="location-city"><path d="M15 11V5l-3-3-3 3v2H3v14h18V11h-6zm-8 8H5v-2h2v2zm0-4H5v-2h2v2zm0-4H5V9h2v2zm6 8h-2v-2h2v2zm0-4h-2v-2h2v2zm0-4h-2V9h2v2zm0-4h-2V5h2v2zm6 12h-2v-2h2v2zm0-4h-2v-2h2v2z"></path></g>
|
||
<g id="mood"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z"></path></g>
|
||
<g id="mood-bad"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 3c-2.33 0-4.31 1.46-5.11 3.5h10.22c-.8-2.04-2.78-3.5-5.11-3.5z"></path></g>
|
||
<g id="notifications"><path d="M11.5 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2zm6.5-6v-5.5c0-3.07-2.13-5.64-5-6.32V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5v.68c-2.87.68-5 3.25-5 6.32V16l-2 2v1h17v-1l-2-2z"></path></g>
|
||
<g id="notifications-active"><path d="M6.58 3.58L5.15 2.15C2.76 3.97 1.18 6.8 1.03 10h2c.15-2.65 1.51-4.97 3.55-6.42zM19.97 10h2c-.15-3.2-1.73-6.03-4.13-7.85l-1.43 1.43c2.05 1.45 3.41 3.77 3.56 6.42zm-1.97.5c0-3.07-2.13-5.64-5-6.32V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5v.68c-2.87.68-5 3.25-5 6.32V16l-2 2v1h17v-1l-2-2v-5.5zM11.5 22c.14 0 .27-.01.4-.04.65-.13 1.19-.58 1.44-1.18.1-.24.16-.5.16-.78h-4c0 1.1.9 2 2 2z"></path></g>
|
||
<g id="notifications-none"><path d="M11.5 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2zm6.5-6v-5.5c0-3.07-2.13-5.64-5-6.32V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5v.68c-2.87.68-5 3.25-5 6.32V16l-2 2v1h17v-1l-2-2zm-2 1H7v-6.5C7 8.01 9.01 6 11.5 6S16 8.01 16 10.5V17z"></path></g>
|
||
<g id="notifications-off"><path d="M11.5 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2zM18 10.5c0-3.07-2.13-5.64-5-6.32V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5v.68c-.51.12-.99.32-1.45.56L18 14.18V10.5zm-.27 8.5l2 2L21 19.73 4.27 3 3 4.27l2.92 2.92C5.34 8.16 5 9.29 5 10.5V16l-2 2v1h14.73z"></path></g>
|
||
<g id="notifications-paused"><path d="M11.5 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2zm6.5-6v-5.5c0-3.07-2.13-5.64-5-6.32V3.5c0-.83-.67-1.5-1.5-1.5S10 2.67 10 3.5v.68c-2.87.68-5 3.25-5 6.32V16l-2 2v1h17v-1l-2-2zm-4-6.2l-2.8 3.4H14V15H9v-1.8l2.8-3.4H9V8h5v1.8z"></path></g>
|
||
<g id="pages"><path d="M3 5v6h5L7 7l4 1V3H5c-1.1 0-2 .9-2 2zm5 8H3v6c0 1.1.9 2 2 2h6v-5l-4 1 1-4zm9 4l-4-1v5h6c1.1 0 2-.9 2-2v-6h-5l1 4zm2-14h-6v5l4-1-1 4h5V5c0-1.1-.9-2-2-2z"></path></g>
|
||
<g id="party-mode"><path d="M20 4h-3.17L15 2H9L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 3c1.63 0 3.06.79 3.98 2H12c-1.66 0-3 1.34-3 3 0 .35.07.69.18 1H7.1c-.06-.32-.1-.66-.1-1 0-2.76 2.24-5 5-5zm0 10c-1.63 0-3.06-.79-3.98-2H12c1.66 0 3-1.34 3-3 0-.35-.07-.69-.18-1h2.08c.07.32.1.66.1 1 0 2.76-2.24 5-5 5z"></path></g>
|
||
<g id="people"><path d="M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5z"></path></g>
|
||
<g id="people-outline"><path d="M16.5 13c-1.2 0-3.07.34-4.5 1-1.43-.67-3.3-1-4.5-1C5.33 13 1 14.08 1 16.25V19h22v-2.75c0-2.17-4.33-3.25-6.5-3.25zm-4 4.5h-10v-1.25c0-.54 2.56-1.75 5-1.75s5 1.21 5 1.75v1.25zm9 0H14v-1.25c0-.46-.2-.86-.52-1.22.88-.3 1.96-.53 3.02-.53 2.44 0 5 1.21 5 1.75v1.25zM7.5 12c1.93 0 3.5-1.57 3.5-3.5S9.43 5 7.5 5 4 6.57 4 8.5 5.57 12 7.5 12zm0-5.5c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm9 5.5c1.93 0 3.5-1.57 3.5-3.5S18.43 5 16.5 5 13 6.57 13 8.5s1.57 3.5 3.5 3.5zm0-5.5c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2z"></path></g>
|
||
<g id="person"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"></path></g>
|
||
<g id="person-add"><path d="M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm-9-2V7H4v3H1v2h3v3h2v-3h3v-2H6zm9 4c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"></path></g>
|
||
<g id="person-outline"><path d="M12 5.9c1.16 0 2.1.94 2.1 2.1s-.94 2.1-2.1 2.1S9.9 9.16 9.9 8s.94-2.1 2.1-2.1m0 9c2.97 0 6.1 1.46 6.1 2.1v1.1H5.9V17c0-.64 3.13-2.1 6.1-2.1M12 4C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4z"></path></g>
|
||
<g id="plus-one"><path d="M10 8H8v4H4v2h4v4h2v-4h4v-2h-4zm4.5-1.92V7.9l2.5-.5V18h2V5z"></path></g>
|
||
<g id="poll"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z"></path></g>
|
||
<g id="public"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"></path></g>
|
||
<g id="school"><path d="M5 13.18v4L12 21l7-3.82v-4L12 17l-7-3.82zM12 3L1 9l11 6 9-4.91V17h2V9L12 3z"></path></g>
|
||
<g id="share"><path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"></path></g>
|
||
<g id="whatshot"><path d="M13.5.67s.74 2.65.74 4.8c0 2.06-1.35 3.73-3.41 3.73-2.07 0-3.63-1.67-3.63-3.73l.03-.36C5.21 7.51 4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 17.41 3.8 13.5.67zM11.71 19c-1.78 0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 1.77-.36 3.6-1.21 4.62-2.58.39 1.29.59 2.65.59 4.04 0 2.65-2.15 4.8-4.8 4.8z"></path></g>
|
||
</defs></svg>
|
||
</iron-iconset-svg>
|
||
<iron-iconset-svg name="image" size="24">
|
||
<svg><defs>
|
||
<g id="add-to-photos"><path d="M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9h-4v4h-2v-4H9V9h4V5h2v4h4v2z"></path></g>
|
||
<g id="adjust"><path d="M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10 10-4.49 10-10S17.51 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm3-8c0 1.66-1.34 3-3 3s-3-1.34-3-3 1.34-3 3-3 3 1.34 3 3z"></path></g>
|
||
<g id="assistant"><path d="M19 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h4l3 3 3-3h4c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-5.12 10.88L12 17l-1.88-4.12L6 11l4.12-1.88L12 5l1.88 4.12L18 11l-4.12 1.88z"></path></g>
|
||
<g id="assistant-photo"><path d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z"></path></g>
|
||
<g id="audiotrack"><path d="M12 3v9.28c-.47-.17-.97-.28-1.5-.28C8.01 12 6 14.01 6 16.5S8.01 21 10.5 21c2.31 0 4.2-1.75 4.45-4H15V6h4V3h-7z"></path></g>
|
||
<g id="blur-circular"><path d="M10 9c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zM7 9.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm3 7c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm-3-3c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm3-6c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM14 9c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-1.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zm3 6c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm0-4c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm2-3.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm0-3.5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1z"></path></g>
|
||
<g id="blur-linear"><path d="M5 17.5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5-1.5.67-1.5 1.5.67 1.5 1.5 1.5zM9 13c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0-4c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zM3 21h18v-2H3v2zM5 9.5c.83 0 1.5-.67 1.5-1.5S5.83 6.5 5 6.5 3.5 7.17 3.5 8 4.17 9.5 5 9.5zm0 4c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5-1.5.67-1.5 1.5.67 1.5 1.5 1.5zM9 17c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm8-.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM3 3v2h18V3H3zm14 5.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zm0 4c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM13 9c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0 4c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0 4c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1z"></path></g>
|
||
<g id="blur-off"><path d="M14 7c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm-.2 4.48l.2.02c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5-1.5.67-1.5 1.5l.02.2c.09.67.61 1.19 1.28 1.28zM14 3.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zm-4 0c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zm11 7c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM10 7c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm8 8c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0-4c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0-4c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm-4 13.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM2.5 5.27l3.78 3.78L6 9c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1c0-.1-.03-.19-.06-.28l2.81 2.81c-.71.11-1.25.73-1.25 1.47 0 .83.67 1.5 1.5 1.5.74 0 1.36-.54 1.47-1.25l2.81 2.81c-.09-.03-.18-.06-.28-.06-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1c0-.1-.03-.19-.06-.28l3.78 3.78L20 20.23 3.77 4 2.5 5.27zM10 17c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm11-3.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM6 13c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zM3 9.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm7 11c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM6 17c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm-3-3.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5z"></path></g>
|
||
<g id="blur-on"><path d="M6 13c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-8c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm-3 .5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM6 5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm15 5.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM14 7c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0-3.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zm-11 10c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm7 7c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm0-17c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM10 7c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0 5.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm8 .5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-8c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm3 8.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM14 17c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 3.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm-4-12c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0 8.5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm4-4.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-4c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5z"></path></g>
|
||
<g id="brightness-1"><circle cx="12" cy="12" r="10"></circle></g>
|
||
<g id="brightness-2"><path d="M10 2c-1.82 0-3.53.5-5 1.35C7.99 5.08 10 8.3 10 12s-2.01 6.92-5 8.65C6.47 21.5 8.18 22 10 22c5.52 0 10-4.48 10-10S15.52 2 10 2z"></path></g>
|
||
<g id="brightness-3"><path d="M9 2c-1.05 0-2.05.16-3 .46 4.06 1.27 7 5.06 7 9.54 0 4.48-2.94 8.27-7 9.54.95.3 1.95.46 3 .46 5.52 0 10-4.48 10-10S14.52 2 9 2z"></path></g>
|
||
<g id="brightness-4"><path d="M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69zM12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6c3.31 0 6 2.69 6 6s-2.69 6-6 6z"></path></g>
|
||
<g id="brightness-5"><path d="M20 15.31L23.31 12 20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6z"></path></g>
|
||
<g id="brightness-6"><path d="M20 15.31L23.31 12 20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69zM12 18V6c3.31 0 6 2.69 6 6s-2.69 6-6 6z"></path></g>
|
||
<g id="brightness-7"><path d="M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12 20 8.69zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6zm0-10c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4z"></path></g>
|
||
<g id="broken-image"><path d="M21 5v6.59l-3-3.01-4 4.01-4-4-4 4-3-3.01V5c0-1.1.9-2 2-2h14c1.1 0 2 .9 2 2zm-3 6.42l3 3.01V19c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2v-6.58l3 2.99 4-4 4 4 4-3.99z"></path></g>
|
||
<g id="brush"><path d="M7 14c-1.66 0-3 1.34-3 3 0 1.31-1.16 2-2 2 .92 1.22 2.49 2 4 2 2.21 0 4-1.79 4-4 0-1.66-1.34-3-3-3zm13.71-9.37l-1.34-1.34c-.39-.39-1.02-.39-1.41 0L9 12.25 11.75 15l8.96-8.96c.39-.39.39-1.02 0-1.41z"></path></g>
|
||
<g id="camera"><path d="M9.4 10.5l4.77-8.26C13.47 2.09 12.75 2 12 2c-2.4 0-4.6.85-6.32 2.25l3.66 6.35.06-.1zM21.54 9c-.92-2.92-3.15-5.26-6-6.34L11.88 9h9.66zm.26 1h-7.49l.29.5 4.76 8.25C21 16.97 22 14.61 22 12c0-.69-.07-1.35-.2-2zM8.54 12l-3.9-6.75C3.01 7.03 2 9.39 2 12c0 .69.07 1.35.2 2h7.49l-1.15-2zm-6.08 3c.92 2.92 3.15 5.26 6 6.34L12.12 15H2.46zm11.27 0l-3.9 6.76c.7.15 1.42.24 2.17.24 2.4 0 4.6-.85 6.32-2.25l-3.66-6.35-.93 1.6z"></path></g>
|
||
<g id="camera-alt"><circle cx="12" cy="12" r="3.2"></circle><path d="M9 2L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z"></path></g>
|
||
<g id="camera-front"><path d="M10 20H5v2h5v2l3-3-3-3v2zm4 0v2h5v-2h-5zM12 8c1.1 0 2-.9 2-2s-.9-2-2-2-1.99.9-1.99 2S10.9 8 12 8zm5-8H7C5.9 0 5 .9 5 2v14c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zM7 2h10v10.5c0-1.67-3.33-2.5-5-2.5s-5 .83-5 2.5V2z"></path></g>
|
||
<g id="camera-rear"><path d="M10 20H5v2h5v2l3-3-3-3v2zm4 0v2h5v-2h-5zm3-20H7C5.9 0 5 .9 5 2v14c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zm-5 6c-1.11 0-2-.9-2-2s.89-2 1.99-2 2 .9 2 2C14 5.1 13.1 6 12 6z"></path></g>
|
||
<g id="camera-roll"><path d="M14 5c0-1.1-.9-2-2-2h-1V2c0-.55-.45-1-1-1H6c-.55 0-1 .45-1 1v1H4c-1.1 0-2 .9-2 2v15c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2h8V5h-8zm-2 13h-2v-2h2v2zm0-9h-2V7h2v2zm4 9h-2v-2h2v2zm0-9h-2V7h2v2zm4 9h-2v-2h2v2zm0-9h-2V7h2v2z"></path></g>
|
||
<g id="center-focus-strong"><path d="M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm-7 7H3v4c0 1.1.9 2 2 2h4v-2H5v-4zM5 5h4V3H5c-1.1 0-2 .9-2 2v4h2V5zm14-2h-4v2h4v4h2V5c0-1.1-.9-2-2-2zm0 16h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4z"></path></g>
|
||
<g id="center-focus-weak"><path d="M5 15H3v4c0 1.1.9 2 2 2h4v-2H5v-4zM5 5h4V3H5c-1.1 0-2 .9-2 2v4h2V5zm14-2h-4v2h4v4h2V5c0-1.1-.9-2-2-2zm0 16h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zM12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"></path></g>
|
||
<g id="collections"><path d="M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"></path></g>
|
||
<g id="collections-bookmark"><path d="M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zM20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 10l-2.5-1.5L15 12V4h5v8z"></path></g>
|
||
<g id="color-lens"><path d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"></path></g>
|
||
<g id="colorize"><path d="M20.71 5.63l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-3.12 3.12-1.93-1.91-1.41 1.41 1.42 1.42L3 16.25V21h4.75l8.92-8.92 1.42 1.42 1.41-1.41-1.92-1.92 3.12-3.12c.4-.4.4-1.03.01-1.42zM6.92 19L5 17.08l8.06-8.06 1.92 1.92L6.92 19z"></path></g>
|
||
<g id="compare"><path d="M10 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h5v2h2V1h-2v2zm0 15H5l5-6v6zm9-15h-5v2h5v13l-5-6v9h5c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path></g>
|
||
<g id="control-point"><path d="M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4V7zm-1-5C6.49 2 2 6.49 2 12s4.49 10 10 10 10-4.49 10-10S17.51 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></g>
|
||
<g id="control-point-duplicate"><path d="M16 8h-2v3h-3v2h3v3h2v-3h3v-2h-3zM2 12c0-2.79 1.64-5.2 4.01-6.32V3.52C2.52 4.76 0 8.09 0 12s2.52 7.24 6.01 8.48v-2.16C3.64 17.2 2 14.79 2 12zm13-9c-4.96 0-9 4.04-9 9s4.04 9 9 9 9-4.04 9-9-4.04-9-9-9zm0 16c-3.86 0-7-3.14-7-7s3.14-7 7-7 7 3.14 7 7-3.14 7-7 7z"></path></g>
|
||
<g id="crop"><path d="M17 15h2V7c0-1.1-.9-2-2-2H9v2h8v8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2H7z"></path></g>
|
||
<g id="crop-16-9"><path d="M19 6H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 10H5V8h14v8z"></path></g>
|
||
<g id="crop-3-2"><path d="M19 4H5c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H5V6h14v12z"></path></g>
|
||
<g id="crop-5-4"><path d="M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 12H5V7h14v10z"></path></g>
|
||
<g id="crop-7-5"><path d="M19 7H5c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2zm0 8H5V9h14v6z"></path></g>
|
||
<g id="crop-din"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14z"></path></g>
|
||
<g id="crop-free"><path d="M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2zm2 10H3v4c0 1.1.9 2 2 2h4v-2H5v-4zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2z"></path></g>
|
||
<g id="crop-landscape"><path d="M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 12H5V7h14v10z"></path></g>
|
||
<g id="crop-original"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-5.04-6.71l-2.75 3.54-1.96-2.36L6.5 17h11l-3.54-4.71z"></path></g>
|
||
<g id="crop-portrait"><path d="M17 3H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H7V5h10v14z"></path></g>
|
||
<g id="crop-square"><path d="M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H6V6h12v12z"></path></g>
|
||
<g id="dehaze"><path d="M2 15.5v2h20v-2H2zm0-5v2h20v-2H2zm0-5v2h20v-2H2z"></path></g>
|
||
<g id="details"><path d="M3 4l9 16 9-16H3zm3.38 2h11.25L12 16 6.38 6z"></path></g>
|
||
<g id="edit"><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"></path></g>
|
||
<g id="exposure"><path d="M15 17v2h2v-2h2v-2h-2v-2h-2v2h-2v2h2zm5-15H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM5 5h6v2H5V5zm15 15H4L20 4v16z"></path></g>
|
||
<g id="exposure-neg-1"><path d="M4 11v2h8v-2H4zm15 7h-2V7.38L14 8.4V6.7L18.7 5h.3v13z"></path></g>
|
||
<g id="exposure-neg-2"><path d="M15.05 16.29l2.86-3.07c.38-.39.72-.79 1.04-1.18.32-.39.59-.78.82-1.17.23-.39.41-.78.54-1.17s.19-.79.19-1.18c0-.53-.09-1.02-.27-1.46-.18-.44-.44-.81-.78-1.11-.34-.31-.77-.54-1.26-.71-.51-.16-1.08-.24-1.72-.24-.69 0-1.31.11-1.85.32-.54.21-1 .51-1.36.88-.37.37-.65.8-.84 1.3-.18.47-.27.97-.28 1.5h2.14c.01-.31.05-.6.13-.87.09-.29.23-.54.4-.75.18-.21.41-.37.68-.49.27-.12.6-.18.96-.18.31 0 .58.05.81.15.23.1.43.25.59.43.16.18.28.4.37.65.08.25.13.52.13.81 0 .22-.03.43-.08.65-.06.22-.15.45-.29.7-.14.25-.32.53-.56.83-.23.3-.52.65-.88 1.03l-4.17 4.55V18H21v-1.71h-5.95zM2 11v2h8v-2H2z"></path></g>
|
||
<g id="exposure-plus-1"><path d="M10 7H8v4H4v2h4v4h2v-4h4v-2h-4V7zm10 11h-2V7.38L15 8.4V6.7L19.7 5h.3v13z"></path></g>
|
||
<g id="exposure-plus-2"><path d="M16.05 16.29l2.86-3.07c.38-.39.72-.79 1.04-1.18.32-.39.59-.78.82-1.17.23-.39.41-.78.54-1.17.13-.39.19-.79.19-1.18 0-.53-.09-1.02-.27-1.46-.18-.44-.44-.81-.78-1.11-.34-.31-.77-.54-1.26-.71-.51-.16-1.08-.24-1.72-.24-.69 0-1.31.11-1.85.32-.54.21-1 .51-1.36.88-.37.37-.65.8-.84 1.3-.18.47-.27.97-.28 1.5h2.14c.01-.31.05-.6.13-.87.09-.29.23-.54.4-.75.18-.21.41-.37.68-.49.27-.12.6-.18.96-.18.31 0 .58.05.81.15.23.1.43.25.59.43.16.18.28.4.37.65.08.25.13.52.13.81 0 .22-.03.43-.08.65-.06.22-.15.45-.29.7-.14.25-.32.53-.56.83-.23.3-.52.65-.88 1.03l-4.17 4.55V18H22v-1.71h-5.95zM8 7H6v4H2v2h4v4h2v-4h4v-2H8V7z"></path></g>
|
||
<g id="exposure-zero"><path d="M16.14 12.5c0 1-.1 1.85-.3 2.55-.2.7-.48 1.27-.83 1.7-.36.44-.79.75-1.3.95-.51.2-1.07.3-1.7.3-.62 0-1.18-.1-1.69-.3-.51-.2-.95-.51-1.31-.95-.36-.44-.65-1.01-.85-1.7-.2-.7-.3-1.55-.3-2.55v-2.04c0-1 .1-1.85.3-2.55.2-.7.48-1.26.84-1.69.36-.43.8-.74 1.31-.93C10.81 5.1 11.38 5 12 5c.63 0 1.19.1 1.7.29.51.19.95.5 1.31.93.36.43.64.99.84 1.69.2.7.3 1.54.3 2.55v2.04zm-2.11-2.36c0-.64-.05-1.18-.13-1.62-.09-.44-.22-.79-.4-1.06-.17-.27-.39-.46-.64-.58-.25-.13-.54-.19-.86-.19-.32 0-.61.06-.86.18s-.47.31-.64.58c-.17.27-.31.62-.4 1.06s-.13.98-.13 1.62v2.67c0 .64.05 1.18.14 1.62.09.45.23.81.4 1.09s.39.48.64.61.54.19.87.19c.33 0 .62-.06.87-.19s.46-.33.63-.61c.17-.28.3-.64.39-1.09.09-.45.13-.99.13-1.62v-2.66z"></path></g>
|
||
<g id="filter"><path d="M15.96 10.29l-2.75 3.54-1.96-2.36L8.5 15h11l-3.54-4.71zM3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14z"></path></g>
|
||
<g id="filter-1"><path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm11 10h2V5h-4v2h2v8zm7-14H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14z"></path></g>
|
||
<g id="filter-2"><path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14zm-4-4h-4v-2h2c1.1 0 2-.89 2-2V7c0-1.11-.9-2-2-2h-4v2h4v2h-2c-1.1 0-2 .89-2 2v4h6v-2z"></path></g>
|
||
<g id="filter-3"><path d="M21 1H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14zM3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm14 8v-1.5c0-.83-.67-1.5-1.5-1.5.83 0 1.5-.67 1.5-1.5V7c0-1.11-.9-2-2-2h-4v2h4v2h-2v2h2v2h-4v2h4c1.1 0 2-.89 2-2z"></path></g>
|
||
<g id="filter-4"><path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm12 10h2V5h-2v4h-2V5h-2v6h4v4zm6-14H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14z"></path></g>
|
||
<g id="filter-5"><path d="M21 1H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14zM3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm14 8v-2c0-1.11-.9-2-2-2h-2V7h4V5h-6v6h4v2h-4v2h4c1.1 0 2-.89 2-2z"></path></g>
|
||
<g id="filter-6"><path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14zm-8-2h2c1.1 0 2-.89 2-2v-2c0-1.11-.9-2-2-2h-2V7h4V5h-4c-1.1 0-2 .89-2 2v6c0 1.11.9 2 2 2zm0-4h2v2h-2v-2z"></path></g>
|
||
<g id="filter-7"><path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14zm-8-2l4-8V5h-6v2h4l-4 8h2z"></path></g>
|
||
<g id="filter-8"><path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14zm-8-2h2c1.1 0 2-.89 2-2v-1.5c0-.83-.67-1.5-1.5-1.5.83 0 1.5-.67 1.5-1.5V7c0-1.11-.9-2-2-2h-2c-1.1 0-2 .89-2 2v1.5c0 .83.67 1.5 1.5 1.5-.83 0-1.5.67-1.5 1.5V13c0 1.11.9 2 2 2zm0-8h2v2h-2V7zm0 4h2v2h-2v-2z"></path></g>
|
||
<g id="filter-9"><path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14zM15 5h-2c-1.1 0-2 .89-2 2v2c0 1.11.9 2 2 2h2v2h-4v2h4c1.1 0 2-.89 2-2V7c0-1.11-.9-2-2-2zm0 4h-2V7h2v2z"></path></g>
|
||
<g id="filter-9-plus"><path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm11 7V8c0-1.11-.9-2-2-2h-1c-1.1 0-2 .89-2 2v1c0 1.11.9 2 2 2h1v1H9v2h3c1.1 0 2-.89 2-2zm-3-3V8h1v1h-1zm10-8H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 8h-2V7h-2v2h-2v2h2v2h2v-2h2v6H7V3h14v6z"></path></g>
|
||
<g id="filter-b-and-w"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16l-7-8v8H5l7-8V5h7v14z"></path></g>
|
||
<g id="filter-center-focus"><path d="M5 15H3v4c0 1.1.9 2 2 2h4v-2H5v-4zM5 5h4V3H5c-1.1 0-2 .9-2 2v4h2V5zm14-2h-4v2h4v4h2V5c0-1.1-.9-2-2-2zm0 16h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zM12 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"></path></g>
|
||
<g id="filter-drama"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.61 5.64 5.36 8.04 2.35 8.36 0 10.9 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4h2c0-2.76-1.86-5.08-4.4-5.78C8.61 6.88 10.2 6 12 6c3.03 0 5.5 2.47 5.5 5.5v.5H19c1.65 0 3 1.35 3 3s-1.35 3-3 3z"></path></g>
|
||
<g id="filter-frames"><path d="M20 4h-4l-4-4-4 4H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H4V6h4.52l3.52-3.5L15.52 6H20v14zM18 8H6v10h12"></path></g>
|
||
<g id="filter-hdr"><path d="M14 6l-3.75 5 2.85 3.8-1.6 1.2C9.81 13.75 7 10 7 10l-6 8h22L14 6z"></path></g>
|
||
<g id="filter-none"><path d="M3 5H1v16c0 1.1.9 2 2 2h16v-2H3V5zm18-4H7c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2zm0 16H7V3h14v14z"></path></g>
|
||
<g id="filter-tilt-shift"><path d="M11 4.07V2.05c-2.01.2-3.84 1-5.32 2.21L7.1 5.69c1.11-.86 2.44-1.44 3.9-1.62zm7.32.19C16.84 3.05 15.01 2.25 13 2.05v2.02c1.46.18 2.79.76 3.9 1.62l1.42-1.43zM19.93 11h2.02c-.2-2.01-1-3.84-2.21-5.32L18.31 7.1c.86 1.11 1.44 2.44 1.62 3.9zM5.69 7.1L4.26 5.68C3.05 7.16 2.25 8.99 2.05 11h2.02c.18-1.46.76-2.79 1.62-3.9zM4.07 13H2.05c.2 2.01 1 3.84 2.21 5.32l1.43-1.43c-.86-1.1-1.44-2.43-1.62-3.89zM15 12c0-1.66-1.34-3-3-3s-3 1.34-3 3 1.34 3 3 3 3-1.34 3-3zm3.31 4.9l1.43 1.43c1.21-1.48 2.01-3.32 2.21-5.32h-2.02c-.18 1.45-.76 2.78-1.62 3.89zM13 19.93v2.02c2.01-.2 3.84-1 5.32-2.21l-1.43-1.43c-1.1.86-2.43 1.44-3.89 1.62zm-7.32-.19C7.16 20.95 9 21.75 11 21.95v-2.02c-1.46-.18-2.79-.76-3.9-1.62l-1.42 1.43z"></path></g>
|
||
<g id="filter-vintage"><path d="M18.7 12.4c-.28-.16-.57-.29-.86-.4.29-.11.58-.24.86-.4 1.92-1.11 2.99-3.12 3-5.19-1.79-1.03-4.07-1.11-6 0-.28.16-.54.35-.78.54.05-.31.08-.63.08-.95 0-2.22-1.21-4.15-3-5.19C10.21 1.85 9 3.78 9 6c0 .32.03.64.08.95-.24-.2-.5-.39-.78-.55-1.92-1.11-4.2-1.03-6 0 0 2.07 1.07 4.08 3 5.19.28.16.57.29.86.4-.29.11-.58.24-.86.4-1.92 1.11-2.99 3.12-3 5.19 1.79 1.03 4.07 1.11 6 0 .28-.16.54-.35.78-.54-.05.32-.08.64-.08.96 0 2.22 1.21 4.15 3 5.19 1.79-1.04 3-2.97 3-5.19 0-.32-.03-.64-.08-.95.24.2.5.38.78.54 1.92 1.11 4.2 1.03 6 0-.01-2.07-1.08-4.08-3-5.19zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z"></path></g>
|
||
<g id="flare"><path d="M7 11H1v2h6v-2zm2.17-3.24L7.05 5.64 5.64 7.05l2.12 2.12 1.41-1.41zM13 1h-2v6h2V1zm5.36 6.05l-1.41-1.41-2.12 2.12 1.41 1.41 2.12-2.12zM17 11v2h6v-2h-6zm-5-2c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3zm2.83 7.24l2.12 2.12 1.41-1.41-2.12-2.12-1.41 1.41zm-9.19.71l1.41 1.41 2.12-2.12-1.41-1.41-2.12 2.12zM11 23h2v-6h-2v6z"></path></g>
|
||
<g id="flash-auto"><path d="M3 2v12h3v9l7-12H9l4-9H3zm16 0h-2l-3.2 9h1.9l.7-2h3.2l.7 2h1.9L19 2zm-2.15 5.65L18 4l1.15 3.65h-2.3z"></path></g>
|
||
<g id="flash-off"><path d="M3.27 3L2 4.27l5 5V13h3v9l3.58-6.14L17.73 20 19 18.73 3.27 3zM17 10h-4l4-8H7v2.18l8.46 8.46L17 10z"></path></g>
|
||
<g id="flash-on"><path d="M7 2v11h3v9l7-12h-4l4-8z"></path></g>
|
||
<g id="flip"><path d="M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"></path></g>
|
||
<g id="gradient"><path d="M11 9h2v2h-2zm-2 2h2v2H9zm4 0h2v2h-2zm2-2h2v2h-2zM7 9h2v2H7zm12-6H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 18H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm2-7h-2v2h2v2h-2v-2h-2v2h-2v-2h-2v2H9v-2H7v2H5v-2h2v-2H5V5h14v6z"></path></g>
|
||
<g id="grain"><path d="M10 12c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zM6 8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12-8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm-4 8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm4-4c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-4-4c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-4-4c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></g>
|
||
<g id="grid-off"><path d="M8 4v1.45l2 2V4h4v4h-3.45l2 2H14v1.45l2 2V10h4v4h-3.45l2 2H20v1.45l2 2V4c0-1.1-.9-2-2-2H4.55l2 2H8zm8 0h4v4h-4V4zM1.27 1.27L0 2.55l2 2V20c0 1.1.9 2 2 2h15.46l2 2 1.27-1.27L1.27 1.27zM10 12.55L11.45 14H10v-1.45zm-6-6L5.45 8H4V6.55zM8 20H4v-4h4v4zm0-6H4v-4h3.45l.55.55V14zm6 6h-4v-4h3.45l.55.54V20zm2 0v-1.46L17.46 20H16z"></path></g>
|
||
<g id="grid-on"><path d="M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"></path></g>
|
||
<g id="hdr-off"><path d="M17.5 15v-2h1.1l.9 2H21l-.9-2.1c.5-.2.9-.8.9-1.4v-1c0-.8-.7-1.5-1.5-1.5H16v4.9l1.1 1.1h.4zm0-4.5h2v1h-2v-1zm-4.5 0v.4l1.5 1.5v-1.9c0-.8-.7-1.5-1.5-1.5h-1.9l1.5 1.5h.4zm-3.5-1l-7-7-1.1 1L6.9 9h-.4v2h-2V9H3v6h1.5v-2.5h2V15H8v-4.9l1.5 1.5V15h3.4l7.6 7.6 1.1-1.1-12.1-12z"></path></g>
|
||
<g id="hdr-on"><path d="M21 11.5v-1c0-.8-.7-1.5-1.5-1.5H16v6h1.5v-2h1.1l.9 2H21l-.9-2.1c.5-.3.9-.8.9-1.4zm-1.5 0h-2v-1h2v1zm-13-.5h-2V9H3v6h1.5v-2.5h2V15H8V9H6.5v2zM13 9H9.5v6H13c.8 0 1.5-.7 1.5-1.5v-3c0-.8-.7-1.5-1.5-1.5zm0 4.5h-2v-3h2v3z"></path></g>
|
||
<g id="hdr-strong"><path d="M17 6c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zM5 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"></path></g>
|
||
<g id="hdr-weak"><path d="M5 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm12-2c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm0 10c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z"></path></g>
|
||
<g id="healing"><path d="M17.73 12.02l3.98-3.98c.39-.39.39-1.02 0-1.41l-4.34-4.34c-.39-.39-1.02-.39-1.41 0l-3.98 3.98L8 2.29C7.8 2.1 7.55 2 7.29 2c-.25 0-.51.1-.7.29L2.25 6.63c-.39.39-.39 1.02 0 1.41l3.98 3.98L2.25 16c-.39.39-.39 1.02 0 1.41l4.34 4.34c.39.39 1.02.39 1.41 0l3.98-3.98 3.98 3.98c.2.2.45.29.71.29.26 0 .51-.1.71-.29l4.34-4.34c.39-.39.39-1.02 0-1.41l-3.99-3.98zM12 9c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm-4.71 1.96L3.66 7.34l3.63-3.63 3.62 3.62-3.62 3.63zM10 13c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm2 2c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm2-4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm2.66 9.34l-3.63-3.62 3.63-3.63 3.62 3.62-3.62 3.63z"></path></g>
|
||
<g id="image"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"></path></g>
|
||
<g id="image-aspect-ratio"><path d="M16 10h-2v2h2v-2zm0 4h-2v2h2v-2zm-8-4H6v2h2v-2zm4 0h-2v2h2v-2zm8-6H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V6h16v12z"></path></g>
|
||
<g id="iso"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5.5 7.5h2v-2H9v2h2V9H9v2H7.5V9h-2V7.5zM19 19H5L19 5v14zm-2-2v-1.5h-5V17h5z"></path></g>
|
||
<g id="landscape"><path d="M14 6l-3.75 5 2.85 3.8-1.6 1.2C9.81 13.75 7 10 7 10l-6 8h22L14 6z"></path></g>
|
||
<g id="leak-add"><path d="M6 3H3v3c1.66 0 3-1.34 3-3zm8 0h-2c0 4.97-4.03 9-9 9v2c6.08 0 11-4.93 11-11zm-4 0H8c0 2.76-2.24 5-5 5v2c3.87 0 7-3.13 7-7zm0 18h2c0-4.97 4.03-9 9-9v-2c-6.07 0-11 4.93-11 11zm8 0h3v-3c-1.66 0-3 1.34-3 3zm-4 0h2c0-2.76 2.24-5 5-5v-2c-3.87 0-7 3.13-7 7z"></path></g>
|
||
<g id="leak-remove"><path d="M10 3H8c0 .37-.04.72-.12 1.06l1.59 1.59C9.81 4.84 10 3.94 10 3zM3 4.27l2.84 2.84C5.03 7.67 4.06 8 3 8v2c1.61 0 3.09-.55 4.27-1.46L8.7 9.97C7.14 11.24 5.16 12 3 12v2c2.71 0 5.19-.99 7.11-2.62l2.5 2.5C10.99 15.81 10 18.29 10 21h2c0-2.16.76-4.14 2.03-5.69l1.43 1.43C14.55 17.91 14 19.39 14 21h2c0-1.06.33-2.03.89-2.84L19.73 21 21 19.73 4.27 3 3 4.27zM14 3h-2c0 1.5-.37 2.91-1.02 4.16l1.46 1.46C13.42 6.98 14 5.06 14 3zm5.94 13.12c.34-.08.69-.12 1.06-.12v-2c-.94 0-1.84.19-2.66.52l1.6 1.6zm-4.56-4.56l1.46 1.46C18.09 12.37 19.5 12 21 12v-2c-2.06 0-3.98.58-5.62 1.56z"></path></g>
|
||
<g id="lens"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z"></path></g>
|
||
<g id="looks"><path d="M12 10c-3.86 0-7 3.14-7 7h2c0-2.76 2.24-5 5-5s5 2.24 5 5h2c0-3.86-3.14-7-7-7zm0-4C5.93 6 1 10.93 1 17h2c0-4.96 4.04-9 9-9s9 4.04 9 9h2c0-6.07-4.93-11-11-11z"></path></g>
|
||
<g id="looks-3"><path d="M19.01 3h-14c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 7.5c0 .83-.67 1.5-1.5 1.5.83 0 1.5.67 1.5 1.5V15c0 1.11-.9 2-2 2h-4v-2h4v-2h-2v-2h2V9h-4V7h4c1.1 0 2 .89 2 2v1.5z"></path></g>
|
||
<g id="looks-4"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 14h-2v-4H9V7h2v4h2V7h2v10z"></path></g>
|
||
<g id="looks-5"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 6h-4v2h2c1.1 0 2 .89 2 2v2c0 1.11-.9 2-2 2H9v-2h4v-2H9V7h6v2z"></path></g>
|
||
<g id="looks-6"><path d="M11 15h2v-2h-2v2zm8-12H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 6h-4v2h2c1.1 0 2 .89 2 2v2c0 1.11-.9 2-2 2h-2c-1.1 0-2-.89-2-2V9c0-1.11.9-2 2-2h4v2z"></path></g>
|
||
<g id="looks-one"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14h-2V9h-2V7h4v10z"></path></g>
|
||
<g id="looks-two"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 8c0 1.11-.9 2-2 2h-2v2h4v2H9v-4c0-1.11.9-2 2-2h2V9H9V7h4c1.1 0 2 .89 2 2v2z"></path></g>
|
||
<g id="loupe"><path d="M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4V7zm-1-5C6.49 2 2 6.49 2 12s4.49 10 10 10h8c1.1 0 2-.9 2-2v-8c0-5.51-4.49-10-10-10zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></g>
|
||
<g id="monochrome-photos"><path d="M20 5h-3.2L15 3H9L7.2 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 14h-8v-1c-2.8 0-5-2.2-5-5s2.2-5 5-5V7h8v12zm-3-6c0-2.8-2.2-5-5-5v1.8c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2V18c2.8 0 5-2.2 5-5zm-8.2 0c0 1.8 1.4 3.2 3.2 3.2V9.8c-1.8 0-3.2 1.4-3.2 3.2z"></path></g>
|
||
<g id="movie-creation"><path d="M18 4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4h-4z"></path></g>
|
||
<g id="music-note"><path d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"></path></g>
|
||
<g id="nature"><path d="M13 16.12c3.47-.41 6.17-3.36 6.17-6.95 0-3.87-3.13-7-7-7s-7 3.13-7 7c0 3.47 2.52 6.34 5.83 6.89V20H5v2h14v-2h-6v-3.88z"></path></g>
|
||
<g id="nature-people"><path d="M22.17 9.17c0-3.87-3.13-7-7-7s-7 3.13-7 7c0 3.47 2.52 6.34 5.83 6.89V20H6v-3h1v-4c0-.55-.45-1-1-1H3c-.55 0-1 .45-1 1v4h1v5h16v-2h-3v-3.88c3.47-.41 6.17-3.36 6.17-6.95zM4.5 11c.83 0 1.5-.67 1.5-1.5S5.33 8 4.5 8 3 8.67 3 9.5 3.67 11 4.5 11z"></path></g>
|
||
<g id="navigate-before"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"></path></g>
|
||
<g id="navigate-next"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path></g>
|
||
<g id="palette"><path d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"></path></g>
|
||
<g id="panorama"><path d="M23 18V6c0-1.1-.9-2-2-2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zM8.5 12.5l2.5 3.01L14.5 11l4.5 6H5l3.5-4.5z"></path></g>
|
||
<g id="panorama-fish-eye"><path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></g>
|
||
<g id="panorama-horizontal"><path d="M20 6.54v10.91c-2.6-.77-5.28-1.16-8-1.16-2.72 0-5.4.39-8 1.16V6.54c2.6.77 5.28 1.16 8 1.16 2.72.01 5.4-.38 8-1.16M21.43 4c-.1 0-.2.02-.31.06C18.18 5.16 15.09 5.7 12 5.7c-3.09 0-6.18-.55-9.12-1.64-.11-.04-.22-.06-.31-.06-.34 0-.57.23-.57.63v14.75c0 .39.23.62.57.62.1 0 .2-.02.31-.06 2.94-1.1 6.03-1.64 9.12-1.64 3.09 0 6.18.55 9.12 1.64.11.04.21.06.31.06.33 0 .57-.23.57-.63V4.63c0-.4-.24-.63-.57-.63z"></path></g>
|
||
<g id="panorama-vertical"><path d="M19.94 21.12c-1.1-2.94-1.64-6.03-1.64-9.12 0-3.09.55-6.18 1.64-9.12.04-.11.06-.22.06-.31 0-.34-.23-.57-.63-.57H4.63c-.4 0-.63.23-.63.57 0 .1.02.2.06.31C5.16 5.82 5.71 8.91 5.71 12c0 3.09-.55 6.18-1.64 9.12-.05.11-.07.22-.07.31 0 .33.23.57.63.57h14.75c.39 0 .63-.24.63-.57-.01-.1-.03-.2-.07-.31zM6.54 20c.77-2.6 1.16-5.28 1.16-8 0-2.72-.39-5.4-1.16-8h10.91c-.77 2.6-1.16 5.28-1.16 8 0 2.72.39 5.4 1.16 8H6.54z"></path></g>
|
||
<g id="panorama-wide-angle"><path d="M12 6c2.45 0 4.71.2 7.29.64.47 1.78.71 3.58.71 5.36 0 1.78-.24 3.58-.71 5.36-2.58.44-4.84.64-7.29.64s-4.71-.2-7.29-.64C4.24 15.58 4 13.78 4 12c0-1.78.24-3.58.71-5.36C7.29 6.2 9.55 6 12 6m0-2c-2.73 0-5.22.24-7.95.72l-.93.16-.25.9C2.29 7.85 2 9.93 2 12s.29 4.15.87 6.22l.25.89.93.16c2.73.49 5.22.73 7.95.73s5.22-.24 7.95-.72l.93-.16.25-.89c.58-2.08.87-4.16.87-6.23s-.29-4.15-.87-6.22l-.25-.89-.93-.16C17.22 4.24 14.73 4 12 4z"></path></g>
|
||
<g id="photo"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"></path></g>
|
||
<g id="photo-album"><path d="M18 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 4h5v8l-2.5-1.5L6 12V4zm0 15l3-3.86 2.14 2.58 3-3.86L18 19H6z"></path></g>
|
||
<g id="photo-camera"><circle cx="12" cy="12" r="3.2"></circle><path d="M9 2L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z"></path></g>
|
||
<g id="photo-library"><path d="M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"></path></g>
|
||
<g id="photo-size-select-actual"><path d="M21 3H3C2 3 1 4 1 5v14c0 1.1.9 2 2 2h18c1 0 2-1 2-2V5c0-1-1-2-2-2zM5 17l3.5-4.5 2.5 3.01L14.5 11l4.5 6H5z"></path></g>
|
||
<g id="photo-size-select-large"><path d="M21 15h2v2h-2v-2zm0-4h2v2h-2v-2zm2 8h-2v2c1 0 2-1 2-2zM13 3h2v2h-2V3zm8 4h2v2h-2V7zm0-4v2h2c0-1-1-2-2-2zM1 7h2v2H1V7zm16-4h2v2h-2V3zm0 16h2v2h-2v-2zM3 3C2 3 1 4 1 5h2V3zm6 0h2v2H9V3zM5 3h2v2H5V3zm-4 8v8c0 1.1.9 2 2 2h12V11H1zm2 8l2.5-3.21 1.79 2.15 2.5-3.22L13 19H3z"></path></g>
|
||
<g id="photo-size-select-small"><path d="M23 15h-2v2h2v-2zm0-4h-2v2h2v-2zm0 8h-2v2c1 0 2-1 2-2zM15 3h-2v2h2V3zm8 4h-2v2h2V7zm-2-4v2h2c0-1-1-2-2-2zM3 21h8v-6H1v4c0 1.1.9 2 2 2zM3 7H1v2h2V7zm12 12h-2v2h2v-2zm4-16h-2v2h2V3zm0 16h-2v2h2v-2zM3 3C2 3 1 4 1 5h2V3zm0 8H1v2h2v-2zm8-8H9v2h2V3zM7 3H5v2h2V3z"></path></g>
|
||
<g id="picture-as-pdf"><path d="M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z"></path></g>
|
||
<g id="portrait"><path d="M12 12.25c1.24 0 2.25-1.01 2.25-2.25S13.24 7.75 12 7.75 9.75 8.76 9.75 10s1.01 2.25 2.25 2.25zm4.5 4c0-1.5-3-2.25-4.5-2.25s-4.5.75-4.5 2.25V17h9v-.75zM19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14z"></path></g>
|
||
<g id="remove-red-eye"><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"></path></g>
|
||
<g id="rotate-90-degrees-ccw"><path d="M7.34 6.41L.86 12.9l6.49 6.48 6.49-6.48-6.5-6.49zM3.69 12.9l3.66-3.66L11 12.9l-3.66 3.66-3.65-3.66zm15.67-6.26C17.61 4.88 15.3 4 13 4V.76L8.76 5 13 9.24V6c1.79 0 3.58.68 4.95 2.05 2.73 2.73 2.73 7.17 0 9.9C16.58 19.32 14.79 20 13 20c-.97 0-1.94-.21-2.84-.61l-1.49 1.49C10.02 21.62 11.51 22 13 22c2.3 0 4.61-.88 6.36-2.64 3.52-3.51 3.52-9.21 0-12.72z"></path></g>
|
||
<g id="rotate-left"><path d="M7.11 8.53L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47zM6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47zm1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93z"></path></g>
|
||
<g id="rotate-right"><path d="M15.55 5.55L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45zM19.93 11c-.17-1.39-.72-2.73-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47h2.02zM13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03zm3.89-2.42l1.42 1.41c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.48z"></path></g>
|
||
<g id="slideshow"><path d="M10 8v8l5-4-5-4zm9-5H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14z"></path></g>
|
||
<g id="straighten"><path d="M21 6H3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 10H3V8h2v4h2V8h2v4h2V8h2v4h2V8h2v4h2V8h2v8z"></path></g>
|
||
<g id="style"><path d="M2.53 19.65l1.34.56v-9.03l-2.43 5.86c-.41 1.02.08 2.19 1.09 2.61zm19.5-3.7L17.07 3.98c-.31-.75-1.04-1.21-1.81-1.23-.26 0-.53.04-.79.15L7.1 5.95c-.75.31-1.21 1.03-1.23 1.8-.01.27.04.54.15.8l4.96 11.97c.31.76 1.05 1.22 1.83 1.23.26 0 .52-.05.77-.15l7.36-3.05c1.02-.42 1.51-1.59 1.09-2.6zM7.88 8.75c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-2 11c0 1.1.9 2 2 2h1.45l-3.45-8.34v6.34z"></path></g>
|
||
<g id="switch-camera"><path d="M20 4h-3.17L15 2H9L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-5 11.5V13H9v2.5L5.5 12 9 8.5V11h6V8.5l3.5 3.5-3.5 3.5z"></path></g>
|
||
<g id="switch-video"><path d="M18 9.5V6c0-.55-.45-1-1-1H3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h14c.55 0 1-.45 1-1v-3.5l4 4v-13l-4 4zm-5 6V13H7v2.5L3.5 12 7 8.5V11h6V8.5l3.5 3.5-3.5 3.5z"></path></g>
|
||
<g id="tag-faces"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z"></path></g>
|
||
<g id="texture"><path d="M19.51 3.08L3.08 19.51c.09.34.27.65.51.9.25.24.56.42.9.51L20.93 4.49c-.19-.69-.73-1.23-1.42-1.41zM11.88 3L3 11.88v2.83L14.71 3h-2.83zM5 3c-1.1 0-2 .9-2 2v2l4-4H5zm14 18c.55 0 1.05-.22 1.41-.59.37-.36.59-.86.59-1.41v-2l-4 4h2zm-9.71 0h2.83L21 12.12V9.29L9.29 21z"></path></g>
|
||
<g id="timelapse"><path d="M16.24 7.76C15.07 6.59 13.54 6 12 6v6l-4.24 4.24c2.34 2.34 6.14 2.34 8.49 0 2.34-2.34 2.34-6.14-.01-8.48zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></g>
|
||
<g id="timer"><path d="M15 1H9v2h6V1zm-4 13h2V8h-2v6zm8.03-6.61l1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM12 20c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"></path></g>
|
||
<g id="timer-10"><path d="M0 7.72V9.4l3-1V18h2V6h-.25L0 7.72zm23.78 6.65c-.14-.28-.35-.53-.63-.74-.28-.21-.61-.39-1.01-.53s-.85-.27-1.35-.38c-.35-.07-.64-.15-.87-.23-.23-.08-.41-.16-.55-.25-.14-.09-.23-.19-.28-.3-.05-.11-.08-.24-.08-.39 0-.14.03-.28.09-.41.06-.13.15-.25.27-.34.12-.1.27-.18.45-.24s.4-.09.64-.09c.25 0 .47.04.66.11.19.07.35.17.48.29.13.12.22.26.29.42.06.16.1.32.1.49h1.95c0-.39-.08-.75-.24-1.09-.16-.34-.39-.63-.69-.88-.3-.25-.66-.44-1.09-.59C21.49 9.07 21 9 20.46 9c-.51 0-.98.07-1.39.21-.41.14-.77.33-1.06.57-.29.24-.51.52-.67.84-.16.32-.23.65-.23 1.01s.08.69.23.96c.15.28.36.52.64.73.27.21.6.38.98.53.38.14.81.26 1.27.36.39.08.71.17.95.26s.43.19.57.29c.13.1.22.22.27.34.05.12.07.25.07.39 0 .32-.13.57-.4.77-.27.2-.66.29-1.17.29-.22 0-.43-.02-.64-.08-.21-.05-.4-.13-.56-.24-.17-.11-.3-.26-.41-.44-.11-.18-.17-.41-.18-.67h-1.89c0 .36.08.71.24 1.05.16.34.39.65.7.93.31.27.69.49 1.15.66.46.17.98.25 1.58.25.53 0 1.01-.06 1.44-.19.43-.13.8-.31 1.11-.54.31-.23.54-.51.71-.83.17-.32.25-.67.25-1.06-.02-.4-.09-.74-.24-1.02zm-9.96-7.32c-.34-.4-.75-.7-1.23-.88-.47-.18-1.01-.27-1.59-.27-.58 0-1.11.09-1.59.27-.48.18-.89.47-1.23.88-.34.41-.6.93-.79 1.59-.18.65-.28 1.45-.28 2.39v1.92c0 .94.09 1.74.28 2.39.19.66.45 1.19.8 1.6.34.41.75.71 1.23.89.48.18 1.01.28 1.59.28.59 0 1.12-.09 1.59-.28.48-.18.88-.48 1.22-.89.34-.41.6-.94.78-1.6.18-.65.28-1.45.28-2.39v-1.92c0-.94-.09-1.74-.28-2.39-.18-.66-.44-1.19-.78-1.59zm-.92 6.17c0 .6-.04 1.11-.12 1.53-.08.42-.2.76-.36 1.02-.16.26-.36.45-.59.57-.23.12-.51.18-.82.18-.3 0-.58-.06-.82-.18s-.44-.31-.6-.57c-.16-.26-.29-.6-.38-1.02-.09-.42-.13-.93-.13-1.53v-2.5c0-.6.04-1.11.13-1.52.09-.41.21-.74.38-1 .16-.25.36-.43.6-.55.24-.11.51-.17.81-.17.31 0 .58.06.81.17.24.11.44.29.6.55.16.25.29.58.37.99.08.41.13.92.13 1.52v2.51z"></path></g>
|
||
<g id="timer-3"><path d="M11.61 12.97c-.16-.24-.36-.46-.62-.65-.25-.19-.56-.35-.93-.48.3-.14.57-.3.8-.5.23-.2.42-.41.57-.64.15-.23.27-.46.34-.71.08-.24.11-.49.11-.73 0-.55-.09-1.04-.28-1.46-.18-.42-.44-.77-.78-1.06-.33-.28-.73-.5-1.2-.64-.45-.13-.97-.2-1.53-.2-.55 0-1.06.08-1.52.24-.47.17-.87.4-1.2.69-.33.29-.6.63-.78 1.03-.2.39-.29.83-.29 1.29h1.98c0-.26.05-.49.14-.69.09-.2.22-.38.38-.52.17-.14.36-.25.58-.33.22-.08.46-.12.73-.12.61 0 1.06.16 1.36.47.3.31.44.75.44 1.32 0 .27-.04.52-.12.74-.08.22-.21.41-.38.57-.17.16-.38.28-.63.37-.25.09-.55.13-.89.13H6.72v1.57H7.9c.34 0 .64.04.91.11.27.08.5.19.69.35.19.16.34.36.44.61.1.24.16.54.16.87 0 .62-.18 1.09-.53 1.42-.35.33-.84.49-1.45.49-.29 0-.56-.04-.8-.13-.24-.08-.44-.2-.61-.36-.17-.16-.3-.34-.39-.56-.09-.22-.14-.46-.14-.72H4.19c0 .55.11 1.03.32 1.45.21.42.5.77.86 1.05s.77.49 1.24.63.96.21 1.48.21c.57 0 1.09-.08 1.58-.23.49-.15.91-.38 1.26-.68.36-.3.64-.66.84-1.1.2-.43.3-.93.3-1.48 0-.29-.04-.58-.11-.86-.08-.25-.19-.51-.35-.76zm9.26 1.4c-.14-.28-.35-.53-.63-.74-.28-.21-.61-.39-1.01-.53s-.85-.27-1.35-.38c-.35-.07-.64-.15-.87-.23-.23-.08-.41-.16-.55-.25-.14-.09-.23-.19-.28-.3-.05-.11-.08-.24-.08-.39s.03-.28.09-.41c.06-.13.15-.25.27-.34.12-.1.27-.18.45-.24s.4-.09.64-.09c.25 0 .47.04.66.11.19.07.35.17.48.29.13.12.22.26.29.42.06.16.1.32.1.49h1.95c0-.39-.08-.75-.24-1.09-.16-.34-.39-.63-.69-.88-.3-.25-.66-.44-1.09-.59-.43-.15-.92-.22-1.46-.22-.51 0-.98.07-1.39.21-.41.14-.77.33-1.06.57-.29.24-.51.52-.67.84-.16.32-.23.65-.23 1.01s.08.68.23.96c.15.28.37.52.64.73.27.21.6.38.98.53.38.14.81.26 1.27.36.39.08.71.17.95.26s.43.19.57.29c.13.1.22.22.27.34.05.12.07.25.07.39 0 .32-.13.57-.4.77-.27.2-.66.29-1.17.29-.22 0-.43-.02-.64-.08-.21-.05-.4-.13-.56-.24-.17-.11-.3-.26-.41-.44-.11-.18-.17-.41-.18-.67h-1.89c0 .36.08.71.24 1.05.16.34.39.65.7.93.31.27.69.49 1.15.66.46.17.98.25 1.58.25.53 0 1.01-.06 1.44-.19.43-.13.8-.31 1.11-.54.31-.23.54-.51.71-.83.17-.32.25-.67.25-1.06-.02-.4-.09-.74-.24-1.02z"></path></g>
|
||
<g id="timer-off"><path d="M19.04 4.55l-1.42 1.42C16.07 4.74 14.12 4 12 4c-1.83 0-3.53.55-4.95 1.48l1.46 1.46C9.53 6.35 10.73 6 12 6c3.87 0 7 3.13 7 7 0 1.27-.35 2.47-.94 3.49l1.45 1.45C20.45 16.53 21 14.83 21 13c0-2.12-.74-4.07-1.97-5.61l1.42-1.42-1.41-1.42zM15 1H9v2h6V1zm-4 8.44l2 2V8h-2v1.44zM3.02 4L1.75 5.27 4.5 8.03C3.55 9.45 3 11.16 3 13c0 4.97 4.02 9 9 9 1.84 0 3.55-.55 4.98-1.5l2.5 2.5 1.27-1.27-7.71-7.71L3.02 4zM12 20c-3.87 0-7-3.13-7-7 0-1.28.35-2.48.95-3.52l9.56 9.56c-1.03.61-2.23.96-3.51.96z"></path></g>
|
||
<g id="tonality"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.94-.49-7-3.85-7-7.93s3.05-7.44 7-7.93v15.86zm2-15.86c1.03.13 2 .45 2.87.93H13v-.93zM13 7h5.24c.25.31.48.65.68 1H13V7zm0 3h6.74c.08.33.15.66.19 1H13v-1zm0 9.93V19h2.87c-.87.48-1.84.8-2.87.93zM18.24 17H13v-1h5.92c-.2.35-.43.69-.68 1zm1.5-3H13v-1h6.93c-.04.34-.11.67-.19 1z"></path></g>
|
||
<g id="transform"><path d="M22 18v-2H8V4h2L7 1 4 4h2v2H2v2h4v8c0 1.1.9 2 2 2h8v2h-2l3 3 3-3h-2v-2h4zM10 8h6v6h2V8c0-1.1-.9-2-2-2h-6v2z"></path></g>
|
||
<g id="tune"><path d="M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"></path></g>
|
||
<g id="view-comfy"><path d="M3 9h4V5H3v4zm0 5h4v-4H3v4zm5 0h4v-4H8v4zm5 0h4v-4h-4v4zM8 9h4V5H8v4zm5-4v4h4V5h-4zm5 9h4v-4h-4v4zM3 19h4v-4H3v4zm5 0h4v-4H8v4zm5 0h4v-4h-4v4zm5 0h4v-4h-4v4zm0-14v4h4V5h-4z"></path></g>
|
||
<g id="view-compact"><path d="M3 19h6v-7H3v7zm7 0h12v-7H10v7zM3 5v6h19V5H3z"></path></g>
|
||
<g id="vignette"><path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-9 15c-4.42 0-8-2.69-8-6s3.58-6 8-6 8 2.69 8 6-3.58 6-8 6z"></path></g>
|
||
<g id="wb-auto"><path d="M6.85 12.65h2.3L8 9l-1.15 3.65zM22 7l-1.2 6.29L19.3 7h-1.6l-1.49 6.29L15 7h-.76C12.77 5.17 10.53 4 8 4c-4.42 0-8 3.58-8 8s3.58 8 8 8c3.13 0 5.84-1.81 7.15-4.43l.1.43H17l1.5-6.1L20 16h1.75l2.05-9H22zm-11.7 9l-.7-2H6.4l-.7 2H3.8L7 7h2l3.2 9h-1.9z"></path></g>
|
||
<g id="wb-cloudy"><path d="M19.36 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.64-4.96z"></path></g>
|
||
<g id="wb-incandescent"><path d="M3.55 18.54l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8zM11 22.45h2V19.5h-2v2.95zM4 10.5H1v2h3v-2zm11-4.19V1.5H9v4.81C7.21 7.35 6 9.28 6 11.5c0 3.31 2.69 6 6 6s6-2.69 6-6c0-2.22-1.21-4.15-3-5.19zm5 4.19v2h3v-2h-3zm-2.76 7.66l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4z"></path></g>
|
||
<g id="wb-iridescent"><path d="M5 14.5h14v-6H5v6zM11 .55V3.5h2V.55h-2zm8.04 2.5l-1.79 1.79 1.41 1.41 1.8-1.79-1.42-1.41zM13 22.45V19.5h-2v2.95h2zm7.45-3.91l-1.8-1.79-1.41 1.41 1.79 1.8 1.42-1.42zM3.55 4.46l1.79 1.79 1.41-1.41-1.79-1.79-1.41 1.41zm1.41 15.49l1.79-1.8-1.41-1.41-1.79 1.79 1.41 1.42z"></path></g>
|
||
<g id="wb-sunny"><path d="M6.76 4.84l-1.8-1.79-1.41 1.41 1.79 1.79 1.42-1.41zM4 10.5H1v2h3v-2zm9-9.95h-2V3.5h2V.55zm7.45 3.91l-1.41-1.41-1.79 1.79 1.41 1.41 1.79-1.79zm-3.21 13.7l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4zM20 10.5v2h3v-2h-3zm-8-5c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm-1 16.95h2V19.5h-2v2.95zm-7.45-3.91l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8z"></path></g>
|
||
</defs></svg>
|
||
</iron-iconset-svg>
|
||
<iron-iconset-svg name="hardware" size="24">
|
||
<svg><defs>
|
||
<g id="cast"><path d="M21 3H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm0-4v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11z"></path></g>
|
||
<g id="cast-connected"><path d="M1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm18-7H5v1.63c3.96 1.28 7.09 4.41 8.37 8.37H19V7zM1 10v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11zm20-7H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path></g>
|
||
<g id="computer"><path d="M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2h-4zM4 6h16v10H4V6z"></path></g>
|
||
<g id="desktop-mac"><path d="M21 2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h7l-2 3v1h8v-1l-2-3h7c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 12H3V4h18v10z"></path></g>
|
||
<g id="desktop-windows"><path d="M21 2H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h7v2H8v2h8v-2h-2v-2h7c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H3V4h18v12z"></path></g>
|
||
<g id="developer-board"><path d="M22 9V7h-2V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-2h2v-2h-2v-2h2v-2h-2V9h2zm-4 10H4V5h14v14zM6 13h5v4H6zm6-6h4v3h-4zM6 7h5v5H6zm6 4h4v6h-4z"></path></g>
|
||
<g id="device-hub"><path d="M17 16l-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"></path></g>
|
||
<g id="dock"><path d="M8 23h8v-2H8v2zm8-21.99L8 1c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99zM16 15H8V5h8v10z"></path></g>
|
||
<g id="gamepad"><path d="M15 7.5V2H9v5.5l3 3 3-3zM7.5 9H2v6h5.5l3-3-3-3zM9 16.5V22h6v-5.5l-3-3-3 3zM16.5 9l-3 3 3 3H22V9h-5.5z"></path></g>
|
||
<g id="headset"><path d="M12 1c-4.97 0-9 4.03-9 9v7c0 1.66 1.34 3 3 3h3v-8H5v-2c0-3.87 3.13-7 7-7s7 3.13 7 7v2h-4v8h3c1.66 0 3-1.34 3-3v-7c0-4.97-4.03-9-9-9z"></path></g>
|
||
<g id="headset-mic"><path d="M12 1c-4.97 0-9 4.03-9 9v7c0 1.66 1.34 3 3 3h3v-8H5v-2c0-3.87 3.13-7 7-7s7 3.13 7 7v2h-4v8h4v1h-7v2h6c1.66 0 3-1.34 3-3V10c0-4.97-4.03-9-9-9z"></path></g>
|
||
<g id="keyboard"><path d="M20 5H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-9 3h2v2h-2V8zm0 3h2v2h-2v-2zM8 8h2v2H8V8zm0 3h2v2H8v-2zm-1 2H5v-2h2v2zm0-3H5V8h2v2zm9 7H8v-2h8v2zm0-4h-2v-2h2v2zm0-3h-2V8h2v2zm3 3h-2v-2h2v2zm0-3h-2V8h2v2z"></path></g>
|
||
<g id="keyboard-arrow-down"><path d="M7.41 7.84L12 12.42l4.59-4.58L18 9.25l-6 6-6-6z"></path></g>
|
||
<g id="keyboard-arrow-left"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"></path></g>
|
||
<g id="keyboard-arrow-right"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"></path></g>
|
||
<g id="keyboard-arrow-up"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path></g>
|
||
<g id="keyboard-backspace"><path d="M21 11H6.83l3.58-3.59L9 6l-6 6 6 6 1.41-1.41L6.83 13H21z"></path></g>
|
||
<g id="keyboard-capslock"><path d="M12 8.41L16.59 13 18 11.59l-6-6-6 6L7.41 13 12 8.41zM6 18h12v-2H6v2z"></path></g>
|
||
<g id="keyboard-hide"><path d="M20 3H4c-1.1 0-1.99.9-1.99 2L2 15c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-9 3h2v2h-2V6zm0 3h2v2h-2V9zM8 6h2v2H8V6zm0 3h2v2H8V9zm-1 2H5V9h2v2zm0-3H5V6h2v2zm9 7H8v-2h8v2zm0-4h-2V9h2v2zm0-3h-2V6h2v2zm3 3h-2V9h2v2zm0-3h-2V6h2v2zm-7 15l4-4H8l4 4z"></path></g>
|
||
<g id="keyboard-return"><path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"></path></g>
|
||
<g id="keyboard-tab"><path d="M11.59 7.41L15.17 11H1v2h14.17l-3.59 3.59L13 18l6-6-6-6-1.41 1.41zM20 6v12h2V6h-2z"></path></g>
|
||
<g id="keyboard-voice"><path d="M12 15c1.66 0 2.99-1.34 2.99-3L15 6c0-1.66-1.34-3-3-3S9 4.34 9 6v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 15 6.7 12H5c0 3.42 2.72 6.23 6 6.72V22h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"></path></g>
|
||
<g id="laptop"><path d="M20 18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2h-4zM4 6h16v10H4V6z"></path></g>
|
||
<g id="laptop-chromebook"><path d="M22 18V3H2v15H0v2h24v-2h-2zm-8 0h-4v-1h4v1zm6-3H4V5h16v10z"></path></g>
|
||
<g id="laptop-mac"><path d="M20 18c1.1 0 1.99-.9 1.99-2L22 5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v11c0 1.1.9 2 2 2H0c0 1.1.9 2 2 2h20c1.1 0 2-.9 2-2h-4zM4 5h16v11H4V5zm8 14c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"></path></g>
|
||
<g id="laptop-windows"><path d="M20 18v-1c1.1 0 1.99-.9 1.99-2L22 5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2v1H0v2h24v-2h-4zM4 5h16v10H4V5z"></path></g>
|
||
<g id="memory"><path d="M15 9H9v6h6V9zm-2 4h-2v-2h2v2zm8-2V9h-2V7c0-1.1-.9-2-2-2h-2V3h-2v2h-2V3H9v2H7c-1.1 0-2 .9-2 2v2H3v2h2v2H3v2h2v2c0 1.1.9 2 2 2h2v2h2v-2h2v2h2v-2h2c1.1 0 2-.9 2-2v-2h2v-2h-2v-2h2zm-4 6H7V7h10v10z"></path></g>
|
||
<g id="mouse"><path d="M13 1.07V9h7c0-4.08-3.05-7.44-7-7.93zM4 15c0 4.42 3.58 8 8 8s8-3.58 8-8v-4H4v4zm7-13.93C7.05 1.56 4 4.92 4 9h7V1.07z"></path></g>
|
||
<g id="phone-android"><path d="M16 1H8C6.34 1 5 2.34 5 4v16c0 1.66 1.34 3 3 3h8c1.66 0 3-1.34 3-3V4c0-1.66-1.34-3-3-3zm-2 20h-4v-1h4v1zm3.25-3H6.75V4h10.5v14z"></path></g>
|
||
<g id="phone-iphone"><path d="M15.5 1h-8C6.12 1 5 2.12 5 3.5v17C5 21.88 6.12 23 7.5 23h8c1.38 0 2.5-1.12 2.5-2.5v-17C18 2.12 16.88 1 15.5 1zm-4 21c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm4.5-4H7V4h9v14z"></path></g>
|
||
<g id="phonelink"><path d="M4 6h18V4H4c-1.1 0-2 .9-2 2v11H0v3h14v-3H4V6zm19 2h-6c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1zm-1 9h-4v-7h4v7z"></path></g>
|
||
<g id="phonelink-off"><path d="M22 6V4H6.82l2 2H22zM1.92 1.65L.65 2.92l1.82 1.82C2.18 5.08 2 5.52 2 6v11H0v3h17.73l2.35 2.35 1.27-1.27L3.89 3.62 1.92 1.65zM4 6.27L14.73 17H4V6.27zM23 8h-6c-.55 0-1 .45-1 1v4.18l2 2V10h4v7h-2.18l3 3H23c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1z"></path></g>
|
||
<g id="power-input"><path d="M2 9v2h19V9H2zm0 6h5v-2H2v2zm7 0h5v-2H9v2zm7 0h5v-2h-5v2z"></path></g>
|
||
<g id="router"><path d="M20.2 5.9l.8-.8C19.6 3.7 17.8 3 16 3s-3.6.7-5 2.1l.8.8C13 4.8 14.5 4.2 16 4.2s3 .6 4.2 1.7zm-.9.8c-.9-.9-2.1-1.4-3.3-1.4s-2.4.5-3.3 1.4l.8.8c.7-.7 1.6-1 2.5-1 .9 0 1.8.3 2.5 1l.8-.8zM19 13h-2V9h-2v4H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2zM8 18H6v-2h2v2zm3.5 0h-2v-2h2v2zm3.5 0h-2v-2h2v2z"></path></g>
|
||
<g id="scanner"><path d="M19.8 10.7L4.2 5l-.7 1.9L17.6 12H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-5.5c0-.8-.5-1.6-1.2-1.8zM7 17H5v-2h2v2zm12 0H9v-2h10v2z"></path></g>
|
||
<g id="security"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z"></path></g>
|
||
<g id="sim-card"><path d="M19.99 4c0-1.1-.89-2-1.99-2h-8L4 8v12c0 1.1.9 2 2 2h12.01c1.1 0 1.99-.9 1.99-2l-.01-16zM9 19H7v-2h2v2zm8 0h-2v-2h2v2zm-8-4H7v-4h2v4zm4 4h-2v-4h2v4zm0-6h-2v-2h2v2zm4 2h-2v-4h2v4z"></path></g>
|
||
<g id="smartphone"><path d="M17 1.01L7 1c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99zM17 19H7V5h10v14z"></path></g>
|
||
<g id="speaker"><path d="M17 2H7c-1.1 0-2 .9-2 2v16c0 1.1.9 1.99 2 1.99L17 22c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-5 2c1.1 0 2 .9 2 2s-.9 2-2 2c-1.11 0-2-.9-2-2s.89-2 2-2zm0 16c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"></path></g>
|
||
<g id="speaker-group"><path d="M18.2 1H9.8C8.81 1 8 1.81 8 2.8v14.4c0 .99.81 1.79 1.8 1.79l8.4.01c.99 0 1.8-.81 1.8-1.8V2.8c0-.99-.81-1.8-1.8-1.8zM14 3c1.1 0 2 .89 2 2s-.9 2-2 2-2-.89-2-2 .9-2 2-2zm0 13.5c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4z"></path><circle cx="14" cy="12.5" r="2.5"></circle><path d="M6 5H4v16c0 1.1.89 2 2 2h10v-2H6V5z"></path></g>
|
||
<g id="tablet"><path d="M21 4H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h18c1.1 0 1.99-.9 1.99-2L23 6c0-1.1-.9-2-2-2zm-2 14H5V6h14v12z"></path></g>
|
||
<g id="tablet-android"><path d="M18 0H6C4.34 0 3 1.34 3 3v18c0 1.66 1.34 3 3 3h12c1.66 0 3-1.34 3-3V3c0-1.66-1.34-3-3-3zm-4 22h-4v-1h4v1zm5.25-3H4.75V3h14.5v16z"></path></g>
|
||
<g id="tablet-mac"><path d="M18.5 0h-14C3.12 0 2 1.12 2 2.5v19C2 22.88 3.12 24 4.5 24h14c1.38 0 2.5-1.12 2.5-2.5v-19C21 1.12 19.88 0 18.5 0zm-7 23c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm7.5-4H4V3h15v16z"></path></g>
|
||
<g id="toys"><path d="M12 12c0-3 2.5-5.5 5.5-5.5S23 9 23 12H12zm0 0c0 3-2.5 5.5-5.5 5.5S1 15 1 12h11zm0 0c-3 0-5.5-2.5-5.5-5.5S9 1 12 1v11zm0 0c3 0 5.5 2.5 5.5 5.5S15 23 12 23V12z"></path></g>
|
||
<g id="tv"><path d="M21 3H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.1-.9-2-2-2zm0 14H3V5h18v12z"></path></g>
|
||
<g id="watch"><path d="M20 12c0-2.54-1.19-4.81-3.04-6.27L16 0H8l-.95 5.73C5.19 7.19 4 9.45 4 12s1.19 4.81 3.05 6.27L8 24h8l.96-5.73C18.81 16.81 20 14.54 20 12zM6 12c0-3.31 2.69-6 6-6s6 2.69 6 6-2.69 6-6 6-6-2.69-6-6z"></path></g>
|
||
</defs></svg>
|
||
</iron-iconset-svg>
|
||
<iron-iconset-svg name="av" size="24">
|
||
<svg><defs>
|
||
<g id="airplay"><defs><path id="a" d="M0 0h24v24H0V0z"></path></defs><defs><path id="c" d="M0 0h24v24H0V0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><clipPath id="d" clip-path="url(#b)"><use xlink:href="#c" overflow="visible"></use></clipPath><path d="M6 22h12l-6-6zM21 3H3c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4v-2H3V5h18v12h-4v2h4c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" clip-path="url(#d)"></path></g>
|
||
<g id="album"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 14.5c-2.49 0-4.5-2.01-4.5-4.5S9.51 7.5 12 7.5s4.5 2.01 4.5 4.5-2.01 4.5-4.5 4.5zm0-5.5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1z"></path></g>
|
||
<g id="av-timer"><path d="M11 17c0 .55.45 1 1 1s1-.45 1-1-.45-1-1-1-1 .45-1 1zm0-14v4h2V5.08c3.39.49 6 3.39 6 6.92 0 3.87-3.13 7-7 7s-7-3.13-7-7c0-1.68.59-3.22 1.58-4.42L12 13l1.41-1.41-6.8-6.8v.02C4.42 6.45 3 9.05 3 12c0 4.97 4.02 9 9 9 4.97 0 9-4.03 9-9s-4.03-9-9-9h-1zm7 9c0-.55-.45-1-1-1s-1 .45-1 1 .45 1 1 1 1-.45 1-1zM6 12c0 .55.45 1 1 1s1-.45 1-1-.45-1-1-1-1 .45-1 1z"></path></g>
|
||
<g id="closed-caption"><path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z"></path></g>
|
||
<g id="equalizer"><path d="M10 20h4V4h-4v16zm-6 0h4v-8H4v8zM16 9v11h4V9h-4z"></path></g>
|
||
<g id="explicit"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 6h-4v2h4v2h-4v2h4v2H9V7h6v2z"></path></g>
|
||
<g id="fast-forward"><path d="M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z"></path></g>
|
||
<g id="fast-rewind"><path d="M11 18V6l-8.5 6 8.5 6zm.5-6l8.5 6V6l-8.5 6z"></path></g>
|
||
<g id="forward-10"><defs><path id="a" d="M24 24H0V0h24v24z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path d="M4 13c0 4.4 3.6 8 8 8s8-3.6 8-8h-2c0 3.3-2.7 6-6 6s-6-2.7-6-6 2.7-6 6-6v4l5-5-5-5v4c-4.4 0-8 3.6-8 8zm6.8 3H10v-3.3L9 13v-.7l1.8-.6h.1V16zm4.3-1.8c0 .3 0 .6-.1.8l-.3.6s-.3.3-.5.3-.4.1-.6.1-.4 0-.6-.1-.3-.2-.5-.3-.2-.3-.3-.6-.1-.5-.1-.8v-.7c0-.3 0-.6.1-.8l.3-.6s.3-.3.5-.3.4-.1.6-.1.4 0 .6.1.3.2.5.3.2.3.3.6.1.5.1.8v.7zm-.8-.8v-.5s-.1-.2-.1-.3-.1-.1-.2-.2-.2-.1-.3-.1-.2 0-.3.1l-.2.2s-.1.2-.1.3v2s.1.2.1.3.1.1.2.2.2.1.3.1.2 0 .3-.1l.2-.2s.1-.2.1-.3v-1.5z" clip-path="url(#b)"></path></g>
|
||
<g id="forward-30"><defs><path id="a" d="M24 24H0V0h24v24z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path d="M9.6 13.5h.4c.2 0 .4-.1.5-.2s.2-.2.2-.4v-.2s-.1-.1-.1-.2-.1-.1-.2-.1h-.5s-.1.1-.2.1-.1.1-.1.2v.2h-1c0-.2 0-.3.1-.5s.2-.3.3-.4.3-.2.4-.2.4-.1.5-.1c.2 0 .4 0 .6.1s.3.1.5.2.2.2.3.4.1.3.1.5v.3s-.1.2-.1.3-.1.2-.2.2-.2.1-.3.2c.2.1.4.2.5.4s.2.4.2.6c0 .2 0 .4-.1.5s-.2.3-.3.4-.3.2-.5.2-.4.1-.6.1c-.2 0-.4 0-.5-.1s-.3-.1-.5-.2-.2-.2-.3-.4-.1-.4-.1-.6h.8v.2s.1.1.1.2.1.1.2.1h.5s.1-.1.2-.1.1-.1.1-.2v-.5s-.1-.1-.1-.2-.1-.1-.2-.1h-.6v-.7zm5.7.7c0 .3 0 .6-.1.8l-.3.6s-.3.3-.5.3-.4.1-.6.1-.4 0-.6-.1-.3-.2-.5-.3-.2-.3-.3-.6-.1-.5-.1-.8v-.7c0-.3 0-.6.1-.8l.3-.6s.3-.3.5-.3.4-.1.6-.1.4 0 .6.1.3.2.5.3.2.3.3.6.1.5.1.8v.7zm-.9-.8v-.5s-.1-.2-.1-.3-.1-.1-.2-.2-.2-.1-.3-.1-.2 0-.3.1l-.2.2s-.1.2-.1.3v2s.1.2.1.3.1.1.2.2.2.1.3.1.2 0 .3-.1l.2-.2s.1-.2.1-.3v-1.5zM4 13c0 4.4 3.6 8 8 8s8-3.6 8-8h-2c0 3.3-2.7 6-6 6s-6-2.7-6-6 2.7-6 6-6v4l5-5-5-5v4c-4.4 0-8 3.6-8 8z" clip-path="url(#b)"></path></g>
|
||
<g id="forward-5"><defs><path id="a" d="M24 24H0V0h24v24z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path d="M4 13c0 4.4 3.6 8 8 8s8-3.6 8-8h-2c0 3.3-2.7 6-6 6s-6-2.7-6-6 2.7-6 6-6v4l5-5-5-5v4c-4.4 0-8 3.6-8 8zm6.7.9l.2-2.2h2.4v.7h-1.7l-.1.9s.1 0 .1-.1.1 0 .1-.1.1 0 .2 0h.2c.2 0 .4 0 .5.1s.3.2.4.3.2.3.3.5.1.4.1.6c0 .2 0 .4-.1.5s-.1.3-.3.5-.3.2-.5.3-.4.1-.6.1c-.2 0-.4 0-.5-.1s-.3-.1-.5-.2-.2-.2-.3-.4-.1-.3-.1-.5h.8c0 .2.1.3.2.4s.2.1.4.1c.1 0 .2 0 .3-.1l.2-.2s.1-.2.1-.3v-.6l-.1-.2-.2-.2s-.2-.1-.3-.1h-.2s-.1 0-.2.1-.1 0-.1.1-.1.1-.1.1h-.6z" clip-path="url(#b)"></path></g>
|
||
<g id="games"><path d="M15 7.5V2H9v5.5l3 3 3-3zM7.5 9H2v6h5.5l3-3-3-3zM9 16.5V22h6v-5.5l-3-3-3 3zM16.5 9l-3 3 3 3H22V9h-5.5z"></path></g>
|
||
<g id="hd"><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm2-6h4c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1h-4V9zm1.5 4.5h2v-3h-2v3z"></path></g>
|
||
<g id="hearing"><path d="M17 20c-.29 0-.56-.06-.76-.15-.71-.37-1.21-.88-1.71-2.38-.51-1.56-1.47-2.29-2.39-3-.79-.61-1.61-1.24-2.32-2.53C9.29 10.98 9 9.93 9 9c0-2.8 2.2-5 5-5s5 2.2 5 5h2c0-3.93-3.07-7-7-7S7 5.07 7 9c0 1.26.38 2.65 1.07 3.9.91 1.65 1.98 2.48 2.85 3.15.81.62 1.39 1.07 1.71 2.05.6 1.82 1.37 2.84 2.73 3.55.51.23 1.07.35 1.64.35 2.21 0 4-1.79 4-4h-2c0 1.1-.9 2-2 2zM7.64 2.64L6.22 1.22C4.23 3.21 3 5.96 3 9s1.23 5.79 3.22 7.78l1.41-1.41C6.01 13.74 5 11.49 5 9s1.01-4.74 2.64-6.36zM11.5 9c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5-1.12-2.5-2.5-2.5-2.5 1.12-2.5 2.5z"></path></g>
|
||
<g id="high-quality"><path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 11H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm7-1c0 .55-.45 1-1 1h-.75v1.5h-1.5V15H14c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v4zm-3.5-.5h2v-3h-2v3z"></path></g>
|
||
<g id="library-add"><path d="M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9h-4v4h-2v-4H9V9h4V5h2v4h4v2z"></path></g>
|
||
<g id="library-books"><path d="M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9H9V9h10v2zm-4 4H9v-2h6v2zm4-8H9V5h10v2z"></path></g>
|
||
<g id="library-music"><path d="M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 5h-3v5.5c0 1.38-1.12 2.5-2.5 2.5S10 13.88 10 12.5s1.12-2.5 2.5-2.5c.57 0 1.08.19 1.5.51V5h4v2zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6z"></path></g>
|
||
<g id="loop"><path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"></path></g>
|
||
<g id="mic"><path d="M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm5.3-3c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"></path></g>
|
||
<g id="mic-none"><path d="M12 14c1.66 0 2.99-1.34 2.99-3L15 5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3zm-1.2-9.1c0-.66.54-1.2 1.2-1.2.66 0 1.2.54 1.2 1.2l-.01 6.2c0 .66-.53 1.2-1.19 1.2-.66 0-1.2-.54-1.2-1.2V4.9zm6.5 6.1c0 3-2.54 5.1-5.3 5.1S6.7 14 6.7 11H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c3.28-.48 6-3.3 6-6.72h-1.7z"></path></g>
|
||
<g id="mic-off"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17c0-.06.02-.11.02-.17V5c0-1.66-1.34-3-3-3S9 3.34 9 5v.18l5.98 5.99zM4.27 3L3 4.27l6.01 6.01V11c0 1.66 1.33 3 2.99 3 .22 0 .44-.03.65-.08l1.66 1.66c-.71.33-1.5.52-2.31.52-2.76 0-5.3-2.1-5.3-5.1H5c0 3.41 2.72 6.23 6 6.72V21h2v-3.28c.91-.13 1.77-.45 2.54-.9L19.73 21 21 19.73 4.27 3z"></path></g>
|
||
<g id="movie"><path d="M18 4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4h-4z"></path></g>
|
||
<g id="new-releases"><path d="M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"></path></g>
|
||
<g id="not-interested"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z"></path></g>
|
||
<g id="pause"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"></path></g>
|
||
<g id="pause-circle-filled"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 14H9V8h2v8zm4 0h-2V8h2v8z"></path></g>
|
||
<g id="pause-circle-outline"><path d="M9 16h2V8H9v8zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm1-4h2V8h-2v8z"></path></g>
|
||
<g id="play-arrow"><path d="M8 5v14l11-7z"></path></g>
|
||
<g id="play-circle-filled"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 14.5v-9l6 4.5-6 4.5z"></path></g>
|
||
<g id="play-circle-outline"><path d="M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></g>
|
||
<g id="playlist-add"><path d="M14 10H2v2h12v-2zm0-4H2v2h12V6zm4 8v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zM2 16h8v-2H2v2z"></path></g>
|
||
<g id="queue"><path d="M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9h-4v4h-2v-4H9V9h4V5h2v4h4v2z"></path></g>
|
||
<g id="queue-music"><path d="M15 6H3v2h12V6zm0 4H3v2h12v-2zM3 16h8v-2H3v2zM17 6v8.18c-.31-.11-.65-.18-1-.18-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3V8h3V6h-5z"></path></g>
|
||
<g id="radio"><path d="M3.24 6.15C2.51 6.43 2 7.17 2 8v12c0 1.1.89 2 2 2h16c1.11 0 2-.9 2-2V8c0-1.11-.89-2-2-2H8.3l8.26-3.34L15.88 1 3.24 6.15zM7 20c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm13-8h-2v-2h-2v2H4V8h16v4z"></path></g>
|
||
<g id="recent-actors"><path d="M21 5v14h2V5h-2zm-4 14h2V5h-2v14zM14 5H2c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1zM8 7.75c1.24 0 2.25 1.01 2.25 2.25S9.24 12.25 8 12.25 5.75 11.24 5.75 10 6.76 7.75 8 7.75zM12.5 17h-9v-.75c0-1.5 3-2.25 4.5-2.25s4.5.75 4.5 2.25V17z"></path></g>
|
||
<g id="repeat"><path d="M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z"></path></g>
|
||
<g id="repeat-one"><path d="M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4zm-4-2V9h-1l-2 1v1h1.5v4H13z"></path></g>
|
||
<g id="replay"><path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"></path></g>
|
||
<g id="replay-10"><defs><path id="a" d="M0 0h24v24H0V0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path d="M12 5V1L7 6l5 5V7c3.3 0 6 2.7 6 6s-2.7 6-6 6-6-2.7-6-6H4c0 4.4 3.6 8 8 8s8-3.6 8-8-3.6-8-8-8zm-1.1 11H10v-3.3L9 13v-.7l1.8-.6h.1V16zm4.3-1.8c0 .3 0 .6-.1.8l-.3.6s-.3.3-.5.3-.4.1-.6.1-.4 0-.6-.1-.3-.2-.5-.3-.2-.3-.3-.6-.1-.5-.1-.8v-.7c0-.3 0-.6.1-.8l.3-.6s.3-.3.5-.3.4-.1.6-.1.4 0 .6.1c.2.1.3.2.5.3s.2.3.3.6.1.5.1.8v.7zm-.9-.8v-.5s-.1-.2-.1-.3-.1-.1-.2-.2-.2-.1-.3-.1-.2 0-.3.1l-.2.2s-.1.2-.1.3v2s.1.2.1.3.1.1.2.2.2.1.3.1.2 0 .3-.1l.2-.2s.1-.2.1-.3v-1.5z" clip-path="url(#b)"></path></g>
|
||
<g id="replay-30"><defs><path id="a" d="M0 0h24v24H0V0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path d="M12 5V1L7 6l5 5V7c3.3 0 6 2.7 6 6s-2.7 6-6 6-6-2.7-6-6H4c0 4.4 3.6 8 8 8s8-3.6 8-8-3.6-8-8-8zm-2.4 8.5h.4c.2 0 .4-.1.5-.2s.2-.2.2-.4v-.2s-.1-.1-.1-.2-.1-.1-.2-.1h-.5s-.1.1-.2.1-.1.1-.1.2v.2h-1c0-.2 0-.3.1-.5s.2-.3.3-.4.3-.2.4-.2.4-.1.5-.1c.2 0 .4 0 .6.1s.3.1.5.2.2.2.3.4.1.3.1.5v.3s-.1.2-.1.3-.1.2-.2.2-.2.1-.3.2c.2.1.4.2.5.4s.2.4.2.6c0 .2 0 .4-.1.5s-.2.3-.3.4-.3.2-.5.2-.4.1-.6.1c-.2 0-.4 0-.5-.1s-.3-.1-.5-.2-.2-.2-.3-.4-.1-.4-.1-.6h.8v.2s.1.1.1.2.1.1.2.1h.5s.1-.1.2-.1.1-.1.1-.2v-.5s-.1-.1-.1-.2-.1-.1-.2-.1h-.6v-.7zm5.7.7c0 .3 0 .6-.1.8l-.3.6s-.3.3-.5.3-.4.1-.6.1-.4 0-.6-.1-.3-.2-.5-.3-.2-.3-.3-.6-.1-.5-.1-.8v-.7c0-.3 0-.6.1-.8l.3-.6s.3-.3.5-.3.4-.1.6-.1.4 0 .6.1.3.2.5.3.2.3.3.6.1.5.1.8v.7zm-.8-.8v-.5c0-.1-.1-.2-.1-.3s-.1-.1-.2-.2-.2-.1-.3-.1-.2 0-.3.1l-.2.2s-.1.2-.1.3v2s.1.2.1.3.1.1.2.2.2.1.3.1.2 0 .3-.1l.2-.2s.1-.2.1-.3v-1.5z" clip-path="url(#b)"></path></g>
|
||
<g id="replay-5"><defs><path id="a" d="M0 0h24v24H0V0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path d="M12 5V1L7 6l5 5V7c3.3 0 6 2.7 6 6s-2.7 6-6 6-6-2.7-6-6H4c0 4.4 3.6 8 8 8s8-3.6 8-8-3.6-8-8-8zm-1.3 8.9l.2-2.2h2.4v.7h-1.7l-.1.9s.1 0 .1-.1.1 0 .1-.1.1 0 .2 0h.2c.2 0 .4 0 .5.1s.3.2.4.3.2.3.3.5.1.4.1.6c0 .2 0 .4-.1.5s-.1.3-.3.5-.3.2-.4.3-.4.1-.6.1c-.2 0-.4 0-.5-.1s-.3-.1-.5-.2-.2-.2-.3-.4-.1-.3-.1-.5h.8c0 .2.1.3.2.4s.2.1.4.1c.1 0 .2 0 .3-.1l.2-.2s.1-.2.1-.3v-.6l-.1-.2-.2-.2s-.2-.1-.3-.1h-.2s-.1 0-.2.1-.1 0-.1.1-.1.1-.1.1h-.7z" clip-path="url(#b)"></path></g>
|
||
<g id="shuffle"><path d="M10.59 9.17L5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm.33 9.41l-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z"></path></g>
|
||
<g id="skip-next"><path d="M6 18l8.5-6L6 6v12zM16 6v12h2V6h-2z"></path></g>
|
||
<g id="skip-previous"><path d="M6 6h2v12H6zm3.5 6l8.5 6V6z"></path></g>
|
||
<g id="snooze"><path d="M7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7zm-3-9h3.63L9 15.2V17h6v-2h-3.63L15 10.8V9H9v2z"></path></g>
|
||
<g id="sort-by-alpha"><path d="M14.94 4.66h-4.72l2.36-2.36zm-4.69 14.71h4.66l-2.33 2.33zM6.1 6.27L1.6 17.73h1.84l.92-2.45h5.11l.92 2.45h1.84L7.74 6.27H6.1zm-1.13 7.37l1.94-5.18 1.94 5.18H4.97zm10.76 2.5h6.12v1.59h-8.53v-1.29l5.92-8.56h-5.88v-1.6h8.3v1.26l-5.93 8.6z"></path></g>
|
||
<g id="stop"><path d="M6 6h12v12H6z"></path></g>
|
||
<g id="subtitles"><path d="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM4 12h4v2H4v-2zm10 6H4v-2h10v2zm6 0h-4v-2h4v2zm0-4H10v-2h10v2z"></path></g>
|
||
<g id="surround-sound"><path d="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM7.76 16.24l-1.41 1.41C4.78 16.1 4 14.05 4 12c0-2.05.78-4.1 2.34-5.66l1.41 1.41C6.59 8.93 6 10.46 6 12s.59 3.07 1.76 4.24zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm5.66 1.66l-1.41-1.41C17.41 15.07 18 13.54 18 12s-.59-3.07-1.76-4.24l1.41-1.41C19.22 7.9 20 9.95 20 12c0 2.05-.78 4.1-2.34 5.66zM12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></g>
|
||
<g id="video-library"><path d="M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8 12.5v-9l6 4.5-6 4.5z"></path></g>
|
||
<g id="videocam"><path d="M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z"></path></g>
|
||
<g id="videocam-off"><path d="M21 6.5l-4 4V7c0-.55-.45-1-1-1H9.82L21 17.18V6.5zM3.27 2L2 3.27 4.73 6H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.21 0 .39-.08.54-.18L19.73 21 21 19.73 3.27 2z"></path></g>
|
||
<g id="volume-down"><path d="M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z"></path></g>
|
||
<g id="volume-mute"><path d="M7 9v6h4l5 5V4l-5 5H7z"></path></g>
|
||
<g id="volume-off"><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"></path></g>
|
||
<g id="volume-up"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"></path></g>
|
||
<g id="web"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-5 14H4v-4h11v4zm0-5H4V9h11v4zm5 5h-4V9h4v9z"></path></g>
|
||
</defs></svg>
|
||
</iron-iconset-svg>
|
||
<iron-iconset-svg name="homeassistant-100" size="100">
|
||
<svg><defs>
|
||
|
||
<g id="thermostat"><path d="M66.861,60.105V17.453c0-9.06-7.347-16.405-16.408-16.405c-9.06,0-16.404,7.345-16.404,16.405v42.711 c-4.04,4.14-6.533,9.795-6.533,16.035c0,12.684,10.283,22.967,22.967,22.967c12.682,0,22.964-10.283,22.964-22.967 C73.447,69.933,70.933,64.254,66.861,60.105z M60.331,20.38h-13.21v6.536h6.63v6.539h-6.63v6.713h6.63v6.538h-6.63v6.5h6.63v6.536 h-6.63v7.218c-3.775,1.373-6.471,4.993-6.471,9.24h-6.626c0-5.396,2.598-10.182,6.61-13.185V17.446c0-0.038,0.004-0.075,0.004-0.111 l-0.004-0.007c0-5.437,4.411-9.846,9.849-9.846c5.438,0,9.848,4.409,9.848,9.846V20.38z"></path></g>
|
||
</defs></svg>
|
||
</iron-iconset-svg>
|
||
|
||
<iron-iconset-svg name="homeassistant-24" size="24">
|
||
<svg><defs>
|
||
|
||
<g id="group"><path d="M9 12c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm5-3c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2zm-2-7c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></g>
|
||
</defs></svg>
|
||
</iron-iconset-svg>
|
||
|
||
<script>
|
||
window.hass.uiUtil.domainIcon = function(domain, state) {
|
||
switch(domain) {
|
||
case "homeassistant":
|
||
return "home";
|
||
|
||
case "group":
|
||
return "homeassistant-24:group";
|
||
|
||
case "device_tracker":
|
||
return "social:person";
|
||
|
||
case "switch":
|
||
return "image:flash-on";
|
||
|
||
case "media_player":
|
||
var icon = "hardware:cast";
|
||
|
||
if (state && state !== "off" && state !== 'idle') {
|
||
icon += "-connected";
|
||
}
|
||
|
||
return icon;
|
||
|
||
case "sun":
|
||
return "image:wb-sunny";
|
||
|
||
case "light":
|
||
return "image:wb-incandescent";
|
||
|
||
case "simple_alarm":
|
||
return "social:notifications";
|
||
|
||
case "notify":
|
||
return "announcement";
|
||
|
||
case "thermostat":
|
||
return "homeassistant-100:thermostat";
|
||
|
||
case "sensor":
|
||
return "visibility";
|
||
|
||
case "configurator":
|
||
return "settings";
|
||
|
||
case "conversation":
|
||
return "av:hearing";
|
||
|
||
case "script":
|
||
return "description";
|
||
|
||
case 'scene':
|
||
return 'social:pages';
|
||
|
||
default:
|
||
return "bookmark";
|
||
}
|
||
};
|
||
</script>
|
||
<dom-module id="paper-ripple" assetpath="bower_components/paper-ripple/">
|
||
|
||
|
||
|
||
<style>
|
||
:host {
|
||
display: block;
|
||
position: absolute;
|
||
border-radius: inherit;
|
||
overflow: hidden;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
}
|
||
|
||
:host([animating]) {
|
||
/* This resolves a rendering issue in Chrome (as of 40) where the
|
||
ripple is not properly clipped by its parent (which may have
|
||
rounded corners). See: http://jsbin.com/temexa/4
|
||
|
||
Note: We only apply this style conditionally. Otherwise, the browser
|
||
will create a new compositing layer for every ripple element on the
|
||
page, and that would be bad. */
|
||
-webkit-transform: translate(0, 0);
|
||
transform: translate3d(0, 0, 0);
|
||
}
|
||
|
||
:host([noink]) {
|
||
pointer-events: none;
|
||
}
|
||
|
||
#background,
|
||
#waves,
|
||
.wave-container,
|
||
.wave {
|
||
pointer-events: none;
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
|
||
#background,
|
||
.wave {
|
||
opacity: 0;
|
||
}
|
||
|
||
#waves,
|
||
.wave {
|
||
overflow: hidden;
|
||
}
|
||
|
||
.wave-container,
|
||
.wave {
|
||
border-radius: 50%;
|
||
}
|
||
|
||
:host(.circle) #background,
|
||
:host(.circle) #waves {
|
||
border-radius: 50%;
|
||
}
|
||
|
||
:host(.circle) .wave-container {
|
||
overflow: hidden;
|
||
}
|
||
|
||
</style>
|
||
<template>
|
||
<div id="background"></div>
|
||
<div id="waves"></div>
|
||
</template>
|
||
</dom-module>
|
||
<script>
|
||
(function() {
|
||
var Utility = {
|
||
cssColorWithAlpha: function(cssColor, alpha) {
|
||
var parts = cssColor.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
||
|
||
if (typeof alpha == 'undefined') {
|
||
alpha = 1;
|
||
}
|
||
|
||
if (!parts) {
|
||
return 'rgba(255, 255, 255, ' + alpha + ')';
|
||
}
|
||
|
||
return 'rgba(' + parts[1] + ', ' + parts[2] + ', ' + parts[3] + ', ' + alpha + ')';
|
||
},
|
||
|
||
distance: function(x1, y1, x2, y2) {
|
||
var xDelta = (x1 - x2);
|
||
var yDelta = (y1 - y2);
|
||
|
||
return Math.sqrt(xDelta * xDelta + yDelta * yDelta);
|
||
},
|
||
|
||
now: (function() {
|
||
if (window.performance && window.performance.now) {
|
||
return window.performance.now.bind(window.performance);
|
||
}
|
||
|
||
return Date.now;
|
||
})()
|
||
};
|
||
|
||
/**
|
||
* @param {HTMLElement} element
|
||
* @constructor
|
||
*/
|
||
function ElementMetrics(element) {
|
||
this.element = element;
|
||
this.width = this.boundingRect.width;
|
||
this.height = this.boundingRect.height;
|
||
|
||
this.size = Math.max(this.width, this.height);
|
||
}
|
||
|
||
ElementMetrics.prototype = {
|
||
get boundingRect () {
|
||
return this.element.getBoundingClientRect();
|
||
},
|
||
|
||
furthestCornerDistanceFrom: function(x, y) {
|
||
var topLeft = Utility.distance(x, y, 0, 0);
|
||
var topRight = Utility.distance(x, y, this.width, 0);
|
||
var bottomLeft = Utility.distance(x, y, 0, this.height);
|
||
var bottomRight = Utility.distance(x, y, this.width, this.height);
|
||
|
||
return Math.max(topLeft, topRight, bottomLeft, bottomRight);
|
||
}
|
||
};
|
||
|
||
/**
|
||
* @param {HTMLElement} element
|
||
* @constructor
|
||
*/
|
||
function Ripple(element) {
|
||
this.element = element;
|
||
this.color = window.getComputedStyle(element).color;
|
||
|
||
this.wave = document.createElement('div');
|
||
this.waveContainer = document.createElement('div');
|
||
this.wave.style.backgroundColor = this.color;
|
||
this.wave.classList.add('wave');
|
||
this.waveContainer.classList.add('wave-container');
|
||
Polymer.dom(this.waveContainer).appendChild(this.wave);
|
||
|
||
this.resetInteractionState();
|
||
}
|
||
|
||
Ripple.MAX_RADIUS = 300;
|
||
|
||
Ripple.prototype = {
|
||
get recenters() {
|
||
return this.element.recenters;
|
||
},
|
||
|
||
get center() {
|
||
return this.element.center;
|
||
},
|
||
|
||
get mouseDownElapsed() {
|
||
var elapsed;
|
||
|
||
if (!this.mouseDownStart) {
|
||
return 0;
|
||
}
|
||
|
||
elapsed = Utility.now() - this.mouseDownStart;
|
||
|
||
if (this.mouseUpStart) {
|
||
elapsed -= this.mouseUpElapsed;
|
||
}
|
||
|
||
return elapsed;
|
||
},
|
||
|
||
get mouseUpElapsed() {
|
||
return this.mouseUpStart ?
|
||
Utility.now () - this.mouseUpStart : 0;
|
||
},
|
||
|
||
get mouseDownElapsedSeconds() {
|
||
return this.mouseDownElapsed / 1000;
|
||
},
|
||
|
||
get mouseUpElapsedSeconds() {
|
||
return this.mouseUpElapsed / 1000;
|
||
},
|
||
|
||
get mouseInteractionSeconds() {
|
||
return this.mouseDownElapsedSeconds + this.mouseUpElapsedSeconds;
|
||
},
|
||
|
||
get initialOpacity() {
|
||
return this.element.initialOpacity;
|
||
},
|
||
|
||
get opacityDecayVelocity() {
|
||
return this.element.opacityDecayVelocity;
|
||
},
|
||
|
||
get radius() {
|
||
var width2 = this.containerMetrics.width * this.containerMetrics.width;
|
||
var height2 = this.containerMetrics.height * this.containerMetrics.height;
|
||
var waveRadius = Math.min(
|
||
Math.sqrt(width2 + height2),
|
||
Ripple.MAX_RADIUS
|
||
) * 1.1 + 5;
|
||
|
||
var duration = 1.1 - 0.2 * (waveRadius / Ripple.MAX_RADIUS);
|
||
var timeNow = this.mouseInteractionSeconds / duration;
|
||
var size = waveRadius * (1 - Math.pow(80, -timeNow));
|
||
|
||
return Math.abs(size);
|
||
},
|
||
|
||
get opacity() {
|
||
if (!this.mouseUpStart) {
|
||
return this.initialOpacity;
|
||
}
|
||
|
||
return Math.max(
|
||
0,
|
||
this.initialOpacity - this.mouseUpElapsedSeconds * this.opacityDecayVelocity
|
||
);
|
||
},
|
||
|
||
get outerOpacity() {
|
||
// Linear increase in background opacity, capped at the opacity
|
||
// of the wavefront (waveOpacity).
|
||
var outerOpacity = this.mouseUpElapsedSeconds * 0.3;
|
||
var waveOpacity = this.opacity;
|
||
|
||
return Math.max(
|
||
0,
|
||
Math.min(outerOpacity, waveOpacity)
|
||
);
|
||
},
|
||
|
||
get isOpacityFullyDecayed() {
|
||
return this.opacity < 0.01 &&
|
||
this.radius >= Math.min(this.maxRadius, Ripple.MAX_RADIUS);
|
||
},
|
||
|
||
get isRestingAtMaxRadius() {
|
||
return this.opacity >= this.initialOpacity &&
|
||
this.radius >= Math.min(this.maxRadius, Ripple.MAX_RADIUS);
|
||
},
|
||
|
||
get isAnimationComplete() {
|
||
return this.mouseUpStart ?
|
||
this.isOpacityFullyDecayed : this.isRestingAtMaxRadius;
|
||
},
|
||
|
||
get translationFraction() {
|
||
return Math.min(
|
||
1,
|
||
this.radius / this.containerMetrics.size * 2 / Math.sqrt(2)
|
||
);
|
||
},
|
||
|
||
get xNow() {
|
||
if (this.xEnd) {
|
||
return this.xStart + this.translationFraction * (this.xEnd - this.xStart);
|
||
}
|
||
|
||
return this.xStart;
|
||
},
|
||
|
||
get yNow() {
|
||
if (this.yEnd) {
|
||
return this.yStart + this.translationFraction * (this.yEnd - this.yStart);
|
||
}
|
||
|
||
return this.yStart;
|
||
},
|
||
|
||
get isMouseDown() {
|
||
return this.mouseDownStart && !this.mouseUpStart;
|
||
},
|
||
|
||
resetInteractionState: function() {
|
||
this.maxRadius = 0;
|
||
this.mouseDownStart = 0;
|
||
this.mouseUpStart = 0;
|
||
|
||
this.xStart = 0;
|
||
this.yStart = 0;
|
||
this.xEnd = 0;
|
||
this.yEnd = 0;
|
||
this.slideDistance = 0;
|
||
|
||
this.containerMetrics = new ElementMetrics(this.element);
|
||
},
|
||
|
||
draw: function() {
|
||
var scale;
|
||
var translateString;
|
||
var dx;
|
||
var dy;
|
||
|
||
this.wave.style.opacity = this.opacity;
|
||
|
||
scale = this.radius / (this.containerMetrics.size / 2);
|
||
dx = this.xNow - (this.containerMetrics.width / 2);
|
||
dy = this.yNow - (this.containerMetrics.height / 2);
|
||
|
||
|
||
// 2d transform for safari because of border-radius and overflow:hidden clipping bug.
|
||
// https://bugs.webkit.org/show_bug.cgi?id=98538
|
||
this.waveContainer.style.webkitTransform = 'translate(' + dx + 'px, ' + dy + 'px)';
|
||
this.waveContainer.style.transform = 'translate3d(' + dx + 'px, ' + dy + 'px, 0)';
|
||
this.wave.style.webkitTransform = 'scale(' + scale + ',' + scale + ')';
|
||
this.wave.style.transform = 'scale3d(' + scale + ',' + scale + ',1)';
|
||
},
|
||
|
||
/** @param {Event=} event */
|
||
downAction: function(event) {
|
||
var xCenter = this.containerMetrics.width / 2;
|
||
var yCenter = this.containerMetrics.height / 2;
|
||
|
||
this.resetInteractionState();
|
||
this.mouseDownStart = Utility.now();
|
||
|
||
if (this.center) {
|
||
this.xStart = xCenter;
|
||
this.yStart = yCenter;
|
||
this.slideDistance = Utility.distance(
|
||
this.xStart, this.yStart, this.xEnd, this.yEnd
|
||
);
|
||
} else {
|
||
this.xStart = event ?
|
||
event.detail.x - this.containerMetrics.boundingRect.left :
|
||
this.containerMetrics.width / 2;
|
||
this.yStart = event ?
|
||
event.detail.y - this.containerMetrics.boundingRect.top :
|
||
this.containerMetrics.height / 2;
|
||
}
|
||
|
||
if (this.recenters) {
|
||
this.xEnd = xCenter;
|
||
this.yEnd = yCenter;
|
||
this.slideDistance = Utility.distance(
|
||
this.xStart, this.yStart, this.xEnd, this.yEnd
|
||
);
|
||
}
|
||
|
||
this.maxRadius = this.containerMetrics.furthestCornerDistanceFrom(
|
||
this.xStart,
|
||
this.yStart
|
||
);
|
||
|
||
this.waveContainer.style.top =
|
||
(this.containerMetrics.height - this.containerMetrics.size) / 2 + 'px';
|
||
this.waveContainer.style.left =
|
||
(this.containerMetrics.width - this.containerMetrics.size) / 2 + 'px';
|
||
|
||
this.waveContainer.style.width = this.containerMetrics.size + 'px';
|
||
this.waveContainer.style.height = this.containerMetrics.size + 'px';
|
||
},
|
||
|
||
/** @param {Event=} event */
|
||
upAction: function(event) {
|
||
if (!this.isMouseDown) {
|
||
return;
|
||
}
|
||
|
||
this.mouseUpStart = Utility.now();
|
||
},
|
||
|
||
remove: function() {
|
||
Polymer.dom(this.waveContainer.parentNode).removeChild(
|
||
this.waveContainer
|
||
);
|
||
}
|
||
};
|
||
|
||
Polymer({
|
||
is: 'paper-ripple',
|
||
|
||
behaviors: [
|
||
Polymer.IronA11yKeysBehavior
|
||
],
|
||
|
||
properties: {
|
||
/**
|
||
* The initial opacity set on the wave.
|
||
*
|
||
* @attribute initialOpacity
|
||
* @type number
|
||
* @default 0.25
|
||
*/
|
||
initialOpacity: {
|
||
type: Number,
|
||
value: 0.25
|
||
},
|
||
|
||
/**
|
||
* How fast (opacity per second) the wave fades out.
|
||
*
|
||
* @attribute opacityDecayVelocity
|
||
* @type number
|
||
* @default 0.8
|
||
*/
|
||
opacityDecayVelocity: {
|
||
type: Number,
|
||
value: 0.8
|
||
},
|
||
|
||
/**
|
||
* If true, ripples will exhibit a gravitational pull towards
|
||
* the center of their container as they fade away.
|
||
*
|
||
* @attribute recenters
|
||
* @type boolean
|
||
* @default false
|
||
*/
|
||
recenters: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* If true, ripples will center inside its container
|
||
*
|
||
* @attribute recenters
|
||
* @type boolean
|
||
* @default false
|
||
*/
|
||
center: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* A list of the visual ripples.
|
||
*
|
||
* @attribute ripples
|
||
* @type Array
|
||
* @default []
|
||
*/
|
||
ripples: {
|
||
type: Array,
|
||
value: function() {
|
||
return [];
|
||
}
|
||
},
|
||
|
||
/**
|
||
* True when there are visible ripples animating within the
|
||
* element.
|
||
*/
|
||
animating: {
|
||
type: Boolean,
|
||
readOnly: true,
|
||
reflectToAttribute: true,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* If true, the ripple will remain in the "down" state until `holdDown`
|
||
* is set to false again.
|
||
*/
|
||
holdDown: {
|
||
type: Boolean,
|
||
value: false,
|
||
observer: '_holdDownChanged'
|
||
},
|
||
|
||
_animating: {
|
||
type: Boolean
|
||
},
|
||
|
||
_boundAnimate: {
|
||
type: Function,
|
||
value: function() {
|
||
return this.animate.bind(this);
|
||
}
|
||
}
|
||
},
|
||
|
||
get target () {
|
||
var ownerRoot = Polymer.dom(this).getOwnerRoot();
|
||
var target;
|
||
|
||
if (this.parentNode.nodeType == 11) { // DOCUMENT_FRAGMENT_NODE
|
||
target = ownerRoot.host;
|
||
} else {
|
||
target = this.parentNode;
|
||
}
|
||
|
||
return target;
|
||
},
|
||
|
||
keyBindings: {
|
||
'enter:keydown': '_onEnterKeydown',
|
||
'space:keydown': '_onSpaceKeydown',
|
||
'space:keyup': '_onSpaceKeyup'
|
||
},
|
||
|
||
attached: function() {
|
||
this.listen(this.target, 'up', 'upAction');
|
||
this.listen(this.target, 'down', 'downAction');
|
||
|
||
if (!this.target.hasAttribute('noink')) {
|
||
this.keyEventTarget = this.target;
|
||
}
|
||
},
|
||
|
||
get shouldKeepAnimating () {
|
||
for (var index = 0; index < this.ripples.length; ++index) {
|
||
if (!this.ripples[index].isAnimationComplete) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
return false;
|
||
},
|
||
|
||
simulatedRipple: function() {
|
||
this.downAction(null);
|
||
|
||
// Please see polymer/polymer#1305
|
||
this.async(function() {
|
||
this.upAction();
|
||
}, 1);
|
||
},
|
||
|
||
/** @param {Event=} event */
|
||
downAction: function(event) {
|
||
if (this.holdDown && this.ripples.length > 0) {
|
||
return;
|
||
}
|
||
|
||
var ripple = this.addRipple();
|
||
|
||
ripple.downAction(event);
|
||
|
||
if (!this._animating) {
|
||
this.animate();
|
||
}
|
||
},
|
||
|
||
/** @param {Event=} event */
|
||
upAction: function(event) {
|
||
if (this.holdDown) {
|
||
return;
|
||
}
|
||
|
||
this.ripples.forEach(function(ripple) {
|
||
ripple.upAction(event);
|
||
});
|
||
|
||
this.animate();
|
||
},
|
||
|
||
onAnimationComplete: function() {
|
||
this._animating = false;
|
||
this.$.background.style.backgroundColor = null;
|
||
this.fire('transitionend');
|
||
},
|
||
|
||
addRipple: function() {
|
||
var ripple = new Ripple(this);
|
||
|
||
Polymer.dom(this.$.waves).appendChild(ripple.waveContainer);
|
||
this.$.background.style.backgroundColor = ripple.color;
|
||
this.ripples.push(ripple);
|
||
|
||
this._setAnimating(true);
|
||
|
||
return ripple;
|
||
},
|
||
|
||
removeRipple: function(ripple) {
|
||
var rippleIndex = this.ripples.indexOf(ripple);
|
||
|
||
if (rippleIndex < 0) {
|
||
return;
|
||
}
|
||
|
||
this.ripples.splice(rippleIndex, 1);
|
||
|
||
ripple.remove();
|
||
|
||
if (!this.ripples.length) {
|
||
this._setAnimating(false);
|
||
}
|
||
},
|
||
|
||
animate: function() {
|
||
var index;
|
||
var ripple;
|
||
|
||
this._animating = true;
|
||
|
||
for (index = 0; index < this.ripples.length; ++index) {
|
||
ripple = this.ripples[index];
|
||
|
||
ripple.draw();
|
||
|
||
this.$.background.style.opacity = ripple.outerOpacity;
|
||
|
||
if (ripple.isOpacityFullyDecayed && !ripple.isRestingAtMaxRadius) {
|
||
this.removeRipple(ripple);
|
||
}
|
||
}
|
||
|
||
if (!this.shouldKeepAnimating && this.ripples.length === 0) {
|
||
this.onAnimationComplete();
|
||
} else {
|
||
window.requestAnimationFrame(this._boundAnimate);
|
||
}
|
||
},
|
||
|
||
_onEnterKeydown: function() {
|
||
this.downAction();
|
||
this.async(this.upAction, 1);
|
||
},
|
||
|
||
_onSpaceKeydown: function() {
|
||
this.downAction();
|
||
},
|
||
|
||
_onSpaceKeyup: function() {
|
||
this.upAction();
|
||
},
|
||
|
||
_holdDownChanged: function(holdDown) {
|
||
if (holdDown) {
|
||
this.downAction();
|
||
} else {
|
||
this.upAction();
|
||
}
|
||
}
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="paper-checkbox" assetpath="bower_components/paper-checkbox/">
|
||
<style>
|
||
/*
|
||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||
Code distributed by Google as part of the polymer project is also
|
||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||
*/
|
||
|
||
:host {
|
||
display: inline-block;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
:host(:focus) {
|
||
outline: none;
|
||
}
|
||
|
||
.hidden {
|
||
display: none;
|
||
}
|
||
|
||
#checkboxContainer {
|
||
display: inline-block;
|
||
position: relative;
|
||
width: 18px;
|
||
height: 18px;
|
||
cursor: pointer;
|
||
-webkit-transform: translateZ(0);
|
||
transform: translateZ(0);
|
||
vertical-align: middle;
|
||
}
|
||
|
||
:host #ink {
|
||
position: absolute;
|
||
top: -15px;
|
||
left: -15px;
|
||
width: 48px;
|
||
height: 48px;
|
||
color: var(--paper-checkbox-unchecked-ink-color, --primary-text-color);
|
||
opacity: 0.6;
|
||
}
|
||
|
||
:host #ink[checked] {
|
||
color: var(--paper-checkbox-checked-ink-color, --default-primary-color);
|
||
}
|
||
|
||
:host #checkbox {
|
||
position: relative;
|
||
box-sizing: border-box;
|
||
height: 100%;
|
||
border: solid 2px;
|
||
border-color: var(--paper-checkbox-unchecked-color, --primary-text-color);
|
||
border-radius: 2px;
|
||
pointer-events: none;
|
||
-webkit-transition: background-color 140ms, border-color 140ms;
|
||
transition: background-color 140ms, border-color 140ms;
|
||
}
|
||
|
||
/* checkbox checked animations */
|
||
#checkbox.checked #checkmark {
|
||
-webkit-animation: checkmark-expand 140ms ease-out forwards;
|
||
animation: checkmark-expand 140ms ease-out forwards;
|
||
}
|
||
|
||
@-webkit-keyframes checkmark-expand {
|
||
0% {
|
||
top: 9px;
|
||
left: 6px;
|
||
width: 0px;
|
||
height: 0px;
|
||
}
|
||
100% {
|
||
top: -1px;
|
||
left: 4px;
|
||
width: 5px;
|
||
height: 10px;
|
||
}
|
||
}
|
||
|
||
@keyframes checkmark-expand {
|
||
0% {
|
||
top: 9px;
|
||
left: 6px;
|
||
width: 0px;
|
||
height: 0px;
|
||
}
|
||
100% {
|
||
top: -1px;
|
||
left: 4px;
|
||
width: 5px;
|
||
height: 10px;
|
||
}
|
||
}
|
||
|
||
:host #checkbox.checked {
|
||
background-color: var(--paper-checkbox-checked-color, --default-primary-color);
|
||
border-color: var(--paper-checkbox-checked-color, --default-primary-color);
|
||
}
|
||
|
||
:host #checkmark {
|
||
-webkit-transform: rotate(45deg);
|
||
transform: rotate(45deg);
|
||
position: absolute;
|
||
top: -1px;
|
||
left: 4px;
|
||
width: 5px;
|
||
height: 10px;
|
||
border-style: solid;
|
||
border-top: none;
|
||
border-left: none;
|
||
border-right-width: 2px;
|
||
border-bottom-width: 2px;
|
||
border-color: white;
|
||
}
|
||
|
||
/* label */
|
||
#checkboxLabel {
|
||
position: relative;
|
||
display: inline-block;
|
||
vertical-align: middle;
|
||
padding-left: 8px;
|
||
white-space: normal;
|
||
pointer-events: none;
|
||
color: var(--paper-checkbox-label-color, --primary-text-color);
|
||
}
|
||
|
||
#checkboxLabel[hidden] {
|
||
display: none;
|
||
}
|
||
|
||
/* disabled state */
|
||
:host([disabled]) {
|
||
pointer-events: none;
|
||
}
|
||
|
||
:host([disabled]) #checkbox {
|
||
opacity: 0.5;
|
||
border-color: var(--paper-checkbox-unchecked-color, --primary-text-color);
|
||
}
|
||
|
||
:host([disabled][checked]) #checkbox {
|
||
background-color: var(--paper-checkbox-unchecked-color, --primary-text-color);
|
||
opacity: 0.5;
|
||
}
|
||
|
||
:host([disabled]) #checkboxLabel {
|
||
opacity: 0.65;
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
|
||
<div id="checkboxContainer">
|
||
<paper-ripple id="ink" class="circle" center="" checked$="[[checked]]"></paper-ripple>
|
||
<div id="checkbox" class$="[[_computeCheckboxClass(checked)]]">
|
||
<div id="checkmark" class$="[[_computeCheckmarkClass(checked)]]"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="checkboxLabel" aria-hidden="true"><content></content></div>
|
||
|
||
</template>
|
||
|
||
<script>
|
||
Polymer({
|
||
is: 'paper-checkbox',
|
||
|
||
behaviors: [
|
||
Polymer.PaperInkyFocusBehavior
|
||
],
|
||
|
||
hostAttributes: {
|
||
role: 'checkbox',
|
||
'aria-checked': false,
|
||
tabindex: 0
|
||
},
|
||
|
||
properties: {
|
||
/**
|
||
* Fired when the checked state changes due to user interaction.
|
||
*
|
||
* @event change
|
||
*/
|
||
|
||
/**
|
||
* Fired when the checked state changes.
|
||
*
|
||
* @event iron-change
|
||
*/
|
||
|
||
/**
|
||
* Gets or sets the state, `true` is checked and `false` is unchecked.
|
||
*/
|
||
checked: {
|
||
type: Boolean,
|
||
value: false,
|
||
reflectToAttribute: true,
|
||
notify: true,
|
||
observer: '_checkedChanged'
|
||
},
|
||
|
||
/**
|
||
* If true, the button toggles the active state with each tap or press
|
||
* of the spacebar.
|
||
*/
|
||
toggles: {
|
||
type: Boolean,
|
||
value: true,
|
||
reflectToAttribute: true
|
||
}
|
||
},
|
||
|
||
ready: function() {
|
||
if (Polymer.dom(this).textContent == '') {
|
||
this.$.checkboxLabel.hidden = true;
|
||
} else {
|
||
this.setAttribute('aria-label', Polymer.dom(this).textContent);
|
||
}
|
||
this._isReady = true;
|
||
},
|
||
|
||
// button-behavior hook
|
||
_buttonStateChanged: function() {
|
||
if (this.disabled) {
|
||
return;
|
||
}
|
||
if (this._isReady) {
|
||
this.checked = this.active;
|
||
}
|
||
},
|
||
|
||
_checkedChanged: function(checked) {
|
||
this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
|
||
this.active = this.checked;
|
||
this.fire('iron-change');
|
||
},
|
||
|
||
_computeCheckboxClass: function(checked) {
|
||
if (checked) {
|
||
return 'checked';
|
||
}
|
||
return '';
|
||
},
|
||
|
||
_computeCheckmarkClass: function(checked) {
|
||
if (!checked) {
|
||
return 'hidden';
|
||
}
|
||
return '';
|
||
}
|
||
})
|
||
</script>
|
||
|
||
</dom-module>
|
||
<dom-module id="paper-material" assetpath="bower_components/paper-material/">
|
||
<style>
|
||
:host {
|
||
display: block;
|
||
position: relative;
|
||
@apply(--shadow-transition);
|
||
}
|
||
|
||
:host([elevation="1"]) {
|
||
@apply(--shadow-elevation-2dp);
|
||
}
|
||
|
||
:host([elevation="2"]) {
|
||
@apply(--shadow-elevation-4dp);
|
||
}
|
||
|
||
:host([elevation="3"]) {
|
||
@apply(--shadow-elevation-6dp);
|
||
}
|
||
|
||
:host([elevation="4"]) {
|
||
@apply(--shadow-elevation-8dp);
|
||
}
|
||
|
||
:host([elevation="5"]) {
|
||
@apply(--shadow-elevation-16dp);
|
||
}
|
||
</style>
|
||
<template>
|
||
<content></content>
|
||
</template>
|
||
</dom-module>
|
||
<script>
|
||
Polymer({
|
||
is: 'paper-material',
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The z-depth of this element, from 0-5. Setting to 0 will remove the
|
||
* shadow, and each increasing number greater than 0 will be "deeper"
|
||
* than the last.
|
||
*
|
||
* @attribute elevation
|
||
* @type number
|
||
* @default 1
|
||
*/
|
||
elevation: {
|
||
type: Number,
|
||
reflectToAttribute: true,
|
||
value: 1
|
||
},
|
||
|
||
/**
|
||
* Set this to true to animate the shadow when setting a new
|
||
* `elevation` value.
|
||
*
|
||
* @attribute animated
|
||
* @type boolean
|
||
* @default false
|
||
*/
|
||
animated: {
|
||
type: Boolean,
|
||
reflectToAttribute: true,
|
||
value: false
|
||
}
|
||
}
|
||
});
|
||
</script>
|
||
<dom-module id="paper-button" assetpath="bower_components/paper-button/">
|
||
|
||
<style>
|
||
|
||
:host {
|
||
display: inline-block;
|
||
position: relative;
|
||
box-sizing: border-box;
|
||
min-width: 5.14em;
|
||
margin: 0 0.29em;
|
||
background: transparent;
|
||
text-align: center;
|
||
font: inherit;
|
||
text-transform: uppercase;
|
||
outline: none;
|
||
border-radius: 3px;
|
||
-moz-user-select: none;
|
||
-ms-user-select: none;
|
||
-webkit-user-select: none;
|
||
user-select: none;
|
||
cursor: pointer;
|
||
z-index: 0;
|
||
|
||
@apply(--paper-button);
|
||
}
|
||
|
||
.keyboard-focus {
|
||
font-weight: bold;
|
||
}
|
||
|
||
:host([disabled]) {
|
||
background: #eaeaea;
|
||
color: #a8a8a8;
|
||
cursor: auto;
|
||
pointer-events: none;
|
||
|
||
@apply(--paper-button-disabled);
|
||
}
|
||
|
||
:host([noink]) paper-ripple {
|
||
display: none;
|
||
}
|
||
|
||
paper-material {
|
||
border-radius: inherit;
|
||
}
|
||
|
||
.content > ::content * {
|
||
text-transform: inherit;
|
||
}
|
||
|
||
.content {
|
||
padding: 0.7em 0.57em
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
|
||
<paper-ripple></paper-ripple>
|
||
|
||
<paper-material class$="[[_computeContentClass(receivedFocusFromKeyboard)]]" elevation="[[_elevation]]" animated="">
|
||
<content></content>
|
||
</paper-material>
|
||
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-button',
|
||
|
||
behaviors: [
|
||
Polymer.PaperButtonBehavior
|
||
],
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* If true, the button should be styled with a shadow.
|
||
*/
|
||
raised: {
|
||
type: Boolean,
|
||
reflectToAttribute: true,
|
||
value: false,
|
||
observer: '_calculateElevation'
|
||
}
|
||
},
|
||
|
||
_calculateElevation: function() {
|
||
if (!this.raised) {
|
||
this._elevation = 0;
|
||
} else {
|
||
Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(this);
|
||
}
|
||
},
|
||
|
||
_computeContentClass: function(receivedFocusFromKeyboard) {
|
||
var className = 'content ';
|
||
if (receivedFocusFromKeyboard) {
|
||
className += ' keyboard-focus';
|
||
}
|
||
return className;
|
||
}
|
||
});
|
||
|
||
</script>
|
||
<dom-module id="paper-input-container" assetpath="bower_components/paper-input/">
|
||
|
||
<style>
|
||
|
||
:host {
|
||
display: block;
|
||
padding: 8px 0;
|
||
|
||
@apply(--paper-input-container);
|
||
}
|
||
|
||
:host[inline] {
|
||
display: inline-block;
|
||
}
|
||
|
||
:host([disabled]) {
|
||
pointer-events: none;
|
||
opacity: 0.33;
|
||
}
|
||
|
||
.floated-label-placeholder {
|
||
@apply(--paper-font-caption);
|
||
}
|
||
|
||
.underline {
|
||
position: relative;
|
||
}
|
||
|
||
.focused-line {
|
||
height: 2px;
|
||
|
||
-webkit-transform-origin: center center;
|
||
transform-origin: center center;
|
||
-webkit-transform: scale3d(0,1,1);
|
||
transform: scale3d(0,1,1);
|
||
|
||
background: var(--paper-input-container-focus-color, --default-primary-color);
|
||
}
|
||
|
||
.underline.is-highlighted .focused-line {
|
||
-webkit-transform: none;
|
||
transform: none;
|
||
-webkit-transition: -webkit-transform 0.25s;
|
||
transition: transform 0.25s;
|
||
|
||
@apply(--paper-transition-easing);
|
||
}
|
||
|
||
.underline.is-invalid .focused-line {
|
||
background: var(--paper-input-container-invalid-color, --google-red-500);
|
||
|
||
-webkit-transform: none;
|
||
transform: none;
|
||
-webkit-transition: -webkit-transform 0.25s;
|
||
transition: transform 0.25s;
|
||
|
||
@apply(--paper-transition-easing);
|
||
}
|
||
|
||
.unfocused-line {
|
||
height: 1px;
|
||
background: var(--paper-input-container-color, --secondary-text-color);
|
||
}
|
||
|
||
:host([disabled]) .unfocused-line {
|
||
border-bottom: 1px dashed;
|
||
border-color: var(--paper-input-container-color, --secondary-text-color);
|
||
background: transparent;
|
||
}
|
||
|
||
.input-content {
|
||
position: relative;
|
||
}
|
||
|
||
.input-content ::content label,
|
||
.input-content ::content .paper-input-label {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
left: 0;
|
||
font: inherit;
|
||
color: var(--paper-input-container-color, --secondary-text-color);
|
||
|
||
@apply(--paper-font-subhead);
|
||
@apply(--paper-input-container-label);
|
||
}
|
||
|
||
.input-content.label-is-floating ::content label,
|
||
.input-content.label-is-floating ::content .paper-input-label {
|
||
-webkit-transform: translate3d(0, -75%, 0) scale(0.75);
|
||
transform: translate3d(0, -75%, 0) scale(0.75);
|
||
-webkit-transform-origin: left top;
|
||
transform-origin: left top;
|
||
-webkit-transition: -webkit-transform 0.25s;
|
||
transition: transform 0.25s;
|
||
|
||
@apply(--paper-transition-easing);
|
||
}
|
||
|
||
.input-content.label-is-highlighted ::content label,
|
||
.input-content.label-is-highlighted ::content .paper-input-label {
|
||
color: var(--paper-input-container-focus-color, --default-primary-color);
|
||
}
|
||
|
||
.input-content.is-invalid ::content label,
|
||
.input-content.is-invalid ::content .paper-input-label {
|
||
color: var(--paper-input-container-invalid-color, --google-red-500);
|
||
}
|
||
|
||
.input-content.label-is-hidden ::content label,
|
||
.input-content.label-is-hidden ::content .paper-input-label {
|
||
visibility: hidden;
|
||
}
|
||
|
||
.input-content ::content input,
|
||
.input-content ::content textarea,
|
||
.input-content ::content iron-autogrow-textarea,
|
||
.input-content ::content .paper-input-input {
|
||
position: relative; /* to make a stacking context */
|
||
outline: none;
|
||
box-shadow: none;
|
||
padding: 0;
|
||
width: 100%;
|
||
background: transparent;
|
||
border: none;
|
||
color: var(--paper-input-container-input-color, --primary-text-color);
|
||
|
||
@apply(--paper-font-subhead);
|
||
@apply(--paper-input-container-input);
|
||
}
|
||
|
||
/* Firefox sets a min-width on the input, which can cause layout issues */
|
||
.input-content ::content input {
|
||
min-width: 0;
|
||
}
|
||
|
||
.input-content ::content textarea {
|
||
resize: none;
|
||
}
|
||
|
||
.add-on-content.is-invalid ::content * {
|
||
color: var(--paper-input-container-invalid-color, --google-red-500);
|
||
}
|
||
|
||
.add-on-content.is-highlighted ::content * {
|
||
color: var(--paper-input-container-focus-color, --default-primary-color);
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
|
||
<template is="dom-if" if="[[!noLabelFloat]]">
|
||
<div class="floated-label-placeholder"> </div>
|
||
</template>
|
||
|
||
<div class$="[[_computeInputContentClass(noLabelFloat,alwaysFloatLabel,focused,invalid,_inputHasContent)]]">
|
||
<content select=":not([add-on])"></content>
|
||
</div>
|
||
|
||
<div class$="[[_computeUnderlineClass(focused,invalid)]]">
|
||
<div class="unfocused-line fit"></div>
|
||
<div class="focused-line fit"></div>
|
||
</div>
|
||
|
||
<div class$="[[_computeAddOnContentClass(focused,invalid)]]">
|
||
<content id="addOnContent" select="[add-on]"></content>
|
||
</div>
|
||
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-input-container',
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* Set to true to disable the floating label. The label disappears when the input value is
|
||
* not null.
|
||
*/
|
||
noLabelFloat: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Set to true to always float the floating label.
|
||
*/
|
||
alwaysFloatLabel: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* The attribute to listen for value changes on.
|
||
*/
|
||
attrForValue: {
|
||
type: String,
|
||
value: 'bind-value'
|
||
},
|
||
|
||
/**
|
||
* Set to true to auto-validate the input value when it changes.
|
||
*/
|
||
autoValidate: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* True if the input is invalid. This property is set automatically when the input value
|
||
* changes if auto-validating, or when the `iron-input-valid` event is heard from a child.
|
||
*/
|
||
invalid: {
|
||
observer: '_invalidChanged',
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* True if the input has focus.
|
||
*/
|
||
focused: {
|
||
readOnly: true,
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
_addons: {
|
||
type: Array
|
||
// do not set a default value here intentionally - it will be initialized lazily when a
|
||
// distributed child is attached, which may occur before configuration for this element
|
||
// in polyfill.
|
||
},
|
||
|
||
_inputHasContent: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
_inputSelector: {
|
||
type: String,
|
||
value: 'input,textarea,.paper-input-input'
|
||
},
|
||
|
||
_boundOnFocus: {
|
||
type: Function,
|
||
value: function() {
|
||
return this._onFocus.bind(this);
|
||
}
|
||
},
|
||
|
||
_boundOnBlur: {
|
||
type: Function,
|
||
value: function() {
|
||
return this._onBlur.bind(this);
|
||
}
|
||
},
|
||
|
||
_boundOnInput: {
|
||
type: Function,
|
||
value: function() {
|
||
return this._onInput.bind(this);
|
||
}
|
||
},
|
||
|
||
_boundValueChanged: {
|
||
type: Function,
|
||
value: function() {
|
||
return this._onValueChanged.bind(this);
|
||
}
|
||
}
|
||
|
||
},
|
||
|
||
listeners: {
|
||
'addon-attached': '_onAddonAttached',
|
||
'iron-input-validate': '_onIronInputValidate'
|
||
},
|
||
|
||
get _valueChangedEvent() {
|
||
return this.attrForValue + '-changed';
|
||
},
|
||
|
||
get _propertyForValue() {
|
||
return Polymer.CaseMap.dashToCamelCase(this.attrForValue);
|
||
},
|
||
|
||
get _inputElement() {
|
||
return Polymer.dom(this).querySelector(this._inputSelector);
|
||
},
|
||
|
||
ready: function() {
|
||
if (!this._addons) {
|
||
this._addons = [];
|
||
}
|
||
this.addEventListener('focus', this._boundOnFocus, true);
|
||
this.addEventListener('blur', this._boundOnBlur, true);
|
||
if (this.attrForValue) {
|
||
this._inputElement.addEventListener(this._valueChangedEvent, this._boundValueChanged);
|
||
} else {
|
||
this.addEventListener('input', this._onInput);
|
||
}
|
||
},
|
||
|
||
attached: function() {
|
||
this._handleValue(this._inputElement);
|
||
},
|
||
|
||
_onAddonAttached: function(event) {
|
||
if (!this._addons) {
|
||
this._addons = [];
|
||
}
|
||
var target = event.target;
|
||
if (this._addons.indexOf(target) === -1) {
|
||
this._addons.push(target);
|
||
if (this.isAttached) {
|
||
this._handleValue(this._inputElement);
|
||
}
|
||
}
|
||
},
|
||
|
||
_onFocus: function() {
|
||
this._setFocused(true);
|
||
},
|
||
|
||
_onBlur: function() {
|
||
this._setFocused(false);
|
||
},
|
||
|
||
_onInput: function(event) {
|
||
this._handleValue(event.target);
|
||
},
|
||
|
||
_onValueChanged: function(event) {
|
||
this._handleValue(event.target);
|
||
},
|
||
|
||
_handleValue: function(inputElement) {
|
||
var value = inputElement[this._propertyForValue] || inputElement.value;
|
||
|
||
if (this.autoValidate) {
|
||
var valid;
|
||
if (inputElement.validate) {
|
||
valid = inputElement.validate(value);
|
||
} else {
|
||
valid = inputElement.checkValidity();
|
||
}
|
||
this.invalid = !valid;
|
||
}
|
||
|
||
// type="number" hack needed because this.value is empty until it's valid
|
||
if (value || (inputElement.type === 'number' && !inputElement.checkValidity())) {
|
||
this._inputHasContent = true;
|
||
} else {
|
||
this._inputHasContent = false;
|
||
}
|
||
|
||
this.updateAddons({
|
||
inputElement: inputElement,
|
||
value: value,
|
||
invalid: this.invalid
|
||
});
|
||
},
|
||
|
||
_onIronInputValidate: function(event) {
|
||
this.invalid = this._inputElement.invalid;
|
||
},
|
||
|
||
_invalidChanged: function() {
|
||
if (this._addons) {
|
||
this.updateAddons({invalid: this.invalid});
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Call this to update the state of add-ons.
|
||
* @param {Object} state Add-on state.
|
||
*/
|
||
updateAddons: function(state) {
|
||
for (var addon, index = 0; addon = this._addons[index]; index++) {
|
||
addon.update(state);
|
||
}
|
||
},
|
||
|
||
_computeInputContentClass: function(noLabelFloat, alwaysFloatLabel, focused, invalid, _inputHasContent) {
|
||
var cls = 'input-content';
|
||
if (!noLabelFloat) {
|
||
if (alwaysFloatLabel || _inputHasContent) {
|
||
cls += ' label-is-floating';
|
||
if (invalid) {
|
||
cls += ' is-invalid';
|
||
} else if (focused) {
|
||
cls += " label-is-highlighted";
|
||
}
|
||
}
|
||
} else {
|
||
if (_inputHasContent) {
|
||
cls += ' label-is-hidden';
|
||
}
|
||
}
|
||
return cls;
|
||
},
|
||
|
||
_computeUnderlineClass: function(focused, invalid) {
|
||
var cls = 'underline';
|
||
if (invalid) {
|
||
cls += ' is-invalid';
|
||
} else if (focused) {
|
||
cls += ' is-highlighted'
|
||
}
|
||
return cls;
|
||
},
|
||
|
||
_computeAddOnContentClass: function(focused, invalid) {
|
||
var cls = 'add-on-content';
|
||
if (invalid) {
|
||
cls += ' is-invalid';
|
||
} else if (focused) {
|
||
cls += ' is-highlighted'
|
||
}
|
||
return cls;
|
||
}
|
||
|
||
});
|
||
|
||
})();
|
||
</script>
|
||
<dom-module id="paper-input-error" assetpath="bower_components/paper-input/">
|
||
|
||
<style>
|
||
|
||
:host {
|
||
/* need to use display: none for role="alert" */
|
||
display: none;
|
||
float: left;
|
||
|
||
color: var(--paper-input-container-invalid-color, --google-red-500);
|
||
|
||
@apply(--paper-font-caption);
|
||
@apply(--paper-input-error);
|
||
}
|
||
|
||
:host([invalid]) {
|
||
display: inline-block;
|
||
};
|
||
|
||
</style>
|
||
|
||
<template>
|
||
|
||
<content></content>
|
||
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-input-error',
|
||
|
||
behaviors: [
|
||
Polymer.PaperInputAddonBehavior
|
||
],
|
||
|
||
hostAttributes: {
|
||
'role': 'alert'
|
||
},
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* True if the error is showing.
|
||
*/
|
||
invalid: {
|
||
readOnly: true,
|
||
reflectToAttribute: true,
|
||
type: Boolean
|
||
}
|
||
|
||
},
|
||
|
||
update: function(state) {
|
||
this._setInvalid(state.invalid);
|
||
}
|
||
|
||
})
|
||
|
||
})();
|
||
|
||
</script>
|
||
<dom-module id="paper-spinner" assetpath="bower_components/paper-spinner/">
|
||
|
||
<style>
|
||
/**
|
||
@license
|
||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||
Code distributed by Google as part of the polymer project is also
|
||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||
|
||
*/
|
||
/**************************/
|
||
/* STYLES FOR THE SPINNER */
|
||
/**************************/
|
||
|
||
/*
|
||
* Constants:
|
||
* STROKEWIDTH = 3px
|
||
* ARCSIZE = 270 degrees (amount of circle the arc takes up)
|
||
* ARCTIME = 1333ms (time it takes to expand and contract arc)
|
||
* ARCSTARTROT = 216 degrees (how much the start location of the arc
|
||
* should rotate each time, 216 gives us a
|
||
* 5 pointed star shape (it's 360/5 * 3).
|
||
* For a 7 pointed star, we might do
|
||
* 360/7 * 3 = 154.286)
|
||
* CONTAINERWIDTH = 28px
|
||
* SHRINK_TIME = 400ms
|
||
*/
|
||
|
||
:host {
|
||
display: inline-block;
|
||
position: relative;
|
||
width: 28px; /* CONTAINERWIDTH */
|
||
height: 28px; /* CONTAINERWIDTH */
|
||
}
|
||
|
||
#spinnerContainer {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
|
||
#spinnerContainer.active {
|
||
/* duration: 360 * ARCTIME / (ARCSTARTROT + (360-ARCSIZE)) */
|
||
-webkit-animation: container-rotate 1568ms linear infinite;
|
||
animation: container-rotate 1568ms linear infinite;
|
||
}
|
||
|
||
@-webkit-keyframes container-rotate {
|
||
to { -webkit-transform: rotate(360deg) }
|
||
}
|
||
|
||
@keyframes container-rotate {
|
||
to { transform: rotate(360deg) }
|
||
}
|
||
|
||
.spinner-layer {
|
||
position: absolute;
|
||
width: 100%;
|
||
height: 100%;
|
||
opacity: 0;
|
||
}
|
||
|
||
.layer-1 {
|
||
border-color: var(--paper-spinner-layer-1-color, --google-blue-500);
|
||
}
|
||
|
||
.layer-2 {
|
||
border-color: var(--paper-spinner-layer-2-color, --google-red-500);
|
||
}
|
||
|
||
.layer-3 {
|
||
border-color: var(--paper-spinner-layer-3-color, --google-yellow-500);
|
||
}
|
||
|
||
.layer-4 {
|
||
border-color: var(--paper-spinner-layer-4-color, --google-blue-500);
|
||
}
|
||
|
||
/**
|
||
* IMPORTANT NOTE ABOUT CSS ANIMATION PROPERTIES (keanulee):
|
||
*
|
||
* iOS Safari (tested on iOS 8.1) does not handle animation-delay very well - it doesn't
|
||
* guarantee that the animation will start _exactly_ after that value. So we avoid using
|
||
* animation-delay and instead set custom keyframes for each color (as layer-2undant as it
|
||
* seems).
|
||
*
|
||
* We write out each animation in full (instead of separating animation-name,
|
||
* animation-duration, etc.) because under the polyfill, Safari does not recognize those
|
||
* specific properties properly, treats them as -webkit-animation, and overrides the
|
||
* other animation rules. See https://github.com/Polymer/platform/issues/53.
|
||
*/
|
||
.active .spinner-layer.layer-1 {
|
||
/* durations: 4 * ARCTIME */
|
||
-webkit-animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-1-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
|
||
animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-1-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
|
||
}
|
||
|
||
.active .spinner-layer.layer-2 {
|
||
/* durations: 4 * ARCTIME */
|
||
-webkit-animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-2-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
|
||
animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-2-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
|
||
}
|
||
|
||
.active .spinner-layer.layer-3 {
|
||
/* durations: 4 * ARCTIME */
|
||
-webkit-animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-3-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
|
||
animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-3-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
|
||
}
|
||
|
||
.active .spinner-layer.layer-4 {
|
||
/* durations: 4 * ARCTIME */
|
||
-webkit-animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-4-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
|
||
animation: fill-unfill-rotate 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both, layer-4-fade-in-out 5332ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
|
||
}
|
||
|
||
@-webkit-keyframes fill-unfill-rotate {
|
||
12.5% { -webkit-transform: rotate(135deg); } /* 0.5 * ARCSIZE */
|
||
25% { -webkit-transform: rotate(270deg); } /* 1 * ARCSIZE */
|
||
37.5% { -webkit-transform: rotate(405deg); } /* 1.5 * ARCSIZE */
|
||
50% { -webkit-transform: rotate(540deg); } /* 2 * ARCSIZE */
|
||
62.5% { -webkit-transform: rotate(675deg); } /* 2.5 * ARCSIZE */
|
||
75% { -webkit-transform: rotate(810deg); } /* 3 * ARCSIZE */
|
||
87.5% { -webkit-transform: rotate(945deg); } /* 3.5 * ARCSIZE */
|
||
to { -webkit-transform: rotate(1080deg); } /* 4 * ARCSIZE */
|
||
}
|
||
|
||
@keyframes fill-unfill-rotate {
|
||
12.5% { transform: rotate(135deg); } /* 0.5 * ARCSIZE */
|
||
25% { transform: rotate(270deg); } /* 1 * ARCSIZE */
|
||
37.5% { transform: rotate(405deg); } /* 1.5 * ARCSIZE */
|
||
50% { transform: rotate(540deg); } /* 2 * ARCSIZE */
|
||
62.5% { transform: rotate(675deg); } /* 2.5 * ARCSIZE */
|
||
75% { transform: rotate(810deg); } /* 3 * ARCSIZE */
|
||
87.5% { transform: rotate(945deg); } /* 3.5 * ARCSIZE */
|
||
to { transform: rotate(1080deg); } /* 4 * ARCSIZE */
|
||
}
|
||
|
||
/**
|
||
* HACK: Even though the intention is to have the current .spinner-layer at
|
||
* `opacity: 1`, we set it to `opacity: 0.99` instead since this forces Chrome
|
||
* to do proper subpixel rendering for the elements being animated. This is
|
||
* especially visible in Chrome 39 on Ubuntu 14.04. See:
|
||
*
|
||
* - https://github.com/Polymer/paper-spinner/issues/9
|
||
* - https://code.google.com/p/chromium/issues/detail?id=436255
|
||
*/
|
||
@-webkit-keyframes layer-1-fade-in-out {
|
||
from { opacity: 0.99; }
|
||
25% { opacity: 0.99; }
|
||
26% { opacity: 0; }
|
||
89% { opacity: 0; }
|
||
90% { opacity: 0.99; }
|
||
100% { opacity: 0.99; }
|
||
}
|
||
|
||
@keyframes layer-1-fade-in-out {
|
||
from { opacity: 0.99; }
|
||
25% { opacity: 0.99; }
|
||
26% { opacity: 0; }
|
||
89% { opacity: 0; }
|
||
90% { opacity: 0.99; }
|
||
100% { opacity: 0.99; }
|
||
}
|
||
|
||
@-webkit-keyframes layer-2-fade-in-out {
|
||
from { opacity: 0; }
|
||
15% { opacity: 0; }
|
||
25% { opacity: 0.99; }
|
||
50% { opacity: 0.99; }
|
||
51% { opacity: 0; }
|
||
}
|
||
|
||
@keyframes layer-2-fade-in-out {
|
||
from { opacity: 0; }
|
||
15% { opacity: 0; }
|
||
25% { opacity: 0.99; }
|
||
50% { opacity: 0.99; }
|
||
51% { opacity: 0; }
|
||
}
|
||
|
||
@-webkit-keyframes layer-3-fade-in-out {
|
||
from { opacity: 0; }
|
||
40% { opacity: 0; }
|
||
50% { opacity: 0.99; }
|
||
75% { opacity: 0.99; }
|
||
76% { opacity: 0; }
|
||
}
|
||
|
||
@keyframes layer-3-fade-in-out {
|
||
from { opacity: 0; }
|
||
40% { opacity: 0; }
|
||
50% { opacity: 0.99; }
|
||
75% { opacity: 0.99; }
|
||
76% { opacity: 0; }
|
||
}
|
||
|
||
@-webkit-keyframes layer-4-fade-in-out {
|
||
from { opacity: 0; }
|
||
65% { opacity: 0; }
|
||
75% { opacity: 0.99; }
|
||
90% { opacity: 0.99; }
|
||
100% { opacity: 0; }
|
||
}
|
||
|
||
@keyframes layer-4-fade-in-out {
|
||
from { opacity: 0; }
|
||
65% { opacity: 0; }
|
||
75% { opacity: 0.99; }
|
||
90% { opacity: 0.99; }
|
||
100% { opacity: 0; }
|
||
}
|
||
|
||
/**
|
||
* Patch the gap that appear between the two adjacent div.circle-clipper while the
|
||
* spinner is rotating (appears on Chrome 38, Safari 7.1, and IE 11).
|
||
*
|
||
* Update: the gap no longer appears on Chrome when .spinner-layer's opacity is 0.99,
|
||
* but still does on Safari and IE.
|
||
*/
|
||
.gap-patch {
|
||
position: absolute;
|
||
box-sizing: border-box;
|
||
top: 0;
|
||
left: 45%;
|
||
width: 10%;
|
||
height: 100%;
|
||
overflow: hidden;
|
||
border-color: inherit;
|
||
}
|
||
|
||
.gap-patch .circle {
|
||
width: 1000%;
|
||
left: -450%;
|
||
}
|
||
|
||
.circle-clipper {
|
||
display: inline-block;
|
||
position: relative;
|
||
width: 50%;
|
||
height: 100%;
|
||
overflow: hidden;
|
||
border-color: inherit;
|
||
}
|
||
|
||
.circle-clipper .circle {
|
||
width: 200%;
|
||
}
|
||
|
||
.circle {
|
||
box-sizing: border-box;
|
||
height: 100%;
|
||
border-width: 3px; /* STROKEWIDTH */
|
||
border-style: solid;
|
||
border-color: inherit;
|
||
border-bottom-color: transparent !important;
|
||
border-radius: 50%;
|
||
-webkit-animation: none;
|
||
animation: none;
|
||
|
||
@apply(--layout-fit);
|
||
}
|
||
|
||
.circle-clipper.left .circle {
|
||
border-right-color: transparent !important;
|
||
-webkit-transform: rotate(129deg);
|
||
transform: rotate(129deg);
|
||
}
|
||
|
||
.circle-clipper.right .circle {
|
||
left: -100%;
|
||
border-left-color: transparent !important;
|
||
-webkit-transform: rotate(-129deg);
|
||
transform: rotate(-129deg);
|
||
}
|
||
|
||
.active .circle-clipper.left .circle {
|
||
/* duration: ARCTIME */
|
||
-webkit-animation: left-spin 1333ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
|
||
animation: left-spin 1333ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
|
||
}
|
||
|
||
.active .circle-clipper.right .circle {
|
||
/* duration: ARCTIME */
|
||
-webkit-animation: right-spin 1333ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
|
||
animation: right-spin 1333ms cubic-bezier(0.4, 0.0, 0.2, 1) infinite both;
|
||
}
|
||
|
||
@-webkit-keyframes left-spin {
|
||
from { -webkit-transform: rotate(130deg); }
|
||
50% { -webkit-transform: rotate(-5deg); }
|
||
to { -webkit-transform: rotate(130deg); }
|
||
}
|
||
|
||
@keyframes left-spin {
|
||
from { transform: rotate(130deg); }
|
||
50% { transform: rotate(-5deg); }
|
||
to { transform: rotate(130deg); }
|
||
}
|
||
|
||
@-webkit-keyframes right-spin {
|
||
from { -webkit-transform: rotate(-130deg); }
|
||
50% { -webkit-transform: rotate(5deg); }
|
||
to { -webkit-transform: rotate(-130deg); }
|
||
}
|
||
|
||
@keyframes right-spin {
|
||
from { transform: rotate(-130deg); }
|
||
50% { transform: rotate(5deg); }
|
||
to { transform: rotate(-130deg); }
|
||
}
|
||
|
||
#spinnerContainer.cooldown {
|
||
/* duration: SHRINK_TIME */
|
||
-webkit-animation: container-rotate 1568ms linear infinite, fade-out 400ms cubic-bezier(0.4, 0.0, 0.2, 1);
|
||
animation: container-rotate 1568ms linear infinite, fade-out 400ms cubic-bezier(0.4, 0.0, 0.2, 1);
|
||
}
|
||
|
||
@-webkit-keyframes fade-out {
|
||
from { opacity: 0.99; }
|
||
to { opacity: 0; }
|
||
}
|
||
|
||
@keyframes fade-out {
|
||
from { opacity: 0.99; }
|
||
to { opacity: 0; }
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
|
||
<div id="spinnerContainer" class-name="[[_spinnerContainerClassName]]">
|
||
<div class="spinner-layer layer-1">
|
||
<div class="circle-clipper left">
|
||
<div class="circle"></div>
|
||
</div><div class="gap-patch">
|
||
<div class="circle"></div>
|
||
</div><div class="circle-clipper right">
|
||
<div class="circle"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="spinner-layer layer-2">
|
||
<div class="circle-clipper left">
|
||
<div class="circle"></div>
|
||
</div><div class="gap-patch">
|
||
<div class="circle"></div>
|
||
</div><div class="circle-clipper right">
|
||
<div class="circle"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="spinner-layer layer-3">
|
||
<div class="circle-clipper left">
|
||
<div class="circle"></div>
|
||
</div><div class="gap-patch">
|
||
<div class="circle"></div>
|
||
</div><div class="circle-clipper right">
|
||
<div class="circle"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="spinner-layer layer-4">
|
||
<div class="circle-clipper left">
|
||
<div class="circle"></div>
|
||
</div><div class="gap-patch">
|
||
<div class="circle"></div>
|
||
</div><div class="circle-clipper right">
|
||
<div class="circle"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</template>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
'use strict';
|
||
|
||
function classNames(obj) {
|
||
var classNames = [];
|
||
for (var key in obj) {
|
||
if (obj.hasOwnProperty(key) && obj[key]) {
|
||
classNames.push(key);
|
||
}
|
||
}
|
||
|
||
return classNames.join(' ');
|
||
}
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-spinner',
|
||
|
||
listeners: {
|
||
'animationend': 'reset',
|
||
'webkitAnimationEnd': 'reset'
|
||
},
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* Displays the spinner.
|
||
*
|
||
* @attribute active
|
||
* @type boolean
|
||
* @default false
|
||
*/
|
||
active: {
|
||
observer: '_activeChanged',
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Alternative text content for accessibility support.
|
||
* If alt is present, it will add an aria-label whose content matches alt when active.
|
||
* If alt is not present, it will default to 'loading' as the alt value.
|
||
*
|
||
* @attribute alt
|
||
* @type string
|
||
* @default 'loading'
|
||
*/
|
||
alt: {
|
||
observer: '_altChanged',
|
||
type: String,
|
||
value: 'loading'
|
||
},
|
||
|
||
/**
|
||
* True when the spinner is going from active to inactive. This is represented by a fade
|
||
* to 0% opacity to the user.
|
||
*/
|
||
_coolingDown: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
_spinnerContainerClassName: {
|
||
type: String,
|
||
computed: '_computeSpinnerContainerClassName(active, _coolingDown)'
|
||
}
|
||
|
||
},
|
||
|
||
_computeSpinnerContainerClassName: function(active, _coolingDown) {
|
||
return classNames({
|
||
active: active || _coolingDown,
|
||
cooldown: _coolingDown
|
||
});
|
||
},
|
||
|
||
ready: function() {
|
||
// Allow user-provided `aria-label` take preference to any other text alternative.
|
||
if (this.hasAttribute('aria-label')) {
|
||
this.alt = this.getAttribute('aria-label');
|
||
} else {
|
||
this.setAttribute('aria-label', this.alt);
|
||
}
|
||
|
||
if (!this.active) {
|
||
this.setAttribute('aria-hidden', 'true');
|
||
}
|
||
},
|
||
|
||
_activeChanged: function() {
|
||
if (this.active) {
|
||
this.removeAttribute('aria-hidden');
|
||
} else {
|
||
this._coolingDown = true;
|
||
this.setAttribute('aria-hidden', 'true');
|
||
}
|
||
},
|
||
|
||
_altChanged: function() {
|
||
if (this.alt === '') {
|
||
this.setAttribute('aria-hidden', 'true');
|
||
} else {
|
||
this.removeAttribute('aria-hidden');
|
||
}
|
||
|
||
this.setAttribute('aria-label', this.alt);
|
||
},
|
||
|
||
reset: function() {
|
||
this.active = false;
|
||
this._coolingDown = false;
|
||
}
|
||
|
||
});
|
||
|
||
}());
|
||
|
||
</script>
|
||
|
||
</dom-module>
|
||
<dom-module id="login-form" assetpath="layouts/">
|
||
<style>
|
||
#passwordDecorator {
|
||
display: block;
|
||
height: 57px;
|
||
}
|
||
|
||
paper-checkbox {
|
||
margin-right: 8px;
|
||
}
|
||
|
||
paper-checkbox::shadow #checkbox.checked {
|
||
background-color: #03a9f4;
|
||
border-color: #03a9f4;
|
||
}
|
||
|
||
paper-checkbox::shadow #ink[checked] {
|
||
color: #03a9f4;
|
||
}
|
||
|
||
paper-button {
|
||
margin-left: 72px;
|
||
}
|
||
|
||
.interact {
|
||
height: 125px;
|
||
}
|
||
|
||
#validatebox {
|
||
text-align: center;
|
||
}
|
||
|
||
.validatemessage {
|
||
margin-top: 10px;
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<div class="layout horizontal center fit login" id="splash">
|
||
<div class="layout vertical center flex">
|
||
|
||
<img src="/static/favicon-192x192.png">
|
||
<h1>Home Assistant</h1>
|
||
|
||
<a href="#" id="hideKeyboardOnFocus"></a>
|
||
|
||
<div class="interact">
|
||
<div id="loginform" hidden$="[[isValidating]]">
|
||
<paper-input-container id="passwordDecorator" invalid="[[isInvalid]]">
|
||
<label>Password</label>
|
||
<input is="iron-input" type="password" id="passwordInput">
|
||
<paper-input-error invalid="[[isInvalid]]">[[errorMessage]]</paper-input-error>
|
||
</paper-input-container>
|
||
|
||
<div class="layout horizontal center">
|
||
<paper-checkbox for="" id="rememberLogin">Remember</paper-checkbox>
|
||
<paper-button id="loginButton">Log In</paper-button>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="validatebox" hidden$="[[!isValidating]]">
|
||
<paper-spinner active="true"></paper-spinner><br>
|
||
<div class="validatemessage">Loading data…</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var uiActions = window.hass.uiActions;
|
||
|
||
Polymer({
|
||
is: 'login-form',
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
isValidating: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
isInvalid: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
errorMessage: {
|
||
type: String,
|
||
value: '',
|
||
}
|
||
},
|
||
|
||
listeners: {
|
||
'passwordInput.keydown': 'passwordKeyDown',
|
||
'loginButton.click': 'validatePassword',
|
||
},
|
||
|
||
attached: function() {
|
||
this.focusPassword();
|
||
},
|
||
|
||
authStoreChanged: function(authStore) {
|
||
this.isValidating = authStore.isValidating;
|
||
|
||
if (authStore.lastAttemptInvalid) {
|
||
this.errorMessage = authStore.lastAttemptMessage;
|
||
this.isInvalid = true;
|
||
}
|
||
|
||
if (!this.isValidating) {
|
||
setTimeout(this.focusPassword.bind(this), 0);
|
||
}
|
||
},
|
||
|
||
focusPassword: function() {
|
||
this.$.passwordInput.focus();
|
||
},
|
||
|
||
passwordKeyDown: function(ev) {
|
||
// validate on enter
|
||
if(ev.keyCode === 13) {
|
||
this.validatePassword();
|
||
ev.preventDefault();
|
||
|
||
// clear error after we start typing again
|
||
} else if(this.isInvalid) {
|
||
this.isInvalid = false;
|
||
}
|
||
},
|
||
|
||
validatePassword: function() {
|
||
this.$.hideKeyboardOnFocus.focus();
|
||
|
||
uiActions.validateAuth(this.$.passwordInput.value, this.$.rememberLogin.checked);
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
|
||
|
||
<dom-module id="paper-drawer-panel" assetpath="bower_components/paper-drawer-panel/">
|
||
<style>
|
||
/**
|
||
@license
|
||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||
Code distributed by Google as part of the polymer project is also
|
||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||
|
||
*/
|
||
:host {
|
||
display: block;
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
overflow: hidden;
|
||
}
|
||
|
||
iron-selector > #drawer {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
height: 100%;
|
||
background-color: white;
|
||
will-change: transform;
|
||
box-sizing: border-box;
|
||
-moz-box-sizing: border-box;
|
||
|
||
@apply(--paper-drawer-panel-drawer-container);
|
||
}
|
||
|
||
.transition > #drawer {
|
||
transition: -webkit-transform ease-in-out 0.3s, width ease-in-out 0.3s;
|
||
transition: transform ease-in-out 0.3s, width ease-in-out 0.3s;
|
||
}
|
||
|
||
.left-drawer > #drawer {
|
||
@apply(--paper-drawer-panel-left-drawer-container);
|
||
}
|
||
|
||
.right-drawer > #drawer {
|
||
left: auto;
|
||
right: 0;
|
||
|
||
@apply(--paper-drawer-panel-right-drawer-container);
|
||
}
|
||
|
||
iron-selector > #main {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
|
||
@apply(--paper-drawer-panel-main-container);
|
||
}
|
||
|
||
.transition > #main {
|
||
transition: left ease-in-out 0.3s, padding ease-in-out 0.3s;
|
||
}
|
||
|
||
.right-drawer > #main {
|
||
left: 0;
|
||
}
|
||
|
||
.right-drawer.transition > #main {
|
||
transition: right ease-in-out 0.3s, padding ease-in-out 0.3s;
|
||
}
|
||
|
||
#main > ::content > [main] {
|
||
height: 100%;
|
||
}
|
||
|
||
#drawer > ::content > [drawer] {
|
||
height: 100%;
|
||
}
|
||
|
||
#scrim {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
visibility: hidden;
|
||
opacity: 0;
|
||
transition: opacity ease-in-out 0.38s, visibility ease-in-out 0.38s;
|
||
background-color: rgba(0, 0, 0, 0.3);
|
||
}
|
||
|
||
.narrow-layout > #drawer.iron-selected {
|
||
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.15);
|
||
}
|
||
|
||
.right-drawer.narrow-layout > #drawer.iron-selected {
|
||
box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.15);
|
||
}
|
||
|
||
.narrow-layout > #drawer > ::content > [drawer] {
|
||
border: 0;
|
||
}
|
||
|
||
.left-drawer.narrow-layout > #drawer:not(.iron-selected) {
|
||
-webkit-transform: translateX(-100%);
|
||
transform: translateX(-100%);
|
||
}
|
||
|
||
.right-drawer.narrow-layout > #drawer:not(.iron-selected) {
|
||
left: auto;
|
||
-webkit-transform: translateX(100%);
|
||
transform: translateX(100%);
|
||
}
|
||
|
||
.narrow-layout > #main {
|
||
left: 0 !important;
|
||
padding: 0;
|
||
}
|
||
|
||
.right-drawer.narrow-layout > #main {
|
||
left: 0;
|
||
right: 0;
|
||
padding: 0;
|
||
}
|
||
|
||
.narrow-layout > #main:not(.iron-selected) > #scrim,
|
||
.dragging > #main > #scrim {
|
||
visibility: visible;
|
||
opacity: var(--paper-drawer-panel-scrim-opacity, 1);
|
||
}
|
||
|
||
.narrow-layout > #main > * {
|
||
margin: 0;
|
||
min-height: 100%;
|
||
left: 0;
|
||
right: 0;
|
||
box-sizing: border-box;
|
||
-moz-box-sizing: border-box;
|
||
}
|
||
|
||
iron-selector:not(.narrow-layout) #main ::content [paper-drawer-toggle] {
|
||
display: none;
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<iron-media-query id="mq" on-query-matches-changed="_onQueryMatchesChanged" query="[[_computeMediaQuery(forceNarrow, responsiveWidth)]]">
|
||
</iron-media-query>
|
||
|
||
<iron-selector attr-for-selected="id" class$="[[_computeIronSelectorClass(narrow, transition, dragging, rightDrawer)]]" activate-event="" selected="[[selected]]">
|
||
|
||
<div id="main" style$="[[_computeMainStyle(narrow, rightDrawer, drawerWidth)]]">
|
||
<content select="[main]"></content>
|
||
<div id="scrim" on-tap="closeDrawer"></div>
|
||
</div>
|
||
|
||
<div id="drawer" style$="[[_computeDrawerStyle(drawerWidth)]]">
|
||
<content select="[drawer]"></content>
|
||
</div>
|
||
|
||
</iron-selector>
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
'use strict';
|
||
|
||
// this would be the only `paper-drawer-panel` in
|
||
// the whole app that can be in `dragging` state
|
||
var sharedPanel = null;
|
||
|
||
function classNames(obj) {
|
||
var classes = [];
|
||
for (var key in obj) {
|
||
if (obj.hasOwnProperty(key) && obj[key]) {
|
||
classes.push(key);
|
||
}
|
||
}
|
||
|
||
return classes.join(' ');
|
||
}
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-drawer-panel',
|
||
|
||
/**
|
||
* Fired when the narrow layout changes.
|
||
*
|
||
* @event paper-responsive-change {{narrow: boolean}} detail -
|
||
* narrow: true if the panel is in narrow layout.
|
||
*/
|
||
|
||
/**
|
||
* Fired when the selected panel changes.
|
||
*
|
||
* Listening for this event is an alternative to observing changes in the `selected` attribute.
|
||
* This event is fired both when a panel is selected and deselected.
|
||
* The `isSelected` detail property contains the selection state.
|
||
*
|
||
* @event paper-select {{isSelected: boolean, item: Object}} detail -
|
||
* isSelected: True for selection and false for deselection.
|
||
* item: The panel that the event refers to.
|
||
*/
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The panel to be selected when `paper-drawer-panel` changes to narrow
|
||
* layout.
|
||
*/
|
||
defaultSelected: {
|
||
type: String,
|
||
value: 'main'
|
||
},
|
||
|
||
/**
|
||
* If true, swipe from the edge is disable.
|
||
*/
|
||
disableEdgeSwipe: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* If true, swipe to open/close the drawer is disabled.
|
||
*/
|
||
disableSwipe: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Whether the user is dragging the drawer interactively.
|
||
*/
|
||
dragging: {
|
||
type: Boolean,
|
||
value: false,
|
||
readOnly: true,
|
||
notify: true
|
||
},
|
||
|
||
/**
|
||
* Width of the drawer panel.
|
||
*/
|
||
drawerWidth: {
|
||
type: String,
|
||
value: '256px'
|
||
},
|
||
|
||
/**
|
||
* How many pixels on the side of the screen are sensitive to edge
|
||
* swipes and peek.
|
||
*/
|
||
edgeSwipeSensitivity: {
|
||
type: Number,
|
||
value: 30
|
||
},
|
||
|
||
/**
|
||
* If true, ignore `responsiveWidth` setting and force the narrow layout.
|
||
*/
|
||
forceNarrow: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Whether the browser has support for the transform CSS property.
|
||
*/
|
||
hasTransform: {
|
||
type: Boolean,
|
||
value: function() {
|
||
return 'transform' in this.style;
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Whether the browser has support for the will-change CSS property.
|
||
*/
|
||
hasWillChange: {
|
||
type: Boolean,
|
||
value: function() {
|
||
return 'willChange' in this.style;
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Returns true if the panel is in narrow layout. This is useful if you
|
||
* need to show/hide elements based on the layout.
|
||
*/
|
||
narrow: {
|
||
reflectToAttribute: true,
|
||
type: Boolean,
|
||
value: false,
|
||
readOnly: true,
|
||
notify: true
|
||
},
|
||
|
||
/**
|
||
* Whether the drawer is peeking out from the edge.
|
||
*/
|
||
peeking: {
|
||
type: Boolean,
|
||
value: false,
|
||
readOnly: true,
|
||
notify: true
|
||
},
|
||
|
||
/**
|
||
* Max-width when the panel changes to narrow layout.
|
||
*/
|
||
responsiveWidth: {
|
||
type: String,
|
||
value: '640px'
|
||
},
|
||
|
||
/**
|
||
* If true, position the drawer to the right.
|
||
*/
|
||
rightDrawer: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* The panel that is being selected. `drawer` for the drawer panel and
|
||
* `main` for the main panel.
|
||
*/
|
||
selected: {
|
||
reflectToAttribute: true,
|
||
notify: true,
|
||
type: String,
|
||
value: null
|
||
},
|
||
|
||
/**
|
||
* The attribute on elements that should toggle the drawer on tap, also elements will
|
||
* automatically be hidden in wide layout.
|
||
*/
|
||
drawerToggleAttribute: {
|
||
type: String,
|
||
value: 'paper-drawer-toggle'
|
||
},
|
||
|
||
/**
|
||
* Whether the transition is enabled.
|
||
*/
|
||
transition: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
},
|
||
|
||
listeners: {
|
||
tap: '_onTap',
|
||
track: '_onTrack',
|
||
down: '_downHandler',
|
||
up: '_upHandler'
|
||
},
|
||
|
||
observers: [
|
||
'_forceNarrowChanged(forceNarrow, defaultSelected)'
|
||
],
|
||
|
||
/**
|
||
* Toggles the panel open and closed.
|
||
*
|
||
* @method togglePanel
|
||
*/
|
||
togglePanel: function() {
|
||
if (this._isMainSelected()) {
|
||
this.openDrawer();
|
||
} else {
|
||
this.closeDrawer();
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Opens the drawer.
|
||
*
|
||
* @method openDrawer
|
||
*/
|
||
openDrawer: function() {
|
||
this.selected = 'drawer';
|
||
},
|
||
|
||
/**
|
||
* Closes the drawer.
|
||
*
|
||
* @method closeDrawer
|
||
*/
|
||
closeDrawer: function() {
|
||
this.selected = 'main';
|
||
},
|
||
|
||
ready: function() {
|
||
// Avoid transition at the beginning e.g. page loads and enable
|
||
// transitions only after the element is rendered and ready.
|
||
this.transition = true;
|
||
},
|
||
|
||
_computeIronSelectorClass: function(narrow, transition, dragging, rightDrawer) {
|
||
return classNames({
|
||
dragging: dragging,
|
||
'narrow-layout': narrow,
|
||
'right-drawer': rightDrawer,
|
||
'left-drawer': !rightDrawer,
|
||
transition: transition
|
||
});
|
||
},
|
||
|
||
_computeDrawerStyle: function(drawerWidth) {
|
||
return 'width:' + drawerWidth + ';';
|
||
},
|
||
|
||
_computeMainStyle: function(narrow, rightDrawer, drawerWidth) {
|
||
var style = '';
|
||
|
||
style += 'left:' + ((narrow || rightDrawer) ? '0' : drawerWidth) + ';';
|
||
|
||
if (rightDrawer) {
|
||
style += 'right:' + (narrow ? '' : drawerWidth) + ';';
|
||
} else {
|
||
style += 'right:;';
|
||
}
|
||
|
||
return style;
|
||
},
|
||
|
||
_computeMediaQuery: function(forceNarrow, responsiveWidth) {
|
||
return forceNarrow ? '' : '(max-width: ' + responsiveWidth + ')';
|
||
},
|
||
|
||
_computeSwipeOverlayHidden: function(narrow, disableEdgeSwipe) {
|
||
return !narrow || disableEdgeSwipe;
|
||
},
|
||
|
||
_onTrack: function(e) {
|
||
if (sharedPanel && this !== sharedPanel) {
|
||
return;
|
||
}
|
||
switch (e.detail.state) {
|
||
case 'start':
|
||
this._trackStart(e);
|
||
break;
|
||
case 'track':
|
||
this._trackX(e);
|
||
break;
|
||
case 'end':
|
||
this._trackEnd(e);
|
||
break;
|
||
}
|
||
|
||
},
|
||
|
||
_responsiveChange: function(narrow) {
|
||
this._setNarrow(narrow);
|
||
|
||
if (this.narrow) {
|
||
this.selected = this.defaultSelected;
|
||
}
|
||
|
||
this.setScrollDirection(this._swipeAllowed() ? 'y' : 'all');
|
||
this.fire('paper-responsive-change', {narrow: this.narrow});
|
||
},
|
||
|
||
_onQueryMatchesChanged: function(e) {
|
||
this._responsiveChange(e.detail.value);
|
||
},
|
||
|
||
_forceNarrowChanged: function() {
|
||
// set the narrow mode only if we reached the `responsiveWidth`
|
||
this._responsiveChange(this.forceNarrow || this.$.mq.queryMatches);
|
||
},
|
||
|
||
_swipeAllowed: function() {
|
||
return this.narrow && !this.disableSwipe;
|
||
},
|
||
|
||
_isMainSelected: function() {
|
||
return this.selected === 'main';
|
||
},
|
||
|
||
_startEdgePeek: function() {
|
||
this.width = this.$.drawer.offsetWidth;
|
||
this._moveDrawer(this._translateXForDeltaX(this.rightDrawer ?
|
||
-this.edgeSwipeSensitivity : this.edgeSwipeSensitivity));
|
||
this._setPeeking(true);
|
||
},
|
||
|
||
_stopEdgePeek: function() {
|
||
if (this.peeking) {
|
||
this._setPeeking(false);
|
||
this._moveDrawer(null);
|
||
}
|
||
},
|
||
|
||
_downHandler: function(e) {
|
||
if (!this.dragging && this._isMainSelected() && this._isEdgeTouch(e) && !sharedPanel) {
|
||
this._startEdgePeek();
|
||
// grab this panel
|
||
sharedPanel = this;
|
||
}
|
||
},
|
||
|
||
_upHandler: function() {
|
||
this._stopEdgePeek();
|
||
// release the panel
|
||
sharedPanel = null;
|
||
},
|
||
|
||
_onTap: function(e) {
|
||
var targetElement = Polymer.dom(e).localTarget;
|
||
var isTargetToggleElement = targetElement &&
|
||
this.drawerToggleAttribute &&
|
||
targetElement.hasAttribute(this.drawerToggleAttribute);
|
||
|
||
if (isTargetToggleElement) {
|
||
this.togglePanel();
|
||
}
|
||
},
|
||
|
||
_isEdgeTouch: function(e) {
|
||
var x = e.detail.x;
|
||
|
||
return !this.disableEdgeSwipe && this._swipeAllowed() &&
|
||
(this.rightDrawer ?
|
||
x >= this.offsetWidth - this.edgeSwipeSensitivity :
|
||
x <= this.edgeSwipeSensitivity);
|
||
},
|
||
|
||
_trackStart: function(event) {
|
||
if (this._swipeAllowed()) {
|
||
sharedPanel = this;
|
||
this._setDragging(true);
|
||
|
||
if (this._isMainSelected()) {
|
||
this._setDragging(this.peeking || this._isEdgeTouch(event));
|
||
}
|
||
|
||
if (this.dragging) {
|
||
this.width = this.$.drawer.offsetWidth;
|
||
this.transition = false;
|
||
}
|
||
}
|
||
},
|
||
|
||
_translateXForDeltaX: function(deltaX) {
|
||
var isMain = this._isMainSelected();
|
||
|
||
if (this.rightDrawer) {
|
||
return Math.max(0, isMain ? this.width + deltaX : deltaX);
|
||
} else {
|
||
return Math.min(0, isMain ? deltaX - this.width : deltaX);
|
||
}
|
||
},
|
||
|
||
_trackX: function(e) {
|
||
if (this.dragging) {
|
||
var dx = e.detail.dx;
|
||
|
||
if (this.peeking) {
|
||
if (Math.abs(dx) <= this.edgeSwipeSensitivity) {
|
||
// Ignore trackx until we move past the edge peek.
|
||
return;
|
||
}
|
||
this._setPeeking(false);
|
||
}
|
||
|
||
this._moveDrawer(this._translateXForDeltaX(dx));
|
||
}
|
||
},
|
||
|
||
_trackEnd: function(e) {
|
||
if (this.dragging) {
|
||
var xDirection = e.detail.dx > 0;
|
||
|
||
this._setDragging(false);
|
||
this.transition = true;
|
||
sharedPanel = null;
|
||
this._moveDrawer(null);
|
||
|
||
if (this.rightDrawer) {
|
||
this[xDirection ? 'closeDrawer' : 'openDrawer']();
|
||
} else {
|
||
this[xDirection ? 'openDrawer' : 'closeDrawer']();
|
||
}
|
||
}
|
||
},
|
||
|
||
_transformForTranslateX: function(translateX) {
|
||
if (translateX === null) {
|
||
return '';
|
||
}
|
||
|
||
return this.hasWillChange ? 'translateX(' + translateX + 'px)' :
|
||
'translate3d(' + translateX + 'px, 0, 0)';
|
||
},
|
||
|
||
_moveDrawer: function(translateX) {
|
||
var s = this.$.drawer.style;
|
||
|
||
if (this.hasTransform) {
|
||
s.transform = this._transformForTranslateX(translateX);
|
||
} else {
|
||
s.webkitTransform = this._transformForTranslateX(translateX);
|
||
}
|
||
}
|
||
|
||
});
|
||
|
||
}());
|
||
|
||
</script>
|
||
<dom-module id="paper-header-panel" assetpath="bower_components/paper-header-panel/">
|
||
|
||
<style>
|
||
:host {
|
||
@apply(--layout);
|
||
@apply(--layout-vertical);
|
||
|
||
display: block;
|
||
position: relative;
|
||
height: 100%;
|
||
|
||
/* Create a stack context, we will need it for the shadow*/
|
||
z-index: 0;
|
||
}
|
||
|
||
:root {
|
||
/**
|
||
* Default paper header panel shadow
|
||
*/
|
||
--paper-header-panel-shadow: {
|
||
height: 6px;
|
||
bottom: -6px;
|
||
box-shadow: inset 0px 5px 6px -3px rgba(0, 0, 0, 0.4);
|
||
};
|
||
}
|
||
|
||
#mainContainer {
|
||
@apply(--layout-flex);
|
||
|
||
position: relative;
|
||
overflow-y: auto;
|
||
overflow-x: hidden;
|
||
-webkit-overflow-scrolling: touch;
|
||
flex-basis: 0.0001px;
|
||
}
|
||
|
||
/*
|
||
* mode: scroll
|
||
*/
|
||
:host([mode=scroll]) #mainContainer {
|
||
@apply(--paper-header-panel-scroll-container);
|
||
overflow: visible;
|
||
}
|
||
|
||
:host([mode=scroll]) {
|
||
overflow-y: auto;
|
||
overflow-x: hidden;
|
||
-webkit-overflow-scrolling: touch;
|
||
}
|
||
|
||
/*
|
||
* mode: cover
|
||
*/
|
||
:host([mode=cover]) #mainContainer {
|
||
@apply(--paper-header-panel-cover-container);
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
/*
|
||
* mode: standard
|
||
*/
|
||
:host([mode=standard]) #mainContainer {
|
||
@apply(--paper-header-panel-standard-container);
|
||
}
|
||
|
||
/*
|
||
* mode: waterfall
|
||
*/
|
||
:host([mode=waterfall]) #mainContainer {
|
||
@apply(--paper-header-panel-waterfall-container);
|
||
}
|
||
|
||
/*
|
||
* mode: waterfall-tall
|
||
*/
|
||
:host([mode=waterfall-tall]) #mainContainer {
|
||
@apply(--paper-header-panel-waterfall-tall-container);
|
||
}
|
||
|
||
:host ::content paper-toolbar,
|
||
:host ::content .paper-header {
|
||
position: relative;
|
||
overflow: visible !important;
|
||
}
|
||
|
||
:host ::content paper-toolbar:after,
|
||
:host ::content .paper-header:after {
|
||
@apply(--paper-header-panel-shadow);
|
||
|
||
-webkit-transition: opacity 0.5s, -webkit-transform 0.5s;
|
||
transition: opacity 0.5s, transform 0.5s;
|
||
|
||
opacity: 0;
|
||
content: "";
|
||
|
||
width: 100%;
|
||
position: absolute;
|
||
left: 0px;
|
||
right: 0px;
|
||
z-index: 1;
|
||
|
||
-webkit-transform: scale3d(1, 0, 1);
|
||
-webkit-transform-origin: 0% 0%;
|
||
|
||
transform: scale3d(1, 0, 1);
|
||
transform-origin: 0% 0%;
|
||
}
|
||
|
||
:host ::content paper-toolbar.has-shadow:after,
|
||
:host ::content .paper-header.has-shadow:after {
|
||
opacity: 1;
|
||
-webkit-transform: scale3d(1, 1, 1);
|
||
transform: scale3d(1, 1, 1);
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<content id="headerContent" select="paper-toolbar, .paper-header"></content>
|
||
<div id="mainContainer" class$="[[_computeMainContainerClass(mode)]]">
|
||
<content id="mainContent" select="*"></content>
|
||
</div>
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
'use strict';
|
||
|
||
var SHADOW_WHEN_SCROLLING = 1;
|
||
var SHADOW_ALWAYS = 2;
|
||
|
||
|
||
var MODE_CONFIGS = {
|
||
|
||
outerScroll: {
|
||
scroll: true
|
||
},
|
||
|
||
shadowMode: {
|
||
standard: SHADOW_ALWAYS,
|
||
waterfall: SHADOW_WHEN_SCROLLING,
|
||
'waterfall-tall': SHADOW_WHEN_SCROLLING
|
||
},
|
||
|
||
tallMode: {
|
||
'waterfall-tall': true
|
||
}
|
||
};
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-header-panel',
|
||
|
||
/**
|
||
* Fired when the content has been scrolled. `event.detail.target` returns
|
||
* the scrollable element which you can use to access scroll info such as
|
||
* `scrollTop`.
|
||
*
|
||
* <paper-header-panel on-content-scroll="{{scrollHandler}}">
|
||
* ...
|
||
* </paper-header-panel>
|
||
*
|
||
*
|
||
* scrollHandler: function(event) {
|
||
* var scroller = event.detail.target;
|
||
* console.log(scroller.scrollTop);
|
||
* }
|
||
*
|
||
* @event content-scroll
|
||
*/
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* Controls header and scrolling behavior. Options are
|
||
* `standard`, `seamed`, `waterfall`, `waterfall-tall`, `scroll` and
|
||
* `cover`. Default is `standard`.
|
||
*
|
||
* `standard`: The header is a step above the panel. The header will consume the
|
||
* panel at the point of entry, preventing it from passing through to the
|
||
* opposite side.
|
||
*
|
||
* `seamed`: The header is presented as seamed with the panel.
|
||
*
|
||
* `waterfall`: Similar to standard mode, but header is initially presented as
|
||
* seamed with panel, but then separates to form the step.
|
||
*
|
||
* `waterfall-tall`: The header is initially taller (`tall` class is added to
|
||
* the header). As the user scrolls, the header separates (forming an edge)
|
||
* while condensing (`tall` class is removed from the header).
|
||
*
|
||
* `scroll`: The header keeps its seam with the panel, and is pushed off screen.
|
||
*
|
||
* `cover`: The panel covers the whole `paper-header-panel` including the
|
||
* header. This allows user to style the panel in such a way that the panel is
|
||
* partially covering the header.
|
||
*
|
||
* <paper-header-panel mode="cover">
|
||
* <paper-toolbar class="tall">
|
||
* <core-icon-button icon="menu"></core-icon-button>
|
||
* </paper-toolbar>
|
||
* <div class="content"></div>
|
||
* </paper-header-panel>
|
||
*/
|
||
mode: {
|
||
type: String,
|
||
value: 'standard',
|
||
observer: '_modeChanged',
|
||
reflectToAttribute: true
|
||
},
|
||
|
||
/**
|
||
* If true, the drop-shadow is always shown no matter what mode is set to.
|
||
*/
|
||
shadow: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* The class used in waterfall-tall mode. Change this if the header
|
||
* accepts a different class for toggling height, e.g. "medium-tall"
|
||
*/
|
||
tallClass: {
|
||
type: String,
|
||
value: 'tall'
|
||
},
|
||
|
||
/**
|
||
* If true, the scroller is at the top
|
||
*/
|
||
atTop: {
|
||
type: Boolean,
|
||
value: true,
|
||
readOnly: true
|
||
}
|
||
},
|
||
|
||
observers: [
|
||
'_computeDropShadowHidden(atTop, mode, shadow)'
|
||
],
|
||
|
||
ready: function() {
|
||
this.scrollHandler = this._scroll.bind(this);
|
||
this._addListener();
|
||
|
||
// Run `scroll` logic once to initialze class names, etc.
|
||
this._keepScrollingState();
|
||
},
|
||
|
||
detached: function() {
|
||
this._removeListener();
|
||
},
|
||
|
||
/**
|
||
* Returns the header element
|
||
*
|
||
* @property header
|
||
* @type Object
|
||
*/
|
||
get header() {
|
||
return Polymer.dom(this.$.headerContent).getDistributedNodes()[0];
|
||
},
|
||
|
||
/**
|
||
* Returns the scrollable element.
|
||
*
|
||
* @property scroller
|
||
* @type Object
|
||
*/
|
||
get scroller() {
|
||
return this._getScrollerForMode(this.mode);
|
||
},
|
||
|
||
/**
|
||
* Returns true if the scroller has a visible shadow.
|
||
*
|
||
* @property visibleShadow
|
||
* @type Boolean
|
||
*/
|
||
get visibleShadow() {
|
||
return this.header.classList.contains('has-shadow');
|
||
},
|
||
|
||
_computeDropShadowHidden: function(atTop, mode, shadow) {
|
||
|
||
var shadowMode = MODE_CONFIGS.shadowMode[mode];
|
||
|
||
if (this.shadow) {
|
||
this.toggleClass('has-shadow', true, this.header);
|
||
|
||
} else if (shadowMode === SHADOW_ALWAYS) {
|
||
this.toggleClass('has-shadow', true, this.header);
|
||
|
||
} else if (shadowMode === SHADOW_WHEN_SCROLLING && !atTop) {
|
||
this.toggleClass('has-shadow', true, this.header);
|
||
|
||
} else {
|
||
this.toggleClass('has-shadow', false, this.header);
|
||
|
||
}
|
||
},
|
||
|
||
_computeMainContainerClass: function(mode) {
|
||
// TODO: It will be useful to have a utility for classes
|
||
// e.g. Polymer.Utils.classes({ foo: true });
|
||
|
||
var classes = {};
|
||
|
||
classes['flex'] = mode !== 'cover';
|
||
|
||
return Object.keys(classes).filter(
|
||
function(className) {
|
||
return classes[className];
|
||
}).join(' ');
|
||
},
|
||
|
||
_addListener: function() {
|
||
this.scroller.addEventListener('scroll', this.scrollHandler, false);
|
||
},
|
||
|
||
_removeListener: function() {
|
||
this.scroller.removeEventListener('scroll', this.scrollHandler);
|
||
},
|
||
|
||
_modeChanged: function(newMode, oldMode) {
|
||
var configs = MODE_CONFIGS;
|
||
var header = this.header;
|
||
var animateDuration = 200;
|
||
|
||
if (header) {
|
||
// in tallMode it may add tallClass to the header; so do the cleanup
|
||
// when mode is changed from tallMode to not tallMode
|
||
if (configs.tallMode[oldMode] && !configs.tallMode[newMode]) {
|
||
header.classList.remove(this.tallClass);
|
||
this.async(function() {
|
||
header.classList.remove('animate');
|
||
}, animateDuration);
|
||
} else {
|
||
header.classList.toggle('animate', configs.tallMode[newMode]);
|
||
}
|
||
}
|
||
this._keepScrollingState();
|
||
},
|
||
|
||
_keepScrollingState: function () {
|
||
var main = this.scroller;
|
||
var header = this.header;
|
||
|
||
this._setAtTop(main.scrollTop === 0);
|
||
|
||
if (header && MODE_CONFIGS.tallMode[this.mode]) {
|
||
this.toggleClass(this.tallClass, this.atTop ||
|
||
header.classList.contains(this.tallClass) &&
|
||
main.scrollHeight < this.offsetHeight, header);
|
||
}
|
||
},
|
||
|
||
_scroll: function(e) {
|
||
this._keepScrollingState();
|
||
this.fire('content-scroll', {target: this.scroller}, {bubbles: false});
|
||
},
|
||
|
||
_getScrollerForMode: function(mode) {
|
||
return MODE_CONFIGS.outerScroll[mode] ?
|
||
this : this.$.mainContainer;
|
||
}
|
||
|
||
});
|
||
|
||
})();
|
||
|
||
</script>
|
||
<dom-module id="paper-toolbar" assetpath="bower_components/paper-toolbar/">
|
||
|
||
<style>
|
||
:host {
|
||
/* technical */
|
||
display: block;
|
||
position: relative;
|
||
box-sizing: border-box;
|
||
-moz-box-sizing: border-box;
|
||
|
||
/* size */
|
||
height: 64px;
|
||
|
||
background: var(--paper-toolbar-background, --default-primary-color);
|
||
color: var(--paper-toolbar-color, --text-primary-color);
|
||
|
||
@apply(--paper-toolbar);
|
||
}
|
||
|
||
:host(.animate) {
|
||
/* transition */
|
||
transition: height 0.18s ease-in;
|
||
}
|
||
|
||
:host(.medium-tall) {
|
||
height: 128px;
|
||
}
|
||
|
||
:host(.tall) {
|
||
height: 192px;
|
||
}
|
||
|
||
.toolbar-tools {
|
||
position: relative;
|
||
height: 64px;
|
||
padding: 0 16px;
|
||
pointer-events: none;
|
||
}
|
||
|
||
/*
|
||
* TODO: Where should media query breakpoints live so they can be shared between elements?
|
||
*/
|
||
|
||
@media (max-width: 639px) {
|
||
:host {
|
||
height: 56px;
|
||
}
|
||
|
||
:host(.medium-tall) {
|
||
height: 112px;
|
||
}
|
||
|
||
:host(.tall) {
|
||
height: 168px;
|
||
}
|
||
|
||
.toolbar-tools {
|
||
height: 56px;
|
||
}
|
||
}
|
||
|
||
#topBar {
|
||
position: relative;
|
||
}
|
||
|
||
/* middle bar */
|
||
#middleBar {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
left: 0;
|
||
}
|
||
|
||
:host(.tall) #middleBar,
|
||
:host(.medium-tall) #middleBar {
|
||
-webkit-transform: translateY(100%);
|
||
transform: translateY(100%);
|
||
}
|
||
|
||
/* bottom bar */
|
||
#bottomBar {
|
||
position: absolute;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
}
|
||
|
||
/*
|
||
* make elements (e.g. buttons) respond to mouse/touch events
|
||
*
|
||
* `.toolbar-tools` disables touch events so multiple toolbars can stack and not
|
||
* absorb events. All children must have pointer events re-enabled to work as
|
||
* expected.
|
||
*/
|
||
.toolbar-tools > ::content > *:not([disabled]) {
|
||
pointer-events: auto;
|
||
}
|
||
|
||
.toolbar-tools > ::content .title {
|
||
@apply(--paper-font-title);
|
||
@apply(--layout-flex);
|
||
|
||
pointer-events: none;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
|
||
/*
|
||
* Polymer/polymer/issues/1525
|
||
* --paper-font-title defines a `font-weight`
|
||
* let's override its value, but we need `important!`
|
||
* because all mixins are resolved in rule's selector that has higher precedence
|
||
* than the current selector.
|
||
*/
|
||
font-weight: 400 !important;
|
||
}
|
||
|
||
/**
|
||
* TODO: Refactor these selectors
|
||
* Work in progress.
|
||
*/
|
||
.toolbar-tools > ::content paper-icon-button[icon=menu] {
|
||
margin-right: 24px;
|
||
}
|
||
|
||
.toolbar-tools > ::content > .title,
|
||
.toolbar-tools > ::content[select=".middle"] > .title,
|
||
.toolbar-tools > ::content[select=".bottom"] > .title {
|
||
margin-left: 56px;
|
||
}
|
||
|
||
.toolbar-tools > ::content > paper-icon-button + .title,
|
||
.toolbar-tools > ::content[select=".middle"] paper-icon-button + .title,
|
||
.toolbar-tools > ::content[select=".bottom"] paper-icon-button + .title {
|
||
margin-left: 0;
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
|
||
<div id="topBar" class$="[[_computeBarClassName(justify)]]">
|
||
<content select=":not(.middle):not(.bottom)"></content>
|
||
</div>
|
||
|
||
<div id="middleBar" class$="[[_computeBarClassName(middleJustify)]]">
|
||
<content select=".middle"></content>
|
||
</div>
|
||
|
||
<div id="bottomBar" class$="[[_computeBarClassName(bottomJustify)]]">
|
||
<content select=".bottom"></content>
|
||
</div>
|
||
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
'use strict';
|
||
|
||
function classNames(obj) {
|
||
var classNames = [];
|
||
for (var key in obj) {
|
||
if (obj.hasOwnProperty(key) && obj[key]) {
|
||
classNames.push(key);
|
||
}
|
||
}
|
||
|
||
return classNames.join(' ');
|
||
}
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-toolbar',
|
||
|
||
hostAttributes: {
|
||
'role': 'toolbar'
|
||
},
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* Controls how the items are aligned horizontally when they are placed
|
||
* at the bottom.
|
||
* Options are `start`, `center`, `end`, `justified` and `around`.
|
||
*
|
||
* @attribute bottomJustify
|
||
* @type string
|
||
* @default ''
|
||
*/
|
||
bottomJustify: {
|
||
type: String,
|
||
value: ''
|
||
},
|
||
|
||
/**
|
||
* Controls how the items are aligned horizontally.
|
||
* Options are `start`, `center`, `end`, `justified` and `around`.
|
||
*
|
||
* @attribute justify
|
||
* @type string
|
||
* @default ''
|
||
*/
|
||
justify: {
|
||
type: String,
|
||
value: ''
|
||
},
|
||
|
||
/**
|
||
* Controls how the items are aligned horizontally when they are placed
|
||
* in the middle.
|
||
* Options are `start`, `center`, `end`, `justified` and `around`.
|
||
*
|
||
* @attribute middleJustify
|
||
* @type string
|
||
* @default ''
|
||
*/
|
||
middleJustify: {
|
||
type: String,
|
||
value: ''
|
||
}
|
||
|
||
},
|
||
|
||
attached: function() {
|
||
this._observer = this._observe(this);
|
||
this._updateAriaLabelledBy();
|
||
},
|
||
|
||
detached: function() {
|
||
if (this._observer) {
|
||
this._observer.disconnect();
|
||
}
|
||
},
|
||
|
||
_observe: function(node) {
|
||
var observer = new MutationObserver(function() {
|
||
this._updateAriaLabelledBy();
|
||
}.bind(this));
|
||
observer.observe(node, {
|
||
childList: true,
|
||
subtree: true
|
||
});
|
||
return observer;
|
||
},
|
||
|
||
_updateAriaLabelledBy: function() {
|
||
var labelledBy = [];
|
||
var contents = Polymer.dom(this.root).querySelectorAll('content');
|
||
for (var content, index = 0; content = contents[index]; index++) {
|
||
var nodes = Polymer.dom(content).getDistributedNodes();
|
||
for (var node, jndex = 0; node = nodes[jndex]; jndex++) {
|
||
if (node.classList && node.classList.contains('title')) {
|
||
if (node.id) {
|
||
labelledBy.push(node.id);
|
||
} else {
|
||
var id = 'paper-toolbar-label-' + Math.floor(Math.random() * 10000);
|
||
node.id = id;
|
||
labelledBy.push(id);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (labelledBy.length > 0) {
|
||
this.setAttribute('aria-labelledby', labelledBy.join(' '));
|
||
}
|
||
},
|
||
|
||
_computeBarClassName: function(barJustify) {
|
||
var classObj = {
|
||
center: true,
|
||
horizontal: true,
|
||
layout: true,
|
||
'toolbar-tools': true
|
||
};
|
||
|
||
// If a blank string or any falsy value is given, no other class name is
|
||
// added.
|
||
if (barJustify) {
|
||
var justifyClassName = (barJustify === 'justified') ?
|
||
barJustify :
|
||
barJustify + '-justified';
|
||
|
||
classObj[justifyClassName] = true;
|
||
}
|
||
|
||
return classNames(classObj);
|
||
}
|
||
|
||
});
|
||
|
||
}());
|
||
|
||
</script>
|
||
<dom-module id="paper-menu" assetpath="bower_components/paper-menu/">
|
||
|
||
<style>
|
||
|
||
:host {
|
||
display: block;
|
||
padding: 8px 0;
|
||
|
||
background: var(--paper-menu-background-color, --primary-background-color);
|
||
color: var(--paper-menu-color, --primary-text-color);
|
||
|
||
@apply(--paper-menu);
|
||
}
|
||
|
||
/* need a wrapper element to make this higher specificity than the :host rule in paper-item */
|
||
.content > ::content > .iron-selected {
|
||
font-weight: bold;
|
||
|
||
@apply(--paper-menu-selected-item);
|
||
}
|
||
|
||
.content > ::content > [disabled] {
|
||
color: var(--paper-menu-disabled-color, --disabled-text-color);
|
||
}
|
||
|
||
.content > ::content > *:focus {
|
||
position: relative;
|
||
outline: 0;
|
||
|
||
@apply(--paper-menu-colored-focused-item);
|
||
}
|
||
|
||
.content > ::content > *:focus:after {
|
||
@apply(--layout-fit);
|
||
background: currentColor;
|
||
/* FIXME move to paper-styles for next widget */
|
||
opacity: 0.12;
|
||
content: '';
|
||
|
||
@apply(--paper-menu-colored-focused-item-after);
|
||
}
|
||
|
||
.content > ::content > *[colored]:focus:after {
|
||
opacity: 0.26;
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
|
||
<div class="content">
|
||
<content></content>
|
||
</div>
|
||
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-menu',
|
||
|
||
behaviors: [
|
||
Polymer.IronMenuBehavior
|
||
]
|
||
|
||
});
|
||
|
||
})();
|
||
|
||
</script>
|
||
<dom-module id="paper-item" assetpath="bower_components/paper-item/">
|
||
|
||
<style>
|
||
/*
|
||
@license
|
||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||
Code distributed by Google as part of the polymer project is also
|
||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||
*/
|
||
|
||
:host {
|
||
display: block;
|
||
min-height: var(--paper-item-min-height, 48px);
|
||
padding: 0px 16px;
|
||
}
|
||
|
||
:host > ::content > *:not(:first-child):not(:last-child) {
|
||
margin-right: 16px;
|
||
}
|
||
|
||
</style>
|
||
|
||
<style>
|
||
|
||
:host {
|
||
@apply(--layout-horizontal);
|
||
@apply(--layout-center);
|
||
@apply(--paper-font-subhead);
|
||
|
||
@apply(--paper-item);
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
<content></content>
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-item',
|
||
|
||
hostAttributes: {
|
||
role: 'listitem'
|
||
}
|
||
|
||
});
|
||
|
||
})();
|
||
|
||
</script>
|
||
<dom-module id="paper-icon-item" assetpath="bower_components/paper-item/">
|
||
|
||
<style>
|
||
/*
|
||
@license
|
||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||
Code distributed by Google as part of the polymer project is also
|
||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||
*/
|
||
|
||
:host {
|
||
display: block;
|
||
min-height: var(--paper-item-min-height, 48px);
|
||
padding: 0px 16px;
|
||
}
|
||
|
||
:host > ::content > *:not(:first-child):not(:last-child) {
|
||
margin-right: 16px;
|
||
}
|
||
|
||
</style>
|
||
|
||
<style>
|
||
|
||
:host {
|
||
@apply(--layout-horizontal);
|
||
@apply(--layout-center);
|
||
@apply(--paper-font-subhead);
|
||
|
||
@apply(--paper-item);
|
||
@apply(--paper-icon-item);
|
||
}
|
||
|
||
.content-icon {
|
||
width: var(--paper-item-icon-width, 56px);
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
<div id="contentIcon" class="content-icon layout horizontal center">
|
||
<content select="[item-icon]"></content>
|
||
</div>
|
||
<content></content>
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-icon-item',
|
||
|
||
hostAttributes: {
|
||
'role': 'listitem'
|
||
}
|
||
|
||
});
|
||
|
||
})();
|
||
|
||
</script>
|
||
<dom-module id="paper-icon-button" assetpath="bower_components/paper-icon-button/">
|
||
<style>
|
||
|
||
:host {
|
||
display: inline-block;
|
||
position: relative;
|
||
padding: 8px;
|
||
outline: none;
|
||
-webkit-user-select: none;
|
||
-moz-user-select: none;
|
||
-ms-user-select: none;
|
||
user-select: none;
|
||
cursor: pointer;
|
||
z-index: 0;
|
||
|
||
@apply(--paper-icon-button);
|
||
}
|
||
|
||
:host #ink {
|
||
color: var(--paper-icon-button-ink-color, --primary-text-color);
|
||
opacity: 0.6;
|
||
}
|
||
|
||
:host([disabled]) {
|
||
color: var(--paper-icon-button-disabled-text, --disabled-text-color);
|
||
pointer-events: none;
|
||
cursor: auto;
|
||
@apply(--paper-icon-button-disabled);
|
||
}
|
||
</style>
|
||
<template>
|
||
<paper-ripple id="ink" class="circle" center=""></paper-ripple>
|
||
<iron-icon id="icon" src="[[src]]" icon="[[icon]]" alt$="[[alt]]"></iron-icon>
|
||
</template>
|
||
</dom-module>
|
||
<script>
|
||
Polymer({
|
||
is: 'paper-icon-button',
|
||
|
||
hostAttributes: {
|
||
role: 'button',
|
||
tabindex: '0'
|
||
},
|
||
|
||
behaviors: [
|
||
Polymer.PaperInkyFocusBehavior
|
||
],
|
||
|
||
properties: {
|
||
/**
|
||
* The URL of an image for the icon. If the src property is specified,
|
||
* the icon property should not be.
|
||
*/
|
||
src: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* Specifies the icon name or index in the set of icons available in
|
||
* the icon's icon set. If the icon property is specified,
|
||
* the src property should not be.
|
||
*/
|
||
icon: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* Specifies the alternate text for the button, for accessibility.
|
||
*/
|
||
alt: {
|
||
type: String,
|
||
observer: "_altChanged"
|
||
}
|
||
},
|
||
|
||
_altChanged: function(newValue, oldValue) {
|
||
var label = this.getAttribute('aria-label');
|
||
|
||
// Don't stomp over a user-set aria-label.
|
||
if (!label || oldValue == label) {
|
||
this.setAttribute('aria-label', newValue);
|
||
}
|
||
}
|
||
});
|
||
</script>
|
||
<dom-module id="paper-scroll-header-panel" assetpath="bower_components/paper-scroll-header-panel/">
|
||
|
||
<style>
|
||
:host {
|
||
display: block;
|
||
position: relative;
|
||
overflow: hidden;
|
||
}
|
||
|
||
#mainContainer {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
left: 0;
|
||
box-sizing: border-box;
|
||
-moz-box-sizing: border-box;
|
||
-webkit-overflow-scrolling: touch;
|
||
overflow-x: hidden;
|
||
overflow-_y: auto;
|
||
-webkit-transform: translateZ(0);
|
||
transform: translateZ(0);
|
||
}
|
||
|
||
#headerContainer {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 0;
|
||
left: 0;
|
||
}
|
||
|
||
.bg-container {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
overflow: hidden;
|
||
}
|
||
|
||
#headerBg {
|
||
@apply(--paper-scroll-header-panel-full-header);
|
||
}
|
||
|
||
#condensedHeaderBg {
|
||
@apply(--paper-scroll-header-panel-condensed-header);
|
||
}
|
||
|
||
#headerBg, #condensedHeaderBg {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
background-repeat: no-repeat;
|
||
background-size: cover;
|
||
background-position: center center;
|
||
}
|
||
|
||
#condensedHeaderBg {
|
||
opacity: 0;
|
||
}
|
||
</style>
|
||
<template>
|
||
<div id="mainContainer">
|
||
<content id="mainContent" select=":not(paper-toolbar):not(.paper-header)"></content>
|
||
</div>
|
||
<div id="headerContainer">
|
||
<div class="bg-container">
|
||
<div id="condensedHeaderBg"></div>
|
||
<div id="headerBg"></div>
|
||
</div>
|
||
<content id="headerContent" select="paper-toolbar, .paper-header"></content>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
|
||
'use strict';
|
||
|
||
Polymer({
|
||
|
||
/**
|
||
* Fired when the content has been scrolled.
|
||
*
|
||
* @event content-scroll
|
||
*/
|
||
|
||
/**
|
||
* Fired when the header is transformed.
|
||
*
|
||
* @event paper-header-transform
|
||
*/
|
||
|
||
is: 'paper-scroll-header-panel',
|
||
|
||
behaviors: [
|
||
Polymer.IronResizableBehavior
|
||
],
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* If true, the header's height will condense to `_condensedHeaderHeight`
|
||
* as the user scrolls down from the top of the content area.
|
||
*/
|
||
condenses: {
|
||
type: Boolean,
|
||
value: false,
|
||
observer: '_condensesChanged'
|
||
},
|
||
|
||
/**
|
||
* If true, no cross-fade transition from one background to another.
|
||
*/
|
||
noDissolve: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* If true, the header doesn't slide back in when scrolling back up.
|
||
*/
|
||
noReveal: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* If true, the header is fixed to the top and never moves away.
|
||
*/
|
||
fixed: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* If true, the condensed header is always shown and does not move away.
|
||
*/
|
||
keepCondensedHeader: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* The height of the header when it is at its full size.
|
||
*
|
||
* By default, the height will be measured when it is ready. If the height
|
||
* changes later the user needs to either set this value to reflect the
|
||
* new height or invoke `measureHeaderHeight()`.
|
||
*/
|
||
headerHeight: {
|
||
type: Number,
|
||
value: 0
|
||
},
|
||
|
||
/**
|
||
* The height of the header when it is condensed.
|
||
*
|
||
* By default, `_condensedHeaderHeight` is 1/3 of `headerHeight` unless
|
||
* this is specified.
|
||
*/
|
||
condensedHeaderHeight: {
|
||
type: Number,
|
||
value: 0
|
||
},
|
||
|
||
/**
|
||
* By default, the top part of the header stays when the header is being
|
||
* condensed. Set this to true if you want the top part of the header
|
||
* to be scrolled away.
|
||
*/
|
||
scrollAwayTopbar: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
_headerMargin: {
|
||
type: Number
|
||
},
|
||
|
||
_prevScrollTop: {
|
||
type: Number
|
||
},
|
||
|
||
_y: {
|
||
type: Number
|
||
}
|
||
|
||
},
|
||
|
||
observers: [
|
||
'_setup(_headerMargin, headerHeight, fixed)',
|
||
'_headerHeightChanged(headerHeight, condensedHeaderHeight)',
|
||
'_condensedHeaderHeightChanged(headerHeight, condensedHeaderHeight)'
|
||
],
|
||
|
||
listeners: {
|
||
'iron-resize': 'measureHeaderHeight'
|
||
},
|
||
|
||
ready: function() {
|
||
this.async(this.measureHeaderHeight, 5);
|
||
this._scrollHandler = this._scroll.bind(this);
|
||
this.scroller.addEventListener('scroll', this._scrollHandler);
|
||
},
|
||
|
||
detached: function() {
|
||
this.scroller.removeEventListener('scroll', this._scrollHandler);
|
||
},
|
||
|
||
/**
|
||
* Returns the header element.
|
||
*
|
||
* @property header
|
||
* @type Object
|
||
*/
|
||
get header() {
|
||
return Polymer.dom(this.$.headerContent).getDistributedNodes()[0];
|
||
},
|
||
|
||
/**
|
||
* Returns the content element.
|
||
*
|
||
* @property content
|
||
* @type Object
|
||
*/
|
||
get content() {
|
||
return Polymer.dom(this.$.mainContent).getDistributedNodes()[0];
|
||
},
|
||
|
||
/**
|
||
* Returns the scrollable element.
|
||
*
|
||
* @property scroller
|
||
* @type Object
|
||
*/
|
||
get scroller() {
|
||
return this.$.mainContainer;
|
||
},
|
||
|
||
/**
|
||
* Invoke this to tell `paper-scroll-header-panel` to re-measure the header's
|
||
* height.
|
||
*
|
||
* @method measureHeaderHeight
|
||
*/
|
||
measureHeaderHeight: function() {
|
||
var header = this.header;
|
||
if (header && header.offsetHeight) {
|
||
this.headerHeight = header.offsetHeight;
|
||
}
|
||
},
|
||
|
||
_headerHeightChanged: function() {
|
||
if (!this.condensedHeaderHeight) {
|
||
// assume condensedHeaderHeight is 1/3 of the headerHeight
|
||
this.condensedHeaderHeight = this.headerHeight * 1 / 3;
|
||
}
|
||
},
|
||
|
||
_condensedHeaderHeightChanged: function() {
|
||
if (this.headerHeight) {
|
||
this._headerMargin = this.headerHeight - this.condensedHeaderHeight;
|
||
}
|
||
},
|
||
|
||
_condensesChanged: function() {
|
||
if (this.condenses) {
|
||
this._scroll();
|
||
} else {
|
||
// reset transform/opacity set on the header
|
||
this._condenseHeader(null);
|
||
}
|
||
},
|
||
|
||
_setup: function() {
|
||
var s = this.scroller.style;
|
||
s.paddingTop = this.fixed ? '' : this.headerHeight + 'px';
|
||
|
||
s.top = this.fixed ? this.headerHeight + 'px' : '';
|
||
|
||
if (this.fixed) {
|
||
this._transformHeader(null);
|
||
} else {
|
||
this._scroll();
|
||
}
|
||
},
|
||
|
||
_transformHeader: function(y) {
|
||
var s = this.$.headerContainer.style;
|
||
this._translateY(s, -y);
|
||
|
||
if (this.condenses) {
|
||
this._condenseHeader(y);
|
||
}
|
||
|
||
this.fire('paper-header-transform', {y: y, height: this.headerHeight,
|
||
condensedHeight: this.condensedHeaderHeight});
|
||
},
|
||
|
||
_condenseHeader: function(y) {
|
||
var reset = (y === null);
|
||
|
||
// adjust top bar in paper-header so the top bar stays at the top
|
||
if (!this.scrollAwayTopbar && this.header.$ && this.header.$.topBar) {
|
||
this._translateY(this.header.$.topBar.style,
|
||
reset ? null : Math.min(y, this._headerMargin));
|
||
}
|
||
// transition header bg
|
||
var hbg = this.$.headerBg.style;
|
||
if (!this.noDissolve) {
|
||
hbg.opacity = reset ? '' : (this._headerMargin - y) / this._headerMargin;
|
||
}
|
||
// adjust header bg so it stays at the center
|
||
this._translateY(hbg, reset ? null : y / 2);
|
||
// transition condensed header bg
|
||
if (!this.noDissolve) {
|
||
var chbg = this.$.condensedHeaderBg.style;
|
||
chbg = this.$.condensedHeaderBg.style;
|
||
chbg.opacity = reset ? '' : y / this._headerMargin;
|
||
|
||
// adjust condensed header bg so it stays at the center
|
||
this._translateY(chbg, reset ? null : y / 2);
|
||
}
|
||
},
|
||
|
||
_translateY: function(s, y) {
|
||
var t = (y === null) ? '' : 'translate3d(0, ' + y + 'px, 0)';
|
||
setTransform(s, t);
|
||
},
|
||
|
||
/** @param {Event=} event */
|
||
_scroll: function(event) {
|
||
if (!this.header) {
|
||
return;
|
||
}
|
||
|
||
var sTop = this.scroller.scrollTop;
|
||
|
||
this._y = this._y || 0;
|
||
this._prevScrollTop = this._prevScrollTop || 0;
|
||
|
||
var y = Math.min(this.keepCondensedHeader ?
|
||
this._headerMargin : this.headerHeight, Math.max(0,
|
||
(this.noReveal ? sTop : this._y + sTop - this._prevScrollTop)));
|
||
|
||
if (this.condenses && this._prevScrollTop >= sTop && sTop > this._headerMargin) {
|
||
y = Math.max(y, this._headerMargin);
|
||
}
|
||
|
||
if (!event || !this.fixed && y !== this._y) {
|
||
this._transformHeader(y);
|
||
}
|
||
|
||
this._prevScrollTop = Math.max(sTop, 0);
|
||
this._y = y;
|
||
|
||
if (event) {
|
||
this.fire('content-scroll', {target: this.scroller}, {cancelable: false});
|
||
}
|
||
}
|
||
|
||
});
|
||
|
||
//determine proper transform mechanizm
|
||
if (document.documentElement.style.transform !== undefined) {
|
||
var setTransform = function(style, string) {
|
||
style.transform = string;
|
||
}
|
||
} else {
|
||
var setTransform = function(style, string) {
|
||
style.webkitTransform = string;
|
||
}
|
||
}
|
||
|
||
})();
|
||
|
||
</script>
|
||
<dom-module id="partial-base" assetpath="layouts/">
|
||
<template>
|
||
<paper-scroll-header-panel class="fit">
|
||
<paper-toolbar>
|
||
<paper-icon-button icon="menu" hidden$="[[!narrow]]" on-click="toggleMenu"></paper-icon-button>
|
||
<div class="title">
|
||
<content select="[header-title]"></content>
|
||
</div>
|
||
<content select="[header-buttons]"></content>
|
||
</paper-toolbar>
|
||
|
||
<content></content>
|
||
</paper-scroll-header-panel>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'partial-base',
|
||
|
||
properties: {
|
||
narrow: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
},
|
||
|
||
toggleMenu: function() {
|
||
this.fire('open-menu');
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="iron-image" assetpath="bower_components/iron-image/">
|
||
|
||
<style>
|
||
|
||
:host {
|
||
display: inline-block;
|
||
overflow: hidden;
|
||
position: relative;
|
||
}
|
||
|
||
:host([sizing]) #img {
|
||
display: none;
|
||
}
|
||
|
||
#placeholder {
|
||
background-color: inherit;
|
||
opacity: 1;
|
||
}
|
||
|
||
#placeholder.faded-out {
|
||
transition: opacity 0.5s linear;
|
||
opacity: 0;
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
|
||
<img id="img" role="none" hidden$="[[_computeImageVisibility(sizing)]]">
|
||
<div id="placeholder" hidden$="[[_computePlaceholderVisibility(fade,loaded,preload)]]" class$="[[_computePlaceholderClassName(fade,loaded,preload)]]"></div>
|
||
<content></content>
|
||
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
Polymer({
|
||
|
||
is: 'iron-image',
|
||
|
||
properties: {
|
||
/**
|
||
* The URL of an image.
|
||
*/
|
||
src: {
|
||
observer: '_srcChanged',
|
||
type: String,
|
||
value: ''
|
||
},
|
||
|
||
/**
|
||
* When true, the image is prevented from loading and any placeholder is
|
||
* shown. This may be useful when a binding to the src property is known to
|
||
* be invalid, to prevent 404 requests.
|
||
*/
|
||
preventLoad: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Sets a sizing option for the image. Valid values are `contain` (full
|
||
* aspect ratio of the image is contained within the element and
|
||
* letterboxed) or `cover` (image is cropped in order to fully cover the
|
||
* bounds of the element), or `null` (default: image takes natural size).
|
||
*/
|
||
sizing: {
|
||
type: String,
|
||
value: null
|
||
},
|
||
|
||
/**
|
||
* When a sizing option is uzed (`cover` or `contain`), this determines
|
||
* how the image is aligned within the element bounds.
|
||
*/
|
||
position: {
|
||
type: String,
|
||
value: 'center'
|
||
},
|
||
|
||
/**
|
||
* When `true`, any change to the `src` property will cause the `placeholder`
|
||
* image to be shown until the
|
||
*/
|
||
preload: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* This image will be used as a background/placeholder until the src image has
|
||
* loaded. Use of a data-URI for placeholder is encouraged for instant rendering.
|
||
*/
|
||
placeholder: {
|
||
type: String,
|
||
value: null
|
||
},
|
||
|
||
/**
|
||
* When `preload` is true, setting `fade` to true will cause the image to
|
||
* fade into place.
|
||
*/
|
||
fade: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Read-only value that is true when the image is loaded.
|
||
*/
|
||
loaded: {
|
||
notify: true,
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Read-only value that tracks the loading state of the image when the `preload`
|
||
* option is used.
|
||
*/
|
||
loading: {
|
||
notify: true,
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* Can be used to set the width of image (e.g. via binding); size may also be
|
||
* set via CSS.
|
||
*/
|
||
width: {
|
||
observer: '_widthChanged',
|
||
type: Number,
|
||
value: null
|
||
},
|
||
|
||
/**
|
||
* Can be used to set the height of image (e.g. via binding); size may also be
|
||
* set via CSS.
|
||
*
|
||
* @attribute height
|
||
* @type number
|
||
* @default null
|
||
*/
|
||
height: {
|
||
observer: '_heightChanged',
|
||
type: Number,
|
||
value: null
|
||
},
|
||
|
||
_placeholderBackgroundUrl: {
|
||
type: String,
|
||
computed: '_computePlaceholderBackgroundUrl(preload,placeholder)',
|
||
observer: '_placeholderBackgroundUrlChanged'
|
||
},
|
||
|
||
requiresPreload: {
|
||
type: Boolean,
|
||
computed: '_computeRequiresPreload(preload,loaded)'
|
||
},
|
||
|
||
canLoad: {
|
||
type: Boolean,
|
||
computed: '_computeCanLoad(preventLoad, src)'
|
||
}
|
||
|
||
},
|
||
|
||
observers: [
|
||
'_transformChanged(sizing, position)',
|
||
'_loadBehaviorChanged(canLoad, preload, loaded)',
|
||
'_loadStateChanged(src, preload, loaded)',
|
||
],
|
||
|
||
ready: function() {
|
||
if (!this.hasAttribute('role')) {
|
||
this.setAttribute('role', 'img');
|
||
}
|
||
},
|
||
|
||
_computeImageVisibility: function() {
|
||
return !!this.sizing;
|
||
},
|
||
|
||
_computePlaceholderVisibility: function() {
|
||
return !this.preload || (this.loaded && !this.fade);
|
||
},
|
||
|
||
_computePlaceholderClassName: function() {
|
||
if (!this.preload) {
|
||
return '';
|
||
}
|
||
|
||
var className = 'fit';
|
||
if (this.loaded && this.fade) {
|
||
className += ' faded-out';
|
||
}
|
||
return className;
|
||
},
|
||
|
||
_computePlaceholderBackgroundUrl: function() {
|
||
if (this.preload && this.placeholder) {
|
||
return 'url(' + this.placeholder + ')';
|
||
}
|
||
|
||
return null;
|
||
},
|
||
|
||
_computeRequiresPreload: function() {
|
||
return this.preload && !this.loaded;
|
||
},
|
||
|
||
_computeCanLoad: function() {
|
||
return Boolean(!this.preventLoad && this.src);
|
||
},
|
||
|
||
_widthChanged: function() {
|
||
this.style.width = isNaN(this.width) ? this.width : this.width + 'px';
|
||
},
|
||
|
||
_heightChanged: function() {
|
||
this.style.height = isNaN(this.height) ? this.height : this.height + 'px';
|
||
},
|
||
|
||
_srcChanged: function(newSrc, oldSrc) {
|
||
if (newSrc !== oldSrc) {
|
||
this.loaded = false;
|
||
}
|
||
},
|
||
|
||
_placeholderBackgroundUrlChanged: function() {
|
||
this.$.placeholder.style.backgroundImage =
|
||
this._placeholderBackgroundUrl;
|
||
},
|
||
|
||
_transformChanged: function() {
|
||
var placeholderStyle = this.$.placeholder.style;
|
||
|
||
this.style.backgroundSize =
|
||
placeholderStyle.backgroundSize = this.sizing;
|
||
|
||
this.style.backgroundPosition =
|
||
placeholderStyle.backgroundPosition =
|
||
this.sizing ? this.position : '';
|
||
|
||
this.style.backgroundRepeat =
|
||
placeholderStyle.backgroundRepeat =
|
||
this.sizing ? 'no-repeat' : '';
|
||
},
|
||
|
||
_loadBehaviorChanged: function() {
|
||
var img;
|
||
|
||
if (!this.canLoad) {
|
||
return;
|
||
}
|
||
|
||
if (this.requiresPreload) {
|
||
img = new Image();
|
||
img.src = this.src;
|
||
|
||
this.loading = true;
|
||
|
||
img.onload = function() {
|
||
this.loading = false;
|
||
this.loaded = true;
|
||
}.bind(this);
|
||
} else {
|
||
this.loaded = true;
|
||
}
|
||
},
|
||
|
||
_loadStateChanged: function() {
|
||
if (this.requiresPreload) {
|
||
return;
|
||
}
|
||
|
||
if (this.sizing) {
|
||
this.style.backgroundImage = this.src ? 'url(' + this.src + ')': '';
|
||
} else {
|
||
this.$.img.src = this.src || '';
|
||
}
|
||
}
|
||
});
|
||
|
||
</script>
|
||
<dom-module id="domain-icon" assetpath="components/">
|
||
<template>
|
||
<iron-icon icon="[[computeIcon(domain, state)]]"></iron-icon>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var uiUtil = window.hass.uiUtil;
|
||
|
||
Polymer({
|
||
is: 'domain-icon',
|
||
|
||
properties: {
|
||
domain: {
|
||
type: String,
|
||
value: '',
|
||
},
|
||
|
||
state: {
|
||
type: String,
|
||
value: '',
|
||
},
|
||
},
|
||
|
||
computeIcon: function(domain, state) {
|
||
return uiUtil.domainIcon(domain, state);
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="state-badge" assetpath="components/">
|
||
<style>
|
||
:host {
|
||
position: relative;
|
||
display: inline-block;
|
||
width: 45px;
|
||
background-color: #4fc3f7;
|
||
color: white;
|
||
border-radius: 50%;
|
||
}
|
||
|
||
div {
|
||
height: 45px;
|
||
text-align: center;
|
||
}
|
||
|
||
iron-image {
|
||
border-radius: 50%;
|
||
}
|
||
|
||
domain-icon {
|
||
margin: 0 auto;
|
||
transition: color .3s ease-in-out;
|
||
}
|
||
|
||
/* Color the icon if light or sun is on */
|
||
domain-icon[data-domain=light][data-state=on],
|
||
domain-icon[data-domain=switch][data-state=on],
|
||
domain-icon[data-domain=sun][data-state=above_horizon] {
|
||
color: #fff176;
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<div class="layout horizontal center">
|
||
<domain-icon id="icon" domain="[[stateObj.domain]]" data-domain$="[[stateObj.domain]]" state="[[stateObj.state]]" data-state$="[[stateObj.state]]">
|
||
</domain-icon>
|
||
<template is="dom-if" if="[[stateObj.attributes.entity_picture]]">
|
||
<iron-image sizing="cover" class="fit" src$="[[stateObj.attributes.entity_picture]]"></iron-image>
|
||
</template>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
Polymer({
|
||
is: 'state-badge',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
observer: 'updateIconColor',
|
||
},
|
||
},
|
||
|
||
/**
|
||
* Called when an attribute changes that influences the color of the icon.
|
||
*/
|
||
updateIconColor: function(newVal) {
|
||
// for domain light, set color of icon to light color if available
|
||
if(newVal.domain == "light" && newVal.state == "on" &&
|
||
newVal.attributes.brightness && newVal.attributes.xy_color) {
|
||
|
||
var rgb = this.xyBriToRgb(newVal.attributes.xy_color[0],
|
||
newVal.attributes.xy_color[1],
|
||
newVal.attributes.brightness);
|
||
this.$.icon.style.color = "rgb(" + rgb.map(Math.floor).join(",") + ")";
|
||
} else {
|
||
this.$.icon.style.color = null;
|
||
}
|
||
},
|
||
|
||
// from http://stackoverflow.com/questions/22894498/philips-hue-convert-xy-from-api-to-hex-or-rgb
|
||
xyBriToRgb: function (x, y, bri) {
|
||
z = 1.0 - x - y;
|
||
Y = bri / 255.0; // Brightness of lamp
|
||
X = (Y / y) * x;
|
||
Z = (Y / y) * z;
|
||
r = X * 1.612 - Y * 0.203 - Z * 0.302;
|
||
g = -X * 0.509 + Y * 1.412 + Z * 0.066;
|
||
b = X * 0.026 - Y * 0.072 + Z * 0.962;
|
||
r = r <= 0.0031308 ? 12.92 * r : (1.0 + 0.055) * Math.pow(r, (1.0 / 2.4)) - 0.055;
|
||
g = g <= 0.0031308 ? 12.92 * g : (1.0 + 0.055) * Math.pow(g, (1.0 / 2.4)) - 0.055;
|
||
b = b <= 0.0031308 ? 12.92 * b : (1.0 + 0.055) * Math.pow(b, (1.0 / 2.4)) - 0.055;
|
||
maxValue = Math.max(r,g,b);
|
||
r /= maxValue;
|
||
g /= maxValue;
|
||
b /= maxValue;
|
||
r = r * 255; if (r < 0) { r = 255; }
|
||
g = g * 255; if (g < 0) { g = 255; }
|
||
b = b * 255; if (b < 0) { b = 255; }
|
||
return [r, g, b];
|
||
}
|
||
|
||
});
|
||
</script>
|
||
<dom-module id="relative-ha-datetime" assetpath="components/">
|
||
<template>
|
||
<span>[[relativeTime]]</span>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var UPDATE_INTERVAL = 60000; // 60 seconds
|
||
|
||
var parseDateTime = window.hass.util.parseDateTime;
|
||
|
||
Polymer({
|
||
is: 'relative-ha-datetime',
|
||
|
||
properties: {
|
||
datetime: {
|
||
type: String,
|
||
observer: 'datetimeChanged',
|
||
},
|
||
|
||
datetimeObj: {
|
||
type: Object,
|
||
observer: 'datetimeObjChanged',
|
||
},
|
||
|
||
parsedDateTime: {
|
||
type: Object,
|
||
},
|
||
|
||
relativeTime: {
|
||
type: String,
|
||
value: 'not set',
|
||
},
|
||
},
|
||
|
||
relativeTime: "",
|
||
parsedDateTime: null,
|
||
|
||
created: function() {
|
||
this.updateRelative = this.updateRelative.bind(this);
|
||
},
|
||
|
||
attached: function() {
|
||
this._interval = setInterval(this.updateRelative, UPDATE_INTERVAL);
|
||
},
|
||
|
||
detached: function() {
|
||
clearInterval(this._interval);
|
||
},
|
||
|
||
datetimeChanged: function(newVal) {
|
||
this.parsedDateTime = newVal ? parseDateTime(newVal) : null;
|
||
|
||
this.updateRelative();
|
||
},
|
||
|
||
datetimeObjChanged: function(newVal) {
|
||
this.parsedDateTime = newVal;
|
||
|
||
this.updateRelative();
|
||
},
|
||
|
||
updateRelative: function() {
|
||
this.relativeTime = this.parsedDateTime ?
|
||
moment(this.parsedDateTime).fromNow() : "";
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="state-info" assetpath="components/">
|
||
<style>
|
||
:host {
|
||
line-height: normal;
|
||
min-width: 150px;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
state-badge {
|
||
float: left;
|
||
}
|
||
|
||
.info {
|
||
margin-left: 60px;
|
||
}
|
||
|
||
.name {
|
||
text-transform: capitalize;
|
||
font-weight: 300;
|
||
font-size: 1.3rem;
|
||
text-overflow: ellipsis;
|
||
overflow-x: hidden;
|
||
}
|
||
|
||
.time-ago {
|
||
color: darkgrey;
|
||
margin-top: -2px;
|
||
font-size: 1rem;
|
||
text-overflow: ellipsis;
|
||
overflow-x: hidden;
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<div>
|
||
<state-badge state-obj="[[stateObj]]"></state-badge>
|
||
|
||
<div class="info">
|
||
<div class="name">[[stateObj.entityDisplay]]</div>
|
||
|
||
<div class="time-ago">
|
||
|
||
<relative-ha-datetime datetime-obj="[[stateObj.lastChangedAsDate]]"></relative-ha-datetime>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'state-info',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
},
|
||
},
|
||
|
||
computeTooltipLabel: function(stateObj) {
|
||
// stateObj.lastChangedAsDate | formatDateTime
|
||
return 'Label TODO';
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="state-card-display" assetpath="cards/">
|
||
<style>
|
||
.state {
|
||
margin-left: 16px;
|
||
text-transform: capitalize;
|
||
font-weight: 300;
|
||
font-size: 1.3rem;
|
||
text-align: right;
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<div class="horizontal justified layout">
|
||
<state-info state-obj="[[stateObj]]"></state-info>
|
||
<div class="state">[[stateObj.stateDisplay]]</div>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'state-card-display',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
},
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="paper-toggle-button" assetpath="bower_components/paper-toggle-button/">
|
||
|
||
<style>
|
||
/*
|
||
@license
|
||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||
Code distributed by Google as part of the polymer project is also
|
||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||
*/
|
||
|
||
:host {
|
||
display: inline-block;
|
||
}
|
||
|
||
:host([disabled]) {
|
||
pointer-events: none;
|
||
}
|
||
|
||
:host(:focus) {
|
||
outline:none;
|
||
}
|
||
|
||
:host .toggle-bar {
|
||
background-color: var(--paper-toggle-button-unchecked-bar-color, #000000);
|
||
}
|
||
|
||
:host .toggle-button {
|
||
background-color: var(--paper-toggle-button-unchecked-button-color, --paper-grey-50);
|
||
}
|
||
|
||
:host([checked]) .toggle-bar {
|
||
background-color: var(--paper-toggle-button-checked-bar-color, --google-green-500);
|
||
}
|
||
|
||
:host([checked]) .toggle-button {
|
||
background-color: var(--paper-toggle-button-checked-button-color, --google-green-500);
|
||
}
|
||
|
||
:host .toggle-ink {
|
||
color: var(--paper-toggle-button-unchecked-ink-color, --primary-text-color);
|
||
}
|
||
|
||
:host([checked]) .toggle-ink {
|
||
color: var(--paper-toggle-button-checked-ink-color, --google-green-500);
|
||
}
|
||
|
||
/* ID selectors should not be overriden by users. */
|
||
|
||
#toggleContainer {
|
||
position: relative;
|
||
width: 36px;
|
||
height: 14px;
|
||
}
|
||
|
||
#toggleBar {
|
||
position: absolute;
|
||
height: 100%;
|
||
width: 100%;
|
||
border-radius: 8px;
|
||
pointer-events: none;
|
||
opacity: 0.4;
|
||
transition: background-color linear .08s;
|
||
}
|
||
|
||
:host([checked]) #toggleBar {
|
||
opacity: 0.5;
|
||
}
|
||
|
||
:host([disabled]) #toggleBar {
|
||
background-color: #000;
|
||
opacity: 0.12;
|
||
}
|
||
|
||
#toggleButton {
|
||
position: absolute;
|
||
top: -3px;
|
||
height: 20px;
|
||
width: 20px;
|
||
border-radius: 50%;
|
||
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.6);
|
||
transition: -webkit-transform linear .08s, background-color linear .08s;
|
||
transition: transform linear .08s, background-color linear .08s;
|
||
will-change: transform;
|
||
}
|
||
|
||
#toggleButton.dragging {
|
||
-webkit-transition: none;
|
||
transition: none;
|
||
}
|
||
|
||
:host([checked]) #toggleButton {
|
||
-webkit-transform: translate(16px, 0);
|
||
transform: translate(16px, 0);
|
||
}
|
||
|
||
:host([disabled]) #toggleButton {
|
||
background-color: #bdbdbd;
|
||
opacity: 1;
|
||
}
|
||
|
||
#ink {
|
||
position: absolute;
|
||
top: -14px;
|
||
left: -14px;
|
||
width: 48px;
|
||
height: 48px;
|
||
opacity: 0.5;
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
|
||
<div id="toggleContainer">
|
||
<div id="toggleBar" class="toggle-bar"></div>
|
||
<div id="toggleButton" class="toggle-button">
|
||
<paper-ripple id="ink" class="toggle-ink circle" recenters=""></paper-ripple>
|
||
</div>
|
||
</div>
|
||
|
||
</template>
|
||
|
||
<script>
|
||
Polymer({
|
||
is: 'paper-toggle-button',
|
||
|
||
behaviors: [
|
||
Polymer.PaperInkyFocusBehavior
|
||
],
|
||
|
||
hostAttributes: {
|
||
role: 'button',
|
||
'aria-pressed': 'false',
|
||
tabindex: 0
|
||
},
|
||
|
||
properties: {
|
||
/**
|
||
* Fired when the checked state changes due to user interaction.
|
||
*
|
||
* @event change
|
||
*/
|
||
/**
|
||
* Fired when the checked state changes.
|
||
*
|
||
* @event iron-change
|
||
*/
|
||
/**
|
||
* Gets or sets the state, `true` is checked and `false` is unchecked.
|
||
*
|
||
* @attribute checked
|
||
* @type boolean
|
||
* @default false
|
||
*/
|
||
checked: {
|
||
type: Boolean,
|
||
value: false,
|
||
reflectToAttribute: true,
|
||
notify: true,
|
||
observer: '_checkedChanged'
|
||
},
|
||
|
||
/**
|
||
* If true, the button toggles the active state with each tap or press
|
||
* of the spacebar.
|
||
*
|
||
* @attribute toggles
|
||
* @type boolean
|
||
* @default true
|
||
*/
|
||
toggles: {
|
||
type: Boolean,
|
||
value: true,
|
||
reflectToAttribute: true
|
||
}
|
||
},
|
||
|
||
listeners: {
|
||
track: '_ontrack'
|
||
},
|
||
|
||
ready: function() {
|
||
this._isReady = true;
|
||
},
|
||
|
||
// button-behavior hook
|
||
_buttonStateChanged: function() {
|
||
if (this.disabled) {
|
||
return;
|
||
}
|
||
if (this._isReady) {
|
||
this.checked = this.active;
|
||
}
|
||
},
|
||
|
||
_checkedChanged: function(checked) {
|
||
this.active = this.checked;
|
||
this.fire('iron-change');
|
||
},
|
||
|
||
_ontrack: function(event) {
|
||
var track = event.detail;
|
||
if (track.state === 'start') {
|
||
this._trackStart(track);
|
||
} else if (track.state === 'track') {
|
||
this._trackMove(track);
|
||
} else if (track.state === 'end') {
|
||
this._trackEnd(track);
|
||
}
|
||
},
|
||
|
||
_trackStart: function(track) {
|
||
this._width = this.$.toggleBar.offsetWidth / 2;
|
||
/*
|
||
* keep an track-only check state to keep the dragging behavior smooth
|
||
* while toggling activations
|
||
*/
|
||
this._trackChecked = this.checked;
|
||
this.$.toggleButton.classList.add('dragging');
|
||
},
|
||
|
||
_trackMove: function(track) {
|
||
var dx = track.dx;
|
||
this._x = Math.min(this._width,
|
||
Math.max(0, this._trackChecked ? this._width + dx : dx));
|
||
this.translate3d(this._x + 'px', 0, 0, this.$.toggleButton);
|
||
this._userActivate(this._x > (this._width / 2));
|
||
},
|
||
|
||
_trackEnd: function(track) {
|
||
this.$.toggleButton.classList.remove('dragging');
|
||
this.transform('', this.$.toggleButton);
|
||
}
|
||
|
||
});
|
||
</script>
|
||
|
||
</dom-module>
|
||
<dom-module id="state-card-toggle" assetpath="cards/">
|
||
<style>
|
||
paper-toggle-button {
|
||
margin-left: 16px;
|
||
}
|
||
</style>
|
||
<template>
|
||
<div class="horizontal justified layout">
|
||
<state-info state-obj="[[stateObj]]"></state-info>
|
||
|
||
<paper-toggle-button class="self-center" checked="[[toggleChecked]]" on-change="toggleChanged" on-tap="toggleTapped">
|
||
</paper-toggle-button>
|
||
</div>
|
||
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var serviceActions = window.hass.serviceActions;
|
||
|
||
Polymer({
|
||
is: 'state-card-toggle',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
observer: 'stateObjChanged',
|
||
},
|
||
|
||
toggleChecked: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
},
|
||
|
||
ready: function() {
|
||
this.forceStateChange = this.forceStateChange.bind(this);
|
||
this.forceStateChange();
|
||
},
|
||
|
||
toggleTapped: function(ev) {
|
||
ev.stopPropagation();
|
||
},
|
||
|
||
toggleChanged: function(ev) {
|
||
var newVal = ev.target.checked;
|
||
|
||
if(newVal && this.stateObj.state === "off") {
|
||
this.turn_on();
|
||
} else if(!newVal && this.stateObj.state === "on") {
|
||
this.turn_off();
|
||
}
|
||
},
|
||
|
||
stateObjChanged: function(newVal) {
|
||
if (newVal) {
|
||
this.updateToggle(newVal);
|
||
}
|
||
},
|
||
|
||
updateToggle: function(stateObj) {
|
||
this.toggleChecked = stateObj && stateObj.state === "on";
|
||
},
|
||
|
||
forceStateChange: function() {
|
||
this.updateToggle(this.stateObj);
|
||
},
|
||
|
||
turn_on: function() {
|
||
// We call updateToggle after a successful call to re-sync the toggle
|
||
// with the state. It will be out of sync if our service call did not
|
||
// result in the entity to be turned on. Since the state is not changing,
|
||
// the resync is not called automatic.
|
||
serviceActions.callTurnOn(this.stateObj.entityId).then(this.forceStateChange);
|
||
},
|
||
|
||
turn_off: function() {
|
||
// We call updateToggle after a successful call to re-sync the toggle
|
||
// with the state. It will be out of sync if our service call did not
|
||
// result in the entity to be turned on. Since the state is not changing,
|
||
// the resync is not called automatic.
|
||
serviceActions.callTurnOff(this.stateObj.entityId).then(this.forceStateChange);
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="state-card-thermostat" assetpath="cards/">
|
||
<style>
|
||
:host {
|
||
line-height: normal;
|
||
}
|
||
|
||
.state {
|
||
margin-left: 16px;
|
||
text-align: right;
|
||
}
|
||
|
||
.target {
|
||
text-transform: capitalize;
|
||
font-weight: 300;
|
||
font-size: 1.3rem;
|
||
}
|
||
|
||
.current {
|
||
color: darkgrey;
|
||
margin-top: -2px;
|
||
font-size: 1rem;
|
||
}
|
||
</style>
|
||
<template>
|
||
<div class="horizontal justified layout">
|
||
<state-info state-obj="[[stateObj]]"></state-info>
|
||
<div class="state">
|
||
<div class="target">[[stateObj.stateDisplay]]</div>
|
||
|
||
<div class="current">
|
||
<span>Currently: </span>
|
||
<span>[[stateObj.attributes.current_temperature]]</span>
|
||
<span> </span>
|
||
<span>[[stateObj.attributes.unit_of_measurement]]</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'state-card-thermostat',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
},
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="state-card-configurator" assetpath="cards/">
|
||
<template>
|
||
<state-card-display state-obj="[[stateObj]]"></state-card-display>
|
||
|
||
|
||
<template is="dom-if" if="[[stateObj.attributes.description_image]]">
|
||
<img hidden="" src="[[stateObj.attributes.description_image]]">
|
||
</template>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'state-card-configurator',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
},
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="state-card-scene" assetpath="cards/">
|
||
<template>
|
||
<template is="dom-if" if="[[allowToggle]]">
|
||
<state-card-toggle state-obj="[[stateObj]]"></state-card-toggle>
|
||
</template>
|
||
<template is="dom-if" if="[[!allowToggle]]">
|
||
<state-card-display state-obj="[[stateObj]]"></state-card-display>
|
||
</template>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'state-card-scene',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
},
|
||
|
||
allowToggle: {
|
||
type: Boolean,
|
||
value: false,
|
||
computed: 'computeAllowToggle(stateObj)',
|
||
},
|
||
},
|
||
|
||
computeAllowToggle: function(stateObj) {
|
||
return stateObj.state === 'off' || stateObj.attributes.active_requested;
|
||
},
|
||
});
|
||
})();
|
||
</script><dom-module id="state-card-media_player" assetpath="cards/">
|
||
<style>
|
||
:host {
|
||
line-height: normal;
|
||
}
|
||
|
||
.state {
|
||
margin-left: 16px;
|
||
text-align: right;
|
||
overflow-x: hidden;
|
||
}
|
||
|
||
.main-text {
|
||
white-space: nowrap;
|
||
overflow-x: hidden;
|
||
text-overflow: ellipsis;
|
||
text-transform: capitalize;
|
||
font-weight: 300;
|
||
font-size: 1.3rem;
|
||
}
|
||
|
||
.secondary-text {
|
||
color: darkgrey;
|
||
margin-top: -2px;
|
||
font-size: 1rem;
|
||
}
|
||
</style>
|
||
<template>
|
||
<div class="horizontal justified layout">
|
||
<state-info state-obj="[[stateObj]]"></state-info>
|
||
<div class="state">
|
||
<div class="main-text">[[computePrimaryText(stateObj, isPlaying)]]</div>
|
||
<div class="secondary-text">[[computeSecondaryText(stateObj, isPlaying)]]</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var PLAYING_STATES = ['playing', 'paused'];
|
||
Polymer({
|
||
is: 'state-card-media_player',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
},
|
||
|
||
isPlaying: {
|
||
type: Boolean,
|
||
computed: 'computeIsPlaying(stateObj)',
|
||
},
|
||
},
|
||
|
||
computeIsPlaying: function(stateObj) {
|
||
return PLAYING_STATES.indexOf(stateObj.state) !== -1;
|
||
},
|
||
|
||
computePrimaryText: function(stateObj, isPlaying) {
|
||
return isPlaying ? stateObj.attributes.media_title : stateObj.stateDisplay;
|
||
},
|
||
|
||
computeSecondaryText: function(stateObj, isPlaying) {
|
||
var text;
|
||
|
||
if (stateObj.attributes.media_content_type == 'music') {
|
||
return stateObj.attributes.media_artist;
|
||
|
||
} else if (stateObj.attributes.media_content_type == 'tvshow') {
|
||
text = stateObj.attributes.media_series_title;
|
||
|
||
if (stateObj.attributes.media_season && stateObj.attributes.media_episode) {
|
||
text += ' S' + stateObj.attributes.media_season + 'E' + stateObj.attributes.media_episode;
|
||
}
|
||
return text;
|
||
|
||
} else if (stateObj.attributes.app_name) {
|
||
return stateObj.attributes.app_name;
|
||
|
||
} else {
|
||
return '';
|
||
}
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="state-card" assetpath="cards/">
|
||
<style>
|
||
:host {
|
||
border-radius: 2px;
|
||
box-shadow: rgba(0, 0, 0, 0.098) 0px 2px 4px, rgba(0, 0, 0, 0.098) 0px 0px 3px;
|
||
transition: all 0.30s ease-out;
|
||
|
||
position: relative;
|
||
background-color: white;
|
||
padding: 16px;
|
||
width: 100%;
|
||
|
||
cursor: pointer;
|
||
overflow: hidden;
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<state-card-content state-obj="[[stateObj]]"></state-card-content>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function(){
|
||
var uiActions = window.hass.uiActions;
|
||
|
||
Polymer({
|
||
is: 'state-card',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
},
|
||
},
|
||
|
||
listeners: {
|
||
'tap': 'cardTapped',
|
||
},
|
||
|
||
cardTapped: function() {
|
||
uiActions.showMoreInfoDialog(this.stateObj.entityId);
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="state-cards" assetpath="components/">
|
||
<style>
|
||
:host {
|
||
display: block;
|
||
}
|
||
|
||
@media all and (min-width: 1020px) {
|
||
.state-card {
|
||
width: calc(50% - 44px);
|
||
margin: 8px 0 0 8px;
|
||
}
|
||
}
|
||
|
||
@media all and (min-width: 1356px) {
|
||
.state-card {
|
||
width: calc(33% - 38px);
|
||
}
|
||
}
|
||
|
||
@media all and (min-width: 1706px) {
|
||
.state-card {
|
||
width: calc(25% - 42px);
|
||
}
|
||
}
|
||
|
||
.no-states-content {
|
||
max-width: 500px;
|
||
background-color: #fff;
|
||
border-radius: 2px;
|
||
box-shadow: rgba(0, 0, 0, 0.098) 0px 2px 4px, rgba(0, 0, 0, 0.098) 0px 0px 3px;
|
||
padding: 0 16px 8px;
|
||
margin: 16px;
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<div class="horizontal layout wrap">
|
||
|
||
<template is="dom-repeat" items="{{states}}">
|
||
<state-card class="state-card" state-obj="[[item]]"></state-card>
|
||
</template>
|
||
|
||
<template is="dom-if" if="[[computeEmptyStates(states)]]">
|
||
<div class="no-states-content">
|
||
<h3>Hi there!</h3>
|
||
<p>
|
||
It looks like we have nothing to show you right now. It could be that we have not yet discovered all your devices but it is more likely that you have not configured Home Assistant yet.
|
||
</p>
|
||
<p>
|
||
Please see the <a href="https://home-assistant.io/getting-started/" target="_blank">Getting Started</a> section on how to setup your devices.
|
||
</p>
|
||
</div>
|
||
</template>
|
||
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'state-cards',
|
||
|
||
properties: {
|
||
states: {
|
||
type: Array,
|
||
value: [],
|
||
},
|
||
},
|
||
|
||
computeEmptyStates: function(states) {
|
||
return states.length === 0;
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="partial-states" assetpath="layouts/">
|
||
<style>
|
||
.content-wrapper {
|
||
position: relative;
|
||
height: 100%;
|
||
background-color: #E5E5E5;
|
||
}
|
||
|
||
.content-wrapper ::content .listening {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
z-index: 1;
|
||
|
||
border-radius: 2px;
|
||
box-shadow: rgba(0, 0, 0, 0.098) 0px 2px 4px, rgba(0, 0, 0, 0.098) 0px 0px 3px;
|
||
padding: 16px;
|
||
background-color: rgba(255, 255, 255, 0.95);
|
||
line-height: 2em;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.interimTranscript {
|
||
color: darkgrey;
|
||
}
|
||
|
||
.listening paper-spinner {
|
||
float: right;
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<partial-base narrow="[[narrow]]">
|
||
<span header-title="">{{headerTitle}}</span>
|
||
|
||
<span header-buttons="">
|
||
<paper-icon-button icon="refresh" class$="[[computeRefreshButtonClass(isFetching)]]" on-click="handleRefresh" hidden$="[[isStreaming]]"></paper-icon-button>
|
||
<paper-icon-button icon="[[listenButtonIcon]]" hidden$="{{!canListen}}" on-click="handleListenClick"></paper-icon-button>
|
||
</span>
|
||
|
||
<div class="content-wrapper">
|
||
<div class="listening" hidden$="[[!showListenInterface]]" on-click="handleListenClick">
|
||
<iron-icon icon="av:hearing"></iron-icon> <span>{{finalTranscript}}</span>
|
||
<span class="interimTranscript">[[interimTranscript]]</span>
|
||
<paper-spinner active$="[[isTransmitting]]" alt="Sending voice command to Home Assistant"></paper-spinner>
|
||
</div>
|
||
|
||
<state-cards states="[[states]]">
|
||
<h3>Hi there!</h3>
|
||
<p>
|
||
It looks like we have nothing to show you right now. It could be that we have not yet discovered all your devices but it is more likely that you have not configured Home Assistant yet.
|
||
</p>
|
||
<p>
|
||
Please see the <a href="https://home-assistant.io/getting-started/" target="_blank">Getting Started</a> section on how to setup your devices.
|
||
</p>
|
||
</state-cards>
|
||
</div>
|
||
</partial-base>
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function(){
|
||
var syncActions = window.hass.syncActions;
|
||
var voiceActions = window.hass.voiceActions;
|
||
var stateStore = window.hass.stateStore;
|
||
var uiConstants = window.hass.uiConstants;
|
||
|
||
Polymer({
|
||
is: 'partial-states',
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
/**
|
||
* Title to show in the header
|
||
*/
|
||
headerTitle: {
|
||
type: String,
|
||
value: 'States',
|
||
},
|
||
|
||
/**
|
||
* If header is to be shown in narrow mode.
|
||
*/
|
||
narrow: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
filter: {
|
||
type: String,
|
||
value: null,
|
||
observer: 'filterChanged',
|
||
},
|
||
|
||
voiceSupported: {
|
||
type: Boolean,
|
||
value: voiceActions.isSupported(),
|
||
},
|
||
|
||
isFetching: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
isStreaming: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
canListen: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
isListening: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
isTransmitting: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
interimTranscript: {
|
||
type: String,
|
||
value: '',
|
||
},
|
||
|
||
finalTranscript: {
|
||
type: String,
|
||
value: '',
|
||
},
|
||
|
||
listenButtonIcon: {
|
||
type: String,
|
||
computed: 'computeListenButtonIcon(isListening)'
|
||
},
|
||
|
||
showListenInterface: {
|
||
type: Boolean,
|
||
computed: 'computeShowListenInterface(isListening,isTransmitting)'
|
||
}
|
||
},
|
||
|
||
componentStoreChanged: function(componentStore) {
|
||
this.canListen = this.voiceSupported &&
|
||
componentStore.isLoaded('conversation');
|
||
},
|
||
|
||
stateStoreChanged: function() {
|
||
this.refreshStates();
|
||
},
|
||
|
||
syncStoreChanged: function(syncStore) {
|
||
this.isFetching = syncStore.isFetching;
|
||
},
|
||
|
||
streamStoreChanged: function(streamStore) {
|
||
this.isStreaming = streamStore.isStreaming;
|
||
},
|
||
|
||
voiceStoreChanged: function(voiceStore) {
|
||
this.isListening = voiceStore.isListening;
|
||
this.isTransmitting = voiceStore.isTransmitting;
|
||
this.finalTranscript = voiceStore.finalTranscript;
|
||
this.interimTranscript = voiceStore.interimTranscript.slice(
|
||
this.finalTranscript.length);
|
||
},
|
||
|
||
filterChanged: function() {
|
||
this.refreshStates();
|
||
|
||
this.headerTitle = uiConstants.STATE_FILTERS[this.filter] || 'States';
|
||
},
|
||
|
||
refreshStates: function() {
|
||
var states;
|
||
|
||
if (this.filter) {
|
||
var filter = this.filter;
|
||
states = stateStore.all.filter(function(state) {
|
||
return state.domain === filter;
|
||
});
|
||
|
||
} else {
|
||
// all but the STATE_FILTER keys
|
||
states = stateStore.all.filter(function(state) {
|
||
return !(state.domain in uiConstants.STATE_FILTERS);
|
||
});
|
||
}
|
||
|
||
this.states = states.toArray().filter(
|
||
function (el) {return !el.attributes.hidden;});
|
||
},
|
||
|
||
handleRefresh: function() {
|
||
syncActions.fetchAll();
|
||
},
|
||
|
||
handleListenClick: function() {
|
||
if (this.isListening) {
|
||
voiceActions.stop();
|
||
} else {
|
||
voiceActions.listen();
|
||
}
|
||
},
|
||
|
||
computeListenButtonIcon: function(isListening) {
|
||
return isListening ? 'av:mic-off' : 'av:mic';
|
||
},
|
||
|
||
computeShowListenInterface: function(isListening,isTransmitting) {
|
||
return isListening || isTransmitting;
|
||
},
|
||
|
||
computeRefreshButtonClass: function(isFetching) {
|
||
if (isFetching) {
|
||
return 'ha-spin';
|
||
}
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="paper-input-char-counter" assetpath="bower_components/paper-input/">
|
||
|
||
<style>
|
||
|
||
:host {
|
||
display: inline-block;
|
||
float: right;
|
||
|
||
@apply(--paper-font-caption);
|
||
@apply(--paper-input-char-counter);
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
|
||
<span>[[_charCounterStr]]</span>
|
||
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-input-char-counter',
|
||
|
||
behaviors: [
|
||
Polymer.PaperInputAddonBehavior
|
||
],
|
||
|
||
properties: {
|
||
|
||
_charCounterStr: {
|
||
type: String,
|
||
value: '0'
|
||
}
|
||
|
||
},
|
||
|
||
update: function(state) {
|
||
if (!state.inputElement) {
|
||
return;
|
||
}
|
||
|
||
state.value = state.value || '';
|
||
|
||
// Account for the textarea's new lines.
|
||
var str = state.value.replace(/(\r\n|\n|\r)/g, '--').length;
|
||
|
||
if (state.inputElement.hasAttribute('maxlength')) {
|
||
str += '/' + state.inputElement.getAttribute('maxlength');
|
||
}
|
||
this._charCounterStr = str;
|
||
}
|
||
|
||
});
|
||
|
||
})();
|
||
|
||
</script>
|
||
<dom-module id="paper-input" assetpath="bower_components/paper-input/">
|
||
|
||
<style>
|
||
|
||
:host {
|
||
display: block;
|
||
}
|
||
|
||
input::-webkit-input-placeholder {
|
||
color: var(--paper-input-container-color, --secondary-text-color);
|
||
}
|
||
|
||
input:-moz-placeholder {
|
||
color: var(--paper-input-container-color, --secondary-text-color);
|
||
}
|
||
|
||
input::-moz-placeholder {
|
||
color: var(--paper-input-container-color, --secondary-text-color);
|
||
}
|
||
|
||
input:-ms-input-placeholder {
|
||
color: var(--paper-input-container-color, --secondary-text-color);
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
|
||
<paper-input-container no-label-float="[[noLabelFloat]]" always-float-label="[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]" auto-validate$="[[autoValidate]]" disabled$="[[disabled]]" invalid="[[invalid]]">
|
||
|
||
<label hidden$="[[!label]]">[[label]]</label>
|
||
|
||
<input is="iron-input" id="input" aria-labelledby$="[[_ariaLabelledBy]]" aria-describedby$="[[_ariaDescribedBy]]" disabled$="[[disabled]]" bind-value="{{value}}" invalid="{{invalid}}" prevent-invalid-input="[[preventInvalidInput]]" allowed-pattern="[[allowedPattern]]" validator="[[validator]]" type$="[[type]]" pattern$="[[pattern]]" maxlength$="[[maxlength]]" required$="[[required]]" autocomplete$="[[autocomplete]]" autofocus$="[[autofocus]]" inputmode$="[[inputmode]]" minlength$="[[minlength]]" name$="[[name]]" placeholder$="[[placeholder]]" readonly$="[[readonly]]" size$="[[size]]">
|
||
|
||
<template is="dom-if" if="[[errorMessage]]">
|
||
<paper-input-error>[[errorMessage]]</paper-input-error>
|
||
</template>
|
||
|
||
<template is="dom-if" if="[[charCounter]]">
|
||
<paper-input-char-counter></paper-input-char-counter>
|
||
</template>
|
||
|
||
</paper-input-container>
|
||
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-input',
|
||
|
||
behaviors: [
|
||
Polymer.PaperInputBehavior,
|
||
Polymer.IronFormElementBehavior
|
||
]
|
||
|
||
})
|
||
|
||
})();
|
||
|
||
</script>
|
||
<dom-module id="display-time" assetpath="components/">
|
||
<template>[[computeTime(dateObj)]]</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var uiUtil = window.hass.uiUtil;
|
||
|
||
Polymer({
|
||
is: 'display-time',
|
||
|
||
properties: {
|
||
dateObj: {
|
||
type: Object,
|
||
},
|
||
},
|
||
|
||
computeTime: function(dateObj) {
|
||
return dateObj ? uiUtil.formatTime(dateObj) : '';
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="logbook-entry" assetpath="components/">
|
||
<style>
|
||
:host {
|
||
display: block;
|
||
line-height: 2em;
|
||
}
|
||
|
||
display-time {
|
||
width: 55px;
|
||
font-size: .8em;
|
||
color: var(--secondary-text-color);
|
||
}
|
||
|
||
domain-icon {
|
||
margin: 0 8px 0 16px;
|
||
color: var(--primary-text-color);
|
||
}
|
||
|
||
.name {
|
||
text-transform: capitalize;
|
||
}
|
||
|
||
.message {
|
||
color: var(--primary-text-color);
|
||
}
|
||
|
||
a {
|
||
color: var(--accent-color);
|
||
}
|
||
</style>
|
||
<template>
|
||
<div class="horizontal layout">
|
||
<display-time date-obj="[[entryObj.when]]"></display-time>
|
||
<domain-icon domain="[[entryObj.domain]]" class="icon"></domain-icon>
|
||
<div class="message" flex="">
|
||
<template is="dom-if" if="[[!entryObj.entityId]]">
|
||
<span class="name">[[entryObj.name]]</span>
|
||
</template>
|
||
<template is="dom-if" if="[[entryObj.entityId]]">
|
||
<a href="#" on-click="entityClicked" class="name">[[entryObj.name]]</a>
|
||
<span> </span>
|
||
</template>
|
||
<span>[[entryObj.message]]</span>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var uiActions = window.hass.uiActions;
|
||
|
||
Polymer({
|
||
is: 'logbook-entry',
|
||
|
||
entityClicked: function(ev) {
|
||
ev.preventDefault();
|
||
uiActions.showMoreInfoDialog(this.entryObj.entityId);
|
||
}
|
||
});
|
||
|
||
})();
|
||
</script>
|
||
<dom-module id="ha-logbook" assetpath="components/">
|
||
<style>
|
||
:host {
|
||
display: block;
|
||
padding: 16px;
|
||
}
|
||
</style>
|
||
<template>
|
||
<template is="dom-if" if="[[!entries]]">
|
||
No logbook entries found.
|
||
</template>
|
||
<template is="dom-if" if="[[entries]]">
|
||
<template is="dom-repeat" items="[[entries]]">
|
||
<logbook-entry entry-obj="[[item]]"></logbook-entry>
|
||
</template>
|
||
</template>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'ha-logbook',
|
||
|
||
properties: {
|
||
entries: {
|
||
type: Object,
|
||
value: [],
|
||
},
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="loading-box" assetpath="components/">
|
||
<style>
|
||
.text {
|
||
display: inline-block;
|
||
line-height: 28px;
|
||
vertical-align: top;
|
||
margin-left: 8px;
|
||
}
|
||
</style>
|
||
<template>
|
||
<div layout="horizontal">
|
||
<paper-spinner active="true"></paper-spinner>
|
||
<div class="text"><content></content>…</div>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'loading-box',
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="partial-logbook" assetpath="layouts/">
|
||
<style>
|
||
.selected-date-container {
|
||
padding: 0 16px;
|
||
}
|
||
|
||
paper-input {
|
||
max-width: 200px;
|
||
}
|
||
</style>
|
||
<template>
|
||
<partial-base narrow="[[narrow]]">
|
||
<span header-title="">Logbook</span>
|
||
|
||
<paper-icon-button icon="refresh" header-buttons="" on-click="handleRefresh"></paper-icon-button>
|
||
|
||
<div>
|
||
<div class="selected-date-container">
|
||
<paper-input label="Showing entries for" on-click="handleShowDatePicker" value="[[computeDateCaption(selectedDate)]]"></paper-input>
|
||
|
||
<loading-box hidden$="[[!isLoading]]">Loading logbook entries</loading-box>
|
||
</div>
|
||
<ha-logbook entries="[[entries]]" hidden$="[[isLoading]]"></ha-logbook>
|
||
</div>
|
||
</partial-base>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var storeListenerMixIn = window.hass.storeListenerMixIn;
|
||
var logbookActions = window.hass.logbookActions;
|
||
var logbookStore = window.hass.logbookStore;
|
||
var uiActions = window.hass.uiActions;
|
||
|
||
function date_to_str(date) {
|
||
return date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate();
|
||
}
|
||
|
||
Polymer({
|
||
is: 'partial-logbook',
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
narrow: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
selectedDate: {
|
||
type: String,
|
||
value: null,
|
||
observer: 'fetchIfNeeded',
|
||
},
|
||
|
||
isLoading: {
|
||
type: Boolean,
|
||
value: true,
|
||
},
|
||
|
||
entries: {
|
||
type: Array,
|
||
value: null,
|
||
},
|
||
},
|
||
|
||
logbookStoreChanged: function() {
|
||
this.isLoading = this.fetchIfNeeded();
|
||
var entries = logbookStore.all.toArray();
|
||
this.entries = entries.length > 0 ? entries : false;
|
||
},
|
||
|
||
computeDateCaption: function(selectedDate) {
|
||
return selectedDate || 'today';
|
||
},
|
||
|
||
fetchIfNeeded: function() {
|
||
if (logbookStore.shouldFetch(this.selectedDate)) {
|
||
this.isLoading = true;
|
||
logbookActions.fetch(this.selectedDate);
|
||
return true;
|
||
}
|
||
return false;
|
||
},
|
||
|
||
handleShowDatePicker: function() {
|
||
uiActions.showDatePicker(function(selectedDate) {
|
||
this.selectedDate = date_to_str(selectedDate);
|
||
}.bind(this), this.selectedDate);
|
||
},
|
||
|
||
handleRefresh: function() {
|
||
logbookActions.fetch(this.selectedDate);
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module is="state-history-chart-timeline">
|
||
<style>
|
||
:host {
|
||
display: block;
|
||
}
|
||
</style>
|
||
<template></template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'state-history-chart-timeline',
|
||
|
||
properties: {
|
||
data: {
|
||
type: Object,
|
||
observer: 'dataChanged',
|
||
},
|
||
|
||
isAttached: {
|
||
type: Boolean,
|
||
value: false,
|
||
observer: 'dataChanged',
|
||
},
|
||
},
|
||
|
||
attached: function() {
|
||
this.isAttached = true;
|
||
},
|
||
|
||
dataChanged: function() {
|
||
this.drawChart();
|
||
},
|
||
|
||
drawChart: function() {
|
||
if (!this.isAttached) {
|
||
return;
|
||
}
|
||
|
||
var root = Polymer.dom(this);
|
||
var stateHistory = this.data;
|
||
|
||
while (root.lastChild) {
|
||
root.removeChild(root.lastChild);
|
||
}
|
||
|
||
if (!stateHistory || stateHistory.length === 0) {
|
||
return;
|
||
}
|
||
|
||
var chart = new google.visualization.Timeline(this);
|
||
var dataTable = new google.visualization.DataTable();
|
||
|
||
dataTable.addColumn({ type: 'string', id: 'Entity' });
|
||
dataTable.addColumn({ type: 'string', id: 'State' });
|
||
dataTable.addColumn({ type: 'date', id: 'Start' });
|
||
dataTable.addColumn({ type: 'date', id: 'End' });
|
||
|
||
var addRow = function(entityDisplay, stateStr, start, end) {
|
||
stateStr = stateStr.replace(/_/g, ' ');
|
||
dataTable.addRow([entityDisplay, stateStr, start, end]);
|
||
};
|
||
|
||
var startTime = new Date(stateHistory.map(function(stateInfo) {
|
||
return stateInfo[0].lastChangedAsDate;
|
||
}).reduce(function(prev, cur) {
|
||
return Math.min(prev, cur);
|
||
}, new Date()));
|
||
|
||
// end time is Math.min(curTime, start time + 1 day)
|
||
var endTime = new Date(startTime);
|
||
endTime.setDate(endTime.getDate()+1);
|
||
if (endTime > new Date()) {
|
||
endTime = new Date();
|
||
}
|
||
|
||
var numTimelines = 0;
|
||
// stateHistory is a list of lists of sorted state objects
|
||
stateHistory.forEach(function(stateInfo) {
|
||
if(stateInfo.length === 0) return;
|
||
|
||
var entityDisplay = stateInfo[0].entityDisplay;
|
||
var newLastChanged, prevState = null, prevLastChanged = null;
|
||
|
||
stateInfo.forEach(function(state) {
|
||
if (prevState !== null && state.state !== prevState) {
|
||
newLastChanged = state.lastChangedAsDate;
|
||
|
||
addRow(entityDisplay, prevState, prevLastChanged, newLastChanged);
|
||
|
||
prevState = state.state;
|
||
prevLastChanged = newLastChanged;
|
||
} else if (prevState === null) {
|
||
prevState = state.state;
|
||
prevLastChanged = state.lastChangedAsDate;
|
||
}
|
||
});
|
||
|
||
addRow(entityDisplay, prevState, prevLastChanged, endTime);
|
||
numTimelines++;
|
||
}.bind(this));
|
||
|
||
chart.draw(dataTable, {
|
||
height: 55 + numTimelines * 42,
|
||
|
||
timeline: {
|
||
showRowLabels: stateHistory.length > 1
|
||
},
|
||
|
||
hAxis: {
|
||
format: 'H:mm'
|
||
},
|
||
});
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="state-history-charts" assetpath="components/">
|
||
<style>
|
||
:host {
|
||
display: block;
|
||
}
|
||
|
||
.loading-container {
|
||
text-align: center;
|
||
padding: 8px;
|
||
}
|
||
|
||
.loading {
|
||
height: 0px;
|
||
overflow: hidden;
|
||
}
|
||
</style>
|
||
<template>
|
||
<google-legacy-loader on-api-load="googleApiLoaded"></google-legacy-loader>
|
||
|
||
<div hidden$="{{!isLoading}}" class="loading-container">
|
||
<loading-box>Updating history data</loading-box>
|
||
</div>
|
||
|
||
<div class$="[[computeContentClasses(isLoading)]]">
|
||
<template is="dom-if" if="[[computeIsEmpty(stateHistory)]]">
|
||
No state history found.
|
||
</template>
|
||
|
||
<state-history-chart-timeline data="[[groupedStateHistory.timeline]]" is-single-device="[[isSingleDevice]]">
|
||
</state-history-chart-timeline>
|
||
|
||
<template is="dom-repeat" items="[[groupedStateHistory.line]]">
|
||
<state-history-chart-line unit="[[extractUnit(item)]]" data="[[extractData(item)]]" is-single-device="[[isSingleDevice]]">
|
||
</state-history-chart-line>
|
||
</template>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'state-history-charts',
|
||
|
||
properties: {
|
||
stateHistory: {
|
||
type: Object,
|
||
},
|
||
|
||
isLoadingData: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
apiLoaded: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
isLoading: {
|
||
type: Boolean,
|
||
computed: 'computeIsLoading(isLoadingData, apiLoaded)',
|
||
},
|
||
|
||
groupedStateHistory: {
|
||
type: Object,
|
||
computed: 'computeGroupedStateHistory(isLoading, stateHistory)',
|
||
},
|
||
|
||
isSingleDevice: {
|
||
type: Boolean,
|
||
computed: 'computeIsSingleDevice(stateHistory)',
|
||
},
|
||
},
|
||
|
||
computeIsSingleDevice: function(stateHistory) {
|
||
return stateHistory && stateHistory.length == 1;
|
||
},
|
||
|
||
computeGroupedStateHistory: function(isLoading, stateHistory) {
|
||
var lineChartDevices = {};
|
||
var timelineDevices = [];
|
||
|
||
if (isLoading || !stateHistory) {
|
||
return {line: unitStates, timeline: timelineDevices};
|
||
}
|
||
|
||
stateHistory.forEach(function(stateInfo) {
|
||
if (!stateInfo || stateInfo.length === 0) {
|
||
return;
|
||
}
|
||
|
||
var unit;
|
||
|
||
for (var i = 0; i < stateInfo.length && !unit; i++) {
|
||
unit = stateInfo[i].attributes.unit_of_measurement;
|
||
}
|
||
|
||
if (unit) {
|
||
if (!(unit in lineChartDevices)) {
|
||
lineChartDevices[unit] = [stateInfo];
|
||
} else {
|
||
lineChartDevices[unit].push(stateInfo);
|
||
}
|
||
} else {
|
||
timelineDevices.push(stateInfo);
|
||
}
|
||
});
|
||
|
||
timelineDevices = timelineDevices.length > 0 && timelineDevices;
|
||
|
||
var unitStates = Object.keys(lineChartDevices).map(function(unit) {
|
||
return [unit, lineChartDevices[unit]]; });
|
||
|
||
return {line: unitStates, timeline: timelineDevices};
|
||
},
|
||
|
||
googleApiLoaded: function() {
|
||
google.load("visualization", "1", {
|
||
packages: ["timeline", "corechart"],
|
||
callback: function() {
|
||
this.apiLoaded = true;
|
||
}.bind(this)
|
||
});
|
||
},
|
||
|
||
computeContentClasses: function(isLoading) {
|
||
return isLoading ? 'loading' : '';
|
||
},
|
||
|
||
computeIsLoading: function(isLoadingData, apiLoaded) {
|
||
return isLoadingData || !apiLoaded;
|
||
},
|
||
|
||
computeIsEmpty: function(stateHistory) {
|
||
return stateHistory && stateHistory.length === 0;
|
||
},
|
||
|
||
extractUnit: function(arr) {
|
||
return arr[0];
|
||
},
|
||
|
||
extractData: function(arr) {
|
||
return arr[1];
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="partial-history" assetpath="layouts/">
|
||
<style>
|
||
.content {
|
||
background-color: white;
|
||
}
|
||
|
||
.content.wide {
|
||
padding: 8px;
|
||
}
|
||
|
||
paper-input {
|
||
max-width: 200px;
|
||
}
|
||
|
||
.narrow paper-input {
|
||
margin-left: 8px;
|
||
}
|
||
</style>
|
||
<template>
|
||
<partial-base narrow="[[narrow]]">
|
||
<span header-title="">History</span>
|
||
|
||
<paper-icon-button icon="refresh" header-buttons="" on-click="handleRefreshClick"></paper-icon-button>
|
||
|
||
<div class$="[[computeContentClasses(narrow)]]">
|
||
<paper-input label="Showing entries for" on-click="handleShowDatePicker" value="[[computeDateCaption(selectedDate)]]"></paper-input>
|
||
|
||
<state-history-charts state-history="[[stateHistory]]" is-loading-data="[[isLoadingData]]"></state-history-charts>
|
||
</div>
|
||
</partial-base>
|
||
</template>
|
||
</dom-module>
|
||
<script>
|
||
(function() {
|
||
var stateHistoryActions = window.hass.stateHistoryActions;
|
||
var stateHistoryStore = window.hass.stateHistoryStore;
|
||
var uiActions = window.hass.uiActions;
|
||
|
||
function date_to_str(date) {
|
||
return date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate();
|
||
}
|
||
|
||
Polymer({
|
||
is: 'partial-history',
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
narrow: {
|
||
type: Boolean,
|
||
},
|
||
|
||
stateHistory: {
|
||
type: Object,
|
||
},
|
||
|
||
isLoadingData: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
selectedDate: {
|
||
type: String,
|
||
value: null,
|
||
observer: 'fetchIfNeeded',
|
||
},
|
||
},
|
||
|
||
stateHistoryStoreChanged: function() {
|
||
this.isLoadingData = this.fetchIfNeeded();
|
||
this.stateHistory = this.isLoadingData ?
|
||
[] : stateHistoryStore.all(this.selectedDate);
|
||
},
|
||
|
||
computeDateCaption: function(selectedDate) {
|
||
return selectedDate || 'today';
|
||
},
|
||
|
||
fetchIfNeeded: function() {
|
||
if (stateHistoryStore.shouldFetch(this.selectedDate)) {
|
||
this.isLoadingData = true;
|
||
stateHistoryActions.fetchAll(this.selectedDate);
|
||
return true;
|
||
}
|
||
return false;
|
||
},
|
||
|
||
handleRefreshClick: function() {
|
||
this.isLoadingData = true;
|
||
stateHistoryActions.fetchAll(this.selectedDate);
|
||
},
|
||
|
||
handleShowDatePicker: function() {
|
||
uiActions.showDatePicker(function(selectedDate) {
|
||
this.selectedDate = date_to_str(selectedDate);
|
||
}.bind(this), this.selectedDate);
|
||
},
|
||
|
||
computeContentClasses: function(narrow) {
|
||
return 'flex content ' + (narrow ? 'narrow' : 'wide');
|
||
},
|
||
});
|
||
})();
|
||
</script><dom-module id="iron-autogrow-textarea" assetpath="bower_components/iron-autogrow-textarea/">
|
||
|
||
<style>
|
||
:host {
|
||
display: inline-block;
|
||
position: relative;
|
||
width: 400px;
|
||
border: 1px solid;
|
||
padding: 2px;
|
||
-moz-appearance: textarea;
|
||
-webkit-appearance: textarea;
|
||
}
|
||
|
||
.mirror-text {
|
||
visibility: hidden;
|
||
word-wrap: break-word;
|
||
}
|
||
|
||
textarea {
|
||
position: relative;
|
||
outline: none;
|
||
border: none;
|
||
resize: none;
|
||
background: inherit;
|
||
/* see comments in template */
|
||
width: 100%;
|
||
height: 100%;
|
||
font-size: inherit;
|
||
font-family: inherit;
|
||
}
|
||
|
||
::content textarea:invalid {
|
||
box-shadow: none;
|
||
}
|
||
|
||
</style>
|
||
<template>
|
||
|
||
<div id="mirror" class="mirror-text" aria-hidden="true"> </div>
|
||
|
||
|
||
<div class="textarea-container fit">
|
||
<textarea id="textarea" autocomplete$="[[autocomplete]]" autofocus$="[[autofocus]]" inputmode$="[[inputmode]]" name$="[[name]]" placeholder$="[[placeholder]]" readonly$="[[readonly]]" required$="[[required]]" rows$="[[rows]]" maxlength$="[[maxlength]]"></textarea>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
|
||
Polymer({
|
||
|
||
is: 'iron-autogrow-textarea',
|
||
|
||
behaviors: [
|
||
Polymer.IronValidatableBehavior
|
||
],
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* Use this property instead of `value` for two-way data binding.
|
||
*/
|
||
bindValue: {
|
||
observer: '_bindValueChanged',
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* The initial number of rows.
|
||
*
|
||
* @attribute rows
|
||
* @type number
|
||
* @default 1
|
||
*/
|
||
rows: {
|
||
type: Number,
|
||
value: 1,
|
||
observer: '_updateCached'
|
||
},
|
||
|
||
/**
|
||
* The maximum number of rows this element can grow to until it
|
||
* scrolls. 0 means no maximum.
|
||
*
|
||
* @attribute maxRows
|
||
* @type number
|
||
* @default 0
|
||
*/
|
||
maxRows: {
|
||
type: Number,
|
||
value: 0,
|
||
observer: '_updateCached'
|
||
},
|
||
|
||
/**
|
||
* Bound to the textarea's `autocomplete` attribute.
|
||
*/
|
||
autocomplete: {
|
||
type: String,
|
||
value: 'off'
|
||
},
|
||
|
||
/**
|
||
* Bound to the textarea's `autofocus` attribute.
|
||
*/
|
||
autofocus: {
|
||
type: String,
|
||
value: 'off'
|
||
},
|
||
|
||
/**
|
||
* Bound to the textarea's `inputmode` attribute.
|
||
*/
|
||
inputmode: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* Bound to the textarea's `name` attribute.
|
||
*/
|
||
name: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* Bound to the textarea's `placeholder` attribute.
|
||
*/
|
||
placeholder: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* Bound to the textarea's `readonly` attribute.
|
||
*/
|
||
readonly: {
|
||
type: String
|
||
},
|
||
|
||
/**
|
||
* Set to true to mark the textarea as required.
|
||
*/
|
||
required: {
|
||
type: Boolean
|
||
},
|
||
|
||
/**
|
||
* The maximum length of the input value.
|
||
*/
|
||
maxlength: {
|
||
type: Number
|
||
}
|
||
|
||
},
|
||
|
||
listeners: {
|
||
'input': '_onInput'
|
||
},
|
||
|
||
/**
|
||
* Returns the underlying textarea.
|
||
*/
|
||
get textarea() {
|
||
return this.$.textarea;
|
||
},
|
||
|
||
_update: function() {
|
||
this.$.mirror.innerHTML = this._valueForMirror();
|
||
|
||
var textarea = this.textarea;
|
||
// If the value of the textarea was updated imperatively, then we
|
||
// need to manually update bindValue as well.
|
||
if (textarea && this.bindValue != textarea.value) {
|
||
this.bindValue = textarea.value;
|
||
}
|
||
},
|
||
|
||
_bindValueChanged: function() {
|
||
var textarea = this.textarea;
|
||
if (!textarea) {
|
||
return;
|
||
}
|
||
|
||
textarea.value = this.bindValue;
|
||
this._update();
|
||
// manually notify because we don't want to notify until after setting value
|
||
this.fire('bind-value-changed', {value: this.bindValue});
|
||
},
|
||
|
||
_onInput: function(event) {
|
||
this.bindValue = event.path ? event.path[0].value : event.target.value;
|
||
this._update();
|
||
},
|
||
|
||
_constrain: function(tokens) {
|
||
var _tokens;
|
||
tokens = tokens || [''];
|
||
// Enforce the min and max heights for a multiline input to avoid measurement
|
||
if (this.maxRows > 0 && tokens.length > this.maxRows) {
|
||
_tokens = tokens.slice(0, this.maxRows);
|
||
} else {
|
||
_tokens = tokens.slice(0);
|
||
}
|
||
while (this.rows > 0 && _tokens.length < this.rows) {
|
||
_tokens.push('');
|
||
}
|
||
return _tokens.join('<br>') + ' ';
|
||
},
|
||
|
||
_valueForMirror: function() {
|
||
var input = this.textarea;
|
||
if (!input) {
|
||
return;
|
||
}
|
||
this.tokens = (input && input.value) ? input.value.replace(/&/gm, '&').replace(/"/gm, '"').replace(/'/gm, ''').replace(/</gm, '<').replace(/>/gm, '>').split('\n') : [''];
|
||
return this._constrain(this.tokens);
|
||
},
|
||
|
||
_updateCached: function() {
|
||
this.$.mirror.innerHTML = this._constrain(this.tokens);
|
||
}
|
||
})
|
||
</script>
|
||
</dom-module><dom-module id="paper-textarea" assetpath="bower_components/paper-input/">
|
||
<template>
|
||
|
||
<paper-input-container no-label-float$="[[noLabelFloat]]" always-float-label="[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]" auto-validate$="[[autoValidate]]" disabled$="[[disabled]]" invalid="[[invalid]]">
|
||
|
||
<label hidden$="[[!label]]">[[label]]</label>
|
||
|
||
<iron-autogrow-textarea id="input" class="paper-input-input" bind-value="{{value}}" autocomplete$="[[autocomplete]]" autofocus$="[[autofocus]]" inputmode$="[[inputmode]]" name$="[[name]]" placeholder$="[[placeholder]]" readonly$="[[readonly]]" required$="[[required]]" maxlength$="[[maxlength]]"></iron-autogrow-textarea>
|
||
|
||
<template is="dom-if" if="[[errorMessage]]">
|
||
<paper-input-error>[[errorMessage]]</paper-input-error>
|
||
</template>
|
||
|
||
<template is="dom-if" if="[[charCounter]]">
|
||
<paper-input-char-counter></paper-input-char-counter>
|
||
</template>
|
||
|
||
</paper-input-container>
|
||
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-textarea',
|
||
|
||
behaviors: [
|
||
Polymer.PaperInputBehavior,
|
||
Polymer.IronFormElementBehavior
|
||
],
|
||
|
||
properties: {
|
||
|
||
_ariaLabelledBy: {
|
||
observer: '_ariaLabelledByChanged',
|
||
type: String
|
||
},
|
||
|
||
_ariaDescribedBy: {
|
||
observer: '_ariaDescribedByChanged',
|
||
type: String
|
||
}
|
||
|
||
},
|
||
|
||
_ariaLabelledByChanged: function(ariaLabelledBy) {
|
||
this.$.input.textarea.setAttribute('aria-labelledby', ariaLabelledBy);
|
||
},
|
||
|
||
_ariaDescribedByChanged: function(ariaDescribedBy) {
|
||
this.$.input.textarea.setAttribute('aria-describedby', ariaDescribedBy);
|
||
}
|
||
|
||
});
|
||
|
||
})();
|
||
|
||
</script>
|
||
<dom-module id="services-list" assetpath="components/">
|
||
<style>
|
||
ul {
|
||
margin: 0;
|
||
padding: 0;
|
||
}
|
||
|
||
li {
|
||
list-style: none;
|
||
line-height: 2em;
|
||
}
|
||
|
||
a {
|
||
color: var(--accent-color);
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<ul>
|
||
<template is="dom-repeat" items="[[domains]]" as="domain">
|
||
<template is="dom-repeat" items="[[computeServices(domain)]]" as="service">
|
||
<li><a href="#" on-click="serviceClicked">
|
||
<span>[[domain]]</span>/<span>[[service]]</span>
|
||
</a></li>
|
||
</template>
|
||
</template>
|
||
</ul>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'services-list',
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
domains: {
|
||
type: Array,
|
||
value: [],
|
||
},
|
||
|
||
services: {
|
||
type: Object,
|
||
},
|
||
},
|
||
|
||
computeServices: function(domain) {
|
||
return this.services.get(domain).toArray();
|
||
},
|
||
|
||
serviceStoreChanged: function(serviceStore) {
|
||
this.services = serviceStore.all;
|
||
this.domains = this.services.keySeq().sort().toArray();
|
||
},
|
||
|
||
serviceClicked: function(ev) {
|
||
ev.preventDefault();
|
||
this.fire(
|
||
'service-selected', {domain: ev.model.domain, service: ev.model.service});
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="partial-dev-call-service" assetpath="layouts/">
|
||
<style>
|
||
.form {
|
||
padding: 24px;
|
||
background-color: white;
|
||
}
|
||
|
||
.ha-form {
|
||
margin-right: 16px;
|
||
}
|
||
</style>
|
||
<template>
|
||
<partial-base narrow="[[narrow]]">
|
||
<span header-title="">Call Service</span>
|
||
|
||
<div class="form fit">
|
||
<p>
|
||
Call a service from a component.
|
||
</p>
|
||
|
||
<div class$="[[computeFormClasses(narrow)]]">
|
||
<div class="ha-form flex">
|
||
<paper-input label="Domain" autofocus="" value="{{domain}}"></paper-input>
|
||
<paper-input label="Service" value="{{service}}"></paper-input>
|
||
<paper-textarea label="Service Data (JSON, optional)" value="{{serviceData}}"></paper-textarea>
|
||
<paper-button on-click="callService" raised="">Call Service</paper-button>
|
||
</div>
|
||
|
||
<div>
|
||
<h4>Available services:</h4>
|
||
<services-list on-service-selected="serviceSelected"></services-list>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</partial-base>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var serviceActions = window.hass.serviceActions;
|
||
|
||
Polymer({
|
||
is: 'partial-dev-call-service',
|
||
|
||
properties: {
|
||
narrow: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
domain: {
|
||
type: String,
|
||
value: '',
|
||
},
|
||
|
||
service: {
|
||
type: String,
|
||
value: '',
|
||
},
|
||
|
||
serviceData: {
|
||
type: String,
|
||
value: '',
|
||
},
|
||
},
|
||
|
||
serviceSelected: function(ev) {
|
||
this.domain = ev.detail.domain;
|
||
this.service = ev.detail.service;
|
||
},
|
||
|
||
callService: function() {
|
||
var serviceData;
|
||
|
||
try {
|
||
serviceData = this.serviceData ? JSON.parse(this.serviceData): {};
|
||
} catch (err) {
|
||
alert("Error parsing JSON: " + err);
|
||
return;
|
||
}
|
||
|
||
serviceActions.callService(this.domain, this.service, serviceData);
|
||
},
|
||
|
||
computeFormClasses: function(narrow) {
|
||
return 'layout ' + (narrow ? 'vertical' : 'horizontal');
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="events-list" assetpath="components/">
|
||
<style>
|
||
ul {
|
||
margin: 0;
|
||
padding: 0;
|
||
}
|
||
|
||
li {
|
||
list-style: none;
|
||
line-height: 2em;
|
||
}
|
||
|
||
a {
|
||
color: var(--accent-color);
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<ul>
|
||
<template is="dom-repeat" items="[[events]]" as="event">
|
||
<li>
|
||
<a href="#" on-click="eventSelected">{{event.event}}</a>
|
||
<span> (</span><span>{{event.listener_count}}</span><span> listeners)</span>
|
||
</li>
|
||
</template>
|
||
</ul>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'events-list',
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
events: {
|
||
type: Array,
|
||
value: [],
|
||
},
|
||
},
|
||
|
||
eventStoreChanged: function(eventStore) {
|
||
this.events = eventStore.all.toArray();
|
||
},
|
||
|
||
eventSelected: function(ev) {
|
||
ev.preventDefault();
|
||
this.fire('event-selected', {eventType: ev.model.event.event});
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="partial-dev-fire-event" assetpath="layouts/">
|
||
<style>
|
||
.form {
|
||
padding: 24px;
|
||
background-color: white;
|
||
}
|
||
|
||
.ha-form {
|
||
margin-right: 16px;
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<partial-base narrow="{{narrow}}">
|
||
<span header-title="">Fire Event</span>
|
||
|
||
<div class="form fit">
|
||
<p>
|
||
Fire an event on the event bus.
|
||
</p>
|
||
|
||
<div class$="[[computeFormClasses(narrow)]]">
|
||
<div class="ha-form flex">
|
||
<paper-input label="Event Type" autofocus="" required="" value="{{eventType}}"></paper-input>
|
||
<paper-textarea label="Event Data (JSON, optional)" value="{{eventData}}"></paper-textarea>
|
||
<paper-button on-click="fireEvent" raised="">Fire Event</paper-button>
|
||
</div>
|
||
|
||
<div>
|
||
<h4>Available events:</h4>
|
||
<events-list on-event-selected="eventSelected">
|
||
</events-list></div>
|
||
</div>
|
||
</div>
|
||
</partial-base>
|
||
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var eventActions = window.hass.eventActions;
|
||
|
||
Polymer({
|
||
is: 'partial-dev-fire-event',
|
||
|
||
properties: {
|
||
eventType: {
|
||
type: String,
|
||
value: '',
|
||
},
|
||
|
||
eventData: {
|
||
type: String,
|
||
value: '',
|
||
},
|
||
},
|
||
|
||
eventSelected: function(ev) {
|
||
this.eventType = ev.detail.eventType;
|
||
},
|
||
|
||
fireEvent: function() {
|
||
var eventData;
|
||
|
||
try {
|
||
eventData = this.eventData ? JSON.parse(this.eventData) : {};
|
||
} catch (err) {
|
||
alert("Error parsing JSON: " + err);
|
||
return;
|
||
}
|
||
|
||
eventActions.fire(this.eventType, eventData);
|
||
},
|
||
|
||
computeFormClasses: function(narrow) {
|
||
return 'layout ' + (narrow ? 'vertical' : 'horizontal');
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="entity-list" assetpath="components/">
|
||
<style>
|
||
ul {
|
||
margin: 0;
|
||
padding: 0;
|
||
}
|
||
|
||
li {
|
||
list-style: none;
|
||
line-height: 2em;
|
||
}
|
||
|
||
a {
|
||
color: var(--accent-color);
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<ul>
|
||
<template is="dom-repeat" items="[[entities]]" as="entity">
|
||
<li><a href="#" on-click="entitySelected">[[entity]]</a></li>
|
||
</template>
|
||
</ul>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'entity-list',
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
entities: {
|
||
type: Array,
|
||
value: [],
|
||
},
|
||
},
|
||
|
||
stateStoreChanged: function(stateStore) {
|
||
this.entities = stateStore.entityIDs.toArray();
|
||
},
|
||
|
||
entitySelected: function(ev) {
|
||
ev.preventDefault();
|
||
this.fire('entity-selected', {entityId: ev.model.entity});
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="partial-dev-set-state" assetpath="layouts/">
|
||
<style>
|
||
.form {
|
||
padding: 24px;
|
||
background-color: white;
|
||
}
|
||
|
||
.ha-form {
|
||
margin-right: 16px;
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<partial-base narrow="[[narrow]]">
|
||
<span header-title="">Set State</span>
|
||
|
||
<div class="form fit">
|
||
<div>
|
||
Set the representation of a device within Home Assistant.<br>
|
||
This will not communicate with the actual device.
|
||
</div>
|
||
|
||
<div class$="[[computeFormClasses(narrow)]]">
|
||
<div class="ha-form flex">
|
||
<paper-input label="Entity ID" autofocus="" required="" value="{{entityId}}"></paper-input>
|
||
<paper-input label="State" required="" value="{{state}}"></paper-input>
|
||
<paper-textarea label="State attributes (JSON, optional)" value="{{stateAttributes}}"></paper-textarea>
|
||
<paper-button on-click="handleSetState" raised="">Set State</paper-button>
|
||
</div>
|
||
|
||
<div class="sidebar">
|
||
<h4>Current entities:</h4>
|
||
<entity-list on-entity-selected="entitySelected"></entity-list>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</partial-base>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var stateStore = window.hass.stateStore;
|
||
var stateActions = window.hass.stateActions;
|
||
|
||
Polymer({
|
||
is: 'partial-dev-set-state',
|
||
|
||
properties: {
|
||
entityId: {
|
||
type: String,
|
||
value: '',
|
||
},
|
||
|
||
state: {
|
||
type: String,
|
||
value: '',
|
||
},
|
||
|
||
stateAttributes: {
|
||
type: String,
|
||
value: '',
|
||
},
|
||
},
|
||
|
||
setStateData: function(stateData) {
|
||
var value = stateData ? JSON.stringify(stateData, null, ' ') : "";
|
||
|
||
this.$.inputData.value = value;
|
||
|
||
// not according to the spec but it works...
|
||
this.$.inputDataWrapper.update(this.$.inputData);
|
||
},
|
||
|
||
entitySelected: function(ev) {
|
||
var state = stateStore.get(ev.detail.entityId);
|
||
|
||
this.entityId = state.entityId;
|
||
this.state = state.state;
|
||
this.stateAttributes = JSON.stringify(state.attributes, null, ' ');
|
||
},
|
||
|
||
handleSetState: function() {
|
||
var attr;
|
||
try {
|
||
attr = this.stateAttributes ? JSON.parse(this.stateAttributes) : {};
|
||
} catch (err) {
|
||
alert("Error parsing JSON: " + err);
|
||
return;
|
||
}
|
||
|
||
stateActions.set(this.entityId, this.state, attr);
|
||
},
|
||
|
||
computeFormClasses: function(narrow) {
|
||
return 'layout ' + (narrow ? 'vertical' : 'horizontal');
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="iron-a11y-announcer" assetpath="bower_components/iron-a11y-announcer/">
|
||
<style>
|
||
:host {
|
||
display: inline-block;
|
||
position: fixed;
|
||
clip: rect(0px,0px,0px,0px);
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<span aria-live$="[[mode]]">[[_text]]</span>
|
||
</template>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
'use strict';
|
||
|
||
Polymer.IronA11yAnnouncer = Polymer({
|
||
is: 'iron-a11y-announcer',
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The value of mode is used to set the `aria-live` attribute
|
||
* for the element that will be announced. Valid values are: `off`,
|
||
* `polite` and `assertive`.
|
||
*/
|
||
mode: {
|
||
type: String,
|
||
value: 'polite'
|
||
},
|
||
|
||
_text: {
|
||
type: String,
|
||
value: ''
|
||
}
|
||
},
|
||
|
||
created: function() {
|
||
if (!Polymer.IronA11yAnnouncer.instance) {
|
||
Polymer.IronA11yAnnouncer.instance = this;
|
||
}
|
||
|
||
document.body.addEventListener('iron-announce', this._onIronAnnounce.bind(this));
|
||
},
|
||
|
||
/**
|
||
* Cause a text string to be announced by screen readers.
|
||
*
|
||
* @param {string} text The text that should be announced.
|
||
*/
|
||
announce: function(text) {
|
||
this._text = '';
|
||
this.async(function() {
|
||
this._text = text;
|
||
}, 100);
|
||
},
|
||
|
||
_onIronAnnounce: function(event) {
|
||
if (event.detail && event.detail.text) {
|
||
this.announce(event.detail.text);
|
||
}
|
||
}
|
||
});
|
||
|
||
Polymer.IronA11yAnnouncer.instance = null;
|
||
|
||
Polymer.IronA11yAnnouncer.requestAvailability = function() {
|
||
if (!Polymer.IronA11yAnnouncer.instance) {
|
||
document.createElement('iron-a11y-announcer');
|
||
}
|
||
|
||
document.body.appendChild(Polymer.IronA11yAnnouncer.instance);
|
||
};
|
||
})();
|
||
|
||
</script>
|
||
</dom-module>
|
||
<dom-module id="paper-toast" assetpath="bower_components/paper-toast/">
|
||
<style>
|
||
:host {
|
||
display: inline-block;
|
||
position: fixed;
|
||
|
||
background: #323232;
|
||
color: #f1f1f1;
|
||
min-height: 48px;
|
||
min-width: 288px;
|
||
padding: 16px 24px 12px;
|
||
box-sizing: border-box;
|
||
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
|
||
border-radius: 2px;
|
||
bottom: 12px;
|
||
left: 12px;
|
||
font-size: 14px;
|
||
cursor: default;
|
||
|
||
-webkit-transition: visibility 0.3s, -webkit-transform 0.3s;
|
||
transition: visibility 0.3s, transform 0.3s;
|
||
|
||
-webkit-transform: translateY(100px);
|
||
transform: translateY(100px);
|
||
|
||
visibility: hidden;
|
||
}
|
||
|
||
:host(.capsule) {
|
||
border-radius: 24px;
|
||
}
|
||
|
||
:host(.fit-bottom) {
|
||
bottom: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
min-width: 0;
|
||
border-radius: 0;
|
||
}
|
||
|
||
:host(.paper-toast-open){
|
||
visibility: visible;
|
||
|
||
-webkit-transform: translateY(0px);
|
||
transform: translateY(0px);
|
||
}
|
||
</style>
|
||
<template>
|
||
<span id="label">{{text}}</span>
|
||
<content></content>
|
||
</template>
|
||
</dom-module>
|
||
<script>
|
||
(function() {
|
||
|
||
var PaperToast = Polymer({
|
||
is: 'paper-toast',
|
||
|
||
properties: {
|
||
/**
|
||
* The duration in milliseconds to show the toast.
|
||
*/
|
||
duration: {
|
||
type: Number,
|
||
value: 3000
|
||
},
|
||
|
||
/**
|
||
* The text to display in the toast.
|
||
*/
|
||
text: {
|
||
type: String,
|
||
value: ""
|
||
},
|
||
|
||
/**
|
||
* True if the toast is currently visible.
|
||
*/
|
||
visible: {
|
||
type: Boolean,
|
||
readOnly: true,
|
||
value: false,
|
||
observer: '_visibleChanged'
|
||
}
|
||
},
|
||
|
||
created: function() {
|
||
Polymer.IronA11yAnnouncer.requestAvailability();
|
||
},
|
||
|
||
ready: function() {
|
||
this.async(function() {
|
||
this.hide();
|
||
});
|
||
},
|
||
|
||
/**
|
||
* Show the toast.
|
||
* @method show
|
||
*/
|
||
show: function() {
|
||
if (PaperToast.currentToast) {
|
||
PaperToast.currentToast.hide();
|
||
}
|
||
PaperToast.currentToast = this;
|
||
this.removeAttribute('aria-hidden');
|
||
this._setVisible(true);
|
||
this.fire('iron-announce', {
|
||
text: this.text
|
||
});
|
||
this.debounce('hide', this.hide, this.duration);
|
||
},
|
||
|
||
/**
|
||
* Hide the toast
|
||
*/
|
||
hide: function() {
|
||
this.setAttribute('aria-hidden', 'true');
|
||
this._setVisible(false);
|
||
},
|
||
|
||
/**
|
||
* Toggle the opened state of the toast.
|
||
* @method toggle
|
||
*/
|
||
toggle: function() {
|
||
if (!this.visible) {
|
||
this.show();
|
||
} else {
|
||
this.hide();
|
||
}
|
||
},
|
||
|
||
_visibleChanged: function(visible) {
|
||
this.toggleClass('paper-toast-open', visible);
|
||
}
|
||
});
|
||
|
||
PaperToast.currentToast = null;
|
||
|
||
})();
|
||
</script>
|
||
<dom-module id="notification-manager" assetpath="managers/">
|
||
<style>
|
||
paper-toast {
|
||
z-index: 1;
|
||
}
|
||
</style>
|
||
<template>
|
||
<paper-toast id="toast" text="{{text}}"></paper-toast>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'notification-manager',
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
text: {
|
||
type: String,
|
||
value: '',
|
||
},
|
||
|
||
lastId: {
|
||
type: Number,
|
||
},
|
||
},
|
||
|
||
notificationStoreChanged: function(notificationStore) {
|
||
if (notificationStore.hasNewNotifications(this.lastId)) {
|
||
var notification = notificationStore.lastNotification;
|
||
|
||
this.lastId = notification.id;
|
||
this.text = notification.message;
|
||
|
||
this.$.toast.show();
|
||
}
|
||
},
|
||
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="iron-overlay-backdrop" assetpath="bower_components/iron-overlay-behavior/">
|
||
|
||
<style>
|
||
|
||
:host {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100vw;
|
||
height: 100vh;
|
||
background-color: var(--iron-overlay-backdrop-background-color, #000);
|
||
opacity: 0;
|
||
transition: opacity 0.2s;
|
||
|
||
@apply(--iron-overlay-backdrop);
|
||
}
|
||
|
||
:host([opened]) {
|
||
opacity: var(--iron-overlay-backdrop-opacity, 0.6);
|
||
|
||
@apply(--iron-overlay-backdrop-opened);
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
<content></content>
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
Polymer({
|
||
|
||
is: 'iron-overlay-backdrop',
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* Returns true if the backdrop is opened.
|
||
*/
|
||
opened: {
|
||
readOnly: true,
|
||
reflectToAttribute: true,
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
_manager: {
|
||
type: Object,
|
||
value: Polymer.IronOverlayManager
|
||
}
|
||
|
||
},
|
||
|
||
/**
|
||
* Appends the backdrop to document body and sets its `z-index` to be below the latest overlay.
|
||
*/
|
||
prepare: function() {
|
||
if (!this.parentNode) {
|
||
Polymer.dom(document.body).appendChild(this);
|
||
this.style.zIndex = this._manager.currentOverlayZ() - 1;
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Shows the backdrop if needed.
|
||
*/
|
||
open: function() {
|
||
// only need to make the backdrop visible if this is called by the first overlay with a backdrop
|
||
if (this._manager.getBackdrops().length < 2) {
|
||
this._setOpened(true);
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Hides the backdrop if needed.
|
||
*/
|
||
close: function() {
|
||
// only need to make the backdrop invisible if this is called by the last overlay with a backdrop
|
||
if (this._manager.getBackdrops().length < 2) {
|
||
this._setOpened(false);
|
||
}
|
||
},
|
||
|
||
/**
|
||
* Removes the backdrop from document body if needed.
|
||
*/
|
||
complete: function() {
|
||
// only remove the backdrop if there are no more overlays with backdrops
|
||
if (this._manager.getBackdrops().length === 0 && this.parentNode) {
|
||
Polymer.dom(this.parentNode).removeChild(this);
|
||
}
|
||
}
|
||
|
||
});
|
||
|
||
})();
|
||
|
||
</script>
|
||
<dom-module id="paper-dialog" assetpath="bower_components/paper-dialog/">
|
||
|
||
<style>
|
||
/*
|
||
@license
|
||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||
Code distributed by Google as part of the polymer project is also
|
||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||
*/
|
||
|
||
:host {
|
||
display: block;
|
||
margin: 24px 40px;
|
||
|
||
background: var(--paper-dialog-background-color, --primary-background-color);
|
||
color: var(--paper-dialog-color, --primary-text-color);
|
||
|
||
@apply(--layout-scroll);
|
||
@apply(--paper-font-body1);
|
||
@apply(--shadow-elevation-16dp);
|
||
@apply(--paper-dialog);
|
||
}
|
||
|
||
:host > ::content > * {
|
||
margin-top: 20px;
|
||
padding: 0 24px;
|
||
}
|
||
|
||
:host > ::content > .no-padding {
|
||
padding: 0;
|
||
};
|
||
|
||
:host > ::content > *:first-child {
|
||
margin-top: 24px;
|
||
}
|
||
|
||
:host > ::content > *:last-child {
|
||
margin-bottom: 24px;
|
||
}
|
||
|
||
:host > ::content h2 {
|
||
position: relative;
|
||
margin: 0;
|
||
@apply(--paper-font-title);
|
||
|
||
@apply(--paper-dialog-title);
|
||
}
|
||
|
||
:host > ::content .buttons {
|
||
position: relative;
|
||
padding: 8px 8px 8px 24px;
|
||
margin: 0;
|
||
|
||
color: var(--paper-dialog-button-color, --default-primary-color);
|
||
|
||
@apply(--layout-horizontal);
|
||
@apply(--layout-end-justified);
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
<content></content>
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-dialog',
|
||
|
||
behaviors: [
|
||
Polymer.PaperDialogBehavior,
|
||
Polymer.NeonAnimationRunnerBehavior
|
||
],
|
||
|
||
listeners: {
|
||
'neon-animation-finish': '_onNeonAnimationFinish'
|
||
},
|
||
|
||
_renderOpened: function() {
|
||
if (this.withBackdrop) {
|
||
this.backdropElement.open();
|
||
}
|
||
this.playAnimation('entry');
|
||
},
|
||
|
||
_renderClosed: function() {
|
||
if (this.withBackdrop) {
|
||
this.backdropElement.close();
|
||
}
|
||
this.playAnimation('exit');
|
||
},
|
||
|
||
_onNeonAnimationFinish: function() {
|
||
if (this.opened) {
|
||
this._finishRenderOpened();
|
||
} else {
|
||
this._finishRenderClosed();
|
||
}
|
||
}
|
||
|
||
});
|
||
|
||
})();
|
||
|
||
</script>
|
||
<dom-module id="neon-animated-pages" assetpath="bower_components/neon-animation/">
|
||
|
||
<style>
|
||
|
||
:host {
|
||
display: block;
|
||
position: relative;
|
||
}
|
||
|
||
:host > ::content > * {
|
||
@apply(--layout-fit);
|
||
height: 100%;
|
||
}
|
||
|
||
:host > ::content > :not(.iron-selected):not(.neon-animating) {
|
||
display: none !important;
|
||
}
|
||
|
||
:host > ::content > .neon-animating {
|
||
pointer-events: none;
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
<content id="content"></content>
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
|
||
Polymer({
|
||
|
||
is: 'neon-animated-pages',
|
||
|
||
behaviors: [
|
||
Polymer.IronResizableBehavior,
|
||
Polymer.IronSelectableBehavior,
|
||
Polymer.NeonAnimationRunnerBehavior
|
||
],
|
||
|
||
properties: {
|
||
|
||
activateEvent: {
|
||
type: String,
|
||
value: ''
|
||
},
|
||
|
||
// if true, the initial page selection will also be animated according to its animation config.
|
||
animateInitialSelection: {
|
||
type: Boolean,
|
||
value: false
|
||
}
|
||
|
||
},
|
||
|
||
observers: [
|
||
'_selectedChanged(selected)'
|
||
],
|
||
|
||
listeners: {
|
||
'neon-animation-finish': '_onNeonAnimationFinish'
|
||
},
|
||
|
||
_selectedChanged: function(selected) {
|
||
|
||
var selectedPage = this.selectedItem;
|
||
var oldPage = this._prevSelected || false;
|
||
this._prevSelected = selectedPage;
|
||
|
||
// on initial load and if animateInitialSelection is negated, simply display selectedPage.
|
||
if (!oldPage && !this.animateInitialSelection) {
|
||
this._completeSelectedChanged();
|
||
return;
|
||
}
|
||
|
||
// insert safari fix.
|
||
this.animationConfig = [{
|
||
name: 'opaque-animation',
|
||
node: selectedPage
|
||
}];
|
||
|
||
// configure selectedPage animations.
|
||
if (this.entryAnimation) {
|
||
this.animationConfig.push({
|
||
name: this.entryAnimation,
|
||
node: selectedPage
|
||
});
|
||
} else {
|
||
if (selectedPage.getAnimationConfig) {
|
||
this.animationConfig.push({
|
||
animatable: selectedPage,
|
||
type: 'entry'
|
||
});
|
||
}
|
||
}
|
||
|
||
// configure oldPage animations iff exists.
|
||
if (oldPage) {
|
||
|
||
// cancel the currently running animation if one is ongoing.
|
||
if (oldPage.classList.contains('neon-animating')) {
|
||
this._squelchNextFinishEvent = true;
|
||
this.cancelAnimation();
|
||
this._completeSelectedChanged();
|
||
}
|
||
|
||
// configure the animation.
|
||
if (this.exitAnimation) {
|
||
this.animationConfig.push({
|
||
name: this.exitAnimation,
|
||
node: oldPage
|
||
});
|
||
} else {
|
||
if (oldPage.getAnimationConfig) {
|
||
this.animationConfig.push({
|
||
animatable: oldPage,
|
||
type: 'exit'
|
||
});
|
||
}
|
||
}
|
||
|
||
// display the oldPage during the transition.
|
||
oldPage.classList.add('neon-animating');
|
||
}
|
||
|
||
// display the selectedPage during the transition.
|
||
selectedPage.classList.add('neon-animating');
|
||
|
||
// actually run the animations.
|
||
if (this.animationConfig.length > 1) {
|
||
|
||
// on first load, ensure we run animations only after element is attached.
|
||
if (!this.isAttached) {
|
||
this.async(function () {
|
||
this.playAnimation(null, {
|
||
fromPage: null,
|
||
toPage: selectedPage
|
||
});
|
||
});
|
||
|
||
} else {
|
||
this.playAnimation(null, {
|
||
fromPage: oldPage,
|
||
toPage: selectedPage
|
||
});
|
||
}
|
||
|
||
} else {
|
||
this._completeSelectedChanged(oldPage, selectedPage);
|
||
}
|
||
},
|
||
|
||
_completeSelectedChanged: function(oldPage, selectedPage) {
|
||
if (selectedPage) {
|
||
selectedPage.classList.remove('neon-animating');
|
||
}
|
||
if (oldPage) {
|
||
oldPage.classList.remove('neon-animating');
|
||
}
|
||
if (!selectedPage || !oldPage) {
|
||
var nodes = Polymer.dom(this.$.content).getDistributedNodes();
|
||
for (var node, index = 0; node = nodes[index]; index++) {
|
||
node.classList && node.classList.remove('neon-animating');
|
||
}
|
||
}
|
||
this.async(this.notifyResize);
|
||
},
|
||
|
||
_onNeonAnimationFinish: function(event) {
|
||
if (this._squelchNextFinishEvent) {
|
||
this._squelchNextFinishEvent = false;
|
||
return;
|
||
}
|
||
this._completeSelectedChanged(event.detail.fromPage, event.detail.toPage);
|
||
}
|
||
|
||
})
|
||
|
||
})();
|
||
</script>
|
||
<dom-module id="paper-date-picker" assetpath="bower_components/paper-date-picker/">
|
||
<style is="custom-style">
|
||
:host {
|
||
display: inline-block;
|
||
position: relative;
|
||
height: 250px;
|
||
width: 300px;
|
||
}
|
||
|
||
#container{
|
||
height: 100%;
|
||
width: 100%;
|
||
overflow-x: hidden;
|
||
overflow-y: auto;
|
||
padding: 0px 9px;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
#container::-webkit-scrollbar {
|
||
width: 4px;
|
||
}
|
||
|
||
#container::-webkit-scrollbar-track {
|
||
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
|
||
-webkit-border-radius: 10px;
|
||
border-radius: 10px;
|
||
}
|
||
|
||
#container::-webkit-scrollbar-thumb {
|
||
-webkit-border-radius: 10px;
|
||
border-radius: 10px;
|
||
background: rgba(0,0,0,0.1);
|
||
}
|
||
|
||
#container::-webkit-scrollbar-thumb:window-inactive {
|
||
background: rgba(255,0,0,0.2);
|
||
}
|
||
|
||
.days{
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
width: 100%;
|
||
align-content: stretch;
|
||
min-height: 210px;
|
||
}
|
||
|
||
.day{
|
||
width: calc(14% - 6px);
|
||
text-align: center;
|
||
margin: 3px;
|
||
font-size: 13px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.day[data-date]{
|
||
cursor: pointer;
|
||
}
|
||
|
||
.day span{
|
||
display: block;
|
||
width: 30px;
|
||
height: 30px;
|
||
line-height: 30px;
|
||
}
|
||
|
||
.day.highlighted span{
|
||
border: 1px solid var(--app-primary-color, --paper-teal-500);
|
||
border-radius: 100%;
|
||
}
|
||
|
||
.day.selected span{
|
||
background-color: var(--app-primary-color, --paper-teal-500);
|
||
color: white;
|
||
border-radius: 100%;
|
||
}
|
||
|
||
.day.title{
|
||
padding-top: 0px;
|
||
padding-bottom: 4px;
|
||
font-weight: bold;
|
||
color: rgba(0,0,0,.6);
|
||
cursor: default;
|
||
}
|
||
|
||
.day[enabled='false']{
|
||
pointer-events: none;
|
||
color: rgba(0,0,0,.3);
|
||
}
|
||
|
||
h1{
|
||
text-align: center;
|
||
font-size: 13px;
|
||
color: rgba(0,0,0,.8);
|
||
margin: 0px;
|
||
padding: 0.67em 0px;
|
||
}
|
||
</style>
|
||
<template>
|
||
<div id="container" on-scroll="_scrollFinished">
|
||
<template is="dom-repeat" items="[[_months]]" as="month">
|
||
<div class="month" data-month$="[[month.number]]" data-year$="[[month.year]]">
|
||
<h1>[[month.name]]</h1>
|
||
<div class="days">
|
||
|
||
<template is="dom-repeat" items="[[_weekDayNames]]" as="name">
|
||
<div class="day title">[[name]]</div>
|
||
</template>
|
||
|
||
<template is="dom-repeat" items="[[month.days]]" as="day">
|
||
<template is="dom-if" if="[[!day]]">
|
||
<div class="day"></div>
|
||
</template>
|
||
|
||
<template is="dom-if" if="[[day]]">
|
||
<div on-click="_pickDate" class$="[[_dayClassName(day, month, _currentDay, _currentMonth, _currentYear, _highlightDateTable)]]" enabled$="[[day.enabled]]" data-date$="[[day.n]]" data-month$="[[month.number]]" data-year$="[[month.year]]">
|
||
<span>[[day.day]]</span>
|
||
</div>
|
||
</template>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
|
||
//temp function before I think of better solution
|
||
var cleanMonthDateArrayObject = function(obj) {
|
||
var m = obj[0] % 12;
|
||
return [m < 0 ? m + 12 : m, obj[1] + Math.floor(obj[0] / 12)];
|
||
};
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-date-picker',
|
||
|
||
properties: {
|
||
/**
|
||
* Gets or sets the currently selected date.
|
||
*
|
||
* @attribute date
|
||
* @type Date
|
||
* @default Today
|
||
*/
|
||
date: {
|
||
type: Object,
|
||
value: new Date(),
|
||
notify: true,
|
||
observer: '_dateChanged'
|
||
},
|
||
|
||
/**
|
||
* Gets or sets earliest selectable date (inclusive).
|
||
*
|
||
* @attribute min
|
||
* @type Date
|
||
* @default 1/1/1900
|
||
*/
|
||
min: {
|
||
type: Object,
|
||
value: new Date(1900, 0, 1)
|
||
},
|
||
|
||
/**
|
||
* Gets or sets the latest selectable date (inclusive).
|
||
*
|
||
* @attribute max
|
||
* @type Date
|
||
* @default 31/12/2100
|
||
*/
|
||
max: {
|
||
type: Object,
|
||
value: new Date(2100, 11, 31)
|
||
},
|
||
|
||
/**
|
||
* Gets or sets whether or not to enable infinite scrolling for all devices (`true`), no
|
||
* devices (`false`), or whether to automatically determine which mode to use based on the
|
||
* viewing dimensions (`auto`).
|
||
*
|
||
* @attribute infiniteScrolling
|
||
* @type String
|
||
* @default 'auto'
|
||
*/
|
||
infiniteScrolling: {
|
||
type: String,
|
||
value: 'auto'
|
||
},
|
||
|
||
/**
|
||
* Gets or sets the list of locale identifiers for localization using the HTML5 Intl API.
|
||
*
|
||
* @attribute locale
|
||
* @type Array
|
||
* @default ['en-US']
|
||
*
|
||
*/
|
||
locale: {
|
||
type: Array,
|
||
value: ['en-US'],
|
||
observer: '_localeChanged'
|
||
},
|
||
|
||
/**
|
||
* Starting day of the week, expressed as 0 - 6 for Sunday - Saturday, respectively.
|
||
*
|
||
* @attribute startDayOfWeek
|
||
* @type Integer
|
||
* @default 0
|
||
*
|
||
*/
|
||
startDayOfWeek: {
|
||
type: Number,
|
||
value: 0
|
||
},
|
||
|
||
/**
|
||
* Sets an array of dates to highlight on the calendar.
|
||
*
|
||
* @attribute highlightDates
|
||
* @type Array
|
||
* @default []
|
||
*/
|
||
highlightDates: {
|
||
type: Array,
|
||
value: [],
|
||
observer: '_highlightDatesChanged'
|
||
}
|
||
},
|
||
|
||
_dayClassName: function(day, month, currentDay, currentMonth, currentYear, highlightDateTable) {
|
||
return 'day' + ((day.n == currentDay && month.number == currentMonth &&
|
||
month.year == currentYear) ? ' selected' : '') +
|
||
(highlightDateTable[this._dateToJulianDay(new Date(month.year,
|
||
month.number, day.n))] ? ' highlighted' : '');
|
||
},
|
||
|
||
_currentYear: 0,
|
||
_currentMonth: 0,
|
||
_currentDay: 0,
|
||
|
||
_loadedRange: 14,
|
||
_triggerRange: 1,
|
||
_loadPerTrigger: 7,
|
||
|
||
_weekDayNames: [],
|
||
|
||
_months: [],
|
||
|
||
_nonNumericDates: false,
|
||
|
||
_intl: {},
|
||
|
||
_highlightDateTable: {},
|
||
|
||
_dateToJulianDay: function(date) {
|
||
return Math.floor((date / 8.64e7) - (date.getTimezoneOffset()/1440) + 2440587.5);
|
||
},
|
||
|
||
_highlightDatesChanged: function(highlightDates) {
|
||
var highlightDateTable = {};
|
||
if (Array.isArray(highlightDates)) {
|
||
highlightDates.forEach(function(date) {
|
||
if (date instanceof Date) {
|
||
highlightDateTable[this._dateToJulianDay(date)] = true;
|
||
}
|
||
}.bind(this));
|
||
}
|
||
this._highlightDateTable = highlightDateTable;
|
||
},
|
||
|
||
_renderMonths: function(start, end) {
|
||
start = cleanMonthDateArrayObject(start);
|
||
end = cleanMonthDateArrayObject(end);
|
||
|
||
var curMonth = start[0];
|
||
var curYear = start[1];
|
||
var date, start, end;
|
||
|
||
this._months = [];
|
||
|
||
while (curYear < end[1] || (curYear == end[1] && curMonth <= end[0])) {
|
||
|
||
var month = {
|
||
days: [],
|
||
name: "",
|
||
number: curMonth,
|
||
year: curYear
|
||
};
|
||
|
||
date = new Date(curYear, curMonth - 1, 1);
|
||
var startPoint = (date.getDay() - this.startDayOfWeek + 7) % 7;
|
||
month.name = Intl.DateTimeFormat(this.locale, {
|
||
month: 'long',
|
||
year: 'numeric'
|
||
}).format(date);
|
||
date = new Date(curYear, curMonth, 0);
|
||
var endPoint = date.getDate();
|
||
|
||
for (i = 0; i < startPoint; i++) {
|
||
month.days.push(0);
|
||
}
|
||
|
||
for (i = 1; i <= endPoint; i++) {
|
||
var thisDate = new Date(curYear, curMonth - 1, i);
|
||
month.days.push({
|
||
n: i,
|
||
day: this._intl.day(thisDate),
|
||
enabled: thisDate >= this.min && thisDate <= this.max
|
||
});
|
||
}
|
||
|
||
this.push('_months', month);
|
||
|
||
curMonth++;
|
||
if (curMonth == 13) {
|
||
curMonth = 1;
|
||
curYear++;
|
||
}
|
||
|
||
}
|
||
},
|
||
|
||
_localeChanged: function() {
|
||
if (!this.locale) { return; }
|
||
this._intl = {};
|
||
this._intl.day = Intl.DateTimeFormat(this.locale, {
|
||
day: 'numeric'
|
||
}).format;
|
||
},
|
||
|
||
_pickDate: function(e) {
|
||
if (e.model.day.n && e.model.month.number && e.model.month.year) {
|
||
//console.log("set date?");
|
||
this.date = new Date(e.model.month.year, e.model.month.number - 1, e.model.day.n);
|
||
this.fire("selection-changed");
|
||
}
|
||
},
|
||
|
||
_refreshScrollPosition: function() {
|
||
|
||
setTimeout(function() {
|
||
|
||
var monthElements = this.querySelectorAll(".month");
|
||
var startLoadedDateOutsideTriggerRange = new Date(monthElements[this._triggerRange].dataset.year, monthElements[this._triggerRange].dataset.month * 1 - 1, 1);
|
||
var endLoadedDateOutsideTriggerRange = new Date(monthElements[monthElements.length - this._triggerRange - 1].dataset.year, monthElements[monthElements.length - this._triggerRange - 1].dataset.month * 1 - 1 + 1, 1);
|
||
|
||
if (!(this.date >= startLoadedDateOutsideTriggerRange && this.date < endLoadedDateOutsideTriggerRange)) {
|
||
this._surroundDate(this.date);
|
||
}
|
||
|
||
}.bind(this), 0);
|
||
|
||
setTimeout(function() {
|
||
|
||
var monthElements = this.querySelectorAll(".month");
|
||
var scrollTop = 0;
|
||
|
||
for (var i = 0; i < monthElements.length; i++) {
|
||
if (monthElements[i].querySelector(".day.selected")) {
|
||
break;
|
||
} else {
|
||
scrollTop += monthElements[i].clientHeight;
|
||
}
|
||
}
|
||
|
||
if (Math.abs(this.$.container.scrollTop - scrollTop) > this.$.container.clientHeight) {
|
||
this.$.container.scrollTop = scrollTop;
|
||
}
|
||
|
||
}.bind(this), 0);
|
||
|
||
},
|
||
|
||
_dateChanged: function() {
|
||
this._setCurrentDateValues();
|
||
this._refreshScrollPosition();
|
||
},
|
||
|
||
_setCurrentDateValues: function() {
|
||
this._currentYear = this.date.getFullYear();
|
||
this._currentMonth = this.date.getMonth() + 1;
|
||
this._currentDay = this.date.getDate();
|
||
},
|
||
|
||
_scrollFinished: function() {
|
||
if (this.infiniteScrolling == true) {
|
||
var monthElements = this.querySelectorAll(".month");
|
||
|
||
for (var i = monthElements.length - 1; i >= 0; i--) {
|
||
if (this.$.container.scrollTop + this.$.container.clientHeight / 2 > monthElements[i].offsetTop) {
|
||
|
||
if (i < this._triggerRange) {
|
||
var newStart = [monthElements[0].dataset.month * 1 - this._loadPerTrigger, monthElements[0].dataset.year * 1];
|
||
var newEnd = [monthElements[monthElements.length - 1].dataset.month * 1 - this._loadPerTrigger, monthElements[monthElements.length - 1].dataset.year * 1];
|
||
this._renderMonths(newStart, newEnd);
|
||
this.$.container.scrollTop += monthElements[0].clientHeight * this._loadPerTrigger;
|
||
}
|
||
|
||
if (i > monthElements.length - this._triggerRange - 1) {
|
||
var newStart = [monthElements[0].dataset.month * 1 + this._loadPerTrigger, monthElements[0].dataset.year * 1];
|
||
var newEnd = [monthElements[monthElements.length - 1].dataset.month * 1 + this._loadPerTrigger, monthElements[monthElements.length - 1].dataset.year * 1];
|
||
this._renderMonths(newStart, newEnd);
|
||
this.$.container.scrollTop -= monthElements[0].clientHeight * this._loadPerTrigger;
|
||
}
|
||
|
||
break;
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
},
|
||
|
||
_surroundDate: function(date) {
|
||
if (this.infiniteScrolling == true) {
|
||
var prevDate = [date.getMonth() + 1 - Math.floor(this._loadedRange / 2), date.getFullYear()];
|
||
var nextDate = [date.getMonth() + 1 + Math.ceil(this._loadedRange / 2), date.getFullYear()];
|
||
} else {
|
||
var prevDate = [1, date.getFullYear()];
|
||
var nextDate = [12, date.getFullYear()];
|
||
}
|
||
|
||
this._renderMonths(prevDate, nextDate);
|
||
},
|
||
|
||
ready: function() {
|
||
|
||
this._weekDayNames = [];
|
||
for (var i = this.startDayOfWeek - 1; i < this.startDayOfWeek + 6; i++) {
|
||
var date = new Date(2000, 1, i, 0, 0, 0);
|
||
this._weekDayNames.push(new Intl.DateTimeFormat(this.locale || ['en-US'], {
|
||
weekday: 'narrow'
|
||
}).format(date));
|
||
}
|
||
|
||
//Infinite scrolling doesn't work (nicely) on mobile devices, so
|
||
// it is disabled by default.
|
||
if (this.infiniteScrolling == 'auto') {
|
||
if (typeof window.orientation !== 'undefined') {
|
||
this.infiniteScrolling = false;
|
||
} else {
|
||
this.infiniteScrolling = true;
|
||
}
|
||
}
|
||
|
||
this._localeChanged();
|
||
this._surroundDate(this.date);
|
||
this._dateChanged();
|
||
|
||
}
|
||
|
||
});
|
||
|
||
})();
|
||
</script><dom-module id="paper-year-picker" assetpath="bower_components/paper-date-picker/">
|
||
|
||
<style is="custom-style">
|
||
|
||
:host {
|
||
display: block;
|
||
height: 250px;
|
||
width: 100%;
|
||
}
|
||
|
||
#container {
|
||
display: block;
|
||
height: 250px;
|
||
width: 100%;
|
||
overflow: auto;
|
||
}
|
||
|
||
#container::-webkit-scrollbar {
|
||
width: 4px;
|
||
}
|
||
|
||
#container::-webkit-scrollbar-track {
|
||
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
|
||
-webkit-border-radius: 10px;
|
||
border-radius: 10px;
|
||
}
|
||
|
||
#container::-webkit-scrollbar-thumb {
|
||
-webkit-border-radius: 10px;
|
||
border-radius: 10px;
|
||
background: rgba(0,0,0,0.4);
|
||
}
|
||
|
||
#container::-webkit-scrollbar-thumb:window-inactive {
|
||
background: rgba(255,0,0,0.2);
|
||
}
|
||
|
||
.year {
|
||
padding: 10px;
|
||
display: block;
|
||
text-align: center;
|
||
line-height: 42px;
|
||
cursor:pointer;
|
||
}
|
||
|
||
.year.selected span {
|
||
background-color: var(--app-primary-color, --paper-teal-500);
|
||
color: #fff;
|
||
border-radius:100%;
|
||
height: 42px;
|
||
display: inline-block;
|
||
width: 42px;
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
|
||
<div id="container">
|
||
<template is="dom-repeat" items="[[_yearArray]]" as="y">
|
||
|
||
<div class$="[[_yearClassName(y, year)]]" on-click="_yearSelected" data-year$="[[y.n]]"><span>[[y.year]]</span></div>
|
||
</template>
|
||
</div>
|
||
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function(){
|
||
Polymer({
|
||
is: 'paper-year-picker',
|
||
|
||
properties: {
|
||
/**
|
||
* Gets or sets the selected year.
|
||
*
|
||
* @attribute year
|
||
* @type integer
|
||
* @default Current
|
||
*/
|
||
year: {
|
||
type: Number,
|
||
value: new Date().getFullYear(),
|
||
notify: true,
|
||
observer: '_yearChanged'
|
||
},
|
||
|
||
/**
|
||
* Gets or sets the earliest selectable year (inclusive).
|
||
*
|
||
* @attribute min
|
||
* @type integer
|
||
* @default 1900
|
||
*/
|
||
min: {
|
||
type: Number,
|
||
value: 1900
|
||
},
|
||
|
||
/**
|
||
* Gets or sets the latest selectable year (inclusive).
|
||
*
|
||
* @attribute max
|
||
* @type integer
|
||
* @default 2100
|
||
*/
|
||
max: {
|
||
type: Number,
|
||
value: 2100
|
||
},
|
||
|
||
/**
|
||
* Gets or sets the list of locale identifiers for localization using the HTML5 Intl API.
|
||
*
|
||
* @attribute locale
|
||
* @type Array
|
||
* @default ['en-US']
|
||
*
|
||
*/
|
||
locale: {
|
||
type: Array,
|
||
value: ['en-US'],
|
||
observer: '_localeChanged'
|
||
}
|
||
},
|
||
|
||
_yearClassName: function(y, year) {
|
||
return 'year' + (y.n == year ? ' selected' : '');
|
||
},
|
||
|
||
_yearArray: [],
|
||
|
||
_intl: {},
|
||
|
||
_localeChanged: function(){
|
||
if (!this.locale) { return; }
|
||
this._intl = {};
|
||
this._intl.year = Intl.DateTimeFormat(this.locale, { year: 'numeric' }).format;
|
||
},
|
||
|
||
_setYearArray: function() {
|
||
this._yearArray = [];
|
||
for (var i = this.min; i <= this.max; i++) {
|
||
this.push('_yearArray', {
|
||
n:i,
|
||
year: this._intl.year(new Date(i,1,1))
|
||
});
|
||
}
|
||
},
|
||
|
||
/* Scroll function taken from http://stackoverflow.com/a/16136789/4220785 */
|
||
_scrollTo: function(element, to, duration) {
|
||
var start = element.scrollTop, change = to - start, currentTime = 0, increment = 20;
|
||
|
||
var easeInOutQuad = function (t, b, c, d) {
|
||
t /= d/2;
|
||
if (t < 1) return c/2*t*t + b;
|
||
t--;
|
||
return -c/2 * (t*(t-2) - 1) + b;
|
||
};
|
||
|
||
var animateScroll = function(){
|
||
currentTime += increment;
|
||
var val = easeInOutQuad(currentTime, start, change, duration);
|
||
element.scrollTop = val;
|
||
if(currentTime < duration) {
|
||
setTimeout(animateScroll, increment);
|
||
}
|
||
};
|
||
animateScroll();
|
||
},
|
||
|
||
_refreshScrollPosition: function(){
|
||
var yearElement = this.querySelector('.year');
|
||
setTimeout(function(){
|
||
this._scrollTo(this.$.container, (this.year - this.min+0.5) * ((yearElement && yearElement.offsetHeight) || 64) - this.$.container.clientHeight/2, 200);
|
||
}.bind(this),0);
|
||
},
|
||
|
||
_yearChanged: function() {
|
||
this._setYearArray();
|
||
this._refreshScrollPosition();
|
||
},
|
||
|
||
_yearSelected: function(e) {
|
||
if (e.model) {
|
||
return this.year = e.model.y.year;
|
||
}
|
||
},
|
||
|
||
ready: function(){
|
||
this._localeChanged();
|
||
this._yearChanged();
|
||
}
|
||
|
||
});
|
||
})();
|
||
</script><dom-module id="fade-wrapper" assetpath="bower_components/paper-date-picker/">
|
||
<template>
|
||
<div class="fit">
|
||
<content></content>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
Polymer({
|
||
|
||
is: 'fade-wrapper',
|
||
|
||
behaviors: [
|
||
Polymer.NeonAnimatableBehavior
|
||
],
|
||
|
||
properties: {
|
||
|
||
animationConfig: {
|
||
value: function() {
|
||
return {
|
||
'entry': {
|
||
name: 'fade-in-animation',
|
||
node: this
|
||
},
|
||
'exit': {
|
||
name: 'fade-out-animation',
|
||
node: this
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
});
|
||
</script><dom-module id="paper-date-picker-dialog" assetpath="bower_components/paper-date-picker/">
|
||
|
||
<style is="custom-style">
|
||
.date-picker-dialog, #container {
|
||
padding: 0px;
|
||
max-height: none !important;
|
||
}
|
||
|
||
#container {
|
||
margin: 0;
|
||
}
|
||
|
||
.header {
|
||
text-align: center;
|
||
color: rgba(255,255,255,.5);
|
||
background-color: var(--app-primary-color, --paper-teal-500);
|
||
}
|
||
|
||
.header .dayOfWeekContainer {
|
||
padding: 5px;
|
||
background-color: #00695C;
|
||
}
|
||
|
||
.header .dayOfMonthContainer {
|
||
cursor: pointer;
|
||
display:flex;
|
||
align-items:center;
|
||
justify-content:center;
|
||
}
|
||
|
||
.header .monthContainer {
|
||
cursor: pointer;
|
||
font-size: 24px;
|
||
display:flex;
|
||
align-items:center;
|
||
justify-content:center;
|
||
min-height:24px;
|
||
font-weight: 300;
|
||
}
|
||
|
||
.header .yearContainer {
|
||
cursor: pointer;
|
||
font-size: 24px;
|
||
display:flex;
|
||
align-items:center;
|
||
justify-content:center;
|
||
min-height:24px;
|
||
min-width: 100px;
|
||
font-weight: 400;
|
||
}
|
||
|
||
.datePickerContainer {
|
||
height: 255px;
|
||
width: 280px;
|
||
}
|
||
#datePicker {
|
||
width: 280px;
|
||
}
|
||
|
||
.selected {
|
||
color: #FFFFFF;
|
||
}
|
||
|
||
@media only screen and (orientation : portrait) {
|
||
.header .yearContainer{
|
||
padding-bottom:10px;
|
||
}
|
||
.header .monthContainer{
|
||
padding-top:10px;
|
||
}
|
||
.header .dayOfMonthContainer {
|
||
font-size: 60px;
|
||
min-height: 60px;
|
||
}
|
||
}
|
||
@media only screen and (orientation : landscape) {
|
||
:host {
|
||
width:570px;
|
||
}
|
||
|
||
/* the second selector is for the polyfill version */
|
||
#container {
|
||
display:flex;
|
||
flex-direction: row;
|
||
overflow:hidden;
|
||
}
|
||
|
||
.header {
|
||
width: 125px;
|
||
}
|
||
|
||
.header .dayOfMonthContainer {
|
||
font-size: 89px;
|
||
min-height: 89px;
|
||
}
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
|
||
<paper-dialog id="dialog" class="date-picker-dialog" modal$="[[modal]]" backdrop="" on-iron-overlay-opened="_dialogOpened">
|
||
<div id="container">
|
||
<div class="header layout vertical flex">
|
||
<div class="dayOfWeekContainer selected">[[_formatDateDayOfWeek(immediateDate)]]</div>
|
||
<div class="monthContainer selected flex" on-click="_showDatePicker" id="month"><span>[[_formatDateShortMonth(immediateDate)]]</span></div>
|
||
<div class="dayOfMonthContainer selected flex" on-click="_showDatePicker" id="day"><span>[[_formatDateDay(immediateDate)]]</span></div>
|
||
<div class="yearContainer flex" id="year" on-click="_showYearPicker"><span>[[_formatDateYear(immediateDate)]]</span></div>
|
||
</div>
|
||
<neon-animated-pages class="datePickerContainer" selected="[[_page]]">
|
||
<fade-wrapper>
|
||
<paper-date-picker id="datePicker" min="[[min]]" max="[[max]]" date="{{immediateDate}}" infinite-scrolling="[[infiniteScrolling]]" locale="[[locale]]" start-day-of-week="[[startDayOfWeek]]" highlight-days="[[highlightDates]]"></paper-date-picker>
|
||
</fade-wrapper>
|
||
<fade-wrapper>
|
||
<paper-year-picker id="yearPicker" min="[[_getFullYear(min)]]" max="[[_getFullYear(max)]]" year="{{_year}}" locale="[[locale]]"></paper-year-picker>
|
||
</fade-wrapper>
|
||
</neon-animated-pages>
|
||
</div>
|
||
<div class="buttons">
|
||
<paper-button dialog-dismiss="">Cancel</paper-button>
|
||
<paper-button dialog-confirm="" on-click="_setDate">OK</paper-button>
|
||
</div>
|
||
</paper-dialog>
|
||
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function(){
|
||
|
||
var _dayOfWeekNames = [
|
||
'Monday',
|
||
'Tuesday',
|
||
'Wednesday',
|
||
'Thursday',
|
||
'Friday',
|
||
'Saturday',
|
||
'Sunday'
|
||
];
|
||
|
||
var _monthNames = [
|
||
'JAN',
|
||
'FEB',
|
||
'MAR',
|
||
'APR',
|
||
'MAY',
|
||
'JUN',
|
||
'JUL',
|
||
'AUG',
|
||
'SEP',
|
||
'OCT',
|
||
'NOV',
|
||
'DEC'
|
||
];
|
||
|
||
Polymer({
|
||
is: 'paper-date-picker-dialog',
|
||
properties: {
|
||
|
||
/**
|
||
* Gets or sets the the selected date.
|
||
*
|
||
* @attribute value
|
||
* @type Date
|
||
* @default Today
|
||
*/
|
||
value: {
|
||
type: Date,
|
||
value: new Date()
|
||
},
|
||
|
||
/**
|
||
* immediateDate, the currently selected date in the dialog. This property is still updated
|
||
* while the dialog is open.
|
||
*
|
||
* @attribute immediateDate
|
||
* @type Date
|
||
* @default Today
|
||
*/
|
||
immediateDate: {
|
||
type: Date,
|
||
value: new Date(),
|
||
notify: true,
|
||
observer: '_immediateDateChanged'
|
||
},
|
||
|
||
/**
|
||
* If true, picker displays in a modal dialog.
|
||
*
|
||
* @attribute modal
|
||
* @type Boolean
|
||
* @default true
|
||
*/
|
||
modal: {
|
||
type: Boolean,
|
||
value: true
|
||
},
|
||
|
||
/**
|
||
* Gets or sets earliest selectable date (inclusive).
|
||
*
|
||
* @attribute min
|
||
* @type Date
|
||
* @default 1/1/1900
|
||
*/
|
||
min: {
|
||
type: Date,
|
||
value: new Date(1900,0,1)
|
||
},
|
||
|
||
/**
|
||
* Gets or sets the latest selectable date (inclusive).
|
||
*
|
||
* @attribute max
|
||
* @type Date
|
||
* @default 31/12/2100
|
||
*/
|
||
max: {
|
||
type: Date,
|
||
value: new Date(2100,12,31)
|
||
},
|
||
|
||
/**
|
||
* Gets or sets whether or not to enable infinite scrolling for all devices (`true`), no
|
||
* devices (`false`), or whether to automatically determine which mode to use based on the
|
||
* viewing dimensions (`auto`).
|
||
*
|
||
* @attribute infiniteScrolling
|
||
* @type String
|
||
* @default 'auto'
|
||
*/
|
||
infiniteScrolling: {
|
||
type: String,
|
||
value: 'auto'
|
||
},
|
||
|
||
/**
|
||
* Gets or sets the list of locale identifiers for localization using the HTML5 Intl API.
|
||
*
|
||
* @attribute locale
|
||
* @type Array
|
||
* @default ['en-US']
|
||
*
|
||
*/
|
||
locale: {
|
||
type: Array,
|
||
value: ['en-US']
|
||
},
|
||
|
||
/**
|
||
* Starting day of the week, expressed as 0 - 6 for Sunday - Saturday, respectively.
|
||
*
|
||
* @attribute startDayOfWeek
|
||
* @type Integer
|
||
* @default 0
|
||
*
|
||
*/
|
||
startDayOfWeek: {
|
||
type: Number,
|
||
value: 0
|
||
},
|
||
|
||
/**
|
||
* Sets an array of dates to highlight on the calendar.
|
||
*
|
||
* @attribute highlightDates
|
||
* @type Array
|
||
* @default []
|
||
*/
|
||
highlightDates: {
|
||
type: Array,
|
||
value: []
|
||
}
|
||
},
|
||
observers: [
|
||
'_yearChanged(_year)',
|
||
'_minChanged(_min)',
|
||
'_maxChanged(_max)',
|
||
'_valueChanged(_value)',
|
||
'_pageChanged(_page)'
|
||
],
|
||
|
||
_getFullYear: function(date) {
|
||
return date.getFullYear();
|
||
},
|
||
|
||
_formatDateYear: function(date) {
|
||
return Intl.DateTimeFormat(this.locale, { year: 'numeric' }).format(date);
|
||
},
|
||
|
||
_formatDateDayOfWeek: function(date) {
|
||
return Intl.DateTimeFormat(this.locale, { weekday: 'long' }).format(date);
|
||
},
|
||
|
||
_formatDateDay: function(date) {
|
||
return Intl.DateTimeFormat(this.locale, { day: 'numeric' }).format(date);
|
||
},
|
||
|
||
_formatDateShortMonth: function(date) {
|
||
return Intl.DateTimeFormat(this.locale, { month: 'short' }).format(date);
|
||
},
|
||
|
||
_dayOfWeek: '',
|
||
_dayOfMonth: 0,
|
||
_monthShortName: '',
|
||
_formattedYear: '',
|
||
_year: 0,
|
||
_page: 0,
|
||
|
||
_immediateDateChanged: function() {
|
||
this._year = this.immediateDate.getFullYear();
|
||
this.fire('selection-changed');
|
||
},
|
||
|
||
toggle: function() {
|
||
this.$.dialog.toggle();
|
||
},
|
||
|
||
_dialogOpened: function(){
|
||
this.$.datePicker._refreshScrollPosition();
|
||
this.$.yearPicker._refreshScrollPosition();
|
||
},
|
||
|
||
_yearChanged: function() {
|
||
var newDate = this.immediateDate.setYear(this._year);
|
||
if(newDate < this.min){
|
||
this.immediateDate = new Date(this.min);
|
||
}else if(newDate > this.max){
|
||
this.immediateDate = new Date(this.max);
|
||
}else{
|
||
this.immediateDate = new Date(newDate);
|
||
}
|
||
this._page = 0;
|
||
},
|
||
|
||
_showYearPicker: function() {
|
||
this._page = 1;
|
||
},
|
||
|
||
_showDatePicker: function() {
|
||
this._page = 0;
|
||
},
|
||
|
||
_setDate: function(){
|
||
if(this.immediateDate <= this.max && this.immediateDate >= this.min){
|
||
this.value = this.immediateDate;
|
||
this.fire('value-changed');
|
||
}
|
||
},
|
||
|
||
_pageChanged: function() {
|
||
if (this._page == 0) {
|
||
this.$.day.classList.add("selected");
|
||
this.$.month.classList.add("selected");
|
||
this.$.year.classList.remove("selected");
|
||
} else {
|
||
this.$.day.classList.remove("selected");
|
||
this.$.month.classList.remove("selected");
|
||
this.$.year.classList.add("selected");
|
||
}
|
||
this.$.datePicker._refreshScrollPosition();
|
||
this.$.yearPicker._refreshScrollPosition();
|
||
},
|
||
|
||
_minChanged: function(){
|
||
if(typeof this.min == "string"){
|
||
this.min = new Date(this.min);
|
||
}
|
||
},
|
||
|
||
_maxChanged: function(){
|
||
if(typeof this.max == "string"){
|
||
this.max = new Date(this.max);
|
||
}
|
||
},
|
||
|
||
_valueChanged: function(){
|
||
if(typeof this.value == "string"){
|
||
this.value = new Date(this.value);
|
||
}
|
||
},
|
||
|
||
ready:function() {
|
||
if(this.value){
|
||
this._valueChanged();
|
||
|
||
this.immediateDate = this.value;
|
||
}
|
||
this._immediateDateChanged();
|
||
}
|
||
|
||
});
|
||
})();
|
||
</script>
|
||
|
||
<dom-module id="paper-dialog-scrollable" assetpath="bower_components/paper-dialog-scrollable/">
|
||
|
||
<style>
|
||
|
||
:host {
|
||
display: block;
|
||
position: relative;
|
||
}
|
||
|
||
:host(.is-scrolled:not(:first-child))::before {
|
||
content: '';
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
height: 1px;
|
||
background: var(--divider-color);
|
||
}
|
||
|
||
:host(.can-scroll:not(.scrolled-to-bottom):not(:last-child))::after {
|
||
content: '';
|
||
position: absolute;
|
||
bottom: 0;
|
||
left: 0;
|
||
right: 0;
|
||
height: 1px;
|
||
background: var(--divider-color);
|
||
}
|
||
|
||
.scrollable {
|
||
padding: 0 24px;
|
||
|
||
@apply(--layout-scroll);
|
||
|
||
@apply(--paper-dialog-scrollable);
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<div id="scrollable" class="scrollable">
|
||
<content></content>
|
||
</div>
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
|
||
(function() {
|
||
|
||
Polymer({
|
||
|
||
is: 'paper-dialog-scrollable',
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The dialog element that implements `Polymer.PaperDialogBehavior` containing this element.
|
||
* @type {?Node}
|
||
*/
|
||
dialogElement: {
|
||
type: Object,
|
||
value: function() {
|
||
return this.parentNode;
|
||
}
|
||
}
|
||
|
||
},
|
||
|
||
listeners: {
|
||
'scrollable.scroll': '_onScroll',
|
||
'iron-resize': '_onIronResize'
|
||
},
|
||
|
||
/**
|
||
* Returns the scrolling element.
|
||
*/
|
||
get scrollTarget() {
|
||
return this.$.scrollable;
|
||
},
|
||
|
||
attached: function() {
|
||
this.classList.add('no-padding');
|
||
// Set itself to the overlay sizing target
|
||
this.dialogElement.sizingTarget = this.scrollTarget;
|
||
// If the host is sized, fit the scrollable area to the container. Otherwise let it be
|
||
// its natural size.
|
||
requestAnimationFrame(function() {
|
||
if (this.offsetHeight > 0) {
|
||
this.$.scrollable.classList.add('fit');
|
||
}
|
||
this._scroll();
|
||
}.bind(this));
|
||
},
|
||
|
||
_scroll: function() {
|
||
this.toggleClass('is-scrolled', this.scrollTarget.scrollTop > 0);
|
||
this.toggleClass('can-scroll', this.scrollTarget.offsetHeight < this.scrollTarget.scrollHeight);
|
||
this.toggleClass('scrolled-to-bottom',
|
||
this.scrollTarget.scrollTop + this.scrollTarget.offsetHeight >= this.scrollTarget.scrollHeight);
|
||
},
|
||
|
||
_onScroll: function() {
|
||
this._scroll();
|
||
}
|
||
|
||
})
|
||
|
||
})();
|
||
|
||
</script>
|
||
<dom-module id="more-info-default" assetpath="more-infos/">
|
||
<style>
|
||
.data-entry .value {
|
||
max-width: 200px;
|
||
}
|
||
</style>
|
||
<template>
|
||
<div class="layout vertical">
|
||
<template is="dom-repeat" items="[[getAttributes(stateObj)]]" as="attribute">
|
||
<div class="data-entry layout justified horizontal">
|
||
<div class="key">[[attribute]]</div>
|
||
<div class="value">[[getAttributeValue(stateObj, attribute)]]</div>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'more-info-default',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
},
|
||
},
|
||
|
||
getAttributes: function(stateObj) {
|
||
return stateObj ? Object.keys(stateObj.attributes) : [];
|
||
},
|
||
|
||
getAttributeValue: function(stateObj, attribute) {
|
||
return stateObj.attributes[attribute];
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="more-info-group" assetpath="more-infos/">
|
||
<style>
|
||
.child-card {
|
||
margin-bottom: 8px;
|
||
}
|
||
|
||
.child-card:last-child {
|
||
margin-bottom: 0;
|
||
}
|
||
</style>
|
||
<template>
|
||
<template is="dom-repeat" items="[[states]]" as="state">
|
||
<div class="child-card">
|
||
<state-card-content state-obj="[[state]]"></state-card-content>
|
||
</div>
|
||
</template>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var stateStore = window.hass.stateStore;
|
||
|
||
Polymer({
|
||
is: 'more-info-group',
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
observer: 'updateStates',
|
||
},
|
||
|
||
states: {
|
||
type: Array,
|
||
value: [],
|
||
},
|
||
},
|
||
|
||
stateStoreChanged: function() {
|
||
this.updateStates();
|
||
},
|
||
|
||
updateStates: function() {
|
||
this.states = this.stateObj && this.stateObj.attributes.entity_id ?
|
||
stateStore.gets(this.stateObj.attributes.entity_id).toArray() : [];
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="more-info-sun" assetpath="more-infos/">
|
||
<template>
|
||
<div class="data-entry layout justified horizontal" id="rising">
|
||
<div class="key">
|
||
Rising <relative-ha-datetime datetime-obj="[[risingDate]]"></relative-ha-datetime>
|
||
</div>
|
||
<div class="value">[[risingTime]]</div>
|
||
</div>
|
||
|
||
<div class="data-entry layout justified horizontal" id="setting">
|
||
<div class="key">
|
||
Setting <relative-ha-datetime datetime-obj="[[settingDate]]"></relative-ha-datetime>
|
||
</div>
|
||
<div class="value">[[settingTime]]</div>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var parseDateTime = window.hass.util.parseDateTime;
|
||
var formatTime = window.hass.uiUtil.formatTime;
|
||
|
||
Polymer({
|
||
is: 'more-info-sun',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
observer: 'stateObjChanged',
|
||
},
|
||
|
||
risingDate: {
|
||
type: Object,
|
||
},
|
||
|
||
settingDate: {
|
||
type: Object,
|
||
},
|
||
|
||
risingTime: {
|
||
type: String,
|
||
},
|
||
|
||
settingTime: {
|
||
type: String,
|
||
},
|
||
},
|
||
|
||
stateObjChanged: function() {
|
||
this.risingDate = parseDateTime(this.stateObj.attributes.next_rising);
|
||
this.risingTime = formatTime(this.risingDate);
|
||
|
||
this.settingDate = parseDateTime(this.stateObj.attributes.next_setting);
|
||
this.settingTime = formatTime(this.settingDate);
|
||
|
||
var root = Polymer.dom(this);
|
||
|
||
if(self.risingDate > self.settingDate) {
|
||
root.appendChild(this.$.rising);
|
||
} else {
|
||
root.appendChild(this.$.setting);
|
||
}
|
||
}
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="more-info-configurator" assetpath="more-infos/">
|
||
<style>
|
||
p {
|
||
margin: 8px 0;
|
||
}
|
||
|
||
p > img {
|
||
max-width: 100%;
|
||
}
|
||
|
||
p.center {
|
||
text-align: center;
|
||
}
|
||
|
||
p.error {
|
||
color: #C62828;
|
||
}
|
||
|
||
p.submit {
|
||
text-align: center;
|
||
height: 41px;
|
||
}
|
||
</style>
|
||
<template>
|
||
<div class="layout vertical">
|
||
<template is="dom-if" if="[[isConfigurable]]">
|
||
|
||
<p hidden$="[[!stateObj.attributes.description]]">[[stateObj.attributes.description]]</p>
|
||
|
||
<p class="error" hidden$="[[!stateObj.attributes.errors]]">[[stateObj.attributes.errors]]</p>
|
||
|
||
<p class="center" hidden$="[[!stateObj.attributes.description_image]]">
|
||
<img src="[[stateObj.attributes.description_image]]">
|
||
</p>
|
||
|
||
<p class="submit">
|
||
<paper-button raised="" on-click="submitClicked" hidden$="[[isConfiguring]]">[[submitCaption]]</paper-button>
|
||
|
||
<loading-box hidden$="[[!isConfiguring]]">Configuring</loading-box>
|
||
</p>
|
||
|
||
</template>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var syncActions = window.hass.syncActions;
|
||
var serviceActions = window.hass.serviceActions;
|
||
|
||
Polymer({
|
||
is: 'more-info-configurator',
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
},
|
||
|
||
action: {
|
||
type: String,
|
||
value: 'display',
|
||
},
|
||
|
||
isStreaming: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
isConfigurable: {
|
||
type: Boolean,
|
||
computed: 'computeIsConfigurable(stateObj)',
|
||
},
|
||
|
||
isConfiguring: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
submitCaption: {
|
||
type: String,
|
||
computed: 'computeSubmitCaption(stateObj)',
|
||
},
|
||
},
|
||
|
||
computeIsConfigurable: function(stateObj) {
|
||
return stateObj.state == 'configure';
|
||
},
|
||
|
||
computeSubmitCaption: function(stateObj) {
|
||
return stateObj.attributes.submit_caption || 'Set configuration';
|
||
},
|
||
|
||
streamStoreChanged: function(streamStore) {
|
||
this.isStreaming = streamStore.isStreaming;
|
||
},
|
||
|
||
submitClicked: function() {
|
||
this.isConfiguring = true;
|
||
|
||
var data = {
|
||
configure_id: this.stateObj.attributes.configure_id
|
||
};
|
||
|
||
serviceActions.callService('configurator', 'configure', data).then(
|
||
function() {
|
||
this.isConfiguring = false;
|
||
|
||
if (!this.isStreaming) {
|
||
syncActions.fetchAll();
|
||
}
|
||
}.bind(this),
|
||
|
||
function() {
|
||
this.isConfiguring = false;
|
||
}.bind(this));
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="paper-progress" assetpath="bower_components/paper-progress/">
|
||
<style>
|
||
:host {
|
||
display: inline-block;
|
||
width: 200px;
|
||
height: 4px;
|
||
}
|
||
|
||
#progressContainer {
|
||
position: relative;
|
||
height: 100%;
|
||
background-color: var(--paper-progress-container-color, --google-grey-300);
|
||
overflow: hidden;
|
||
}
|
||
|
||
#activeProgress,
|
||
#secondaryProgress {
|
||
-webkit-transform-origin: left center;
|
||
transform-origin: left center;
|
||
-webkit-transform: scaleX(0);
|
||
transform: scaleX(0);
|
||
}
|
||
|
||
#activeProgress {
|
||
background-color: var(--paper-progress-active-color, --google-green-500);
|
||
}
|
||
|
||
#secondaryProgress {
|
||
background-color: var(--paper-progress-secondary-color, --google-green-100);
|
||
}
|
||
|
||
#activeProgress.indeterminate {
|
||
-webkit-transform-origin: center center;
|
||
transform-origin: center center;
|
||
-webkit-animation: indeterminate-bar 1s linear infinite;
|
||
animation: indeterminate-bar 1s linear infinite;
|
||
}
|
||
|
||
@-webkit-keyframes indeterminate-bar {
|
||
0% {
|
||
-webkit-transform: translate(-50%) scaleX(0);
|
||
}
|
||
50% {
|
||
-webkit-transform: translate(0%) scaleX(0.3);
|
||
}
|
||
100% {
|
||
-webkit-transform: translate(50%) scaleX(0);
|
||
}
|
||
}
|
||
|
||
@keyframes indeterminate-bar {
|
||
0% {
|
||
transform: translate(-50%) scaleX(0);
|
||
}
|
||
50% {
|
||
transform: translate(0%) scaleX(0.3);
|
||
}
|
||
100% {
|
||
transform: translate(50%) scaleX(0);
|
||
}
|
||
}
|
||
</style>
|
||
<template>
|
||
<div id="progressContainer" role="progressbar" aria-valuenow$="{{value}}" aria-valuemin$="{{min}}" aria-valuemax$="{{max}}">
|
||
<div id="secondaryProgress" class="fit"></div>
|
||
<div id="activeProgress" class="fit"></div>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
Polymer({
|
||
|
||
is: 'paper-progress',
|
||
|
||
behaviors: [
|
||
Polymer.IronRangeBehavior
|
||
],
|
||
|
||
properties: {
|
||
|
||
/**
|
||
* The number that represents the current secondary progress.
|
||
*/
|
||
secondaryProgress: {
|
||
type: Number,
|
||
value: 0,
|
||
notify: true
|
||
},
|
||
|
||
/**
|
||
* The secondary ratio
|
||
*/
|
||
secondaryRatio: {
|
||
type: Number,
|
||
value: 0,
|
||
readOnly: true,
|
||
observer: '_secondaryRatioChanged'
|
||
},
|
||
|
||
/**
|
||
* Use an indeterminate progress indicator.
|
||
*/
|
||
indeterminate: {
|
||
type: Boolean,
|
||
value: false,
|
||
notify: true,
|
||
observer: '_toggleIndeterminate'
|
||
}
|
||
},
|
||
|
||
observers: [
|
||
'_ratioChanged(ratio)',
|
||
'_secondaryProgressChanged(secondaryProgress, min, max)'
|
||
],
|
||
|
||
_toggleIndeterminate: function() {
|
||
// If we use attribute/class binding, the animation sometimes doesn't translate properly
|
||
// on Safari 7.1. So instead, we toggle the class here in the update method.
|
||
this.toggleClass('indeterminate', this.indeterminate, this.$.activeProgress);
|
||
},
|
||
|
||
_transformProgress: function(progress, ratio) {
|
||
var transform = 'scaleX(' + (ratio / 100) + ')';
|
||
progress.style.transform = progress.style.webkitTransform = transform;
|
||
},
|
||
|
||
_ratioChanged: function(ratio) {
|
||
this._transformProgress(this.$.activeProgress, ratio);
|
||
},
|
||
|
||
_secondaryRatioChanged: function(secondaryRatio) {
|
||
this._transformProgress(this.$.secondaryProgress, secondaryRatio);
|
||
},
|
||
|
||
_secondaryProgressChanged: function() {
|
||
this.secondaryProgress = this._clampValue(this.secondaryProgress);
|
||
this._setSecondaryRatio(this._calcRatio(this.secondaryProgress) * 100);
|
||
}
|
||
|
||
});
|
||
|
||
</script>
|
||
<dom-module id="paper-slider" assetpath="bower_components/paper-slider/">
|
||
|
||
<style>
|
||
/**
|
||
@license
|
||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
|
||
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
||
Code distributed by Google as part of the polymer project is also
|
||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
|
||
*/
|
||
|
||
:host {
|
||
display: inline-block;
|
||
width: 200px;
|
||
cursor: default;
|
||
-webkit-user-select: none;
|
||
-moz-user-select: none;
|
||
-ms-user-select: none;
|
||
user-select: none;
|
||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||
}
|
||
|
||
:host(:not([disabled])) #sliderBar::shadow #activeProgress {
|
||
background-color: var(--paper-slider-active-color, --google-blue-700);
|
||
}
|
||
|
||
:host(:not([disabled])) #sliderBar::shadow #secondaryProgress {
|
||
background-color: var(--paper-slider-secondary-color, --google-blue-300);
|
||
}
|
||
|
||
:host([disabled]) #sliderBar::shadow #activeProgress {
|
||
background-color: var(--paper-slider-disabled-active-color, --google-grey-500);
|
||
}
|
||
|
||
:host([disabled]) #sliderBar::shadow #secondaryProgress {
|
||
background-color: var(--paper-slider-disabled-secondary-color, --google-grey-300);
|
||
}
|
||
|
||
:host(:focus) {
|
||
outline: none;
|
||
}
|
||
|
||
#sliderContainer {
|
||
position: relative;
|
||
width: calc(100% - 32px);
|
||
height: 32px;
|
||
}
|
||
|
||
#sliderContainer.editable {
|
||
float: left;
|
||
width: calc(100% - 72px);
|
||
margin: 12px 0;
|
||
}
|
||
|
||
.bar-container {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 16px;
|
||
height: 100%;
|
||
width: 100%;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.ring > .bar-container {
|
||
left: 20px;
|
||
width: calc(100% - 4px);
|
||
transition: left 0.18s ease, width 0.18s ease;
|
||
}
|
||
|
||
.ring.expand:not(.pin) > .bar-container {
|
||
left: 30px;
|
||
width: calc(100% - 14px);
|
||
}
|
||
|
||
.ring.expand.dragging > .bar-container {
|
||
transition: none;
|
||
}
|
||
|
||
#sliderBar {
|
||
position: absolute;
|
||
top: 15px;
|
||
left: 0;
|
||
height: 2px;
|
||
width: 100%;
|
||
padding: 8px 0;
|
||
margin: -8px 0;
|
||
}
|
||
|
||
.ring #sliderBar {
|
||
left: -4px;
|
||
width: calc(100% + 4px);
|
||
}
|
||
|
||
.ring.expand:not(.pin) #sliderBar {
|
||
left: -14px;
|
||
width: calc(100% + 14px);
|
||
}
|
||
|
||
.slider-markers {
|
||
position: absolute;
|
||
top: 15px;
|
||
left: 15px;
|
||
height: 2px;
|
||
width: calc(100% + 2px);
|
||
box-sizing: border-box;
|
||
pointer-events: none;
|
||
}
|
||
|
||
.slider-markers::after,
|
||
.slider-marker::after {
|
||
content: "";
|
||
display: block;
|
||
width: 2px;
|
||
height: 2px;
|
||
border-radius: 50%;
|
||
background-color: black;
|
||
}
|
||
|
||
.transiting #sliderBar::shadow #activeProgress {
|
||
-webkit-transition: -webkit-transform 0.08s ease;
|
||
transition: transform 0.08s ease;
|
||
}
|
||
|
||
#sliderKnob {
|
||
@apply(--layout-center-justified);
|
||
@apply(--layout-center);
|
||
@apply(--layout-horizontal);
|
||
|
||
position: absolute;
|
||
left: 0;
|
||
top: 0;
|
||
width: 32px;
|
||
height: 32px;
|
||
}
|
||
|
||
.transiting > #sliderKnob {
|
||
transition: left 0.08s ease;
|
||
}
|
||
|
||
#sliderKnob:focus {
|
||
outline: none;
|
||
}
|
||
|
||
#sliderKnob.dragging {
|
||
transition: none;
|
||
}
|
||
|
||
.snaps > #sliderKnob.dragging {
|
||
transition: -webkit-transform 0.08s ease;
|
||
transition: transform 0.08s ease;
|
||
}
|
||
|
||
#sliderKnobInner {
|
||
width: 12px;
|
||
height: 12px;
|
||
box-sizing: border-box;
|
||
-moz-box-sizing: border-box;
|
||
border-radius: 50%;
|
||
background-color: var(--paper-slider-knob-color, --google-blue-700);
|
||
transition-property: height, width, background-color, border;
|
||
transition-duration: 0.1s;
|
||
transition-timing-function: ease;
|
||
}
|
||
|
||
.expand:not(.pin) > #sliderKnob > #sliderKnobInner {
|
||
width: 100%;
|
||
height: 100%;
|
||
-webkit-transform: translateZ(0);
|
||
transform: translateZ(0);
|
||
}
|
||
|
||
.ring > #sliderKnob > #sliderKnobInner {
|
||
background-color: transparent;
|
||
border: 2px solid #c8c8c8;
|
||
}
|
||
|
||
#sliderKnobInner::before {
|
||
background-color: var(--paper-slider-pin-color, --google-blue-700);
|
||
}
|
||
|
||
.pin > #sliderKnob > #sliderKnobInner::before {
|
||
content: "";
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 26px;
|
||
height: 26px;
|
||
margin-left: 3px;
|
||
border-radius: 50% 50% 50% 0;
|
||
-webkit-transform: rotate(-45deg) scale(0) translate(0);
|
||
transform: rotate(-45deg) scale(0) translate(0);
|
||
}
|
||
|
||
#sliderKnobInner::before,
|
||
#sliderKnobInner::after {
|
||
transition: -webkit-transform .2s ease, background-color .18s ease;
|
||
transition: transform .2s ease, background-color .18s ease;
|
||
}
|
||
|
||
.pin.ring > #sliderKnob > #sliderKnobInner::before {
|
||
background-color: #c8c8c8;
|
||
}
|
||
|
||
.pin.expand > #sliderKnob > #sliderKnobInner::before {
|
||
-webkit-transform: rotate(-45deg) scale(1) translate(17px, -17px);
|
||
transform: rotate(-45deg) scale(1) translate(17px, -17px);
|
||
}
|
||
|
||
.pin > #sliderKnob > #sliderKnobInner::after {
|
||
content: attr(value);
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 32px;
|
||
height: 26px;
|
||
text-align: center;
|
||
color: var(--paper-slider-font-color, #fff);
|
||
font-size: 10px;
|
||
-webkit-transform: scale(0) translate(0);
|
||
transform: scale(0) translate(0);
|
||
}
|
||
|
||
.pin.expand > #sliderKnob > #sliderKnobInner::after {
|
||
-webkit-transform: scale(1) translate(0, -17px);
|
||
transform: scale(1) translate(0, -17px);
|
||
}
|
||
|
||
/* editable: paper-input */
|
||
.slider-input {
|
||
width: 40px;
|
||
float: right;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.slider-input::shadow input {
|
||
/* FIXME(ffu): should one be able set text-align directly on paper-input? */
|
||
text-align: center;
|
||
}
|
||
|
||
/* disabled state */
|
||
#sliderContainer.disabled {
|
||
pointer-events: none;
|
||
}
|
||
|
||
.disabled > #sliderKnob > #sliderKnobInner {
|
||
width: 8px;
|
||
height: 8px;
|
||
background-color: var(--paper-slider-disabled-knob-color, --google-grey-500);
|
||
}
|
||
|
||
.disabled.ring > #sliderKnob > #sliderKnobInner {
|
||
background-color: transparent;
|
||
}
|
||
|
||
paper-ripple {
|
||
color: var(--paper-slider-knob-color, --google-blue-700);
|
||
}
|
||
|
||
</style>
|
||
|
||
<template>
|
||
<div id="sliderContainer" class$="[[_getClassNames(disabled, pin, snaps, immediateValue, min, expand, dragging, transiting, editable)]]">
|
||
|
||
<div class="bar-container">
|
||
<paper-progress id="sliderBar" aria-hidden="true" min="[[min]]" max="[[max]]" step="[[step]]" value="[[immediateValue]]" secondary-progress="[[secondaryProgress]]" on-down="_bardown" on-up="_resetKnob" on-track="_onTrack">
|
||
</paper-progress>
|
||
</div>
|
||
|
||
<template is="dom-if" if="[[snaps]]">
|
||
<div class="slider-markers horizontal layout">
|
||
<template is="dom-repeat" items="[[markers]]">
|
||
<div class="slider-marker flex"></div>
|
||
</template>
|
||
</div>
|
||
</template>
|
||
|
||
<div id="sliderKnob" class="center-justified center horizontal layout" on-down="_knobdown" on-up="_resetKnob" on-track="_onTrack" on-transitionend="_knobTransitionEnd">
|
||
<paper-ripple id="ink" class="circle" center=""></paper-ripple>
|
||
<div id="sliderKnobInner" value$="[[immediateValue]]"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<template is="dom-if" if="[[editable]]">
|
||
<paper-input id="input" class="slider-input" disabled$="[[disabled]]" on-change="_inputChange">
|
||
</paper-input>
|
||
</template>
|
||
</template>
|
||
|
||
</dom-module>
|
||
|
||
<script>
|
||
/**
|
||
* Fired when the slider's value changes.
|
||
*
|
||
* @event value-change
|
||
*/
|
||
|
||
/**
|
||
* Fired when the slider's immediateValue changes.
|
||
*
|
||
* @event immediate-value-change
|
||
*/
|
||
|
||
/**
|
||
* Fired when the slider's value changes due to user interaction.
|
||
*
|
||
* Changes to the slider's value due to changes in an underlying
|
||
* bound variable will not trigger this event.
|
||
*
|
||
* @event change
|
||
*/
|
||
|
||
Polymer({
|
||
is: 'paper-slider',
|
||
|
||
behaviors: [
|
||
Polymer.IronRangeBehavior,
|
||
Polymer.IronA11yKeysBehavior,
|
||
Polymer.IronFormElementBehavior,
|
||
Polymer.PaperInkyFocusBehavior
|
||
],
|
||
|
||
properties: {
|
||
/**
|
||
* If true, the slider thumb snaps to tick marks evenly spaced based
|
||
* on the `step` property value.
|
||
*/
|
||
snaps: {
|
||
type: Boolean,
|
||
value: false,
|
||
notify: true
|
||
},
|
||
|
||
/**
|
||
* If true, a pin with numeric value label is shown when the slider thumb
|
||
* is pressed. Use for settings for which users need to know the exact
|
||
* value of the setting.
|
||
*/
|
||
pin: {
|
||
type: Boolean,
|
||
value: false,
|
||
notify: true
|
||
},
|
||
|
||
/**
|
||
* The number that represents the current secondary progress.
|
||
*/
|
||
secondaryProgress: {
|
||
type: Number,
|
||
value: 0,
|
||
notify: true,
|
||
observer: '_secondaryProgressChanged'
|
||
},
|
||
|
||
/**
|
||
* If true, an input is shown and user can use it to set the slider value.
|
||
*/
|
||
editable: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
/**
|
||
* The immediate value of the slider. This value is updated while the user
|
||
* is dragging the slider.
|
||
*/
|
||
immediateValue: {
|
||
type: Number,
|
||
value: 0,
|
||
readOnly: true
|
||
},
|
||
|
||
/**
|
||
* The maximum number of markers
|
||
*/
|
||
maxMarkers: {
|
||
type: Number,
|
||
value: 0,
|
||
notify: true,
|
||
observer: '_maxMarkersChanged'
|
||
},
|
||
|
||
/**
|
||
* If true, the knob is expanded
|
||
*/
|
||
expand: {
|
||
type: Boolean,
|
||
value: false,
|
||
readOnly: true
|
||
},
|
||
|
||
/**
|
||
* True when the user is dragging the slider.
|
||
*/
|
||
dragging: {
|
||
type: Boolean,
|
||
value: false,
|
||
readOnly: true
|
||
},
|
||
|
||
transiting: {
|
||
type: Boolean,
|
||
value: false,
|
||
readOnly: true
|
||
},
|
||
|
||
markers: {
|
||
type: Array,
|
||
readOnly: true,
|
||
value: []
|
||
},
|
||
},
|
||
|
||
observers: [
|
||
'_updateKnob(value, min, max, snaps, step)',
|
||
'_minChanged(min)',
|
||
'_maxChanged(max)',
|
||
'_valueChanged(value)',
|
||
'_immediateValueChanged(immediateValue)'
|
||
],
|
||
|
||
hostAttributes: {
|
||
role: 'slider',
|
||
tabindex: 0
|
||
},
|
||
|
||
keyBindings: {
|
||
'left down pagedown home': '_decrementKey',
|
||
'right up pageup end': '_incrementKey'
|
||
},
|
||
|
||
ready: function() {
|
||
// issue polymer/polymer#1305
|
||
|
||
this.async(function() {
|
||
this._updateKnob(this.value);
|
||
this._updateInputValue();
|
||
}, 1);
|
||
},
|
||
|
||
/**
|
||
* Increases value by `step` but not above `max`.
|
||
* @method increment
|
||
*/
|
||
increment: function() {
|
||
this.value = this._clampValue(this.value + this.step);
|
||
},
|
||
|
||
/**
|
||
* Decreases value by `step` but not below `min`.
|
||
* @method decrement
|
||
*/
|
||
decrement: function() {
|
||
this.value = this._clampValue(this.value - this.step);
|
||
},
|
||
|
||
_updateKnob: function(value) {
|
||
this._positionKnob(this._calcRatio(value));
|
||
},
|
||
|
||
_minChanged: function() {
|
||
this.setAttribute('aria-valuemin', this.min);
|
||
},
|
||
|
||
_maxChanged: function() {
|
||
this.setAttribute('aria-valuemax', this.max);
|
||
},
|
||
|
||
_valueChanged: function() {
|
||
this.setAttribute('aria-valuenow', this.value);
|
||
this.fire('value-change');
|
||
},
|
||
|
||
_immediateValueChanged: function() {
|
||
if (this.dragging) {
|
||
this.fire('immediate-value-change');
|
||
} else {
|
||
this.value = this.immediateValue;
|
||
}
|
||
this._updateInputValue();
|
||
},
|
||
|
||
_secondaryProgressChanged: function() {
|
||
this.secondaryProgress = this._clampValue(this.secondaryProgress);
|
||
},
|
||
|
||
_updateInputValue: function() {
|
||
if (this.editable) {
|
||
this.$$('#input').value = this.immediateValue.toString();
|
||
}
|
||
},
|
||
|
||
_expandKnob: function() {
|
||
this.$.ink.holdDown = false;
|
||
this._setExpand(true);
|
||
},
|
||
|
||
_resetKnob: function() {
|
||
this.cancelDebouncer('expandKnob');
|
||
this._setExpand(false);
|
||
this.$.ink.hidden = true;
|
||
},
|
||
|
||
_positionKnob: function(ratio) {
|
||
this._setImmediateValue(this._calcStep(this._calcKnobPosition(ratio)));
|
||
this._setRatio(this._calcRatio(this.immediateValue));
|
||
|
||
this.$.sliderKnob.style.left = (this.ratio * 100) + '%';
|
||
},
|
||
|
||
_inputChange: function() {
|
||
this.value = this.$$('#input').value;
|
||
this.fire('change');
|
||
},
|
||
|
||
_calcKnobPosition: function(ratio) {
|
||
return (this.max - this.min) * ratio + this.min;
|
||
},
|
||
|
||
_onTrack: function(event) {
|
||
switch (event.detail.state) {
|
||
case 'start':
|
||
this._trackStart(event);
|
||
break;
|
||
case 'track':
|
||
this._trackX(event);
|
||
break;
|
||
case 'end':
|
||
this._trackEnd();
|
||
break;
|
||
}
|
||
},
|
||
|
||
_trackStart: function(event) {
|
||
this._w = this.$.sliderBar.offsetWidth;
|
||
this._x = this.ratio * this._w;
|
||
this._startx = this._x || 0;
|
||
this._minx = - this._startx;
|
||
this._maxx = this._w - this._startx;
|
||
this.$.sliderKnob.classList.add('dragging');
|
||
|
||
this._setDragging(true);
|
||
},
|
||
|
||
_trackX: function(e) {
|
||
if (!this.dragging) {
|
||
this._trackStart(e);
|
||
}
|
||
|
||
var dx = Math.min(this._maxx, Math.max(this._minx, e.detail.dx));
|
||
this._x = this._startx + dx;
|
||
|
||
var immediateValue = this._calcStep(this._calcKnobPosition(this._x / this._w));
|
||
this._setImmediateValue(immediateValue);
|
||
|
||
// update knob's position
|
||
var translateX = ((this._calcRatio(immediateValue) * this._w) - this._startx);
|
||
this.translate3d(translateX + 'px', 0, 0, this.$.sliderKnob);
|
||
},
|
||
|
||
_trackEnd: function() {
|
||
var s = this.$.sliderKnob.style;
|
||
|
||
this.$.sliderKnob.classList.remove('dragging');
|
||
this._setDragging(false);
|
||
this._resetKnob();
|
||
this.value = this.immediateValue;
|
||
|
||
s.transform = s.webkitTransform = '';
|
||
|
||
this.fire('change');
|
||
},
|
||
|
||
_knobdown: function(event) {
|
||
this._expandKnob();
|
||
|
||
// cancel selection
|
||
event.detail.sourceEvent.preventDefault();
|
||
|
||
// set the focus manually because we will called prevent default
|
||
this.focus();
|
||
},
|
||
|
||
_bardown: function(event) {
|
||
this.$.ink.hidden = true;
|
||
|
||
event.preventDefault();
|
||
|
||
this._w = this.$.sliderBar.offsetWidth;
|
||
var rect = this.$.sliderBar.getBoundingClientRect();
|
||
var ratio = (event.detail.x - rect.left) / this._w;
|
||
var prevRatio = this.ratio;
|
||
|
||
this._setTransiting(true);
|
||
|
||
this._positionKnob(ratio);
|
||
|
||
this.debounce('expandKnob', this._expandKnob, 60);
|
||
|
||
// if the ratio doesn't change, sliderKnob's animation won't start
|
||
// and `_knobTransitionEnd` won't be called
|
||
// Therefore, we need to manually update the `transiting` state
|
||
|
||
if (prevRatio === this.ratio) {
|
||
this._setTransiting(false);
|
||
}
|
||
|
||
this.async(function() {
|
||
this.fire('change');
|
||
});
|
||
|
||
// cancel selection
|
||
event.detail.sourceEvent.preventDefault();
|
||
},
|
||
|
||
_knobTransitionEnd: function(event) {
|
||
if (event.target === this.$.sliderKnob) {
|
||
this._setTransiting(false);
|
||
}
|
||
},
|
||
|
||
_maxMarkersChanged: function(maxMarkers) {
|
||
var l = (this.max - this.min) / this.step;
|
||
if (!this.snaps && l > maxMarkers) {
|
||
this._setMarkers([]);
|
||
} else {
|
||
this._setMarkers(new Array(l));
|
||
}
|
||
},
|
||
|
||
_getClassNames: function() {
|
||
var classes = {};
|
||
|
||
classes.disabled = this.disabled;
|
||
classes.pin = this.pin;
|
||
classes.snaps = this.snaps;
|
||
classes.ring = this.immediateValue <= this.min;
|
||
classes.expand = this.expand;
|
||
classes.dragging = this.dragging;
|
||
classes.transiting = this.transiting;
|
||
classes.editable = this.editable;
|
||
|
||
return Object.keys(classes).filter(
|
||
function(className) {
|
||
return classes[className];
|
||
}).join(' ');
|
||
},
|
||
|
||
_incrementKey: function(event) {
|
||
if (event.detail.key === 'end') {
|
||
this.value = this.max;
|
||
} else {
|
||
this.increment();
|
||
}
|
||
this.fire('change');
|
||
},
|
||
|
||
_decrementKey: function(event) {
|
||
if (event.detail.key === 'home') {
|
||
this.value = this.min;
|
||
} else {
|
||
this.decrement();
|
||
}
|
||
this.fire('change');
|
||
}
|
||
})
|
||
</script>
|
||
<dom-module id="more-info-thermostat" assetpath="more-infos/">
|
||
<style>
|
||
paper-slider {
|
||
width: 100%;
|
||
}
|
||
|
||
.away-mode-toggle {
|
||
display: none;
|
||
margin-top: 16px;
|
||
}
|
||
|
||
.has-away_mode .away-mode-toggle {
|
||
display: block;
|
||
}
|
||
</style>
|
||
<template>
|
||
<div class$="[[computeClassNames(stateObj)]]">
|
||
<div>
|
||
<div>Target Temperature</div>
|
||
<paper-slider min="[[tempMin]]" max="[[tempMax]]" value="[[targetTemperatureSliderValue]]" pin="" on-change="targetTemperatureSliderChanged">
|
||
</paper-slider>
|
||
</div>
|
||
|
||
<div class="away-mode-toggle">
|
||
<div class="center horizontal layout">
|
||
<div class="flex">Away Mode</div>
|
||
<paper-toggle-button checked="[[awayToggleChecked]]" on-change="toggleChanged">
|
||
</paper-toggle-button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var constants = window.hass.constants;
|
||
var serviceActions = window.hass.serviceActions;
|
||
var uiUtil = window.hass.uiUtil;
|
||
var ATTRIBUTE_CLASSES = ['away_mode'];
|
||
|
||
Polymer({
|
||
is: 'more-info-thermostat',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
observer: 'stateObjChanged',
|
||
},
|
||
|
||
tempMin: {
|
||
type: Number,
|
||
},
|
||
|
||
tempMax: {
|
||
type: Number,
|
||
},
|
||
|
||
targetTemperatureSliderValue: {
|
||
type: Number,
|
||
},
|
||
|
||
awayToggleChecked: {
|
||
type: Boolean,
|
||
},
|
||
},
|
||
|
||
stateObjChanged: function(newVal, oldVal) {
|
||
this.targetTemperatureSliderValue = this.stateObj.state;
|
||
this.awayToggleChecked = this.stateObj.attributes.away_mode == 'on';
|
||
|
||
if (this.stateObj.attributes.unit_of_measurement === constants.UNIT_TEMP_F) {
|
||
this.tempMin = 45;
|
||
this.tempMax = 95;
|
||
} else {
|
||
this.tempMin = 7;
|
||
this.tempMax = 35;
|
||
}
|
||
},
|
||
|
||
computeClassNames: function(stateObj) {
|
||
return uiUtil.attributeClassNames(stateObj, ATTRIBUTE_CLASSES);
|
||
},
|
||
|
||
targetTemperatureSliderChanged: function(ev) {
|
||
var temp = parseInt(ev.target.value);
|
||
|
||
if(isNaN(temp)) return;
|
||
|
||
serviceActions.callService('thermostat', 'set_temperature', {
|
||
entity_id: this.stateObj.entityId,
|
||
temperature: temp
|
||
});
|
||
},
|
||
|
||
toggleChanged: function(ev) {
|
||
var newVal = ev.target.checked;
|
||
|
||
if(newVal && this.stateObj.attributes.away_mode === 'off') {
|
||
this.service_set_away(true);
|
||
} else if(!newVal && this.stateObj.attributes.away_mode === 'on') {
|
||
this.service_set_away(false);
|
||
}
|
||
},
|
||
|
||
service_set_away: function(away_mode) {
|
||
// We call stateChanged after a successful call to re-sync the toggle
|
||
// with the state. It will be out of sync if our service call did not
|
||
// result in the entity to be turned on. Since the state is not changing,
|
||
// the resync is not called automatic.
|
||
serviceActions.callService(
|
||
'thermostat', 'set_away_mode',
|
||
{entity_id: this.stateObj.entityId, away_mode: away_mode})
|
||
|
||
.then(function() {
|
||
this.stateObjChanged(this.stateObj);
|
||
}.bind(this));
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="more-info-script" assetpath="more-infos/">
|
||
<template>
|
||
<div class="layout vertical">
|
||
<div class="data-entry layout justified horizontal">
|
||
<div class="key">Last Action</div>
|
||
<div class="value">[[stateObj.attributes.last_action]]</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
Polymer({
|
||
is: 'more-info-script',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
},
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="more-info-light" assetpath="more-infos/">
|
||
<style>
|
||
.brightness {
|
||
margin-bottom: 8px;
|
||
|
||
max-height: 0px;
|
||
overflow: hidden;
|
||
transition: max-height .5s ease-in;
|
||
}
|
||
|
||
color-picker {
|
||
display: block;
|
||
width: 350px;
|
||
margin: 0 auto;
|
||
|
||
max-height: 0px;
|
||
overflow: hidden;
|
||
transition: max-height .5s ease-in;
|
||
}
|
||
|
||
.has-brightness .brightness {
|
||
max-height: 40px;
|
||
}
|
||
|
||
.has-xy_color color-picker {
|
||
max-height: 500px;
|
||
}
|
||
</style>
|
||
<template>
|
||
<div class$="[[computeClassNames(stateObj)]]">
|
||
<div class="brightness center horizontal layout">
|
||
<div>Brightness</div>
|
||
<paper-slider max="255" id="brightness" value="{{brightnessSliderValue}}" on-change="brightnessSliderChanged" class="flex">
|
||
</paper-slider>
|
||
</div>
|
||
|
||
<color-picker on-colorselected="colorPicked" width="350" height="200">
|
||
</color-picker>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var serviceActions = window.hass.serviceActions;
|
||
var uiUtil = window.hass.uiUtil;
|
||
var ATTRIBUTE_CLASSES = ['brightness', 'xy_color'];
|
||
|
||
Polymer({
|
||
is: 'more-info-light',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
observer: 'stateObjChanged',
|
||
},
|
||
|
||
brightnessSliderValue: {
|
||
type: Number,
|
||
value: 0,
|
||
}
|
||
},
|
||
|
||
stateObjChanged: function(newVal, oldVal) {
|
||
if (newVal && newVal.state === 'on') {
|
||
this.brightnessSliderValue = newVal.attributes.brightness;
|
||
}
|
||
|
||
this.debounce('more-info-light-animation-finish', function() {
|
||
this.fire('iron-resize');
|
||
}.bind(this), 500);
|
||
},
|
||
|
||
computeClassNames: function(stateObj) {
|
||
return uiUtil.attributeClassNames(stateObj, ATTRIBUTE_CLASSES);
|
||
},
|
||
|
||
brightnessSliderChanged: function(ev) {
|
||
var bri = parseInt(ev.target.value);
|
||
|
||
if(isNaN(bri)) return;
|
||
|
||
if(bri === 0) {
|
||
serviceActions.callTurnOff(this.stateObj.entityId);
|
||
} else {
|
||
serviceActions.callService('light', 'turn_on', {
|
||
entity_id: this.stateObj.entityId,
|
||
brightness: bri
|
||
});
|
||
}
|
||
},
|
||
|
||
colorPicked: function(ev) {
|
||
var color = ev.detail.rgb;
|
||
|
||
serviceActions.callService('light', 'turn_on', {
|
||
entity_id: this.stateObj.entityId,
|
||
rgb_color: [color.r, color.g, color.b]
|
||
});
|
||
}
|
||
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="more-info-media_player" assetpath="more-infos/">
|
||
<style>
|
||
.media-state {
|
||
text-transform: capitalize;
|
||
}
|
||
|
||
paper-icon-button[highlight] {
|
||
color: var(--accent-color);
|
||
}
|
||
|
||
.volume {
|
||
margin-bottom: 8px;
|
||
|
||
max-height: 0px;
|
||
overflow: hidden;
|
||
transition: max-height .5s ease-in;
|
||
}
|
||
|
||
.has-volume_level .volume {
|
||
max-height: 40px;
|
||
}
|
||
</style>
|
||
<template>
|
||
<div class$="[[computeClassNames(stateObj)]]">
|
||
<div class="layout horizontal">
|
||
<div class="flex">
|
||
<paper-icon-button icon="power-settings-new" highlight$="[[isOff]]" on-tap="handleTogglePower" hidden$="[[computeHidePowerButton(isOff, supportsTurnOn, supportsTurnOff)]]"></paper-icon-button>
|
||
</div>
|
||
<div>
|
||
<template is="dom-if" if="[[!isOff]]">
|
||
<paper-icon-button icon="av:skip-previous" on-tap="handlePrevious" hidden$="[[!supportsPreviousTrack]]"></paper-icon-button>
|
||
<paper-icon-button icon="[[computePlaybackControlIcon(stateObj)]]" on-tap="handlePlaybackControl" highlight=""></paper-icon-button>
|
||
<paper-icon-button icon="av:skip-next" on-tap="handleNext" hidden$="[[!supportsNextTrack]]"></paper-icon-button>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
<div class="volume center horizontal layout" hidden$="[[!supportsVolumeSet]]">
|
||
<paper-icon-button on-tap="handleVolumeTap" icon="[[computeMuteVolumeIcon(isMuted)]]"></paper-icon-button>
|
||
<paper-slider disabled$="[[isMuted]]" min="0" max="100" value="[[volumeSliderValue]]" on-change="volumeSliderChanged" class="flex">
|
||
</paper-slider>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var serviceActions = window.hass.serviceActions;
|
||
var uiUtil = window.hass.uiUtil;
|
||
var ATTRIBUTE_CLASSES = ['volume_level'];
|
||
|
||
Polymer({
|
||
is: 'more-info-media_player',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
observer: 'stateObjChanged',
|
||
},
|
||
|
||
isOff: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
isPlaying: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
isMuted: {
|
||
type: Boolean,
|
||
value: false
|
||
},
|
||
|
||
volumeSliderValue: {
|
||
type: Number,
|
||
value: 0,
|
||
},
|
||
|
||
supportsPause: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
supportsVolumeSet: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
supportsVolumeMute: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
supportsPreviousTrack: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
supportsNextTrack: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
supportsTurnOn: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
supportsTurnOff: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
},
|
||
|
||
stateObjChanged: function(newVal, oldVal) {
|
||
if (newVal) {
|
||
this.isOff = newVal.state == 'off';
|
||
this.isPlaying = newVal.state == 'playing';
|
||
this.volumeSliderValue = newVal.attributes.volume_level * 100;
|
||
this.isMuted = newVal.attributes.is_volume_muted;
|
||
this.supportsPause = (newVal.attributes.supported_media_commands & 1) !== 0;
|
||
this.supportsVolumeSet = (newVal.attributes.supported_media_commands & 4) !== 0;
|
||
this.supportsVolumeMute = (newVal.attributes.supported_media_commands & 8) !== 0;
|
||
this.supportsPreviousTrack = (newVal.attributes.supported_media_commands & 16) !== 0;
|
||
this.supportsNextTrack = (newVal.attributes.supported_media_commands & 32) !== 0;
|
||
this.supportsTurnOn = (newVal.attributes.supported_media_commands & 128) !== 0;
|
||
this.supportsTurnOff = (newVal.attributes.supported_media_commands & 256) !== 0;
|
||
}
|
||
|
||
this.debounce('more-info-volume-animation-finish', function() {
|
||
this.fire('iron-resize');
|
||
}.bind(this), 500);
|
||
},
|
||
|
||
computeClassNames: function(stateObj) {
|
||
return uiUtil.attributeClassNames(stateObj, ATTRIBUTE_CLASSES);
|
||
},
|
||
|
||
computeIsOff: function(stateObj) {
|
||
return stateObj.state == 'off';
|
||
},
|
||
|
||
computeMuteVolumeIcon: function(isMuted) {
|
||
return isMuted ? 'av:volume-off' : 'av:volume-up';
|
||
},
|
||
|
||
computePlaybackControlIcon: function(stateObj) {
|
||
if (this.isPlaying) {
|
||
return this.supportsPause ? 'av:pause' : 'av:stop';
|
||
}
|
||
return 'av:play-arrow';
|
||
},
|
||
|
||
computeHidePowerButton: function(isOff, supportsTurnOn, supportsTurnOff) {
|
||
return isOff ? !supportsTurnOn : !supportsTurnOff;
|
||
},
|
||
|
||
handleTogglePower: function() {
|
||
this.callService(this.isOff ? 'turn_on' : 'turn_off');
|
||
},
|
||
|
||
handlePrevious: function() {
|
||
this.callService('media_previous_track');
|
||
},
|
||
|
||
handlePlaybackControl: function() {
|
||
if (this.isPlaying && !this.supportsPause) {
|
||
alert('This case is not supported yet');
|
||
}
|
||
this.callService('media_play_pause');
|
||
},
|
||
|
||
handleNext: function() {
|
||
this.callService('media_next_track');
|
||
},
|
||
|
||
handleVolumeTap: function() {
|
||
if (!this.supportsVolumeMute) {
|
||
return;
|
||
}
|
||
this.callService('volume_mute', { is_volume_muted: !this.isMuted });
|
||
},
|
||
|
||
volumeSliderChanged: function(ev) {
|
||
var volPercentage = parseFloat(ev.target.value);
|
||
var vol = volPercentage > 0 ? volPercentage / 100 : 0;
|
||
this.callService('volume_set', { volume_level: vol });
|
||
},
|
||
|
||
callService: function(service, data) {
|
||
data = data || {};
|
||
data.entity_id = this.stateObj.entityId;
|
||
serviceActions.callService('media_player', service, data);
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="more-info-content" assetpath="more-infos/">
|
||
<style>
|
||
:host {
|
||
display: block;
|
||
}
|
||
</style>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var uiUtil = window.hass.uiUtil;
|
||
|
||
Polymer({
|
||
is: 'more-info-content',
|
||
|
||
properties: {
|
||
stateObj: {
|
||
type: Object,
|
||
observer: 'stateObjChanged',
|
||
},
|
||
|
||
dialogOpen: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
},
|
||
|
||
dialogOpenChanged: function(newVal, oldVal) {
|
||
var root = Polymer.dom(this);
|
||
|
||
if (root.lastChild) {
|
||
root.lastChild.dialogOpen = newVal;
|
||
}
|
||
},
|
||
|
||
stateObjChanged: function(newVal, oldVal) {
|
||
var root = Polymer.dom(this);
|
||
var newMoreInfoType;
|
||
|
||
if (!newVal || !(newMoreInfoType = uiUtil.stateMoreInfoType(newVal))) {
|
||
if (root.lastChild) {
|
||
root.removeChild(root.lastChild);
|
||
}
|
||
return;
|
||
}
|
||
|
||
if (!oldVal || uiUtil.stateMoreInfoType(oldVal) != newMoreInfoType) {
|
||
|
||
if (root.lastChild) {
|
||
root.removeChild(root.lastChild);
|
||
}
|
||
|
||
var moreInfo = document.createElement('more-info-' + newMoreInfoType);
|
||
moreInfo.stateObj = newVal;
|
||
moreInfo.dialogOpen = this.dialogOpen;
|
||
root.appendChild(moreInfo);
|
||
|
||
} else {
|
||
|
||
root.lastChild.dialogOpen = this.dialogOpen;
|
||
root.lastChild.stateObj = newVal;
|
||
|
||
}
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="more-info-dialog" assetpath="dialogs/">
|
||
<style>
|
||
state-card-content {
|
||
margin-bottom: 24px;
|
||
}
|
||
|
||
@media all and (max-width: 450px) {
|
||
paper-dialog {
|
||
margin: 0;
|
||
width: 100%;
|
||
max-height: calc(100% - 64px);
|
||
|
||
position: fixed !important;
|
||
bottom: 0px;
|
||
left: 0px;
|
||
right: 0px;
|
||
overflow: scroll;
|
||
}
|
||
}
|
||
</style>
|
||
<template>
|
||
|
||
<paper-dialog id="dialog" with-backdrop="">
|
||
<h2><state-card-content state-obj="[[stateObj]]"></state-card-content></h2>
|
||
<div>
|
||
<template is="dom-if" if="[[hasHistoryComponent]]">
|
||
<state-history-charts state-history="[[stateHistory]]" is-loading-data="[[isLoadingHistoryData]]"></state-history-charts>
|
||
</template>
|
||
<paper-dialog-scrollable>
|
||
<more-info-content state-obj="[[stateObj]]" dialog-open="[[dialogOpen]]"></more-info-content>
|
||
</paper-dialog-scrollable>
|
||
</div>
|
||
</paper-dialog>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var stateStore = window.hass.stateStore;
|
||
var stateHistoryStore = window.hass.stateHistoryStore;
|
||
var stateHistoryActions = window.hass.stateHistoryActions;
|
||
|
||
Polymer({
|
||
is: 'more-info-dialog',
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
entityId: {
|
||
type: String,
|
||
},
|
||
|
||
stateObj: {
|
||
type: Object,
|
||
},
|
||
|
||
stateHistory: {
|
||
type: Object,
|
||
},
|
||
|
||
isLoadingHistoryData: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
hasHistoryComponent: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
dialogOpen: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
},
|
||
|
||
listeners: {
|
||
'iron-overlay-opened': 'onIronOverlayOpened',
|
||
'iron-overlay-closed': 'onIronOverlayClosed'
|
||
},
|
||
|
||
componentStoreChanged: function(componentStore) {
|
||
this.hasHistoryComponent = componentStore.isLoaded('history');
|
||
},
|
||
|
||
stateStoreChanged: function() {
|
||
var newState = this.entityId ? stateStore.get(this.entityId) : null;
|
||
|
||
if (newState !== this.stateObj) {
|
||
this.stateObj = newState;
|
||
}
|
||
},
|
||
|
||
stateHistoryStoreChanged: function() {
|
||
var newHistory;
|
||
|
||
if (this.hasHistoryComponent && this.entityId) {
|
||
newHistory = [stateHistoryStore.get(this.entityId)];
|
||
} else {
|
||
newHistory = null;
|
||
}
|
||
|
||
this.isLoadingHistoryData = false;
|
||
|
||
if (newHistory !== this.stateHistory) {
|
||
this.stateHistory = newHistory;
|
||
}
|
||
},
|
||
|
||
onIronOverlayOpened: function() {
|
||
this.dialogOpen = true;
|
||
},
|
||
|
||
onIronOverlayClosed: function() {
|
||
this.dialogOpen = false;
|
||
},
|
||
|
||
changeEntityId: function(entityId) {
|
||
this.entityId = entityId;
|
||
|
||
this.stateStoreChanged();
|
||
this.stateHistoryStoreChanged();
|
||
|
||
if (this.hasHistoryComponent && stateHistoryStore.shouldFetchEntity(entityId)) {
|
||
this.isLoadingHistoryData = true;
|
||
stateHistoryActions.fetch(entityId);
|
||
}
|
||
},
|
||
|
||
show: function(entityId) {
|
||
this.changeEntityId(entityId);
|
||
|
||
this.debounce('showDialogAfterRender', function() {
|
||
this.$.dialog.toggle();
|
||
}.bind(this));
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<dom-module id="modal-manager" assetpath="managers/">
|
||
<template>
|
||
<more-info-dialog id="moreInfoDialog"></more-info-dialog>
|
||
<paper-date-picker-dialog id="datePicker" on-value-changed="datePickerValueChanged"></paper-date-picker-dialog>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var uiConstants = window.hass.uiConstants,
|
||
dispatcher = window.hass.dispatcher;
|
||
|
||
Polymer({
|
||
is: 'modal-manager',
|
||
|
||
properties: {
|
||
datePickerCallback: {
|
||
type: Function,
|
||
value: null,
|
||
},
|
||
},
|
||
|
||
ready: function() {
|
||
dispatcher.register(function(payload) {
|
||
switch (payload.actionType) {
|
||
case uiConstants.ACTION_SHOW_DIALOG_MORE_INFO:
|
||
this.$.moreInfoDialog.show(payload.entityId);
|
||
break;
|
||
|
||
case uiConstants.ACTION_SHOW_DATE_PICKER:
|
||
this.datePickerCallback = payload.dateSelectedCallback;
|
||
this.$.date = payload.date;
|
||
this.$.datePicker.toggle();
|
||
break;
|
||
}
|
||
}.bind(this));
|
||
},
|
||
|
||
datePickerValueChanged: function(ev) {
|
||
this.datePickerCallback(ev.target.value);
|
||
},
|
||
});
|
||
})();
|
||
</script>
|
||
<iron-iconset-svg name="notification" size="24">
|
||
<svg><defs>
|
||
<g id="adb"><path d="M5 16c0 3.87 3.13 7 7 7s7-3.13 7-7v-4H5v4zM16.12 4.37l2.1-2.1-.82-.83-2.3 2.31C14.16 3.28 13.12 3 12 3s-2.16.28-3.09.75L6.6 1.44l-.82.83 2.1 2.1C6.14 5.64 5 7.68 5 10v1h14v-1c0-2.32-1.14-4.36-2.88-5.63zM9 9c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm6 0c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"></path></g>
|
||
<g id="airline-seat-flat"><path d="M22 11v2H9V7h9c2.21 0 4 1.79 4 4zM2 14v2h6v2h8v-2h6v-2H2zm5.14-1.9c1.16-1.19 1.14-3.08-.04-4.24-1.19-1.16-3.08-1.14-4.24.04-1.16 1.19-1.14 3.08.04 4.24 1.19 1.16 3.08 1.14 4.24-.04z"></path></g>
|
||
<g id="airline-seat-flat-angled"><path d="M22.25 14.29l-.69 1.89L9.2 11.71l2.08-5.66 8.56 3.09c2.1.76 3.18 3.06 2.41 5.15zM1.5 12.14L8 14.48V19h8v-1.63L20.52 19l.69-1.89-19.02-6.86-.69 1.89zm5.8-1.94c1.49-.72 2.12-2.51 1.41-4C7.99 4.71 6.2 4.08 4.7 4.8c-1.49.71-2.12 2.5-1.4 4 .71 1.49 2.5 2.12 4 1.4z"></path></g>
|
||
<g id="airline-seat-individual-suite"><path d="M7 13c1.65 0 3-1.35 3-3S8.65 7 7 7s-3 1.35-3 3 1.35 3 3 3zm12-6h-8v7H3V7H1v10h22v-6c0-2.21-1.79-4-4-4z"></path></g>
|
||
<g id="airline-seat-legroom-extra"><path d="M4 12V3H2v9c0 2.76 2.24 5 5 5h6v-2H7c-1.66 0-3-1.34-3-3zm18.83 5.24c-.38-.72-1.29-.97-2.03-.63l-1.09.5-3.41-6.98c-.34-.68-1.03-1.12-1.79-1.12L11 9V3H5v8c0 1.66 1.34 3 3 3h7l3.41 7 3.72-1.7c.77-.36 1.1-1.3.7-2.06z"></path></g>
|
||
<g id="airline-seat-legroom-normal"><path d="M5 12V3H3v9c0 2.76 2.24 5 5 5h6v-2H8c-1.66 0-3-1.34-3-3zm15.5 6H19v-7c0-1.1-.9-2-2-2h-5V3H6v8c0 1.65 1.35 3 3 3h7v7h4.5c.83 0 1.5-.67 1.5-1.5s-.67-1.5-1.5-1.5z"></path></g>
|
||
<g id="airline-seat-legroom-reduced"><path d="M19.97 19.2c.18.96-.55 1.8-1.47 1.8H14v-3l1-4H9c-1.65 0-3-1.35-3-3V3h6v6h5c1.1 0 2 .9 2 2l-2 7h1.44c.73 0 1.39.49 1.53 1.2zM5 12V3H3v9c0 2.76 2.24 5 5 5h4v-2H8c-1.66 0-3-1.34-3-3z"></path></g>
|
||
<g id="airline-seat-recline-extra"><path d="M5.35 5.64c-.9-.64-1.12-1.88-.49-2.79.63-.9 1.88-1.12 2.79-.49.9.64 1.12 1.88.49 2.79-.64.9-1.88 1.12-2.79.49zM16 19H8.93c-1.48 0-2.74-1.08-2.96-2.54L4 7H2l1.99 9.76C4.37 19.2 6.47 21 8.94 21H16v-2zm.23-4h-4.88l-1.03-4.1c1.58.89 3.28 1.54 5.15 1.22V9.99c-1.63.31-3.44-.27-4.69-1.25L9.14 7.47c-.23-.18-.49-.3-.76-.38-.32-.09-.66-.12-.99-.06h-.02c-1.23.22-2.05 1.39-1.84 2.61l1.35 5.92C7.16 16.98 8.39 18 9.83 18h6.85l3.82 3 1.5-1.5-5.77-4.5z"></path></g>
|
||
<g id="airline-seat-recline-normal"><path d="M7.59 5.41c-.78-.78-.78-2.05 0-2.83.78-.78 2.05-.78 2.83 0 .78.78.78 2.05 0 2.83-.79.79-2.05.79-2.83 0zM6 16V7H4v9c0 2.76 2.24 5 5 5h6v-2H9c-1.66 0-3-1.34-3-3zm14 4.07L14.93 15H11.5v-3.68c1.4 1.15 3.6 2.16 5.5 2.16v-2.16c-1.66.02-3.61-.87-4.67-2.04l-1.4-1.55c-.19-.21-.43-.38-.69-.5-.29-.14-.62-.23-.96-.23h-.03C8.01 7 7 8.01 7 9.25V15c0 1.66 1.34 3 3 3h5.07l3.5 3.5L20 20.07z"></path></g>
|
||
<g id="bluetooth-audio"><path d="M14.24 12.01l2.32 2.32c.28-.72.44-1.51.44-2.33 0-.82-.16-1.59-.43-2.31l-2.33 2.32zm5.29-5.3l-1.26 1.26c.63 1.21.98 2.57.98 4.02s-.36 2.82-.98 4.02l1.2 1.2c.97-1.54 1.54-3.36 1.54-5.31-.01-1.89-.55-3.67-1.48-5.19zm-3.82 1L10 2H9v7.59L4.41 5 3 6.41 8.59 12 3 17.59 4.41 19 9 14.41V22h1l5.71-5.71-4.3-4.29 4.3-4.29zM11 5.83l1.88 1.88L11 9.59V5.83zm1.88 10.46L11 18.17v-3.76l1.88 1.88z"></path></g>
|
||
<g id="confirmation-number"><defs><path id="a" d="M0 0h24v24H0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path d="M22 10V6c0-1.11-.9-2-2-2H4c-1.1 0-1.99.89-1.99 2v4c1.1 0 1.99.9 1.99 2s-.89 2-2 2v4c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-4c-1.1 0-2-.9-2-2s.9-2 2-2zm-9 7.5h-2v-2h2v2zm0-4.5h-2v-2h2v2zm0-4.5h-2v-2h2v2z" clip-path="url(#b)"></path></g>
|
||
<g id="disc-full"><path d="M20 16h2v-2h-2v2zm0-9v5h2V7h-2zM10 4c-4.42 0-8 3.58-8 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm0 10c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"></path></g>
|
||
<g id="do-not-disturb"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z"></path></g>
|
||
<g id="do-not-disturb-alt"><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zM4 12c0-4.4 3.6-8 8-8 1.8 0 3.5.6 4.9 1.7L5.7 16.9C4.6 15.5 4 13.8 4 12zm8 8c-1.8 0-3.5-.6-4.9-1.7L18.3 7.1C19.4 8.5 20 10.2 20 12c0 4.4-3.6 8-8 8z"></path></g>
|
||
<g id="drive-eta"><path d="M18.92 5.01C18.72 4.42 18.16 4 17.5 4h-11c-.66 0-1.21.42-1.42 1.01L3 11v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 15c-.83 0-1.5-.67-1.5-1.5S5.67 12 6.5 12s1.5.67 1.5 1.5S7.33 15 6.5 15zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 10l1.5-4.5h11L19 10H5z"></path></g>
|
||
<g id="event-available"><path d="M16.53 11.06L15.47 10l-4.88 4.88-2.12-2.12-1.06 1.06L10.59 17l5.94-5.94zM19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11z"></path></g>
|
||
<g id="event-busy"><path d="M9.31 17l2.44-2.44L14.19 17l1.06-1.06-2.44-2.44 2.44-2.44L14.19 10l-2.44 2.44L9.31 10l-1.06 1.06 2.44 2.44-2.44 2.44L9.31 17zM19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11z"></path></g>
|
||
<g id="event-note"><path d="M17 10H7v2h10v-2zm2-7h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zm-5-5H7v2h7v-2z"></path></g>
|
||
<g id="folder-special"><path d="M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-6.42 12L10 15.9 6.42 18l.95-4.07-3.16-2.74 4.16-.36L10 7l1.63 3.84 4.16.36-3.16 2.74.95 4.06z"></path></g>
|
||
<g id="live-tv"><path d="M21 6h-7.59l3.29-3.29L16 2l-4 4-4-4-.71.71L10.59 6H3c-1.1 0-2 .89-2 2v12c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V8c0-1.11-.9-2-2-2zm0 14H3V8h18v12zM9 10v8l7-4z"></path></g>
|
||
<g id="mms"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM5 14l3.5-4.5 2.5 3.01L14.5 8l4.5 6H5z"></path></g>
|
||
<g id="more"><path d="M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.97.89 1.66.89H22c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"></path></g>
|
||
<g id="network-locked"><path d="M19.5 10c.17 0 .33.03.5.05V1L1 20h13v-3c0-.89.39-1.68 1-2.23v-.27c0-2.48 2.02-4.5 4.5-4.5zm2.5 6v-1.5c0-1.38-1.12-2.5-2.5-2.5S17 13.12 17 14.5V16c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h5c.55 0 1-.45 1-1v-4c0-.55-.45-1-1-1zm-1 0h-3v-1.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5V16z"></path></g>
|
||
<g id="ondemand-video"><path d="M21 3H3c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.11-.9-2-2-2zm0 14H3V5h18v12zm-5-6l-7 4V7z"></path></g>
|
||
<g id="personal-video"><path d="M21 3H3c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.11-.9-2-2-2zm0 14H3V5h18v12z"></path></g>
|
||
<g id="phone-bluetooth-speaker"><path d="M14.71 9.5L17 7.21V11h.5l2.85-2.85L18.21 6l2.15-2.15L17.5 1H17v3.79L14.71 2.5l-.71.71L16.79 6 14 8.79l.71.71zM18 2.91l.94.94-.94.94V2.91zm0 4.3l.94.94-.94.94V7.21zm2 8.29c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.59l2.2-2.21c.28-.26.36-.65.25-1C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1z"></path></g>
|
||
<g id="phone-forwarded"><path d="M18 11l5-5-5-5v3h-4v4h4v3zm2 4.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.59l2.2-2.21c.28-.26.36-.65.25-1C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1z"></path></g>
|
||
<g id="phone-in-talk"><path d="M20 15.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.59l2.2-2.21c.28-.26.36-.65.25-1C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1zM19 12h2c0-4.97-4.03-9-9-9v2c3.87 0 7 3.13 7 7zm-4 0h2c0-2.76-2.24-5-5-5v2c1.66 0 3 1.34 3 3z"></path></g>
|
||
<g id="phone-locked"><path d="M20 15.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.59l2.2-2.21c.28-.26.36-.65.25-1C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1zM20 4v-.5C20 2.12 18.88 1 17.5 1S15 2.12 15 3.5V4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h5c.55 0 1-.45 1-1V5c0-.55-.45-1-1-1zm-.8 0h-3.4v-.5c0-.94.76-1.7 1.7-1.7s1.7.76 1.7 1.7V4z"></path></g>
|
||
<g id="phone-missed"><path d="M6.5 5.5L12 11l7-7-1-1-6 6-4.5-4.5H11V3H5v6h1.5V5.5zm17.21 11.17C20.66 13.78 16.54 12 12 12 7.46 12 3.34 13.78.29 16.67c-.18.18-.29.43-.29.71s.11.53.29.71l2.48 2.48c.18.18.43.29.71.29.27 0 .52-.11.7-.28.79-.74 1.69-1.36 2.66-1.85.33-.16.56-.5.56-.9v-3.1c1.45-.48 3-.73 4.6-.73 1.6 0 3.15.25 4.6.72v3.1c0 .39.23.74.56.9.98.49 1.87 1.12 2.67 1.85.18.18.43.28.7.28.28 0 .53-.11.71-.29l2.48-2.48c.18-.18.29-.43.29-.71s-.12-.52-.3-.7z"></path></g>
|
||
<g id="phone-paused"><path d="M17 3h-2v7h2V3zm3 12.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.59l2.2-2.21c.28-.26.36-.65.25-1C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1zM19 3v7h2V3h-2z"></path></g>
|
||
<g id="power"><path d="M16.01 7L16 3h-2v4h-4V3H8v4h-.01C7 6.99 6 7.99 6 8.99v5.49L9.5 18v3h5v-3l3.5-3.51v-5.5c0-1-1-2-1.99-1.99z"></path></g>
|
||
<g id="sd-card"><path d="M18 2h-8L4.02 8 4 20c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-6 6h-2V4h2v4zm3 0h-2V4h2v4zm3 0h-2V4h2v4z"></path></g>
|
||
<g id="sim-card-alert"><path d="M18 2h-8L4.02 8 4 20c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-5 15h-2v-2h2v2zm0-4h-2V8h2v5z"></path></g>
|
||
<g id="sms"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM9 11H7V9h2v2zm4 0h-2V9h2v2zm4 0h-2V9h2v2z"></path></g>
|
||
<g id="sms-failed"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 12h-2v-2h2v2zm0-4h-2V6h2v4z"></path></g>
|
||
<g id="sync"><path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"></path></g>
|
||
<g id="sync-disabled"><path d="M10 6.35V4.26c-.8.21-1.55.54-2.23.96l1.46 1.46c.25-.12.5-.24.77-.33zm-7.14-.94l2.36 2.36C4.45 8.99 4 10.44 4 12c0 2.21.91 4.2 2.36 5.64L4 20h6v-6l-2.24 2.24C6.68 15.15 6 13.66 6 12c0-1 .25-1.94.68-2.77l8.08 8.08c-.25.13-.5.25-.77.34v2.09c.8-.21 1.55-.54 2.23-.96l2.36 2.36 1.27-1.27L4.14 4.14 2.86 5.41zM20 4h-6v6l2.24-2.24C17.32 8.85 18 10.34 18 12c0 1-.25 1.94-.68 2.77l1.46 1.46C19.55 15.01 20 13.56 20 12c0-2.21-.91-4.2-2.36-5.64L20 4z"></path></g>
|
||
<g id="sync-problem"><path d="M3 12c0 2.21.91 4.2 2.36 5.64L3 20h6v-6l-2.24 2.24C5.68 15.15 5 13.66 5 12c0-2.61 1.67-4.83 4-5.65V4.26C5.55 5.15 3 8.27 3 12zm8 5h2v-2h-2v2zM21 4h-6v6l2.24-2.24C18.32 8.85 19 10.34 19 12c0 2.61-1.67 4.83-4 5.65v2.09c3.45-.89 6-4.01 6-7.74 0-2.21-.91-4.2-2.36-5.64L21 4zm-10 9h2V7h-2v6z"></path></g>
|
||
<g id="system-update"><path d="M17 1.01L7 1c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99zM17 19H7V5h10v14zm-1-6h-3V8h-2v5H8l4 4 4-4z"></path></g>
|
||
<g id="tap-and-play"><path d="M2 16v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm0 4v3h3c0-1.66-1.34-3-3-3zm0-8v2c4.97 0 9 4.03 9 9h2c0-6.08-4.92-11-11-11zM17 1.01L7 1c-1.1 0-2 .9-2 2v7.37c.69.16 1.36.37 2 .64V5h10v13h-3.03c.52 1.25.84 2.59.95 4H17c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99z"></path></g>
|
||
<g id="time-to-leave"><path d="M18.92 5.01C18.72 4.42 18.16 4 17.5 4h-11c-.66 0-1.21.42-1.42 1.01L3 11v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 15c-.83 0-1.5-.67-1.5-1.5S5.67 12 6.5 12s1.5.67 1.5 1.5S7.33 15 6.5 15zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 10l1.5-4.5h11L19 10H5z"></path></g>
|
||
<g id="vibration"><path d="M0 15h2V9H0v6zm3 2h2V7H3v10zm19-8v6h2V9h-2zm-3 8h2V7h-2v10zM16.5 3h-9C6.67 3 6 3.67 6 4.5v15c0 .83.67 1.5 1.5 1.5h9c.83 0 1.5-.67 1.5-1.5v-15c0-.83-.67-1.5-1.5-1.5zM16 19H8V5h8v14z"></path></g>
|
||
<g id="voice-chat"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12l-4-3.2V14H6V6h8v3.2L18 6v8z"></path></g>
|
||
<g id="vpn-lock"><path d="M22 4v-.5C22 2.12 20.88 1 19.5 1S17 2.12 17 3.5V4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h5c.55 0 1-.45 1-1V5c0-.55-.45-1-1-1zm-.8 0h-3.4v-.5c0-.94.76-1.7 1.7-1.7s1.7.76 1.7 1.7V4zm-2.28 8c.04.33.08.66.08 1 0 2.08-.8 3.97-2.1 5.39-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H7v-2h2c.55 0 1-.45 1-1V8h2c1.1 0 2-.9 2-2V3.46c-.95-.3-1.95-.46-3-.46C5.48 3 1 7.48 1 13s4.48 10 10 10 10-4.48 10-10c0-.34-.02-.67-.05-1h-2.03zM10 20.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L8 16v1c0 1.1.9 2 2 2v1.93z"></path></g>
|
||
<g id="wc"><path d="M5.5 22v-7.5H4V9c0-1.1.9-2 2-2h3c1.1 0 2 .9 2 2v5.5H9.5V22h-4zM18 22v-6h3l-2.54-7.63C18.18 7.55 17.42 7 16.56 7h-.12c-.86 0-1.63.55-1.9 1.37L12 16h3v6h3zM7.5 6c1.11 0 2-.89 2-2s-.89-2-2-2-2 .89-2 2 .89 2 2 2zm9 0c1.11 0 2-.89 2-2s-.89-2-2-2-2 .89-2 2 .89 2 2 2z"></path></g>
|
||
<g id="wifi"><path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3c-1.65-1.66-4.34-1.66-6 0zm-4-4l2 2c2.76-2.76 7.24-2.76 10 0l2-2C15.14 9.14 8.87 9.14 5 13z"></path></g>
|
||
</defs></svg>
|
||
</iron-iconset-svg>
|
||
<dom-module id="stream-status" assetpath="components/">
|
||
<style>
|
||
:host {
|
||
display: inline-block;
|
||
height: 24px;
|
||
}
|
||
|
||
paper-toggle-button {
|
||
vertical-align: middle;
|
||
}
|
||
</style>
|
||
<template>
|
||
<iron-icon icon="warning" hidden$="{{!hasError}}"></iron-icon>
|
||
<paper-toggle-button id="toggle" on-change="toggleChanged" hidden$="{{hasError}}"></paper-toggle-button>
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
var streamActions = window.hass.streamActions;
|
||
var authStore = window.hass.authStore;
|
||
|
||
Polymer({
|
||
is: 'stream-status',
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
isStreaming: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
hasError: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
},
|
||
|
||
streamStoreChanged: function(streamStore) {
|
||
this.hasError = streamStore.hasError;
|
||
this.$.toggle.checked = this.isStreaming = streamStore.isStreaming;
|
||
},
|
||
|
||
toggleChanged: function(ev) {
|
||
if (this.isStreaming) {
|
||
streamActions.stop();
|
||
} else {
|
||
streamActions.start(authStore.authToken);
|
||
}
|
||
},
|
||
});
|
||
</script>
|
||
<dom-module id="home-assistant-main" assetpath="layouts/">
|
||
<style>
|
||
.sidenav {
|
||
background: #fafafa;
|
||
box-shadow: 1px 0 1px rgba(0, 0, 0, 0.1);
|
||
overflow: hidden;
|
||
}
|
||
|
||
.sidenav paper-menu {
|
||
--paper-menu-color: var(--secondary-text-color);
|
||
--paper-menu-background-color: #fafafa;
|
||
}
|
||
|
||
paper-icon-item {
|
||
cursor: pointer;
|
||
}
|
||
|
||
paper-icon-item.logout {
|
||
margin-top: 16px;
|
||
}
|
||
|
||
.divider {
|
||
border-top: 1px solid #e0e0e0;
|
||
}
|
||
|
||
.text {
|
||
padding: 16px;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.dev-tools {
|
||
padding: 0 8px;
|
||
}
|
||
</style>
|
||
|
||
<template>
|
||
<notification-manager></notification-manager>
|
||
<modal-manager></modal-manager>
|
||
|
||
<paper-drawer-panel id="drawer" narrow="{{narrow}}">
|
||
<paper-header-panel mode="scroll" drawer="" class="sidenav fit">
|
||
<paper-toolbar>
|
||
|
||
<paper-icon-button hidden=""></paper-icon-button>
|
||
<div class="title">Home Assistant</div>
|
||
</paper-toolbar>
|
||
|
||
<paper-menu id="menu" selectable="[data-panel]" attr-for-selected="data-panel" on-iron-select="menuSelect" selected="[[selected]]">
|
||
<paper-icon-item data-panel="states">
|
||
<iron-icon item-icon="" icon="apps"></iron-icon> States
|
||
</paper-icon-item>
|
||
|
||
<template is="dom-repeat" items="{{activeFilters}}">
|
||
<paper-icon-item data-panel$="[[filterType(item)]]">
|
||
<iron-icon item-icon="" icon="[[filterIcon(item)]]"></iron-icon>
|
||
<span>[[filterName(item)]]</span>
|
||
</paper-icon-item>
|
||
</template>
|
||
|
||
<template is="dom-if" if="[[hasHistoryComponent]]">
|
||
<paper-icon-item data-panel="history">
|
||
<iron-icon item-icon="" icon="assessment"></iron-icon>
|
||
History
|
||
</paper-icon-item>
|
||
</template>
|
||
|
||
<template is="dom-if" if="[[hasLogbookComponent]]">
|
||
<paper-icon-item data-panel="logbook">
|
||
<iron-icon item-icon="" icon="list"></iron-icon>
|
||
Logbook
|
||
</paper-icon-item>
|
||
</template>
|
||
|
||
<paper-icon-item data-panel="logout" class="logout">
|
||
<iron-icon item-icon="" icon="exit-to-app"></iron-icon>
|
||
Log Out
|
||
</paper-icon-item>
|
||
|
||
<paper-item class="divider horizontal layout justified">
|
||
<div>Streaming updates</div>
|
||
<stream-status></stream-status>
|
||
</paper-item>
|
||
|
||
<div class="text label divider">Developer Tools</div>
|
||
<div class="dev-tools layout horizontal justified">
|
||
<paper-icon-button icon="settings-remote" data-panel$="[[selectedDevService]]" on-click="handleDevClick"></paper-icon-button>
|
||
<paper-icon-button icon="settings-ethernet" data-panel$="[[selectedDevState]]" on-click="handleDevClick"></paper-icon-button>
|
||
<paper-icon-button icon="settings-input-antenna" data-panel$="[[selectedDevEvent]]" on-click="handleDevClick"></paper-icon-button>
|
||
</div>
|
||
</paper-menu>
|
||
</paper-header-panel>
|
||
|
||
<template is="dom-if" if="[[!hideStates]]">
|
||
<partial-states main="" narrow="[[narrow]]" filter="[[stateFilter]]">
|
||
</partial-states>
|
||
</template>
|
||
|
||
<template is="dom-if" if="[[isSelectedLogbook]]">
|
||
<partial-logbook main="" narrow="[[narrow]]"></partial-logbook>
|
||
</template>
|
||
<template is="dom-if" if="[[isSelectedHistory]]">
|
||
<partial-history main="" narrow="[[narrow]]"></partial-history>
|
||
</template>
|
||
<template is="dom-if" if="[[isSelectedDevService]]">
|
||
<partial-dev-call-service main="" narrow="[[narrow]]"></partial-dev-call-service>
|
||
</template>
|
||
<template is="dom-if" if="[[isSelectedDevEvent]]">
|
||
<partial-dev-fire-event main="" narrow="[[narrow]]"></partial-dev-fire-event>
|
||
</template>
|
||
<template is="dom-if" if="[[isSelectedDevState]]">
|
||
<partial-dev-set-state main="" narrow="[[narrow]]"></partial-dev-set-state>
|
||
</template>
|
||
</paper-drawer-panel>
|
||
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
var authActions = window.hass.authActions;
|
||
|
||
var uiUtil = window.hass.uiUtil;
|
||
var uiConstants = window.hass.uiConstants;
|
||
|
||
Polymer({
|
||
is: 'home-assistant-main',
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
selected: {
|
||
type: String,
|
||
value: 'states',
|
||
},
|
||
|
||
stateFilter: {
|
||
type: String,
|
||
value: null,
|
||
},
|
||
|
||
narrow: {
|
||
type: Boolean,
|
||
},
|
||
|
||
activeFilters: {
|
||
type: Array,
|
||
value: [],
|
||
},
|
||
|
||
hasHistoryComponent: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
hasLogbookComponent: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
isStreaming: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
hasStreamError: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
hideStates: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
|
||
selectedHistory: {
|
||
type: String,
|
||
value: 'history',
|
||
readOnly: true,
|
||
},
|
||
|
||
isSelectedHistory: {
|
||
type: Boolean,
|
||
computed: 'computeIsSelected(selected, selectedHistory)',
|
||
},
|
||
|
||
selectedLogbook: {
|
||
type: String,
|
||
value: 'logbook',
|
||
readOnly: true,
|
||
},
|
||
|
||
isSelectedLogbook: {
|
||
type: Boolean,
|
||
computed: 'computeIsSelected(selected, selectedLogbook)',
|
||
},
|
||
|
||
selectedDevEvent: {
|
||
type: String,
|
||
value: 'devEvent',
|
||
readOnly: true,
|
||
},
|
||
|
||
isSelectedDevEvent: {
|
||
type: Boolean,
|
||
computed: 'computeIsSelected(selected, selectedDevEvent)',
|
||
},
|
||
|
||
selectedDevState: {
|
||
type: String,
|
||
value: 'devState',
|
||
readOnly: true,
|
||
},
|
||
|
||
isSelectedDevState: {
|
||
type: Boolean,
|
||
computed: 'computeIsSelected(selected, selectedDevState)',
|
||
},
|
||
|
||
selectedDevService: {
|
||
type: String,
|
||
value: 'devService',
|
||
readOnly: true,
|
||
},
|
||
|
||
isSelectedDevService: {
|
||
type: Boolean,
|
||
computed: 'computeIsSelected(selected, selectedDevService)',
|
||
},
|
||
|
||
|
||
},
|
||
|
||
listeners: {
|
||
'menu.core-select': 'menuSelect',
|
||
'open-menu': 'openDrawer',
|
||
},
|
||
|
||
stateStoreChanged: function(stateStore) {
|
||
this.activeFilters = stateStore.domains.filter(function(domain) {
|
||
return domain in uiConstants.STATE_FILTERS;
|
||
}).toArray();
|
||
},
|
||
|
||
componentStoreChanged: function(componentStore) {
|
||
this.hasHistoryComponent = componentStore.isLoaded('history');
|
||
this.hasLogbookComponent = componentStore.isLoaded('logbook');
|
||
},
|
||
|
||
menuSelect: function(ev, detail, sender) {
|
||
this.selectPanel(this.$.menu.selected);
|
||
},
|
||
|
||
handleDevClick: function(ev, detail, sender) {
|
||
// prevent it from highlighting first menu item
|
||
document.activeElement.blur();
|
||
this.selectPanel(ev.target.parentElement.dataset.panel);
|
||
},
|
||
|
||
selectPanel: function(newChoice) {
|
||
if (newChoice == 'logout') {
|
||
this.handleLogOut();
|
||
return;
|
||
} else if(newChoice == this.selected) {
|
||
return;
|
||
}
|
||
|
||
this.closeDrawer();
|
||
this.selected = newChoice;
|
||
|
||
if (newChoice.substr(0, 7) === 'states_') {
|
||
this.hideStates = false;
|
||
this.stateFilter = newChoice.substr(7);
|
||
} else {
|
||
this.hideStates = newChoice !== 'states';
|
||
this.stateFilter = null;
|
||
}
|
||
},
|
||
|
||
openDrawer: function() {
|
||
this.$.drawer.openDrawer();
|
||
},
|
||
|
||
closeDrawer: function() {
|
||
this.$.drawer.closeDrawer();
|
||
},
|
||
|
||
handleLogOut: function() {
|
||
authActions.logOut();
|
||
},
|
||
|
||
computeIsSelected: function(selected, selectedType) {
|
||
return selected === selectedType;
|
||
},
|
||
|
||
filterIcon: function(filter) {
|
||
return uiUtil.domainIcon(filter);
|
||
},
|
||
|
||
filterName: function(filter) {
|
||
return uiConstants.STATE_FILTERS[filter];
|
||
},
|
||
|
||
filterType: function(filter) {
|
||
return 'states_' + filter;
|
||
}
|
||
});
|
||
})();
|
||
</script>
|
||
</div><dom-module id="home-assistant">
|
||
<style>
|
||
:host {
|
||
font-family: 'Roboto', 'Noto', sans-serif;
|
||
font-weight: 300;
|
||
-webkit-font-smoothing: antialiased;
|
||
text-rendering: optimizeLegibility;
|
||
}
|
||
</style>
|
||
|
||
<home-assistant-icons></home-assistant-icons>
|
||
|
||
<template>
|
||
<template is="dom-if" if="[[!loaded]]">
|
||
<login-form></login-form>
|
||
</template>
|
||
|
||
<template is="dom-if" if="[[loaded]]">
|
||
<home-assistant-main></home-assistant-main>
|
||
</template>
|
||
|
||
</template>
|
||
</dom-module>
|
||
|
||
<script>
|
||
(function() {
|
||
|
||
var storeListenerMixIn = window.hass.storeListenerMixIn,
|
||
uiActions = window.hass.uiActions,
|
||
preferenceStore = window.hass.preferenceStore;
|
||
|
||
Polymer({
|
||
is: 'home-assistant',
|
||
|
||
hostAttributes: {
|
||
auth: null,
|
||
},
|
||
|
||
behaviors: [StoreListenerBehavior],
|
||
|
||
properties: {
|
||
loaded: {
|
||
type: Boolean,
|
||
value: false,
|
||
},
|
||
},
|
||
|
||
ready: function() {
|
||
// remove the HTML init message
|
||
document.getElementById('init').remove();
|
||
|
||
// if auth was given, tell the backend
|
||
if(this.auth) {
|
||
uiActions.validateAuth(this.auth, false);
|
||
} else if (preferenceStore.hasAuthToken) {
|
||
uiActions.validateAuth(preferenceStore.authToken, false);
|
||
}
|
||
},
|
||
|
||
syncStoreChanged: function(syncStore) {
|
||
this.loaded = syncStore.initialLoadDone;
|
||
},
|
||
});
|
||
|
||
})();
|
||
</script>
|
||
</body></html>
|