From 3dd4c17a36866aaf83459a00f83ef60e08417eb0 Mon Sep 17 00:00:00 2001 From: Matt Claypotch Date: Mon, 11 Nov 2013 11:56:30 -0800 Subject: [PATCH] updated calendar and core with fixes --- VERSION | 2 +- bower.json | 2 +- dist/brick.js | 7 +++---- dist/x-tag-calendar.min.js | 2 +- dist/x-tag-core.min.js | 4 +--- package.json | 2 +- 6 files changed, 8 insertions(+), 11 deletions(-) diff --git a/VERSION b/VERSION index dc8579ec..899f24fc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0beta8 \ No newline at end of file +0.9.0 \ No newline at end of file diff --git a/bower.json b/bower.json index 7414283d..b17b07c6 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "brick", "description": "UI Web Components for Mobile Web Apps", - "version": "1.0.0-beta7", + "version": "0.9.0", "keywords": [ "brick", "custom", diff --git a/dist/brick.js b/dist/brick.js index 2b033dfc..eb08ee6e 100644 --- a/dist/brick.js +++ b/dist/brick.js @@ -1,4 +1,3 @@ -window.Platform={};var logFlags={};!function(){function a(a){if(this._element=a,a.className!=this._classCache){if(this._classCache=a.className,!this._classCache)return;var b,c=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(b=0;b>>0)+(b++ +"__")},SideTable.prototype={set:function(b,c){var d=b[this.name];d&&d[0]===b?d[1]=c:a(b,this.name,{value:[b,c],writable:!0})},get:function(a){var b;return(b=a[this.name])&&b[0]===a?b[1]:void 0},"delete":function(a){this.set(a,void 0)}}}(),function(a){function b(a){u.push(a),t||(t=!0,q(d))}function c(a){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(a)||a}function d(){t=!1;var a=u;u=[],a.sort(function(a,b){return a.uid_-b.uid_});var b=!1;a.forEach(function(a){var c=a.takeRecords();e(a),c.length&&(a.callback_(c,a),b=!0)}),b&&d()}function e(a){a.nodes_.forEach(function(b){var c=p.get(b);c&&c.forEach(function(b){b.observer===a&&b.removeTransientObservers()})})}function f(a,b){for(var c=a;c;c=c.parentNode){var d=p.get(c);if(d)for(var e=0;e0){var e=c[d-1],f=n(e,a);if(f)return c[d-1]=f,void 0}else b(this.observer);c[d]=a},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(a){var b=this.options;b.attributes&&a.addEventListener("DOMAttrModified",this,!0),b.characterData&&a.addEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.addEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(a){var b=this.options;b.attributes&&a.removeEventListener("DOMAttrModified",this,!0),b.characterData&&a.removeEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.removeEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(a){if(a!==this.target){this.addListeners_(a),this.transientObservedNodes.push(a);var b=p.get(a);b||p.set(a,b=[]),b.push(this)}},removeTransientObservers:function(){var a=this.transientObservedNodes;this.transientObservedNodes=[],a.forEach(function(a){this.removeListeners_(a);for(var b=p.get(a),c=0;cc&&(a=b[c]);c++)a();B=[]}function l(a){z?j(function(){m(a)}):m(a)}function m(a){(a.enteredViewCallback||a.__upgraded__&&y.dom)&&(y.dom&&console.group("inserted:",a.localName),p(a)&&(a.__inserted=(a.__inserted||0)+1,a.__inserted<1&&(a.__inserted=1),a.__inserted>1?y.dom&&console.warn("inserted:",a.localName,"insert/remove count:",a.__inserted):a.enteredViewCallback&&(y.dom&&console.log("inserted:",a.localName),a.enteredViewCallback())),y.dom&&console.groupEnd())}function n(a){o(a),d(a,function(a){o(a)})}function o(a){z?j(function(){_removed(a)}):_removed(a)}function o(a){(a.leftViewCallback||a.__upgraded__&&y.dom)&&(y.dom&&console.log("removed:",a.localName),p(a)||(a.__inserted=(a.__inserted||0)-1,a.__inserted>0&&(a.__inserted=0),a.__inserted<0?y.dom&&console.warn("removed:",a.localName,"insert/remove count:",a.__inserted):a.leftViewCallback&&a.leftViewCallback()))}function p(a){for(var b=a,c=window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(document)||document;b;){if(b==c)return!0;b=b.parentNode||b.host}}function q(a){if(a.shadowRoot&&!a.shadowRoot.__watched){y.dom&&console.log("watching shadow-root for: ",a.localName);for(var b=a.shadowRoot;b;)r(b),b=b.olderShadowRoot}}function r(a){a.__watched||(v(a),a.__watched=!0)}function s(a){switch(a.localName){case"style":case"script":case"template":case void 0:return!0}}function t(a){if(y.dom){var b=a[0];if(b&&"childList"===b.type&&b.addedNodes&&b.addedNodes){for(var c=b.addedNodes[0];c&&c!==document&&!c.host;)c=c.parentNode;var d=c&&(c.URL||c._URL||c.host&&c.host.localName)||"";d=d.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",a.length,d||"")}a.forEach(function(a){"childList"===a.type&&(D(a.addedNodes,function(a){s(a)||g(a)}),D(a.removedNodes,function(a){s(a)||n(a)}))}),y.dom&&console.groupEnd()}function u(){t(C.takeRecords()),k()}function v(a){C.observe(a,{childList:!0,subtree:!0})}function w(a){v(a)}function x(a){y.dom&&console.group("upgradeDocument: ",(a.URL||a._URL||"").split("/").pop()),g(a),y.dom&&console.groupEnd()}var y=window.logFlags||{},z=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;a.hasPolyfillMutations=z;var A=!1,B=[],C=new MutationObserver(t),D=Array.prototype.forEach.call.bind(Array.prototype.forEach);a.watchShadow=q,a.upgradeAll=g,a.upgradeSubtree=f,a.observeDocument=w,a.upgradeDocument=x,a.takeRecords=u}(window.CustomElements),function(a){function b(a){return d(a,i)}function c(a){return d(a,j)}function d(a,b){return"link"===a.localName&&a.getAttribute("rel")===b}function e(a){return"script"===a.localName}function f(a,b){var c=a;c instanceof Document||(c=document.implementation.createHTMLDocument(i),c.body.innerHTML=a),c._URL=b;var d=c.createElement("base");return d.setAttribute("href",document.baseURI||document.URL),c.head.appendChild(d),window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(c),c}a||(a=window.HTMLImports={flags:{}});var g,h=a.xhr,i="import",j="stylesheet",k={documents:{},cache:{},preloadSelectors:["link[rel="+i+"]","element link[rel="+j+"]","template","script[src]:not([type])",'script[src][type="text/javascript"]'].join(","),loader:function(a){return g=new l(k.loaded,a),g.cache=k.cache,g},load:function(a,b){g=k.loader(b),k.preload(a)},preload:function(a){var b=a.querySelectorAll(k.preloadSelectors);b=this.filterMainDocumentNodes(a,b),b=this.extractTemplateNodes(b),g.addNodes(b)},filterMainDocumentNodes:function(a,b){return a===document&&(b=Array.prototype.filter.call(b,function(a){return!e(a)})),b},extractTemplateNodes:function(a){var b=[];return a=Array.prototype.filter.call(a,function(a){if("template"===a.localName){if(a.content){var c=a.content.querySelectorAll("link[rel="+j+"]");c.length&&(b=b.concat(Array.prototype.slice.call(c,0)))}return!1}return!0}),b.length&&(a=a.concat(b)),a},loaded:function(a,d,e){if(b(d)){var g=k.documents[a];g||(g=f(e,a),p.resolvePathsInHTML(g),k.documents[a]=g,k.preload(g)),d.import={href:a,ownerNode:d,content:g},d.content=e=g}d.__resource=e,c(d)&&p.resolvePathsInStylesheet(d)}},l=function(a,b){this.onload=a,this.oncomplete=b,this.inflight=0,this.pending={},this.cache={}};l.prototype={addNodes:function(a){this.inflight+=a.length,q(a,this.require,this),this.checkDone()},require:function(a){var b=p.nodeUrl(a);a.__nodeUrl=b,this.dedupe(b,a)||this.fetch(b,a)},dedupe:function(a,b){return this.pending[a]?(this.pending[a].push(b),!0):this.cache[a]?(this.onload(a,b,g.cache[a]),this.tail(),!0):(this.pending[a]=[b],!1)},fetch:function(a,b){var c=function(c,d){this.receive(a,b,c,d)}.bind(this);h.load(a,c)},receive:function(a,b,c,d){c||(g.cache[a]=d),g.pending[a].forEach(function(b){c||this.onload(a,b,d),this.tail()},this),g.pending[a]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}};var m=["href","src","action"],n="["+m.join("],[")+"]",o="{{.*}}",p={nodeUrl:function(a){return p.resolveUrl(p.documentURL,p.hrefOrSrc(a))},hrefOrSrc:function(a){return a.getAttribute("href")||a.getAttribute("src")},documentUrlFromNode:function(a){return p.getDocumentUrl(a.ownerDocument||a)},getDocumentUrl:function(a){var b=a&&(a._URL||a.impl&&a.impl._URL||a.baseURI||a.URL)||"";return b.split("#")[0]},resolveUrl:function(a,b){return this.isAbsUrl(b)?b:this.compressUrl(this.urlToPath(a)+b)},resolveRelativeUrl:function(a,b){return this.isAbsUrl(b)?b:this.makeDocumentRelPath(this.resolveUrl(a,b))},isAbsUrl:function(a){return/(^data:)|(^http[s]?:)|(^\/)/.test(a)},urlToPath:function(a){var b=a.split("/");return b.pop(),b.push(""),b.join("/")},compressUrl:function(a){var b="",c=a.indexOf("?");c>-1&&(b=a.substring(c),a=a.substring(c,0));for(var d,e=a.split("/"),f=0;fe;e++)d.unshift("..");var g=d.join("/");return g},resolvePathsInHTML:function(a,b){b=b||p.documentUrlFromNode(a),p.resolveAttributes(a,b),p.resolveStyleElts(a,b);var c=a.querySelectorAll("template");c&&q(c,function(a){a.content&&p.resolvePathsInHTML(a.content,b)})},resolvePathsInStylesheet:function(a){var b=p.nodeUrl(a);a.__resource=p.resolveCssText(a.__resource,b)},resolveStyleElts:function(a,b){var c=a.querySelectorAll("style");c&&q(c,function(a){a.textContent=p.resolveCssText(a.textContent,b)})},resolveCssText:function(a,b){return a.replace(/url\([^)]*\)/g,function(a){var c=a.replace(/["']/g,"").slice(4,-1);return c=p.resolveRelativeUrl(b,c),"url("+c+")"})},resolveAttributes:function(a,b){var c=a&&a.querySelectorAll(n);c&&q(c,function(a){this.resolveNodeAttributes(a,b)},this)},resolveNodeAttributes:function(a,b){m.forEach(function(c){var d=a.attributes[c];if(d&&d.value&&d.value.search(o)<0){var e=p.resolveRelativeUrl(b,d.value);d.value=e}})}};p.documentURL=p.getDocumentUrl(document),p.urlElt=document.createElement("a"),h=h||{async:!0,ok:function(a){return a.status>=200&&a.status<300||304===a.status||0===a.status},load:function(b,c,d){var e=new XMLHttpRequest;return(a.flags.debug||a.flags.bust)&&(b+="?"+Math.random()),e.open("GET",b,h.async),e.addEventListener("readystatechange",function(){4===e.readyState&&c.call(d,!h.ok(e)&&e,e.response,b)}),e.send(),e},loadDocument:function(a,b,c){this.load(a,b,c).responseType="document"}};var q=Array.prototype.forEach.call.bind(Array.prototype.forEach);a.path=p,a.xhr=h,a.importer=k,a.getDocumentUrl=p.getDocumentUrl,a.IMPORT_LINK_TYPE=i}(window.HTMLImports),function(a){function b(a){return"link"===a.localName&&a.getAttribute("rel")===f}function c(a){return a.parentNode&&!d(a)&&!e(a)}function d(a){return a.ownerDocument===document||a.ownerDocument.impl===document}function e(a){return a.parentNode&&"element"===a.parentNode.localName}var f="import",g={selectors:["link[rel="+f+"]","link[rel=stylesheet]","style","script:not([type])",'script[type="text/javascript"]'],map:{link:"parseLink",script:"parseScript",style:"parseGeneric"},parse:function(a){if(!a.__importParsed){a.__importParsed=!0;var b=a.querySelectorAll(g.selectors);h(b,function(a){g[g.map[a.localName]](a)})}},parseLink:function(a){b(a)?a.content&&g.parse(a.content):this.parseGeneric(a)},parseGeneric:function(a){c(a)&&document.head.appendChild(a)},parseScript:function(b){if(c(b)){var d=(b.__resource||b.textContent).trim();if(d){var e=b.__nodeUrl;if(!e){var e=a.path.documentUrlFromNode(b),f="["+Math.floor(1e3*(Math.random()+1))+"]",g=d.match(/Polymer\(['"]([^'"]*)/);f=g&&g[1]||f,e+="/"+f+".js"}d+="\n//# sourceURL="+e+"\n",eval.call(window,d)}}}},h=Array.prototype.forEach.call.bind(Array.prototype.forEach);a.parser=g}(HTMLImports),function(){function a(){HTMLImports.importer.load(document,function(){HTMLImports.parser.parse(document),HTMLImports.readyTime=(new Date).getTime(),document.dispatchEvent(new CustomEvent("HTMLImportsLoaded",{bubbles:!0}))})}"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(a){var b=document.createEvent("HTMLEvents");return b.initEvent(a,!0,!0),b}),"complete"===document.readyState?a():window.addEventListener("DOMContentLoaded",a)}(),function(){function a(a){return"link"===a.localName&&a.getAttribute("rel")===b}var b=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none",c={selectors:["link[rel="+b+"]"],map:{link:"parseLink"},parse:function(a){if(!a.__parsed){a.__parsed=!0;var b=a.querySelectorAll(c.selectors);d(b,function(a){c[c.map[a.localName]](a)}),CustomElements.upgradeDocument(a),CustomElements.observeDocument(a)}},parseLink:function(b){a(b)&&this.parseImport(b)},parseImport:function(a){a.content&&c.parse(a.content)}},d=Array.prototype.forEach.call.bind(Array.prototype.forEach);CustomElements.parser=c}(),function(){function a(){CustomElements.parser.parse(document),CustomElements.upgradeDocument(document);var a=window.Platform&&Platform.endOfMicrotask?Platform.endOfMicrotask:setTimeout;a(function(){CustomElements.ready=!0,CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.body.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}if("function"!=typeof window.CustomEvent&&(window.CustomEvent=function(a){var b=document.createEvent("HTMLEvents");return b.initEvent(a,!0,!0),b}),"complete"===document.readyState)a();else{var b=window.HTMLImports?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(b,a)}}(),function(){function a(a){var b=I.call(a);return H[b]||(H[b]=b.match(J)[1].toLowerCase())}function b(c,d){var e=b[d||a(c)];return e?e(c):c}function c(b){return-1==K.indexOf(a(b))?Array.prototype.slice.call(b,0):[b]}function d(a,b){return(b||L).length?c(a.querySelectorAll(b)):[]}function e(a,b){var c={added:[],removed:[]};b.forEach(function(b){b._mutation=!0;for(var d in c)for(var e=a._records["added"==d?"inserted":"removed"],f=b[d+"Nodes"],g=f.length,h=0;g>h&&-1==c[d].indexOf(f[h]);h++)c[d].push(f[h]),e.forEach(function(a){a(f[h],b)})})}function f(c,d,e){var f=a(e);return"object"==f&&"object"==a(c[d])?O.merge(c[d],e):c[d]=b(e,f),c}function g(a,b,c){var d={};for(var e in c)d[e.split(":")[0]]=!0;for(var f in b)d[f.split(":")[0]]||(c[f]=b[f])}function h(a){return a.mixins.forEach(function(b){var c=O.mixins[b];for(var d in c)switch(d){case"lifecycle":case"methods":g(d,c[d],a[d]);break;case"accessors":case"prototype":for(var e in c[d])g(e,c[d],a.accessors);break;case"events":}}),a}function i(a,b){var c=d(this,a.value).filter(function(a){return a==b.target||a.contains?a.contains(b.target):null})[0];return c?a.listener=a.listener.bind(c):null}function j(a){if(a.type.match("touch"))a.target.__touched__=!0;else if(a.target.__touched__&&a.type.match("mouse"))return delete a.target.__touched__,void 0;return!0}function k(a){var b="over"==a;return{attach:"OverflowEvent"in w?"overflowchanged":[],condition:function(c){return c.flow=a,c.type==a+"flow"||0===c.orient&&c.horizontalOverflow==b||1==c.orient&&c.verticalOverflow==b||2==c.orient&&c.horizontalOverflow==b&&c.verticalOverflow==b}}}function l(a,b,c,d){d?b[a]=c[a]:Object.defineProperty(b,a,{writable:!0,enumerable:!0,value:c[a]})}function m(a,b){var c=Object.getOwnPropertyDescriptor(a,"target");for(var d in b)M[d]||l(d,a,b,c);a.baseEvent=b}function n(a,b){return{value:a.boolean?"":b,method:a.boolean&&!b?"removeAttribute":"setAttribute"}}function o(a,b,c,d){var e=n(b,d);a[e.method](c,e.value)}function p(a,b,c,d,e){for(var f=b.property?[a.xtag[b.property]]:b.selector?O.query(a,b.selector):[],g=f.length;g--;)f[g][e](c,d)}function q(a,b,c){a.__view__&&a.__view__.updateBindingValue(a,b,c)}function r(a,b,c,d,e,f){var g=c.split(":"),h=g[0];if("get"==h)g[0]=b,a.prototype[b].get=O.applyPseudos(g.join(":"),d[c],a.pseudos);else if("set"==h){g[0]=b;var i=a.prototype[b].set=O.applyPseudos(g.join(":"),e?function(a){this.xtag._skipSet=!0,this.xtag._skipAttr||o(this,e,f,a),this.xtag._skipAttr&&e.skip&&delete this.xtag._skipAttr,d[c].call(this,e.boolean?!!a:a),q(this,f,a),delete this.xtag._skipSet}:d[c]?function(a){d[c].call(this,a),q(this,f,a)}:null,a.pseudos);e&&(e.setter=i)}else a.prototype[b][c]=d[c]}function s(a,b){a.prototype[b]={};var c=a.accessors[b],d=c.attribute,e=d&&d.name?d.name.toLowerCase():b;d&&(d.key=b,a.attributes[e]=d);for(var f in c)r(a,b,f,c,d,e);if(d){if(!a.prototype[b].get){var g=(d.boolean?"has":"get")+"Attribute";a.prototype[b].get=function(){return this[g](e)}}a.prototype[b].set||(a.prototype[b].set=function(a){o(this,d,e,a),q(this,e,a)})}}function t(a,b,c){a.__tap__||(a.__tap__={click:"mousedown"==c.type},a.__tap__.click?a.addEventListener("click",b.observer):(a.__tap__.scroll=b.observer.bind(a),window.addEventListener("scroll",a.__tap__.scroll,!0),a.addEventListener("touchmove",b.observer),a.addEventListener("touchcancel",b.observer),a.addEventListener("touchend",b.observer))),a.__tap__.click||(a.__tap__.x=c.touches[0].pageX,a.__tap__.y=c.touches[0].pageY)}function u(a,b){a.__tap__&&(a.__tap__.click?a.removeEventListener("click",b.observer):(window.removeEventListener("scroll",a.__tap__.scroll,!0),a.removeEventListener("touchmove",b.observer),a.removeEventListener("touchcancel",b.observer),a.removeEventListener("touchend",b.observer)),delete a.__tap__)}function v(a,b,c){var d=c.changedTouches[0];return d.pageXa.__tap__.x-b.gesture.tolerance&&d.pageYa.__tap__.y-b.gesture.tolerance?!0:void 0}var w=window,x=document,y=function(){},z=function(){return!0},A=/([\w-]+(?:\([^\)]+\))?)/g,B=/(\w*)(?:\(([^\)]*)\))?/,C=/(\d+)/g,D={action:function(a,b){return a.value.match(C).indexOf(String(b.keyCode))>-1==("keypass"==a.name)||null}},E=function(){var a=w.getComputedStyle(x.documentElement,""),b=(Array.prototype.slice.call(a).join("").match(/-(moz|webkit|ms)-/)||""===a.OLink&&["","o"])[1];return{dom:"ms"==b?"MS":b,lowercase:b,css:"-"+b+"-",js:"ms"==b?b:b[0].toUpperCase()+b.substr(1)}}(),F=Element.prototype.matchesSelector||Element.prototype[E.lowercase+"MatchesSelector"],G=w.MutationObserver||w[E.js+"MutationObserver"],H={},I=H.toString,J=/\s([a-zA-Z]+)/;b.object=function(a){var c={};for(var d in a)c[d]=b(a[d]);return c},b.array=function(a){for(var c=a.length,d=new Array(c);c--;)d[c]=b(a[c]);return d};var K=["undefined","null","number","boolean","string","function"],L="",M={};for(var N in document.createEvent("CustomEvent"))M[N]=1;var O={tags:{},defaultOptions:{pseudos:[],mixins:[],events:{},methods:{},accessors:{},lifecycle:{},attributes:{},prototype:{xtag:{get:function(){return this.__xtag__?this.__xtag__:this.__xtag__={data:{}}}}}},register:function(a,b){var d;if("string"==typeof a){d=a.toLowerCase();var e=b.prototype;delete b.prototype;var f=O.tags[d]=h(O.merge({},O.defaultOptions,b));for(var g in f.events)f.events[g]=O.parseEvent(g,f.events[g]);for(g in f.lifecycle)f.lifecycle[g.split(":")[0]]=O.applyPseudos(g,f.lifecycle[g],f.pseudos);for(g in f.methods)f.prototype[g.split(":")[0]]={value:O.applyPseudos(g,f.methods[g],f.pseudos),enumerable:!0};for(g in f.accessors)s(f,g);var i=f.lifecycle.created||f.lifecycle.ready;f.prototype.createdCallback={enumerable:!0,value:function(){var a=this;O.addEvents(this,f.events),f.mixins.forEach(function(b){O.mixins[b].events&&O.addEvents(a,O.mixins[b].events)});var b=i?i.apply(this,c(arguments)):null;for(var d in f.attributes){var e=f.attributes[d],g=this.hasAttribute(d);(g||e.boolean)&&(this[e.key]=e.boolean?g:this.getAttribute(d))}return f.pseudos.forEach(function(b){b.onAdd.call(a,b)}),b}},f.lifecycle.inserted&&(f.prototype.enteredViewCallback={value:f.lifecycle.inserted,enumerable:!0}),f.lifecycle.removed&&(f.prototype.leftDocumentCallback={value:f.lifecycle.removed,enumerable:!0}),f.lifecycle.attributeChanged&&(f.prototype.attributeChangedCallback={value:f.lifecycle.attributeChanged,enumerable:!0});var j=f.prototype.setAttribute||HTMLElement.prototype.setAttribute;f.prototype.setAttribute={writable:!0,enumberable:!0,value:function(a,b){var c=f.attributes[a.toLowerCase()];this.xtag._skipAttr||j.call(this,a,c&&c.boolean?"":b),c&&(c.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,c.setter.call(this,c.boolean?!0:b)),b=c.skip?c.boolean?this.hasAttribute(a):this.getAttribute(a):b,p(this,c,a,c.boolean?"":b,"setAttribute")),delete this.xtag._skipAttr}};var k=f.prototype.removeAttribute||HTMLElement.prototype.removeAttribute;f.prototype.removeAttribute={writable:!0,enumberable:!0,value:function(a){var b=f.attributes[a.toLowerCase()];this.xtag._skipAttr||k.call(this,a),b&&(b.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,b.setter.call(this,b.boolean?!1:void 0)),p(this,b,a,void 0,"removeAttribute")),delete this.xtag._skipAttr}};var l=e?e:b["extends"]?Object.create(x.createElement(b["extends"]).constructor).prototype:w.HTMLElement.prototype,m={prototype:Object.create(l,f.prototype)};return b["extends"]&&(m["extends"]=b["extends"]),x.register(d,m)}},mixins:{},prefix:E,touches:{active:[],changed:[]},captureEvents:["focus","blur","scroll","underflow","overflow","overflowchanged"],customEvents:{overflow:k("over"),underflow:k("under"),animationstart:{attach:[E.dom+"AnimationStart"]},animationend:{attach:[E.dom+"AnimationEnd"]},transitionend:{attach:[E.dom+"TransitionEnd"]},move:{attach:["mousemove","touchmove"],condition:j},enter:{attach:["mouseover","touchenter"],condition:j},leave:{attach:["mouseout","touchleave"],condition:j},tapstart:{observe:{mousedown:x,touchstart:x},condition:j},tapend:{observe:{mouseup:x,touchend:x},condition:j},tapmove:{attach:["tapstart","dragend","touchcancel"],condition:function(a,b){switch(a.type){case"move":return!0;case"dragover":var c=b.lastDrag||{};return b.lastDrag=a,c.pageX!=a.pageX&&c.pageY!=a.pageY||null;case"tapstart":b.touches=b.touches||1,b.move||(b.current=this,b.move=O.addEvents(this,{move:b.listener,dragover:b.listener}),b.tapend=O.addEvent(x,"tapend",b.listener));break;case"tapend":case"dragend":case"touchcancel":b.touches--,b.touches||(O.removeEvents(b.current,b.move||{}),O.removeEvent(x,b.tapend||{}),delete b.lastDrag,delete b.current,delete b.tapend,delete b.move)}}}},pseudos:{keypass:D,keyfail:D,delegate:{action:i},within:{action:i,onAdd:function(a){var b=a.source.condition;b&&(a.source.condition=function(c,d){return O.query(this,a.value).filter(function(a){return a==c.target||a.contains?a.contains(c.target):null})[0]?b.call(this,c,d):null})}},preventable:{action:function(a,b){return!b.defaultPrevented}}},clone:b,typeOf:a,toArray:c,wrap:function(a,b){return function(){var d=c(arguments),e=a.apply(this,d);return e===!1?!1:b.apply(this,"undefined"!=typeof e?c(e):d)}},merge:function(b,c,d){if("string"==a(c))return f(b,c,d);for(var e=1,g=arguments.length;g>e;e++){var h=arguments[e];for(var i in h)f(b,i,h[i])}return b},uid:function(){return Math.random().toString(36).substr(2,10)},query:d,skipTransition:function(a,b,c){var d=E.js+"TransitionProperty";a.style[d]=a.style.transitionProperty="none",O.requestFrame(function(){var e;b&&(e=b.call(c)),O.requestFrame(function(){a.style[d]=a.style.transitionProperty="",e&&O.requestFrame(e)})})},requestFrame:function(){var a=w.requestAnimationFrame||w[E.lowercase+"RequestAnimationFrame"]||function(a){return w.setTimeout(a,20)};return function(b){return a.call(w,b)}}(),matchSelector:function(a,b){return F.call(a,b)},set:function(a,b,c){a[b]=c,window.CustomElements&&CustomElements.upgradeAll(a)},innerHTML:function(a,b){O.set(a,"innerHTML",b)},hasClass:function(a,b){return a.className.split(" ").indexOf(b.trim())>-1},addClass:function(a,b){var c=a.className.trim().split(" ");return b.trim().split(" ").forEach(function(a){~c.indexOf(a)||c.push(a)}),a.className=c.join(" ").trim(),a},removeClass:function(a,b){var c=b.trim().split(" ");return a.className=a.className.trim().split(" ").filter(function(a){return a&&!~c.indexOf(a)}).join(" "),a},toggleClass:function(a,b){return O[O.hasClass(a,b)?"removeClass":"addClass"].call(null,a,b)},queryChildren:function(a,b){var d=a.id,e=a.id=d||"x_"+O.uid(),f="#"+e+" > ";b=f+(b+"").replace(",",","+f,"g");var g=a.parentNode.querySelectorAll(b);return d||a.removeAttribute("id"),c(g)},createFragment:function(a){var b=x.createDocumentFragment();if(a){for(var d=b.appendChild(x.createElement("div")),e=c(a.nodeName?arguments:!(d.innerHTML=a)||d.children),f=e.length,g=0;f>g;)b.insertBefore(e[g++],d);b.removeChild(d)}return b},manipulate:function(a,b){var c=a.nextSibling,d=a.parentNode,e=x.createDocumentFragment(),f=b.call(e.appendChild(a),e)||a;c?d.insertBefore(f,c):d.appendChild(f)},applyPseudos:function(a,b,d,e){var f=b,g={};if(a.match(":"))for(var h=a.match(A),i=h.length;--i;)h[i].replace(B,function(b,j,k){if(!O.pseudos[j])throw"pseudo not found: "+j+" "+h;var l=g[i]=Object.create(O.pseudos[j]);l.key=a,l.name=j,l.value=k,l.arguments=(k||"").split(","),l.action=l.action||z,l.source=e; -var m=f;f=function(){var b=c(arguments),d={key:a,name:j,value:k,source:e,listener:m},f=l.action.apply(this,[d].concat(b));return null===f||f===!1?f:d.listener.apply(this,b)},d&&l.onAdd&&(d.getAttribute?l.onAdd.call(d,l):d.push(l))});for(var j in g)g[j].onCompiled&&(f=g[j].onCompiled(f,g[j])||f);return f},removePseudos:function(a,b){b._pseudos.forEach(function(b){b.onRemove&&b.onRemove.call(a,b)})},parseEvent:function(a,b){var d=a.split(":"),e=d.shift(),f=O.customEvents[e],g=O.merge({type:e,stack:y,condition:z,attach:[],_attach:[],pseudos:"",_pseudos:[],onAdd:y,onRemove:y},f||{});g.attach=c(g.base||g.attach),g.chain=e+(g.pseudos.length?":"+g.pseudos:"")+(d.length?":"+d.join(":"):"");var h=g.condition;g.condition=function(a){return a.touches,a.targetTouches,h.apply(this,c(arguments))};var i=O.applyPseudos(g.chain,b,g._pseudos,g);if(g.stack=function(a){a.touches,a.targetTouches;var b=a.detail||{};return b.__stack__?b.__stack__==i?(a.stopPropagation(),a.cancelBubble=!0,i.apply(this,c(arguments))):void 0:i.apply(this,c(arguments))},g.listener=function(a){var b=c(arguments),d=g.condition.apply(this,b.concat([g]));return d?a.type==e?g.stack.apply(this,b):(O.fireEvent(a.target,e,{baseEvent:a,detail:{__stack__:i}}),void 0):d},g.attach.forEach(function(a){g._attach.push(O.parseEvent(a,g.listener))}),f&&f.observe&&!f.__observing__){f.observer=function(a){var b=g.condition.apply(this,c(arguments).concat([f]));return b?(O.fireEvent(a.target,e,{baseEvent:a}),void 0):b};for(var j in f.observe)O.addEvent(f.observe[j]||document,j,f.observer,!0);f.__observing__=!0}return g},addEvent:function(a,b,c,d){var e="function"==typeof c?O.parseEvent(b,c):c;return e._pseudos.forEach(function(b){b.onAdd.call(a,b)}),e._attach.forEach(function(b){O.addEvent(a,b.type,b)}),e.onAdd.call(a,e,e.listener),a.addEventListener(e.type,e.stack,d||O.captureEvents.indexOf(e.type)>-1),e},addEvents:function(a,b){var c={};for(var d in b)c[d]=O.addEvent(a,d,b[d]);return c},removeEvent:function(a,b,c){c=c||b,c.onRemove.call(a,c,c.listener),O.removePseudos(a,c),c._attach.forEach(function(b){O.removeEvent(a,b)}),a.removeEventListener(c.type,c.stack)},removeEvents:function(a,b){for(var c in b)O.removeEvent(a,b[c])},fireEvent:function(a,b,c,d){var e=x.createEvent("CustomEvent");c=c||{},d&&console.warn("fireEvent has been modified, more info here: "),e.initCustomEvent(b,c.bubbles!==!1,c.cancelable!==!1,c.detail),c.baseEvent&&m(e,c.baseEvent);try{a.dispatchEvent(e)}catch(f){console.warn("This error may have been caused by a change in the fireEvent method, more info here: ",f)}},addObserver:function(a,b,c){a._records||(a._records={inserted:[],removed:[]},G?(a._observer=new G(function(b){e(a,b)}),a._observer.observe(a,{subtree:!0,childList:!0,attributes:!1,characterData:!1})):["Inserted","Removed"].forEach(function(b){a.addEventListener("DOMNode"+b,function(c){c._mutation=!0,a._records[b.toLowerCase()].forEach(function(a){a(c.target,c)})},!1)})),-1==a._records[b].indexOf(c)&&a._records[b].push(c)},removeObserver:function(a,b,c){var d=a._records;d&&c?d[b].splice(d[b].indexOf(c),1):d[b]=[]}},P=0,Q=null;x.addEventListener("mousedown",function(a){P++,Q=a.target},!0),x.addEventListener("mouseup",function(){P--,Q=null},!1);var R={touches:{configurable:!0,get:function(){return this.__touches__||(this.identifier=0)||(this.__touches__=P?[this]:[])}},targetTouches:{configurable:!0,get:function(){return this.__targetTouches__||(this.__targetTouches__=P&&this.currentTarget&&(this.currentTarget==Q||this.currentTarget.contains&&this.currentTarget.contains(Q))?[this]:[])}},changedTouches:{configurable:!0,get:function(){return this.touches}}};for(N in R)UIEvent.prototype[N]=R[N],Object.defineProperty(UIEvent.prototype,N,R[N]);var S={value:null,writable:!0,configurable:!0},T={touches:S,targetTouches:S,changedTouches:S};if(w.TouchEvent)for(N in T){var U=Object.getOwnPropertyDescriptor(w.TouchEvent.prototype,N);U?w.TouchEvent.prototype[N]=T[N]:Object.defineProperty(w.TouchEvent.prototype,N,T[N])}O.customEvents.tap={observe:{mousedown:document,touchstart:document},gesture:{tolerance:8},condition:function(a,b){var c=a.target;switch(a.type){case"touchstart":return c.__tap__&&c.__tap__.click&&u(c,b),t(c,b,a),void 0;case"mousedown":return c.__tap__||t(c,b,a),void 0;case"scroll":case"touchcancel":return u(this,b),void 0;case"touchmove":case"touchend":return this.__tap__&&!v(this,b,a)?(u(this,b),void 0):"touchend"==a.type||null;case"click":return u(this,b),!0}}},w.xtag=O,"function"==typeof define&&define.amd&&define(O),x.addEventListener("WebComponentsReady",function(){O.fireEvent(x.body,"DOMComponentsLoaded")})}(),function(){xtag.register("x-appbar",{lifecycle:{created:function(){var a=xtag.queryChildren(this,"header")[0];a||(a=document.createElement("header"),this.appendChild(a)),this.xtag.data.header=a,this.subheading=this.subheading}},accessors:{heading:{attribute:{},get:function(){return this.xtag.data.header.innerHTML},set:function(a){this.xtag.data.header.innerHTML=a}},subheading:{attribute:{},get:function(){return this.getAttribute("subheading")||""},set:function(a){this.xtag.data.header.setAttribute("subheading",a)}}}})}(),function(){function a(a){var b;return 0===a.getUTCHours()?b=new Date(a.valueOf()):(b=new Date,b.setUTCHours(0),b.setUTCFullYear(a.getFullYear()),b.setUTCMonth(a.getMonth()),b.setUTCDate(a.getDate())),b.setUTCMinutes(0),b.setUTCSeconds(0),b.setUTCMilliseconds(0),b}function b(a,b){a.appendChild(b)}function c(a){return parseInt(a,10)}function d(a){var b=c(a);return b===a&&!isNaN(b)&&b>=0&&6>=b}function e(a){return a instanceof Date&&!!a.getTime&&!isNaN(a.getTime())}function f(a){return a&&a.isArray?a.isArray():"[object Array]"===Object.prototype.toString.call(a)}function g(a){var b=a.split("."),c=b.shift(),d=document.createElement(c);return d[T]=b.join(" "),d}function h(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function i(a){var b=a.getBoundingClientRect(),c=h(),d=c.left,e=c.top;return{left:b.left+d,right:b.right+d,top:b.top+e,bottom:b.bottom+e,width:b.width,height:b.height}}function j(a,b){xtag.addClass(a,b)}function k(a,b){xtag.removeClass(a,b)}function l(a,b){return xtag.hasClass(a,b)}function m(a){return a.getUTCFullYear()}function n(a){return a.getUTCMonth()}function o(a){return a.getUTCDate()}function p(a){return a.getUTCDay()}function q(a,b){var c=a.toString(),d=new Array(b).join("0");return(d+c).substr(-b)}function r(a){return[q(m(a),4),q(n(a)+1,2),q(o(a),2)].join("-")}function s(b){if(e(b))return b;var c=U.exec(b);return c?a(new Date(c[1],c[2]-1,c[3])):null}function t(b){if(e(b))return b;var c=s(b);if(c)return c;var d=Date.parse(b);return isNaN(d)?null:a(new Date(d))}function u(a){var b;if(f(a))b=a.slice(0);else{if(e(a))return[a];if(!("string"==typeof a&&a.length>0))return null;try{if(b=JSON.parse(a),!f(b))return console.warn("invalid list of ranges",a),null}catch(c){var d=t(a);return d?[d]:(console.warn("unable to parse",a,"as JSON or single date"),null)}}for(var g=0;gk.valueOf())return console.warn("invalid range",h,": start date is after end date"),null;b[g]=[j,k]}}return b}function v(b,c,d,e){return void 0===c&&(c=m(b)),void 0===d&&(d=n(b)),void 0===e&&(e=o(b)),a(new Date(c,d,e))}function w(a,b,c,d){return v(a,m(a)+b,n(a)+c,o(a)+d)}function x(a,b){b=c(b),d(b)||(b=0);for(var e=0;7>e;e++){if(p(a)===b)return a;a=C(a)}throw"unable to find week start"}function y(a,b){b=c(b),d(b)||(b=6);for(var e=0;7>e;e++){if(p(a)===b)return a;a=B(a)}throw"unable to find week end"}function z(b){return b=new Date(b.valueOf()),b.setUTCDate(1),a(b)}function A(a){return C(w(a,0,1,0))}function B(a){return w(a,0,0,1)}function C(a){return w(a,0,0,-1)}function D(a,b){if(b){b=void 0===b.length?[b]:b;var c=!1;return b.forEach(function(b){2===b.length?E(b[0],b[1],a)&&(c=!0):r(b)===r(a)&&(c=!0)}),c}}function E(a,b,c){return r(a)<=r(c)&&r(c)<=r(b)}function F(a){a.sort(function(a,b){var c=e(a)?a:a[0],d=e(b)?b:b[0];return c.valueOf()-d.valueOf()})}function G(a){var c=g("div.controls"),d=g("span.prev"),e=g("span.next");return d.innerHTML=a.prev,e.innerHTML=a.next,b(c,d),b(c,e),c}function H(a){var b=this;a=a||{},b._span=a.span||1,b._multiple=a.multiple||!1,b._viewDate=b._sanitizeViewDate(a.view,a.chosen),b._chosenRanges=b._sanitizeChosenRanges(a.chosen,a.view),b._firstWeekdayNum=a.firstWeekdayNum||0,b._el=g("div.calendar"),b._labels=O(),b._customRenderFn=null,b._renderRecursionFlag=!1,b.render(!0)}function I(a){a=a.slice(0),F(a);for(var b=[],c=0;c0?b[b.length-1]:null;if(e(i)?d=f=i:(d=i[0],f=i[1]),i=D(d,f)?d:[d,f],e(j))g=h=j;else{if(!j){b.push(i);continue}g=j[0],h=j[1]}if(D(d,[j])||D(C(d),[j])){var k=g.valueOf()f.valueOf()?h:f,m=D(k,l)?k:[k,l];b[b.length-1]=m}else b.push(i)}return b}function J(a,b){var c,d=b.getAttribute("data-date"),e=t(d);l(b,S)?(a.xtag.dragType=R,c="datetoggleoff"):(a.xtag.dragType=Q,c="datetoggleon"),a.xtag.dragStartEl=b,a.xtag.dragAllowTap=!0,a.noToggle||xtag.fireEvent(a,c,{detail:{date:e,iso:d}}),a.setAttribute("active",!0),b.setAttribute("active",!0)}function K(a,b){var c=b.getAttribute("data-date"),d=t(c);b!==a.xtag.dragStartEl&&(a.xtag.dragAllowTap=!1),a.noToggle||(a.xtag.dragType!==Q||l(b,S)?a.xtag.dragType===R&&l(b,S)&&xtag.fireEvent(a,"datetoggleoff",{detail:{date:d,iso:c}}):xtag.fireEvent(a,"datetoggleon",{detail:{date:d,iso:c}})),a.xtag.dragType&&b.setAttribute("active",!0)}function L(){for(var a=xtag.query(document,"x-calendar"),b=0;b",months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}},P=a(new Date),Q="add",R="remove",S="chosen",T="className",U=/(\d{4})[^\d]?(\d{2})[^\d]?(\d{2})/,V=H.prototype;V.makeMonth=function(a){if(!e(a))throw"Invalid view date!";var c=this.firstWeekdayNum,d=this.chosen,f=this.labels,h=n(a),i=x(z(a),c),k=g("div.month"),l=g("div.month-label");l.textContent=f.months[h]+" "+m(a),b(k,l);for(var p=g("div.weekday-labels"),q=0;7>q;q++){var s=(c+q)%7,t=g("span.weekday-label");t.textContent=f.weekdays[s],b(p,t)}b(k,p);var u=g("div.week"),v=i,w=42;for(q=0;w>q;q++){var y=g("span.day");if(y.setAttribute("data-date",r(v)),y.textContent=o(v),n(v)!==h&&j(y,"badmonth"),D(v,d)&&j(y,S),D(v,P)&&j(y,"today"),b(u,y),v=B(v),0===(q+1)%7){b(k,u),u=g("div.week");var A=n(v)>h||n(v)m(i);if(A)break}}return k},V._sanitizeViewDate=function(a,b){b=void 0===b?this.chosen:b;var c;if(e(a))c=a;else if(e(b))c=b;else if(f(b)&&b.length>0){var d=b[0];c=e(d)?d:d[0]}else c=P;return c},V._sanitizeChosenRanges=function(a,b){b=void 0===b?this.view:b;var c;c=e(a)?[a]:f(a)?a:null!==a&&void 0!==a&&b?[b]:[];var d=I(c);if(!this.multiple&&d.length>0){var g=d[0];return e(g)?[g]:[g[0]]}return d},V.addDate=function(a,b){e(a)&&(b?(this.chosen.push(a),this.chosen=this.chosen):this.chosen=[a])},V.removeDate=function(a){if(e(a))for(var b=this.chosen.slice(0),c=0;cc;c++)b(this.el,this.makeMonth(i)),i=w(i,0,1,0)}this._callCustomRenderer()},V._callCustomRenderer=function(){if(this._customRenderFn){if(this._renderRecursionFlag)throw"Error: customRenderFn causes recursive loop of rendering calendar; make sure your custom rendering function doesn't modify attributes of the x-calendar that would require a re-render!";for(var a=xtag.query(this.el,".day"),b=0;b=0?b:0,this.render(!1)}},view:{attribute:{},get:function(){return this._viewDate},set:function(a){var b=this._sanitizeViewDate(a),c=this._viewDate;this._viewDate=b,this.render(n(c)===n(b)&&m(c)===m(b))}},chosen:{get:function(){return this._chosenRanges},set:function(a){this._chosenRanges=this._sanitizeChosenRanges(a),this.render(!0)}},firstWeekdayNum:{get:function(){return this._firstWeekdayNum},set:function(a){a=c(a),d(a)||(a=0),this._firstWeekdayNum=a,this.render(!1)}},lastWeekdayNum:{get:function(){return(this._firstWeekdayNum+6)%7}},customRenderFn:{get:function(){return this._customRenderFn},set:function(a){this._customRenderFn=a,this.render(!0)}},chosenString:{get:function(){if(this.multiple){for(var a=this.chosen.slice(0),b=0;b0?r(this.chosen[0]):""}},firstVisibleMonth:{get:function(){return z(w(this.view,0,-Math.floor(this.span/2),0))}},lastVisibleMonth:{get:function(){return w(this.firstVisibleMonth,0,Math.max(0,this.span-1),0)}},firstVisibleDate:{get:function(){return x(this.firstVisibleMonth,this.firstWeekdayNum)}},lastVisibleDate:{get:function(){return y(A(this.lastVisibleMonth),this.lastWeekdayNum)}},labels:{get:function(){return this._labels},set:function(a){var b=this.labels;for(var c in b)if(c in a){var d=this._labels[c],e=a[c];if(f(d)){if(!f(e)||d.length!==e.length)throw"invalid label given for '"+c+"': expected array of "+d.length+" labels, got "+JSON.stringify(e);e=e.slice(0);for(var g=0;g0){var b=a.currentTarget;if(b.xtag.dragType)for(var c=a.touches[0],d=xtag.query(b,".day"),e=0;e0){var b=a[0];return e(b)?b:b[0]}return null},set:function(a){var b=this.multiple?u(a):t(a);this.xtag.calObj.chosen=b?b:null,this.xtag.calObj.chosenString?this.setAttribute("chosen",this.xtag.calObj.chosenString):this.removeAttribute("chosen")}},firstWeekdayNum:{attribute:{name:"first-weekday-num"},set:function(a){this.xtag.calObj.firstWeekdayNum=a}},noToggle:{attribute:{"boolean":!0,name:"notoggle"},set:function(a){a&&(this.chosen=null)}},firstVisibleMonth:{get:function(){return this.xtag.calObj.firstVisibleMonth}},lastVisibleMonth:{get:function(){return this.xtag.calObj.lastVisibleMonth}},firstVisibleDate:{get:function(){return this.xtag.calObj.firstVisibleDate}},lastVisibleDate:{get:function(){return this.xtag.calObj.lastVisibleDate}},customRenderFn:{get:function(){return this.xtag.calObj.customRenderFn},set:function(a){this.xtag.calObj.customRenderFn=a}},labels:{get:function(){return JSON.parse(JSON.stringify(this.xtag.calObj.labels))},set:function(a){this.xtag.calObj.labels=a;var b=this.xtag.calObj.labels,c=this.querySelector(".controls > .prev");c&&(c.textContent=b.prev);var d=this.querySelector(".controls > .next");d&&(d.textContent=b.next)}}},methods:{render:function(a){this.xtag.calObj.render(a)},prevMonth:function(){var a=this.xtag.calObj;a.view=w(a.view,0,-1,0)},nextMonth:function(){var a=this.xtag.calObj;a.view=w(a.view,0,1,0)},toggleDateOn:function(a,b){this.xtag.calObj.addDate(a,b),this.chosen=this.chosen},toggleDateOff:function(a){this.xtag.calObj.removeDate(a),this.chosen=this.chosen},toggleDate:function(a,b){this.xtag.calObj.hasChosenDate(a)?this.toggleDateOff(a):this.toggleDateOn(a,b)},hasVisibleDate:function(a,b){return this.xtag.calObj.hasVisibleDate(a,b)}}})}(),function(){function a(a){return JSON.parse(JSON.stringify(a))}function b(a){var b;return 0===a.getUTCHours()?b=new Date(a.valueOf()):(b=new Date,b.setUTCHours(0),b.setUTCFullYear(a.getFullYear()),b.setUTCMonth(a.getMonth()),b.setUTCDate(a.getDate())),b.setUTCMinutes(0),b.setUTCSeconds(0),b.setUTCMilliseconds(0),b}function c(a){return a instanceof Date&&!!a.getTime&&!isNaN(a.getTime())}function d(a){return a.getUTCFullYear()}function e(a){return a.getUTCMonth()}function f(a){return a.getUTCDate()}function g(a,b){var c=a.toString(),d=new Array(b).join("0");return(d+c).substr(-b)}function h(a){return[g(d(a),4),g(e(a)+1,2),g(f(a),2)].join("-")}function i(a){if(c(a))return a;var d=q.exec(a);return d?b(new Date(d[1],d[2]-1,d[3])):null}function j(a){if(c(a))return a;var d=i(a);if(d)return d;var e=Date.parse(a);return isNaN(e)?null:b(new Date(e))}function k(a){var b=a.polyfill?a.xtag.polyfillInput:a.xtag.dateInput,c=j(b.value);return c?a.removeAttribute("invalid"):a.setAttribute("invalid",!0),!!c}function l(a,b){var c=a.polyfill?a.xtag.polyfillInput:a.xtag.dateInput,d=c.value,e=j(d);a.value=b&&e?e:d}function m(a,b,c){var d=a.submitValue,e=a.value;b();var f=a.submitValue,g=a.value;(d!==f||c&&e!==g)&&xtag.fireEvent(a,"change")}function n(a){var b=a.xtag._labels;return new Array(5).join(b.yearAbbr)+"-"+new Array(3).join(b.monthAbbr)+"-"+new Array(3).join(b.dayAbbr)}var o=13,p=document.createElement("x-calendar").labels,q=/(\d{4})[^\d]?(\d{2})[^\d]?(\d{2})/;xtag.register("x-datepicker",{lifecycle:{created:function(){this.innerHTML="";var b=document.createElement("input");b.setAttribute("type","date"),xtag.addClass(b,"x-datepicker-input"),this.appendChild(b),this.xtag.dateInput=b,this.xtag._labels={yearAbbr:"Y",monthAbbr:"M",dayAbbr:"D"},this.xtag._polyfillCalLabels=a(p),this.xtag.polyfillInput=null,this.xtag.polyfillUI=null,this.polyfill=this.hasAttribute("polyfill")||"date"!==b.type.toLowerCase()}},events:{"datetoggleon:delegate(x-calendar)":function(a){var b=a.currentTarget;if(a.detail&&a.detail.date){var c=j(a.detail.date);m(b,function(){b.value=c?h(c):"",xtag.fireEvent(b,"input")})}},"datetoggleoff:delegate(x-calendar)":function(a){a.currentTarget.value=null},focus:function(a){a.currentTarget.setAttribute("focused",!0)},"blur:delegate(.x-datepicker-input)":function(a){a.currentTarget.removeAttribute("focused")},"blur:delegate(.x-datepicker-polyfill-input)":function(a){var b=a.currentTarget;b.removeAttribute("focused"),m(b,function(){l(b,!0)},!0)},"touchstart:delegate(.x-datepicker-polyfill-input)":function(){this.setAttribute("readonly",!0)},"tapstart:delegate(x-calendar)":function(a){a.preventDefault(),a.baseEvent&&a.baseEvent.preventDefault()},"keypress:delegate(.x-datepicker-polyfill-input)":function(a){var b=a.keyCode,c=a.currentTarget;b===o&&m(c,function(){l(c,!0)},!0)},"input:delegate(.x-datepicker-input)":function(a){var b=a.currentTarget;m(b,function(){l(b,!0),a.stopPropagation(),xtag.fireEvent(b,"input")})},"input:delegate(.x-datepicker-polyfill-input)":function(a){var b=a.currentTarget;m(b,function(){l(b,!1),a.stopPropagation(),xtag.fireEvent(b,"input")})},"change:delegate(.x-datepicker-input)":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"change")},"change:delegate(.x-datepicker-polyfill-input)":function(a){a.stopPropagation();var b=a.currentTarget;m(b,function(){l(b,!1)})}},accessors:{name:{attribute:{selector:".x-datepicker-input"},set:function(a){var b=this.xtag.dateInput;null===a||void 0===a?b.removeAttribute("name"):b.setAttribute("name",a)}},submitValue:{get:function(){return this.xtag.dateInput.value}},value:{attribute:{skip:!0},get:function(){return this.polyfill?this.xtag.polyfillInput.value:this.xtag.dateInput.value},set:function(a){var b=j(a),c=b?h(b):null,d=this.xtag.dateInput,e=this.xtag.polyfillInput,f=this.xtag.polyfillUI;if(null===a||void 0===a)this.removeAttribute("value"),d.value="",e&&(e.value=""),f&&(f.chosen=null);else{var g,i=c?c:a;e?a!==e.value?(e.value=i,g=i):g=a:g=i,this.setAttribute("value",g),c?(d.value=c,f&&(f.chosen=b,f.view=b)):(d.value="",f&&(f.chosen=null))}k(this)}},polyfill:{attribute:{"boolean":!0},set:function(a){var b=this.xtag.dateInput;if(a){if(b.setAttribute("type","hidden"),b.setAttribute("readonly",!0),!this.xtag.polyfillInput){var c=document.createElement("input");xtag.addClass(c,"x-datepicker-polyfill-input"),c.setAttribute("type","text"),c.setAttribute("placeholder",n(this)),c.value=this.xtag.dateInput.value,this.xtag.polyfillInput=c,this.appendChild(c)}if(this.xtag.polyfillInput.removeAttribute("disabled"),!this.xtag.polyfillUI){var d=document.createElement("x-calendar");xtag.addClass(d,"x-datepicker-polyfill-ui"),d.chosen=this.value,d.view=this.xtag.dateInput.value,d.controls=!0,d.labels=this.xtag._polyfillCalLabels,this.xtag.polyfillUI=d,this.appendChild(d)}}else{"date"!==b.getAttribute("type")&&b.setAttribute("type","date"),b.removeAttribute("readonly");var e=this.xtag.polyfillInput;e&&e.setAttribute("disabled",!0)}}},labels:{get:function(){var b={},c=this.xtag._labels,d=this.xtag._polyfillCalLabels;for(var e in c)b[e]=c[e];for(e in d)b[e]=d[e];return a(b)},set:function(a){var b=this.xtag.polyfillUI,c=this.xtag.polyfillInput,d=null;if(b)b.labels=a,this.xtag._polyfillCalLabels=b.labels;else{var e=this.xtag._polyfillCalLabels;for(d in e)d in a&&(e[d]=a[d])}var f=this.xtag._labels;for(d in f)d in a&&(f[d]=a[d]);c&&c.setAttribute("placeholder",n(this))}}}})}(),function(){function a(a,b){this._historyStack=[],this.currIndex=-1,this._itemCap=void 0,this.itemCap=b,this._validatorFn=a?a:function(){return!0}}function b(a){var b=window.getComputedStyle(a),c=xtag.prefix.js+"TransitionDuration";return b.transitionDuration?b.transitionDuration:b[c]}function c(a){if("string"!=typeof a)return 0;var b=/^(\d*\.?\d+)(m?s)$/,c=a.toLowerCase().match(b);if(c){var d=c[1],e=c[2],f=parseFloat(d);if(isNaN(f))throw"value error";if("s"===e)return 1e3*f;if("ms"===e)return f;throw"unit error"}return 0}function d(a,b){return(a%b+b)%b}function e(a){return xtag.queryChildren(a,"x-card")}function f(a,b){var c=e(a);return isNaN(parseInt(b,10))||0>b||b>=c.length?null:c[b]}function g(a,b){var c=e(a);return c.indexOf(b)}function h(a,d,f,h,i){a.xtag._selectedCard=f;var j=new Date;a.xtag._lastAnimTimestamp=j;var m=function(){j===a.xtag._lastAnimTimestamp&&(k(a),xtag.fireEvent(a,"shuffleend",{detail:{oldCard:d,newCard:f}}))};if(f===d)return m(),void 0;var n=!1,o=!1,p=!1,q=function(){n&&o&&(e(a).forEach(function(a){a.removeAttribute("selected"),a.removeAttribute("leaving")}),d.setAttribute("leaving",!0),f.setAttribute("selected",!0),a.xtag._selectedCard=f,a.selectedIndex=g(a,f),i&&(d.setAttribute("reverse",!0),f.setAttribute("reverse",!0)),xtag.fireEvent(a,"shufflestart",{detail:{oldCard:d,newCard:f}}))},r=function(){p||n&&o&&s()},s=function(){p=!0;var a=!1,e=!1,g=!1,i=function(b){g||(b.target===d?(a=!0,d.removeEventListener("transitionend",i)):b.target===f&&(e=!0,f.removeEventListener("transitionend",i)),a&&e&&(g=!0,m()))};d.addEventListener("transitionend",i),f.addEventListener("transitionend",i);var j=c(b(d)),k=c(b(f)),n=Math.max(j,k),o=1.15,q="none"===h.toLowerCase()?0:Math.ceil(n*o);0===q?(g=!0,d.removeEventListener("transitionend",i),f.removeEventListener("transitionend",i),d.removeAttribute(l),f.removeAttribute(l),m()):(d.removeAttribute(l),f.removeAttribute(l),window.setTimeout(function(){g||(g=!0,d.removeEventListener("transitionend",i),f.removeEventListener("transitionend",i),m())},q))};xtag.skipTransition(d,function(){return d.setAttribute("card-anim-type",h),d.setAttribute(l,!0),n=!0,q(),r},this),xtag.skipTransition(f,function(){return f.setAttribute("card-anim-type",h),f.setAttribute(l,!0),o=!0,q(),r},this)}function i(a,b,c,d,f){var g=a.xtag._selectedCard;if(g===b){var i={detail:{oldCard:g,newCard:b}};return xtag.fireEvent(a,"shufflestart",i),xtag.fireEvent(a,"shuffleend",i),void 0}k(a),void 0===c&&(console.log("defaulting to none transition"),c="none");var j;switch(d){case"forward":j=!1;break;case"reverse":j=!0;break;default:g||(j=!1);var l=e(a);j=l.indexOf(b)0?a.xtag.history&&a.xtag.history.numStates>0?a.xtag.history.currState:b[0]:null),b.forEach(function(a){a.removeAttribute("leaving"),a.removeAttribute(l),a.removeAttribute("card-anim-type"),a.removeAttribute("reverse"),a!==c?a.removeAttribute("selected"):a.setAttribute("selected",!0)}),a.xtag._selectedCard=c,a.selectedIndex=g(a,c)}}var l="_before-animation",m=a.prototype;m.pushState=function(a){if(this.canRedo&&this._historyStack.splice(this.currIndex+1,this._historyStack.length-(this.currIndex+1)),this._historyStack.push(a),this.currIndex=this._historyStack.length-1,this.sanitizeStack(),"none"!==this._itemCap&&this._historyStack.length>this._itemCap){var b=this._historyStack.length;this._historyStack.splice(0,b-this._itemCap),this.currIndex=this._historyStack.length-1}},m.sanitizeStack=function(){for(var a,b=this._validatorFn,c=0;c=a)throw"attempted to set invalid item cap: "+a;this._itemCap=b}}},canUndo:{get:function(){return this.currIndex>0}},canRedo:{get:function(){return this.currIndex=0&&a-1&&this.shuffleTo(d(f+1,b.length),a)},shufflePrev:function(a){a=a?a:"auto";var b=e(this),c=this.xtag._selectedCard,f=b.indexOf(c);f>-1&&this.shuffleTo(d(f-1,b.length),a)},getAllCards:function(){return e(this)},getSelectedCard:function(){return this.xtag._selectedCard},getCardIndex:function(a){return g(this,a)},getCardAt:function(a){return f(this,a)},historyBack:function(a){var b=this.xtag.history;if(b.canUndo){b.backwards();var c=b.currState;c&&i(this,c,this.transitionType,a,!0)}},historyForward:function(a){var b=this.xtag.history;if(b.canRedo){b.forwards();var c=b.currState;c&&i(this,c,this.transitionType,a,!0)}}}}),xtag.register("x-card",{lifecycle:{inserted:function(){var a=this,b=a.parentNode;b&&"x-deck"===b.tagName.toLowerCase()&&(k(b),a.xtag.parentDeck=b,xtag.fireEvent(b,"cardadd",{detail:{card:a}}))},created:function(){var a=this.parentNode;a&&"x-deck"===a.tagName.toLowerCase()&&(this.xtag.parentDeck=a)},removed:function(){var a=this;if(a.xtag.parentDeck){var b=a.xtag.parentDeck;b.xtag.history.sanitizeStack(),k(b),xtag.fireEvent(b,"cardremove",{detail:{card:a}}) -}}},accessors:{transitionOverride:{attribute:{name:"transition-override"}}},methods:{show:function(){var a=this.parentNode;a===this.xtag.parentDeck&&a.shuffleTo(a.getCardIndex(this))}}})}(),function(){xtag.register("x-flipbox",{lifecycle:{created:function(){this.firstElementChild&&xtag.skipTransition(this.firstElementChild,function(){}),this.lastElementChild&&xtag.skipTransition(this.lastElementChild,function(){}),this.hasAttribute("direction")||(this.xtag._direction="right")}},events:{"transitionend:delegate(*:first-child)":function(a){var b=a.target,c=b.parentNode;"x-flipbox"===c.nodeName.toLowerCase()&&xtag.fireEvent(c,"flipend")},"show:delegate(*:first-child)":function(a){var b=a.target,c=b.parentNode;"x-flipbox"===c.nodeName.toLowerCase()&&(c.flipped=!1)},"show:delegate(*:last-child)":function(a){var b=a.target,c=b.parentNode;"x-flipbox"===c.nodeName.toLowerCase()&&(c.flipped=!0)}},accessors:{direction:{attribute:{},get:function(){return this.xtag._direction},set:function(a){xtag.skipTransition(this.firstElementChild,function(){this.setAttribute("_anim-direction",a)},this),xtag.skipTransition(this.lastElementChild,function(){this.setAttribute("_anim-direction",a)},this),this.xtag._direction=a}},flipped:{attribute:{"boolean":!0}}},methods:{toggle:function(){this.flipped=!this.flipped},showFront:function(){this.flipped=!1},showBack:function(){this.flipped=!0}}})}(),function(){function a(a,b){a.xtag.iconEl.nodeName===g?(b=void 0!==b?b:a.xtag.iconEl.src,b||(a.xtag.iconEl.src=f),a.xtag.iconEl.style.display=b&&b!==f?"":"none"):a.xtag.iconEl.style.display=a.xtag.iconEl.innerHTML?"":"none",a.xtag.contentEl.style.display=a.xtag.contentEl.innerHTML?"":"none"}function b(a){var b=a.xtag.iconEl,c=a.xtag.contentEl;if(c&&b){var d=b.parentNode;if(!d||c.parentNode!==d)throw"invalid parent node of iconbutton's icon / label";switch(a.iconAnchor){case"right":case"bottom":d.insertBefore(c,b);break;default:d.insertBefore(b,c)}}}function c(){xtag.query(document,"x-iconbutton[active]").forEach(function(a){a.removeAttribute("active")})}function d(){xtag.query(document,"x-iconbutton:focus").forEach(function(a){a.blur()})}function e(a){c(a),d()}var f="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",g=document.createElement("img").nodeName,h=function(a){return a.xtag.contentEl.textContent},i=function(a,b){a.xtag.contentEl.textContent=b},j=32,k=13,l=null;xtag.register("x-iconbutton",{lifecycle:{created:function(){var c=this.innerHTML;this.innerHTML="
"+""+"
"+"
",this.xtag.iconEl=this.querySelector(".x-iconbutton-icon"),this.xtag.contentEl=this.querySelector(".x-iconbutton-content"),this.xtag.contentEl.innerHTML=c,this.textGetter||(this.textGetter=h),this.textSetter||(this.textSetter=i),b(this),a(this),this.hasAttribute("tabindex")||this.setAttribute("tabindex",0)},inserted:function(){l||(l={tapend:xtag.addEvent(document,"tapend",e),dragend:xtag.addEvent(document,"dragend",e),keyup:xtag.addEvent(document,"keyup",c)}),b(this),a(this)},removed:function(){if(l&&!document.query("x-calendar")){for(var a in l)xtag.removeEvent(document,a,l[a]);l=null}},attributeChanged:function(){var c=this.iconEl,d=this.contentEl;c.parentNode&&c.parentNode.parentNode===this&&d.parentNode&&d.parentNode.parentNode===this||console.warn("inner DOM of the iconbutton appears to be out of sync; make sure that editing innerHTML or textContent is done through .contentEl, not directly on the iconbutton itself"),b(this),a(this)}},events:{tapstart:function(a){a.currentTarget.setAttribute("active",!0)},keypress:function(a){var b=a.key||a.keyCode;(b===j||b===k)&&a.currentTarget.click()},keydown:function(a){var b=a.key||a.keyCode;(b===j||b===k)&&a.currentTarget.setAttribute("active",!0)}},accessors:{src:{attribute:{},get:function(){return this.xtag.iconEl.getAttribute("src")},set:function(b){this.xtag.iconEl.setAttribute("src",b),this.xtag.iconEl.src=b,a(this,b)}},active:{attribute:{}},iconAnchor:{attribute:{name:"icon-anchor"},set:function(){b(this)}},iconEl:{get:function(){return this.xtag.iconEl}},contentEl:{get:function(){return this.xtag.contentEl}}}})}(),function(){function a(a){var b=a.firstElementChild;if(!b)return{header:null,section:null,footer:null};var c=b.nextElementSibling;return{header:"HEADER"==b.nodeName?b:null,section:"SECTION"==b.nodeName?b:c&&"SECTION"==c.nodeName?c:null,footer:"FOOTER"==a.lastElementChild.nodeName?a.lastElementChild:null}}function b(a,b){var c=b.__layoutScroll__=b.__layoutScroll__||Object.defineProperty(b,"__layoutScroll__",{value:{last:b.scrollTop}}).__layoutScroll__,d=b.scrollTop,e=a.scrollBuffer;return c.max=c.max||Math.max(d+e,e),c.min=c.min||Math.max(d-e,e),c}function c(a,b){a.setAttribute("content-maximizing",null),b.section&&(b.header&&(b.section.style.marginTop="-"+b.header.getBoundingClientRect().height+"px"),b.footer&&(b.section.style.marginBottom="-"+b.footer.getBoundingClientRect().height+"px"))}function d(a,b){a.removeAttribute("content-maximized"),a.removeAttribute("content-maximizing"),b.section&&(b.section.style.marginTop="",b.section.style.marginBottom="")}function e(e){if(!e.currentTarget.hasAttribute("content-maximizing")){var f=e.target,g=e.currentTarget;if(this.scrollhide&&(f.parentNode==g||xtag.matchSelector(f,g.scrollTarget))){var h=f.scrollTop,i=g.scrollBuffer,j=a(g),k=b(g,f);h>k.last?k.min=Math.max(h-i,i):hk.max&&!g.hasAttribute("content-maximized")?c(g,j):h x-slide[selected]")[0]||0;return[b?xtag.query(a,"x-slides > x-slide").indexOf(b):b,a.firstElementChild.children.length-1]}function b(a,b){var c=xtag.toArray(a.firstElementChild.children);c.forEach(function(a){a.removeAttribute("selected")}),c[b||0].setAttribute("selected",!0);var e="translate"+(a.getAttribute("orientation")||"x")+"("+(b||0)*(-100/c.length)+"%)";a.firstElementChild.style[d]=e,a.firstElementChild.style.transform=e}function c(a){var c=this.firstElementChild;if(c&&c.children.length&&"x-slides"==c.tagName.toLowerCase()){var e=xtag.toArray(c.children),f=100/(e.length||1),g=this.getAttribute("orientation")||"x",h="x"==g?["width","height"]:["height","width"];if(c.style[h[1]]="100%",c.style[h[0]]=100*e.length+"%",c.style[d]="translate"+g+"(0%)",c.style.transform="translate"+g+"(0%)",e.forEach(function(a){a.style[h[0]]=f+"%",a.style[h[1]]="100%"}),a){var i=c.querySelector("[selected]");i&&b(this,e.indexOf(i)||0)}}}var d=xtag.prefix.js+"Transform";xtag.register("x-slidebox",{lifecycle:{created:function(){c()}},events:{transitionend:function(a){a.target==this.firstElementChild&&xtag.fireEvent(this,"slideend")},"show:delegate(x-slide)":function(a){var b=a.target;if("x-slides"===b.parentNode.nodeName.toLowerCase()&&"x-slidebox"===b.parentNode.parentNode.nodeName.toLowerCase()){var c=b.parentNode,d=c.parentNode,e=xtag.query(c,"x-slide");d.slideTo(e.indexOf(b))}}},accessors:{orientation:{get:function(){return this.getAttribute("orientation")},set:function(a){var b=this;xtag.skipTransition(b.firstElementChild,function(){b.setAttribute("orientation",a.toLowerCase()),c.call(b,!0)})}}},methods:{slideTo:function(a){b(this,a)},slideNext:function(){var c=a(this);c[0]++,b(this,c[0]>c[1]?0:c[0])},slidePrevious:function(){var c=a(this);c[0]--,b(this,c[0]<0?c[1]:c[0])}}}),xtag.register("x-slide",{lifecycle:{inserted:function(){var a=this.parentNode.parentNode;"x-slidebox"==a.tagName.toLowerCase()&&c.call(a,!0)},created:function(){if(this.parentNode){var a=this.parentNode.parentNode;"x-slidebox"==a.tagName.toLowerCase()&&c.call(a,!0)}}}})}(),function(){function a(a){return!isNaN(parseFloat(a))}function b(b,c){return b.hasAttribute(c)&&a(b.getAttribute(c))}function c(b,c,d,e){if(e=e?e:Math.round,d=a(d)?d:0,!a(b))throw"invalid value "+b;if(!a(c)||0>=+c)throw"invalid step "+c;return e((b-d)/c)*c+d}function d(a,b,d,e){return b>a?b:a>d?Math.max(b,c(d,e,b,Math.floor)):a}function e(a,b,e){var f=c((b-a)/2+a,e,a);return d(f,a,b,e)}function f(a,b){var c=a.min,d=a.max;return(b-c)/(d-c)}function g(a,b){var c=a.min,d=a.max;return(d-c)*b+c}function h(a,b){b=Math.min(Math.max(0,b),1);var e=g(a,b),f=c(e,a.step,a.min);return d(f,a.min,a.max,a.step)}function i(a,b){var c=a.xtag.polyFillSliderThumb;if(c){var d=a.getBoundingClientRect(),e=c.getBoundingClientRect(),g=f(a,b),h=Math.max(d.width-e.width,0),i=h*g,j=i/d.width;c.style.left=100*j+"%"}}function j(a){i(a,a.value)}function k(a,b){var c=a.xtag.rangeInputEl,d=c.getBoundingClientRect(),e=b-d.left;a.value;var f=h(a,e/d.width);a.value=f,xtag.fireEvent(a,"input"),j(a)}function l(a,b,c){a.xtag.dragInitVal=a.value,k(a,b,c);var d=a.xtag.callbackFns,e=function(a,b){document.body.addEventListener(a,b)};e("mousemove",d.onMouseDragMove),e("touchmove",d.onTouchDragMove),e("mouseup",d.onDragEnd),e("touchend",d.onDragEnd);var f=a.xtag.polyFillSliderThumb;f&&f.setAttribute("active",!0)}function m(a,b,c){k(a,b,c)}function n(a){return{onMouseDragStart:function(b){b.button===p&&(l(a,b.pageX,b.pageY),b.preventDefault())},onTouchDragStart:function(b){var c=b.targetTouches;1===c.length&&(l(a,c[0].pageX,c[0].pageY),b.preventDefault())},onMouseDragMove:function(b){m(a,b.pageX,b.pageY),b.preventDefault()},onTouchDragMove:function(b){var c=b.targetTouches;1===c.length&&(m(a,c[0].pageX,c[0].pageY),b.preventDefault())},onDragEnd:function(b){var c=a.xtag.callbackFns,d=function(a,b){document.body.removeEventListener(a,b)};d("mousemove",c.onMouseDragMove),d("touchmove",c.onTouchDragMove),d("mouseup",c.onDragEnd),d("touchend",c.onDragEnd);var e=a.xtag.polyFillSliderThumb;e&&e.removeAttribute("active"),a.value!==a.xtag.dragInitVal&&xtag.fireEvent(a,"change"),a.xtag.dragInitVal=null,b.preventDefault()},onKeyDown:function(a){var b=a.keyCode;if(b in o){var c=this.value,d=this.min,e=this.max,f=this.step,g=Math.max(0,e-d),h=Math.max(g/10,f);switch(o[b]){case"LEFT_ARROW":case"DOWN_ARROW":this.value=Math.max(c-f,d);break;case"RIGHT_ARROW":case"UP_ARROW":this.value=Math.min(c+f,e);break;case"HOME":this.value=d;break;case"END":this.value=e;break;case"PAGE_DOWN":this.value=Math.max(c-h,d);break;case"PAGE_UP":this.value=Math.min(c+h,e)}this.value!==c&&xtag.fireEvent(this,"change"),a.preventDefault()}}}}var o={33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT_ARROW",38:"UP_ARROW",39:"RIGHT_ARROW",40:"DOWN_ARROW"},p=0;xtag.register("x-slider",{lifecycle:{created:function(){var a=this;a.xtag.callbackFns=n(a),a.xtag.dragInitVal=null;var c=document.createElement("input");xtag.addClass(c,"input"),c.setAttribute("type","range");var d=b(a,"max")?+a.getAttribute("max"):100,f=b(a,"min")?+a.getAttribute("min"):0,g=b(a,"step")?+a.getAttribute("step"):1;g=g>0?g:1;var h=b(a,"value")?+a.getAttribute("value"):e(f,d,g);c.setAttribute("max",d),c.setAttribute("min",f),c.setAttribute("step",g),c.setAttribute("value",h),a.xtag.rangeInputEl=c,a.appendChild(a.xtag.rangeInputEl),a.xtag.polyFillSliderThumb=null,"range"!==c.type||a.hasAttribute("polyfill")?a.setAttribute("polyfill",!0):a.removeAttribute("polyfill"),j(a)},attributeChanged:function(){j(this)}},events:{"change:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"change")},"input:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"input")},"focus:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"focus",{},{bubbles:!1})},"blur:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"blur",{},{bubbles:!1})}},accessors:{polyfill:{attribute:{"boolean":!0},set:function(a){var b=this.xtag.callbackFns;if(a){if(this.setAttribute("tabindex",0),this.xtag.rangeInputEl.setAttribute("tabindex",-1),this.xtag.rangeInputEl.setAttribute("readonly",!0),!this.xtag.polyFillSliderThumb){var c=document.createElement("span");xtag.addClass(c,"slider-thumb"),this.xtag.polyFillSliderThumb=c,this.appendChild(c)}j(this),this.addEventListener("mousedown",b.onMouseDragStart),this.addEventListener("touchstart",b.onTouchDragStart),this.addEventListener("keydown",b.onKeyDown)}else this.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("readonly"),this.removeEventListener("mousedown",b.onMouseDragStart),this.removeEventListener("touchstart",b.onTouchDragStart),this.removeEventListener("keydown",b.onKeyDown)}},max:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("max")}},min:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("min")}},step:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("step")}},name:{attribute:{selector:"input[type=range]"},set:function(a){var b=this.xtag.rangeInputEl;null===a||void 0===a?b.removeAttribute("name"):b.setAttribute("name",a)}},value:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.value},set:function(b){a(b)||(b=e(this.min,this.max,this.step)),b=+b;var f=this.min,g=this.max,h=this.step,i=c(b,h,f),k=d(i,f,g,h);this.xtag.rangeInputEl.value=k,j(this)}},inputElem:{get:function(){return this.xtag.rangeInputEl}}},methods:{}})}(),function(){function a(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function b(b){var c=b.getBoundingClientRect(),d=a(),e=d.left,f=d.top;return{left:c.left+e,right:c.right+e,top:c.top+f,bottom:c.bottom+f,width:c.width,height:c.height}}function c(a,b,c){return c.left<=a&&a<=c.right&&c.top<=b&&b<=c.bottom}function d(a){if("x-tabbar"===a.parentNode.nodeName.toLowerCase()){var b=a.targetEvent,c=a.targetSelector?xtag.query(document,a.targetSelector):a.targetElems;c.forEach(function(a){xtag.fireEvent(a,b)})}}xtag.register("x-tabbar",{lifecycle:{created:function(){this.xtag.overallEventToFire="show"}},events:{"tap:delegate(x-tabbar-tab)":function(){var a=xtag.query(this.parentNode,"x-tabbar-tab[selected]");a.length&&a.forEach(function(a){a.removeAttribute("selected")}),this.setAttribute("selected",!0)}},accessors:{tabs:{get:function(){return xtag.queryChildren(this,"x-tabbar-tab")}},targetEvent:{attribute:{name:"target-event"},get:function(){return this.xtag.overallEventToFire},set:function(a){this.xtag.overallEventToFire=a}}},methods:{}}),xtag.register("x-tabbar-tab",{lifecycle:{created:function(){this.xtag.targetSelector=null,this.xtag.overrideTargetElems=null,this.xtag.targetEvent=null}},events:{tap:function(a){var e=a.currentTarget;if(a.changedTouches&&a.changedTouches.length>0){var f=a.changedTouches[0],g=b(e);c(f.pageX,f.pageY,g)&&d(e)}else d(e)}},accessors:{targetSelector:{attribute:{name:"target-selector"},get:function(){return this.xtag.targetSelector},set:function(a){this.xtag.targetSelector=a,a&&(this.xtag.overrideTargetElems=null)}},targetElems:{get:function(){return this.targetSelector?xtag.query(document,this.targetSelector):null!==this.xtag.overrideTargetElems?this.xtag.overrideTargetElems:[]},set:function(a){this.removeAttribute("target-selector"),this.xtag.overrideTargetElems=a}},targetEvent:{attribute:{name:"target-event"},get:function(){if(this.xtag.targetEvent)return this.xtag.targetEvent;if("x-tabbar"===this.parentNode.nodeName.toLowerCase())return this.parentNode.targetEvent;throw"tabbar-tab is missing event to fire"},set:function(a){this.xtag.targetEvent=a}}},methods:{}})}(),function(){function a(a){var b=a.xtag.inputEl.form;b?a.removeAttribute("x-toggle-no-form"):a.setAttribute("x-toggle-no-form",""),a.xtag.scope=a.parentNode?b||document:null}function b(a){var b={},c=a==document?"[x-toggle-no-form]":"";xtag.query(a,"x-toggle[name]"+c).forEach(function(d){var e=d.name;if(e&&!b[e]){var f=xtag.query(a,'x-toggle[name="'+e+'"]'+c),g=f.length>1?"radio":"checkbox";f.forEach(function(a){a.xtag&&a.xtag.inputEl&&(a.type=g)}),b[e]=!0}})}var c=!1;xtag.addEvents(document,{DOMComponentsLoaded:function(){b(document),xtag.toArray(document.forms).forEach(b)},WebComponentsReady:function(){b(document),xtag.toArray(document.forms).forEach(b)},keydown:function(a){c=a.shiftKey},keyup:function(a){c=a.shiftKey},"focus:delegate(x-toggle)":function(){this.setAttribute("focus","")},"blur:delegate(x-toggle)":function(){this.removeAttribute("focus")},"tap:delegate(x-toggle)":function(){if(c&&this.group){var a=this.groupToggles,b=this.xtag.scope.querySelector('x-toggle[group="'+this.group+'"][active]');if(b&&this!=b){var d=this,e=b.checked,f=a.indexOf(this),g=a.indexOf(b),h=Math.min(f,g),i=Math.max(f,g);a.slice(h,i).forEach(function(a){a!=d&&(a.checked=e)})}}},"change:delegate(x-toggle)":function(){var a=this.xtag.scope.querySelector('x-toggle[group="'+this.group+'"][active]');this.checked=c&&a&&this!=a?a.checked:this.xtag.inputEl.checked,this.group&&(this.groupToggles.forEach(function(a){a.active=!1}),this.active=!0)}}),xtag.register("x-toggle",{lifecycle:{created:function(){this.innerHTML='
',this.xtag.inputWrapEl=this.querySelector(".x-toggle-input-wrap"),this.xtag.inputEl=this.xtag.inputWrapEl.querySelector("input"),this.xtag.contentWrapEl=this.querySelector(".x-toggle-content-wrap"),this.xtag.checkEl=this.querySelector(".x-toggle-check"),this.xtag.contentEl=this.querySelector(".x-toggle-content"),this.type="checkbox",a(this);var b=this.getAttribute("name");b&&(this.xtag.inputEl.name=this.getAttribute("name")),this.hasAttribute("checked")&&(this.checked=!0)},inserted:function(){a(this),this.parentNode&&"x-togglegroup"===this.parentNode.nodeName.toLowerCase()&&(this.parentNode.hasAttribute("name")&&(this.name=this.parentNode.getAttribute("name")),this.parentNode.hasAttribute("group")&&(this.group=this.parentNode.getAttribute("group")),this.setAttribute("no-box",!0)),this.name&&b(this.xtag.scope)},removed:function(){b(this.xtag.scope),a(this)}},accessors:{noBox:{attribute:{name:"no-box","boolean":!0},set:function(){}},type:{attribute:{},set:function(a){this.xtag.inputEl.type=a}},label:{attribute:{},get:function(){return this.xtag.contentEl.innerHTML},set:function(a){this.xtag.contentEl.innerHTML=a}},active:{attribute:{"boolean":!0}},group:{attribute:{}},groupToggles:{get:function(){return xtag.query(this.xtag.scope,'x-toggle[group="'+this.group+'"]')}},name:{attribute:{skip:!0},get:function(){return this.getAttribute("name")},set:function(a){null===a?(this.removeAttribute("name"),this.type="checkbox"):this.setAttribute("name",a),this.xtag.inputEl.name=a,b(this.xtag.scope)}},checked:{get:function(){return this.xtag.inputEl.checked},set:function(a){var b=this.name,c="true"===a||a===!0;if(b){var d=this.xtag.scope==document?"[x-toggle-no-form]":"",e='x-toggle[checked][name="'+b+'"]'+d,f=this.xtag.scope.querySelector(e);f&&f.removeAttribute("checked")}this.xtag.inputEl.checked=c,c?this.setAttribute("checked",""):this.removeAttribute("checked")}},value:{attribute:{},get:function(){return this.xtag.inputEl.value},set:function(a){this.xtag.inputEl.value=a}}}})}(),function(){xtag.register("x-togglegroup",{lifecycle:{created:function(){this.options.forEach(function(a){this.name&&(a.name=this.name),this.group&&(a.group=this.group),a.noBox=!0}.bind(this))}},events:{},accessors:{name:{attribute:{selector:"x-toggle"},set:function(a){this.options.forEach(function(b){b.name=a})}},group:{attribute:{selector:"x-toggle"},set:function(a){this.options.forEach(function(b){b.group=a})}},options:{get:function(){return xtag.queryChildren(this,"x-toggle")}}},methods:{}})}(),function(){function a(a){return a in G}function b(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function c(a){var c=a.getBoundingClientRect(),d=b(),e=d.left,f=d.top;return{left:c.left+e,right:c.right+e,top:c.top+f,bottom:c.bottom+f,width:c.width,height:c.height}}function d(a,b){return b=void 0!==b?b:c(a),{x:a.offsetWidth?b.width/a.offsetWidth:1,y:a.offsetHeight?b.height/a.offsetHeight:1}}function e(a,b){if(a.rightf||l.bottom>g?i.push(k):h.push(k)}var m=h.length>0?h:i;return m[0].orient}function w(a){a.setAttribute("_force-display",!0)}function x(a){a.removeAttribute("_force-display")}function y(b,c){b.removeAttribute(K);var d=b.xtag.arrowEl,e=null,f=[];for(var g in G)d.setAttribute(J,G[g]),e=z(b,c,g),e&&(w(b),q(b,c)||f.push({orient:g,rect:e}),x(b));var h=v(b,f);return h||(h="top"),b.setAttribute(K,h),d.setAttribute(J,G[h]),a(h)&&h!==g?z(b,c,h):e}function z(e,f,g,h){if(!e.parentNode)return e.left="",e.top="",null;h=void 0===h?0:h;var i=e.xtag.arrowEl;if(!a(g))return y(e,f);var j=e.offsetParent?e.offsetParent:e.parentNode;h||(e.style.top="",e.style.left="",i.style.top="",i.style.left=""),w(e);var k=b(),l=c(j),o=d(j,l),p=j.clientWidth*o.x,q=j.clientHeight*o.y,v=c(f),A=v.width,B=v.height,C=c(e),D=d(e,C),E=C.width,F=C.height,G=C.width,H=C.height,I=(G-E)/2,J=(H-F)/2,K=i.offsetWidth*D.x,L=i.offsetHeight*D.y,M=45,N=r(K,L,M);K=N.width,L=N.height,"top"===g||"bottom"===g?L/=2:K/=2;var O=u(e,l),P=O.left,Q=O.top,R=O.right-E,S=O.bottom-F,T={left:v.left+(A-E)/2,top:v.top+(B-F)/2},U=T.left,V=T.top;if("top"===g)V=v.top-H-L,S-=L;else if("bottom"===g)V=v.top+B+L,S-=L;else if("left"===g)U=v.left-G-K,R-=K;else{if("right"!==g)throw"invalid orientation "+g;U=v.left+A+K,R-=K}var W=s(U,P,R),X=s(V,Q,S);W+=I,X+=J;var Y,Z,$=function(a){if(!window.getComputedStyle||a===document||a===document.documentElement)return!1;var b;try{b=window.getComputedStyle(a)}catch(c){return!1}return b&&"fixed"===b.position},_=m(f,$);if(_&&!n(e,_))Y=W-k.left,Z=X-k.top,e.setAttribute("_target-fixed",!0);else{var ab=t(W,X,window,j,o);Y=ab.left,Z=ab.top,e.removeAttribute("_target-fixed")}e.style.top=Z+"px",e.style.left=Y+"px";var bb,cb,db,eb,fb;"top"===g||"bottom"===g?(eb=(A-K)/2,fb=v.left-W,bb=E-K,cb=E,db="left"):(eb=(B-L)/2,fb=v.top-X,bb=F-L,cb=F,db="top");var gb=s(eb+fb,0,bb),hb=cb?gb/cb:0;i.style[db]=100*hb+"%";var ib=e.offsetWidth*D.x,jb=e.offsetHeight*D.y,kb=j.clientWidth*o.x,lb=j.clientHeight*o.y;x(e);var mb=2;return mb>h&&(E!==ib||F!==jb||p!==kb||q!==lb)?z(e,f,g,h+1):{left:W,top:X,width:ib,height:jb,right:W+ib,bottom:X+jb}}function A(a,b){b===a&&console.warn("The tooltip's target element is the tooltip itself! Is this intentional?");var c=a.xtag.arrowEl;c.parentNode||console.warn("The inner component DOM of the tooltip appears to be missing. Make sure to edit tooltip contents through the .contentEl property instead ofdirectly on the x-tooltip to avoid clobbering the component's internals.");var d=a.orientation,e=function(){x(a),a.setAttribute("visible",!0),xtag.fireEvent(a,"tooltipshown",{triggerElem:b})};b?(a.xtag.lastTargetElem=b,xtag.skipTransition(a,function(){return z(a,b,d),e})):(a.style.top="",a.style.left="",c.style.top="",c.style.left="",e())}function B(b){a(b.orientation)&&b.removeAttribute(K),b.hasAttribute("visible")&&(w(b),b.xtag._hideTransitionFlag=!0,b.removeAttribute("visible"))}function C(a){var b=a.xtag.cachedListeners;b.forEach(function(a){a.removeListener()}),a.xtag.cachedListeners=[],E.unregisterTooltip(a.triggerStyle,a)}function D(a,b,c){if(a.parentNode){(void 0===b||null===b)&&(b=a.targetSelector),(void 0===c||null===c)&&(c=a.triggerStyle);var d=p(a,b);-1===d.indexOf(a.xtag.lastTargetElem)&&(a.xtag.lastTargetElem=d.length>0?d[0]:null,z(a,a.xtag.lastTargetElem,a.orientation)),C(a);var e;if(c in F){var f=F[c];e=f(a,b)}else e=l(a,b,c),E.registerTooltip(c,a);e.forEach(function(a){a.attachListener()}),a.xtag.cachedListeners=e,B(a)}}var E,F,G={top:"down",bottom:"up",left:"right",right:"left"},H="_previousSibling",I="_nextSibling",J="arrow-direction",K="_auto-orientation";f.prototype.attachListener=function(){this._attachedFn||(this._attachedFn=xtag.addEvent(this.elem,this.eventType,this.listenerFn))},f.prototype.removeListener=function(){this._attachedFn&&(xtag.removeEvent(this.elem,this.eventType,this._attachedFn),this._attachedFn=null)},g.prototype.destroy=function(){this._cachedListener.removeListener(),this._cachedListener=null,this._tooltips=null},g.prototype.containsTooltip=function(a){return-1!==this._tooltips.indexOf(a)},g.prototype.addTooltip=function(a){this.containsTooltip(a)||this._tooltips.push(a)},g.prototype.removeTooltip=function(a){this.containsTooltip(a)&&this._tooltips.splice(this._tooltips.indexOf(a),1)},Object.defineProperties(g.prototype,{numTooltips:{get:function(){return this._tooltips.length}}}),h.prototype.registerTooltip=function(a,b){if(a in this.eventStructDict){var c=this.eventStructDict[a];c.containsTooltip(b)||c.addTooltip(b)}else this.eventStructDict[a]=new g(a),this.eventStructDict[a].addTooltip(b)},h.prototype.unregisterTooltip=function(a,b){if(a in this.eventStructDict&&this.eventStructDict[a].containsTooltip(b)){var c=this.eventStructDict[a];c.removeTooltip(b),0===c.numTooltips&&(c.destroy(),delete this.eventStructDict[a])}},E=new h,F={custom:function(){return[]},hover:function(a,b){var c=[],d=null,e=200,g=function(){d&&window.clearTimeout(d),d=null},h=o(function(b){g();var c=this,d=b.relatedTarget||b.toElement;n(d,a)||A(a,c)}),i=o(function(b){g();var c=b.relatedTarget||b.toElement;n(c,a)||(d=window.setTimeout(function(){"hover"===a.triggerStyle&&B(a)},e))}),j=k(a,b,"enter",h),l=k(a,b,"leave",i);c.push(j),c.push(l);var m=o(function(b){g();var c=b.relatedTarget||b.toElement,d=a.xtag.lastTargetElem;a.hasAttribute("visible")||!d||n(c,d)||A(a,d)}),p=o(function(b){g();var c=b.relatedTarget||b.toElement,f=a.xtag.lastTargetElem;f&&!n(c,f)&&(d=window.setTimeout(function(){"hover"===a.triggerStyle&&B(a)},e))});return c.push(new f(a,"enter",m)),c.push(new f(a,"leave",p)),c}},xtag.register("x-tooltip",{lifecycle:{created:function(){var a=this;a.xtag.contentEl=document.createElement("div"),a.xtag.arrowEl=document.createElement("span"),xtag.addClass(a.xtag.contentEl,"tooltip-content"),xtag.addClass(a.xtag.arrowEl,"tooltip-arrow"),a.xtag.contentEl.innerHTML=a.innerHTML,a.innerHTML="",a.appendChild(a.xtag.contentEl),a.appendChild(a.xtag.arrowEl),a.xtag._orientation="auto",a.xtag._targetSelector=H,a.xtag._triggerStyle="click";var b=p(a,a.xtag._targetSelector);a.xtag.lastTargetElem=b.length>0?b[0]:null,a.xtag.cachedListeners=[],a.xtag._hideTransitionFlag=!1,a.xtag._skipOuterClick=!1},inserted:function(){D(this,this.xtag._targetSelector,this.xtag._triggerStyle)},removed:function(){C(this)}},events:{transitionend:function(a){var b=a.currentTarget;b.xtag._hideTransitionFlag&&!b.hasAttribute("visible")&&(b.xtag._hideTransitionFlag=!1,xtag.fireEvent(b,"tooltiphidden")),x(b)}},accessors:{orientation:{attribute:{},get:function(){return this.xtag._orientation},set:function(b){b=b.toLowerCase();var c=this.querySelector(".tooltip-arrow"),d=null;a(b)?(d=G[b],c.setAttribute(J,d),this.removeAttribute(K)):c.removeAttribute(J),this.xtag._orientation=b,this.refreshPosition()}},triggerStyle:{attribute:{name:"trigger-style"},get:function(){return this.xtag._triggerStyle},set:function(a){D(this,this.targetSelector,a),this.xtag._triggerStyle=a}},targetSelector:{attribute:{name:"target-selector"},get:function(){return this.xtag._targetSelector},set:function(a){p(this,a),D(this,a,this.triggerStyle),this.xtag._targetSelector=a -}},ignoreOuterTrigger:{attribute:{"boolean":!0,name:"ignore-outer-trigger"}},ignoreTooltipPointerEvents:{attribute:{"boolean":!0,name:"ignore-tooltip-pointer-events"}},allowOverflow:{attribute:{"boolean":!0,name:"allow-overflow"},set:function(){this.refreshPosition()}},contentEl:{get:function(){return this.xtag.contentEl},set:function(a){var b=this.xtag.contentEl;xtag.addClass(a,"tooltip-content"),this.replaceChild(a,b),this.xtag.contentEl=a,this.refreshPosition()}},presetTriggerStyles:{get:function(){var a=[];for(var b in F)a.push(b);return a}},targetElems:{get:function(){return p(this,this.targetSelector)}}},methods:{refreshPosition:function(){this.xtag.lastTargetElem&&z(this,this.xtag.lastTargetElem,this.orientation)},show:function(){A(this,this.xtag.lastTargetElem)},hide:function(){B(this)},toggle:function(){this.hasAttribute("visible")?this.hide():this.show()}}})}(); \ No newline at end of file +window.Platform={};var logFlags={};!function(){function a(a){if(this._element=a,a.className!=this._classCache){if(this._classCache=a.className,!this._classCache)return;var b,c=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(b=0;b>>0)+(b++ +"__")};c.prototype={set:function(b,c){var d=b[this.name];d&&d[0]===b?d[1]=c:a(b,this.name,{value:[b,c],writable:!0})},get:function(a){var b;return(b=a[this.name])&&b[0]===a?b[1]:void 0},"delete":function(a){this.set(a,void 0)}},window.WeakMap=c}();var SideTable;if("undefined"!=typeof WeakMap&&navigator.userAgent.indexOf("Firefox/")<0?SideTable=WeakMap:!function(){var a=Object.defineProperty,b=Date.now()%1e9;SideTable=function(){this.name="__st"+(1e9*Math.random()>>>0)+(b++ +"__")},SideTable.prototype={set:function(b,c){var d=b[this.name];d&&d[0]===b?d[1]=c:a(b,this.name,{value:[b,c],writable:!0})},get:function(a){var b;return(b=a[this.name])&&b[0]===a?b[1]:void 0},"delete":function(a){this.set(a,void 0)}}}(),function(a){function b(a){u.push(a),t||(t=!0,q(d))}function c(a){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(a)||a}function d(){t=!1;var a=u;u=[],a.sort(function(a,b){return a.uid_-b.uid_});var b=!1;a.forEach(function(a){var c=a.takeRecords();e(a),c.length&&(a.callback_(c,a),b=!0)}),b&&d()}function e(a){a.nodes_.forEach(function(b){var c=p.get(b);c&&c.forEach(function(b){b.observer===a&&b.removeTransientObservers()})})}function f(a,b){for(var c=a;c;c=c.parentNode){var d=p.get(c);if(d)for(var e=0;e0){var e=c[d-1],f=n(e,a);if(f)return c[d-1]=f,void 0}else b(this.observer);c[d]=a},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(a){var b=this.options;b.attributes&&a.addEventListener("DOMAttrModified",this,!0),b.characterData&&a.addEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.addEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(a){var b=this.options;b.attributes&&a.removeEventListener("DOMAttrModified",this,!0),b.characterData&&a.removeEventListener("DOMCharacterDataModified",this,!0),b.childList&&a.removeEventListener("DOMNodeInserted",this,!0),(b.childList||b.subtree)&&a.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(a){if(a!==this.target){this.addListeners_(a),this.transientObservedNodes.push(a);var b=p.get(a);b||p.set(a,b=[]),b.push(this)}},removeTransientObservers:function(){var a=this.transientObservedNodes;this.transientObservedNodes=[],a.forEach(function(a){this.removeListeners_(a);for(var b=p.get(a),c=0;cc&&(a=b[c]);c++)a();B=[]}function l(a){z?j(function(){m(a)}):m(a)}function m(a){(a.enteredViewCallback||a.__upgraded__&&y.dom)&&(y.dom&&console.group("inserted:",a.localName),p(a)&&(a.__inserted=(a.__inserted||0)+1,a.__inserted<1&&(a.__inserted=1),a.__inserted>1?y.dom&&console.warn("inserted:",a.localName,"insert/remove count:",a.__inserted):a.enteredViewCallback&&(y.dom&&console.log("inserted:",a.localName),a.enteredViewCallback())),y.dom&&console.groupEnd())}function n(a){o(a),d(a,function(a){o(a)})}function o(a){z?j(function(){_removed(a)}):_removed(a)}function o(a){(a.leftViewCallback||a.__upgraded__&&y.dom)&&(y.dom&&console.log("removed:",a.localName),p(a)||(a.__inserted=(a.__inserted||0)-1,a.__inserted>0&&(a.__inserted=0),a.__inserted<0?y.dom&&console.warn("removed:",a.localName,"insert/remove count:",a.__inserted):a.leftViewCallback&&a.leftViewCallback()))}function p(a){for(var b=a,c=window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(document)||document;b;){if(b==c)return!0;b=b.parentNode||b.host}}function q(a){if(a.shadowRoot&&!a.shadowRoot.__watched){y.dom&&console.log("watching shadow-root for: ",a.localName);for(var b=a.shadowRoot;b;)r(b),b=b.olderShadowRoot}}function r(a){a.__watched||(v(a),a.__watched=!0)}function s(a){switch(a.localName){case"style":case"script":case"template":case void 0:return!0}}function t(a){if(y.dom){var b=a[0];if(b&&"childList"===b.type&&b.addedNodes&&b.addedNodes){for(var c=b.addedNodes[0];c&&c!==document&&!c.host;)c=c.parentNode;var d=c&&(c.URL||c._URL||c.host&&c.host.localName)||"";d=d.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",a.length,d||"")}a.forEach(function(a){"childList"===a.type&&(D(a.addedNodes,function(a){s(a)||g(a)}),D(a.removedNodes,function(a){s(a)||n(a)}))}),y.dom&&console.groupEnd()}function u(){t(C.takeRecords()),k()}function v(a){C.observe(a,{childList:!0,subtree:!0})}function w(a){v(a)}function x(a){y.dom&&console.group("upgradeDocument: ",(a.URL||a._URL||"").split("/").pop()),g(a),y.dom&&console.groupEnd()}var y=window.logFlags||{},z=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;a.hasPolyfillMutations=z;var A=!1,B=[],C=new MutationObserver(t),D=Array.prototype.forEach.call.bind(Array.prototype.forEach);a.watchShadow=q,a.upgradeAll=g,a.upgradeSubtree=f,a.observeDocument=w,a.upgradeDocument=x,a.takeRecords=u}(window.CustomElements),function(){function a(a){return"link"===a.localName&&a.getAttribute("rel")===b}var b=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none",c={selectors:["link[rel="+b+"]"],map:{link:"parseLink"},parse:function(a){if(!a.__parsed){a.__parsed=!0;var b=a.querySelectorAll(c.selectors);d(b,function(a){c[c.map[a.localName]](a)}),CustomElements.upgradeDocument(a),CustomElements.observeDocument(a)}},parseLink:function(b){a(b)&&this.parseImport(b)},parseImport:function(a){a.content&&c.parse(a.content)}},d=Array.prototype.forEach.call.bind(Array.prototype.forEach);CustomElements.parser=c}(),function(){function a(){CustomElements.parser.parse(document),CustomElements.upgradeDocument(document);var a=window.Platform&&Platform.endOfMicrotask?Platform.endOfMicrotask:setTimeout;a(function(){CustomElements.ready=!0,CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.body.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}if("function"!=typeof window.CustomEvent&&(window.CustomEvent=function(a){var b=document.createEvent("HTMLEvents");return b.initEvent(a,!0,!0),b}),"complete"===document.readyState)a();else{var b=window.HTMLImports?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(b,a)}}(),function(){function a(a){var b=K.call(a);return J[b]||(J[b]=b.match(L)[1].toLowerCase())}function b(c,d){var e=b[d||a(c)];return e?e(c):c}function c(b){return-1==M.indexOf(a(b))?Array.prototype.slice.call(b,0):[b]}function d(a,b){return(b||N).length?c(a.querySelectorAll(b)):[]}function e(a,b){var c={added:[],removed:[]};b.forEach(function(b){b._mutation=!0;for(var d in c)for(var e=a._records["added"==d?"inserted":"removed"],f=b[d+"Nodes"],g=f.length,h=0;g>h&&-1==c[d].indexOf(f[h]);h++)c[d].push(f[h]),e.forEach(function(a){a(f[h],b)})})}function f(c,d,e){var f=a(e);return"object"==f&&"object"==a(c[d])?S.merge(c[d],e):c[d]=b(e,f),c}function g(a,b,c,d,e){e[b]="function"!=typeof e[b]?d:S.wrap(e[b],S.applyPseudos(c,d,a.pseudos))}function h(a,b,c,d){if(d){var e={};for(var f in c)e[f.split(":")[0]]=f;for(f in b)g(a,e[f.split(":")[0]]||f,f,b[f],c)}else for(var h in b)g(a,h+":__mixin__("+O++ +")",h,b[h],c)}function i(a){return a.mixins.forEach(function(b){var c=S.mixins[b];for(var d in c){var e=c[d],f=a[d];if(f)switch(d){case"accessors":case"prototype":for(var g in e)f[g]?h(a,e[g],f[g],!0):f[g]=e[g];break;default:h(a,e,f,"events"!=d)}else a[d]=e}}),a}function j(a,b){var c,d=b.target;if(S.matchSelector(d,a.value))c=d;else if(S.matchSelector(d,a.value+" *"))for(var e=d.parentNode;!c;)S.matchSelector(e,a.value)&&(c=e),e=e.parentNode;return c?a.listener=a.listener.bind(c):null}function k(a){if(a.type.match("touch"))a.target.__touched__=!0;else if(a.target.__touched__&&a.type.match("mouse"))return delete a.target.__touched__,void 0;return!0}function l(a){var b="over"==a;return{attach:"OverflowEvent"in y?"overflowchanged":[],condition:function(c){return c.flow=a,c.type==a+"flow"||0===c.orient&&c.horizontalOverflow==b||1==c.orient&&c.verticalOverflow==b||2==c.orient&&c.horizontalOverflow==b&&c.verticalOverflow==b}}}function m(a,b,c,d){d?b[a]=c[a]:Object.defineProperty(b,a,{writable:!0,enumerable:!0,value:c[a]})}function n(a,b){var c=Object.getOwnPropertyDescriptor(a,"target");for(var d in b)P[d]||m(d,a,b,c);a.baseEvent=b}function o(a,b){return{value:a.boolean?"":b,method:a.boolean&&!b?"removeAttribute":"setAttribute"}}function p(a,b,c,d){var e=o(b,d);a[e.method](c,e.value)}function q(a,b,c,d,e){for(var f=b.property?[a.xtag[b.property]]:b.selector?S.query(a,b.selector):[],g=f.length;g--;)f[g][e](c,d)}function r(a,b,c){a.__view__&&a.__view__.updateBindingValue(a,b,c)}function s(a,b,c,d,e,f){var g=c.split(":"),h=g[0];if("get"==h)g[0]=b,a.prototype[b].get=S.applyPseudos(g.join(":"),d[c],a.pseudos);else if("set"==h){g[0]=b;var i=a.prototype[b].set=S.applyPseudos(g.join(":"),e?function(a){this.xtag._skipSet=!0,this.xtag._skipAttr||p(this,e,f,a),this.xtag._skipAttr&&e.skip&&delete this.xtag._skipAttr,d[c].call(this,e.boolean?!!a:a),r(this,f,a),delete this.xtag._skipSet}:d[c]?function(a){d[c].call(this,a),r(this,f,a)}:null,a.pseudos);e&&(e.setter=i)}else a.prototype[b][c]=d[c]}function t(a,b){a.prototype[b]={};var c=a.accessors[b],d=c.attribute,e=d&&d.name?d.name.toLowerCase():b;d&&(d.key=b,a.attributes[e]=d);for(var f in c)s(a,b,f,c,d,e);if(d){if(!a.prototype[b].get){var g=(d.boolean?"has":"get")+"Attribute";a.prototype[b].get=function(){return this[g](e)}}a.prototype[b].set||(a.prototype[b].set=function(a){p(this,d,e,a),r(this,e,a)})}}function u(a){R[a]=(R[a]||[]).filter(function(b){return(b.tags=b.tags.filter(function(b){return b!=a&&!S.tags[b]})).length||b.fn()})}function v(a,b,c){a.__tap__||(a.__tap__={click:"mousedown"==c.type},a.__tap__.click?a.addEventListener("click",b.observer):(a.__tap__.scroll=b.observer.bind(a),window.addEventListener("scroll",a.__tap__.scroll,!0),a.addEventListener("touchmove",b.observer),a.addEventListener("touchcancel",b.observer),a.addEventListener("touchend",b.observer))),a.__tap__.click||(a.__tap__.x=c.touches[0].pageX,a.__tap__.y=c.touches[0].pageY)}function w(a,b){a.__tap__&&(a.__tap__.click?a.removeEventListener("click",b.observer):(window.removeEventListener("scroll",a.__tap__.scroll,!0),a.removeEventListener("touchmove",b.observer),a.removeEventListener("touchcancel",b.observer),a.removeEventListener("touchend",b.observer)),delete a.__tap__)}function x(a,b,c){var d=c.changedTouches[0],e=b.gesture.tolerance;return d.pageXa.__tap__.x-e&&d.pageYa.__tap__.y-e?!0:void 0}var y=window,z=document,A=function(){},B=function(){return!0},C=/([\w-]+(?:\([^\)]+\))?)/g,D=/(\w*)(?:\(([^\)]*)\))?/,E=/(\d+)/g,F={action:function(a,b){return a.value.match(E).indexOf(String(b.keyCode))>-1==("keypass"==a.name)||null}},G=function(){var a=y.getComputedStyle(z.documentElement,""),b=(Array.prototype.slice.call(a).join("").match(/-(moz|webkit|ms)-/)||""===a.OLink&&["","o"])[1];return{dom:"ms"==b?"MS":b,lowercase:b,css:"-"+b+"-",js:"ms"==b?b:b[0].toUpperCase()+b.substr(1)}}(),H=Element.prototype.matchesSelector||Element.prototype[G.lowercase+"MatchesSelector"],I=y.MutationObserver||y[G.js+"MutationObserver"],J={},K=J.toString,L=/\s([a-zA-Z]+)/;b.object=function(a){var c={};for(var d in a)c[d]=b(a[d]);return c},b.array=function(a){for(var c=a.length,d=new Array(c);c--;)d[c]=b(a[c]);return d};var M=["undefined","null","number","boolean","string","function"],N="",O=0,P={};for(var Q in document.createEvent("CustomEvent"))P[Q]=1;var R={},S={tags:{},defaultOptions:{pseudos:[],mixins:[],events:{},methods:{},accessors:{},lifecycle:{},attributes:{},prototype:{xtag:{get:function(){return this.__xtag__?this.__xtag__:this.__xtag__={data:{}}}}}},register:function(a,b){var d;if("string"==typeof a){d=a.toLowerCase();var e=b.prototype;delete b.prototype;var f=S.tags[d]=i(S.merge({},S.defaultOptions,b));for(var g in f.events)f.events[g]=S.parseEvent(g,f.events[g]);for(g in f.lifecycle)f.lifecycle[g.split(":")[0]]=S.applyPseudos(g,f.lifecycle[g],f.pseudos);for(g in f.methods)f.prototype[g.split(":")[0]]={value:S.applyPseudos(g,f.methods[g],f.pseudos),enumerable:!0};for(g in f.accessors)t(f,g);var h=f.lifecycle.created||f.lifecycle.ready;f.prototype.createdCallback={enumerable:!0,value:function(){var a=this;S.addEvents(this,f.events),f.mixins.forEach(function(b){S.mixins[b].events&&S.addEvents(a,S.mixins[b].events)});var b=h?h.apply(this,c(arguments)):null;for(var d in f.attributes){var e=f.attributes[d],g=this.hasAttribute(d);(g||e.boolean)&&(this[e.key]=e.boolean?g:this.getAttribute(d))}return f.pseudos.forEach(function(b){b.onAdd.call(a,b)}),b}},f.lifecycle.inserted&&(f.prototype.enteredViewCallback={value:f.lifecycle.inserted,enumerable:!0}),f.lifecycle.removed&&(f.prototype.leftDocumentCallback={value:f.lifecycle.removed,enumerable:!0}),f.lifecycle.attributeChanged&&(f.prototype.attributeChangedCallback={value:f.lifecycle.attributeChanged,enumerable:!0});var j=f.prototype.setAttribute||HTMLElement.prototype.setAttribute;f.prototype.setAttribute={writable:!0,enumberable:!0,value:function(a,b){var c=f.attributes[a.toLowerCase()];this.xtag._skipAttr||j.call(this,a,c&&c.boolean?"":b),c&&(c.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,c.setter.call(this,c.boolean?!0:b)),b=c.skip?c.boolean?this.hasAttribute(a):this.getAttribute(a):b,q(this,c,a,c.boolean?"":b,"setAttribute")),delete this.xtag._skipAttr}};var k=f.prototype.removeAttribute||HTMLElement.prototype.removeAttribute;f.prototype.removeAttribute={writable:!0,enumberable:!0,value:function(a){var b=f.attributes[a.toLowerCase()];this.xtag._skipAttr||k.call(this,a),b&&(b.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,b.setter.call(this,b.boolean?!1:void 0)),q(this,b,a,void 0,"removeAttribute")),delete this.xtag._skipAttr}};var l=e?e:b["extends"]?Object.create(z.createElement(b["extends"]).constructor).prototype:y.HTMLElement.prototype,m={prototype:Object.create(l,f.prototype)};b["extends"]&&(m["extends"]=b["extends"]);var n=z.register(d,m);return u(d),n}},ready:function(a,b){var d={tags:c(a),fn:b};d.tags.reduce(function(a,b){return S.tags[b]?a:((R[b]=R[b]||[]).push(d),void 0)},!0)&&b()},mixins:{},prefix:G,captureEvents:["focus","blur","scroll","underflow","overflow","overflowchanged","DOMMouseScroll"],customEvents:{overflow:l("over"),underflow:l("under"),animationstart:{attach:[G.dom+"AnimationStart"]},animationend:{attach:[G.dom+"AnimationEnd"]},transitionend:{attach:[G.dom+"TransitionEnd"]},move:{attach:["mousemove","touchmove"],condition:k},enter:{attach:["mouseover","touchenter"],condition:k},leave:{attach:["mouseout","touchleave"],condition:k},scrollwheel:{attach:["DOMMouseScroll","mousewheel"],condition:function(a){return a.delta=a.wheelDelta?a.wheelDelta/40:Math.round(-1*(a.detail/3.5)),!0}},tapstart:{observe:{mousedown:z,touchstart:z},condition:k},tapend:{observe:{mouseup:z,touchend:z},condition:k},tapmove:{attach:["tapstart","dragend","touchcancel"],condition:function(a,b){switch(a.type){case"move":return!0;case"dragover":var c=b.lastDrag||{};return b.lastDrag=a,c.pageX!=a.pageX&&c.pageY!=a.pageY||null;case"tapstart":b.move||(b.current=this,b.move=S.addEvents(this,{move:b.listener,dragover:b.listener}),b.tapend=S.addEvent(z,"tapend",b.listener));break;case"tapend":case"dragend":case"touchcancel":a.touches.length||(b.move&&S.removeEvents(b.current,b.move||{}),b.tapend&&S.removeEvent(z,b.tapend||{}),delete b.lastDrag,delete b.current,delete b.tapend,delete b.move)}}}},pseudos:{__mixin__:{},keypass:F,keyfail:F,delegate:{action:j},within:{action:j,onAdd:function(a){var b=a.source.condition;b&&(a.source.condition=function(c,d){return S.query(this,a.value).filter(function(a){return a==c.target||a.contains?a.contains(c.target):null})[0]?b.call(this,c,d):null})}},preventable:{action:function(a,b){return!b.defaultPrevented}}},clone:b,typeOf:a,toArray:c,wrap:function(a,b){return function(){var d=c(arguments),e=a.apply(this,d);return b.apply(this,d),e}},merge:function(b,c,d){if("string"==a(c))return f(b,c,d);for(var e=1,g=arguments.length;g>e;e++){var h=arguments[e];for(var i in h)f(b,i,h[i])}return b},uid:function(){return Math.random().toString(36).substr(2,10)},query:d,skipTransition:function(a,b){var c=G.js+"TransitionProperty";a.style[c]=a.style.transitionProperty="none";var d=b();return S.requestFrame(function(){S.requestFrame(function(){a.style[c]=a.style.transitionProperty="",d&&S.requestFrame(d)})})},requestFrame:function(){var a=y.requestAnimationFrame||y[G.lowercase+"RequestAnimationFrame"]||function(a){return y.setTimeout(a,20)};return function(b){return a(b)}}(),cancelFrame:function(){var a=y.cancelAnimationFrame||y[G.lowercase+"CancelAnimationFrame"]||y.clearTimeout;return function(b){return a(b)}}(),matchSelector:function(a,b){return H.call(a,b)},set:function(a,b,c){a[b]=c,window.CustomElements&&CustomElements.upgradeAll(a)},innerHTML:function(a,b){S.set(a,"innerHTML",b)},hasClass:function(a,b){return a.className.split(" ").indexOf(b.trim())>-1},addClass:function(a,b){var c=a.className.trim().split(" ");return b.trim().split(" ").forEach(function(a){~c.indexOf(a)||c.push(a)}),a.className=c.join(" ").trim(),a},removeClass:function(a,b){var c=b.trim().split(" ");return a.className=a.className.trim().split(" ").filter(function(a){return a&&!~c.indexOf(a)}).join(" "),a},toggleClass:function(a,b){return S[S.hasClass(a,b)?"removeClass":"addClass"].call(null,a,b)},queryChildren:function(a,b){var d=a.id,e=a.id=d||"x_"+S.uid(),f="#"+e+" > ";b=f+(b+"").replace(",",","+f,"g");var g=a.parentNode.querySelectorAll(b);return d||a.removeAttribute("id"),c(g)},createFragment:function(a){var b=z.createDocumentFragment();if(a){for(var d=b.appendChild(z.createElement("div")),e=c(a.nodeName?arguments:!(d.innerHTML=a)||d.children),f=e.length,g=0;f>g;)b.insertBefore(e[g++],d);b.removeChild(d)}return b},manipulate:function(a,b){var c=a.nextSibling,d=a.parentNode,e=z.createDocumentFragment(),f=b.call(e.appendChild(a),e)||a;c?d.insertBefore(f,c):d.appendChild(f)},applyPseudos:function(a,b,d,e){var f=b,g={};if(a.match(":"))for(var h=a.match(C),i=h.length;--i;)h[i].replace(D,function(b,j,k){if(!S.pseudos[j])throw"pseudo not found: "+j+" "+h;var l=g[i]=Object.create(S.pseudos[j]);l.key=a,l.name=j,l.value=k,l.arguments=(k||"").split(","),l.action=l.action||B,l.source=e;var m=f;f=function(){var b=c(arguments),d={key:a,name:j,value:k,source:e,arguments:l.arguments,listener:m},f=l.action.apply(this,[d].concat(b));return null===f||f===!1?f:d.listener.apply(this,b)},d&&l.onAdd&&(d.nodeName?l.onAdd.call(d,l):d.push(l))});for(var j in g)g[j].onCompiled&&(f=g[j].onCompiled(f,g[j])||f);return f},removePseudos:function(a,b){b.forEach(function(b){b.onRemove&&b.onRemove.call(a,b)})},parseEvent:function(a,b){var d=a.split(":"),e=d.shift(),f=S.customEvents[e],g=S.merge({type:e,stack:A,condition:B,attach:[],_attach:[],pseudos:"",_pseudos:[],onAdd:A,onRemove:A},f||{});g.attach=c(g.base||g.attach),g.chain=e+(g.pseudos.length?":"+g.pseudos:"")+(d.length?":"+d.join(":"):"");var h=g.condition;g.condition=function(a){return a.touches,a.targetTouches,h.apply(this,c(arguments))};var i=S.applyPseudos(g.chain,b,g._pseudos,g);if(g.stack=function(a){a.touches,a.targetTouches;var b=a.detail||{};return b.__stack__?b.__stack__==i?(a.stopPropagation(),a.cancelBubble=!0,i.apply(this,c(arguments))):void 0:i.apply(this,c(arguments))},g.listener=function(a){var b=c(arguments),d=g.condition.apply(this,b.concat([g]));return d?a.type==e?g.stack.apply(this,b):(S.fireEvent(a.target,e,{baseEvent:a,detail:d!==!0&&(d.__stack__=i)?d:{__stack__:i}}),void 0):d},g.attach.forEach(function(a){g._attach.push(S.parseEvent(a,g.listener))}),f&&f.observe&&!f.__observing__){f.observer=function(a){var b=g.condition.apply(this,c(arguments).concat([f]));return b?(S.fireEvent(a.target,e,{baseEvent:a,detail:b!==!0?b:{}}),void 0):b};for(var j in f.observe)S.addEvent(f.observe[j]||document,j,f.observer,!0);f.__observing__=!0}return g},addEvent:function(a,b,c,d){var e="function"==typeof c?S.parseEvent(b,c):c;return e._pseudos.forEach(function(b){b.onAdd.call(a,b)}),e._attach.forEach(function(b){S.addEvent(a,b.type,b)}),e.onAdd.call(a,e,e.listener),a.addEventListener(e.type,e.stack,d||S.captureEvents.indexOf(e.type)>-1),e},addEvents:function(a,b){var c={};for(var d in b)c[d]=S.addEvent(a,d,b[d]);return c},removeEvent:function(a,b,c){c=c||b,c.onRemove.call(a,c,c.listener),S.removePseudos(a,c._pseudos),c._attach.forEach(function(b){S.removeEvent(a,b)}),a.removeEventListener(c.type,c.stack)},removeEvents:function(a,b){for(var c in b)S.removeEvent(a,b[c])},fireEvent:function(a,b,c,d){var e=z.createEvent("CustomEvent");c=c||{},d&&console.warn("fireEvent has been modified"),e.initCustomEvent(b,c.bubbles!==!1,c.cancelable!==!1,c.detail),c.baseEvent&&n(e,c.baseEvent);try{a.dispatchEvent(e)}catch(f){console.warn("This error may have been caused by a change in the fireEvent method",f)}},addObserver:function(a,b,c){a._records||(a._records={inserted:[],removed:[]},I?(a._observer=new I(function(b){e(a,b)}),a._observer.observe(a,{subtree:!0,childList:!0,attributes:!1,characterData:!1})):["Inserted","Removed"].forEach(function(b){a.addEventListener("DOMNode"+b,function(c){c._mutation=!0,a._records[b.toLowerCase()].forEach(function(a){a(c.target,c)})},!1)})),-1==a._records[b].indexOf(c)&&a._records[b].push(c)},removeObserver:function(a,b,c){var d=a._records;d&&c?d[b].splice(d[b].indexOf(c),1):d[b]=[]}},T=!1,U=null;z.addEventListener("mousedown",function(a){T=!0,U=a.target},!0),z.addEventListener("mouseup",function(){T=!1,U=null},!0),z.addEventListener("dragend",function(){T=!1,U=null},!0);var V={touches:{configurable:!0,get:function(){return this.__touches__||(this.identifier=0)||(this.__touches__=T?[this]:[])}},targetTouches:{configurable:!0,get:function(){return this.__targetTouches__||(this.__targetTouches__=T&&this.currentTarget&&(this.currentTarget==U||this.currentTarget.contains&&this.currentTarget.contains(U))?(this.identifier=0)||[this]:[])}},changedTouches:{configurable:!0,get:function(){return this.__changedTouches__||(this.identifier=0)||(this.__changedTouches__=[this])}}};for(Q in V)UIEvent.prototype[Q]=V[Q],Object.defineProperty(UIEvent.prototype,Q,V[Q]);S.customEvents.tap={observe:{mousedown:document,touchstart:document},gesture:{tolerance:8},condition:function(a,b){var c=a.target;switch(a.type){case"touchstart":return c.__tap__&&c.__tap__.click&&w(c,b),v(c,b,a),void 0;case"mousedown":return c.__tap__||v(c,b,a),void 0;case"scroll":case"touchcancel":return w(this,b),void 0;case"touchmove":case"touchend":return this.__tap__&&!x(this,b,a)?(w(this,b),void 0):"touchend"==a.type||null;case"click":return w(this,b),!0}}},y.xtag=S,"function"==typeof define&&define.amd&&define(S),z.addEventListener("WebComponentsReady",function(){S.fireEvent(z.body,"DOMComponentsLoaded")})}(),function(){xtag.register("x-appbar",{lifecycle:{created:function(){var a=xtag.queryChildren(this,"header")[0];a||(a=document.createElement("header"),this.appendChild(a)),this.xtag.data.header=a,this.subheading=this.subheading}},accessors:{heading:{attribute:{},get:function(){return this.xtag.data.header.innerHTML},set:function(a){this.xtag.data.header.innerHTML=a}},subheading:{attribute:{},get:function(){return this.getAttribute("subheading")||""},set:function(a){this.xtag.data.header.setAttribute("subheading",a)}}}})}(),function(){function a(a){var b=new Date(a.valueOf());return b.setHours(0),b.setMinutes(0),b.setSeconds(0),b.setMilliseconds(0),b}function b(a,b){a.appendChild(b)}function c(a){return parseInt(a,10)}function d(a){var b=c(a);return b===a&&!isNaN(b)&&b>=0&&6>=b}function e(a){return a instanceof Date&&!!a.getTime&&!isNaN(a.getTime())}function f(a){return a&&a.isArray?a.isArray():"[object Array]"===Object.prototype.toString.call(a)}function g(a){var b=a.split("."),c=b.shift(),d=document.createElement(c);return d[W]=b.join(" "),d}function h(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function i(a){var b=a.getBoundingClientRect(),c=h(),d=c.left,e=c.top; +return{left:b.left+d,right:b.right+d,top:b.top+e,bottom:b.bottom+e,width:b.width,height:b.height}}function j(a,b){xtag.addClass(a,b)}function k(a,b){xtag.removeClass(a,b)}function l(a,b){return xtag.hasClass(a,b)}function m(a){return a.getFullYear()}function n(a){return a.getMonth()}function o(a){return a.getDate()}function p(a){return a.getDay()}function q(a,b){var c=a.toString(),d=new Array(b).join("0");return(d+c).substr(-b)}function r(a){return[q(m(a),4),q(n(a)+1,2),q(o(a),2)].join("-")}function s(b){if(e(b))return b;var c=X.exec(b);return c?a(new Date(c[1],c[2]-1,c[3])):null}function t(b){if(e(b))return b;var c=s(b);if(c)return c;var d=Date.parse(b);return isNaN(d)?null:a(new Date(d))}function u(a){var b;if(f(a))b=a.slice(0);else{if(e(a))return[a];if(!("string"==typeof a&&a.length>0))return null;try{if(b=JSON.parse(a),!f(b))return console.warn("invalid list of ranges",a),null}catch(c){var d=t(a);return d?[d]:(console.warn("unable to parse",a,"as JSON or single date"),null)}}for(var g=0;gk.valueOf())return console.warn("invalid range",h,": start date is after end date"),null;b[g]=[j,k]}}return b}function v(b,c,d,e){return void 0===c&&(c=m(b)),void 0===d&&(d=n(b)),void 0===e&&(e=o(b)),a(new Date(c,d,e))}function w(a,b){return b||(b=(new Date).getFullYear()),new Date(b,a+1,0).getDate()}function x(a,b,c,d){return v(a,m(a)+b,n(a)+c,o(a)+d)}function y(a){var b=a.getDate(),c=w(a.getMonth()+1,a.getFullYear());return b>c&&(b=c),console.log(new Date(a.getFullYear(),a.getMonth()+1,b).toString()),new Date(a.getFullYear(),a.getMonth()+1,b)}function z(a){var b=a.getDate(),c=w(a.getMonth()-1,a.getFullYear());return b>c&&(b=c),new Date(a.getFullYear(),a.getMonth()-1,b)}function A(a,b){b=c(b),d(b)||(b=0);for(var e=0;7>e;e++){if(p(a)===b)return a;a=F(a)}throw"unable to find week start"}function B(a,b){b=c(b),d(b)||(b=6);for(var e=0;7>e;e++){if(p(a)===b)return a;a=E(a)}throw"unable to find week end"}function C(b){return b=new Date(b.valueOf()),b.setDate(1),a(b)}function D(a){return F(x(a,0,1,0))}function E(a){return x(a,0,0,1)}function F(a){return x(a,0,0,-1)}function G(a,b){if(b){b=void 0===b.length?[b]:b;var c=!1;return b.forEach(function(b){2===b.length?H(b[0],b[1],a)&&(c=!0):r(b)===r(a)&&(c=!0)}),c}}function H(a,b,c){return r(a)<=r(c)&&r(c)<=r(b)}function I(a){a.sort(function(a,b){var c=e(a)?a:a[0],d=e(b)?b:b[0];return c.valueOf()-d.valueOf()})}function J(a){var c=g("div.controls"),d=g("span.prev"),e=g("span.next");return d.innerHTML=a.prev,e.innerHTML=a.next,b(c,d),b(c,e),c}function K(a){var b=this;a=a||{},b._span=a.span||1,b._multiple=a.multiple||!1,b._viewDate=b._sanitizeViewDate(a.view,a.chosen),b._chosenRanges=b._sanitizeChosenRanges(a.chosen,a.view),b._firstWeekdayNum=a.firstWeekdayNum||0,b._el=g("div.calendar"),b._labels=R(),b._customRenderFn=null,b._renderRecursionFlag=!1,b.render(!0)}function L(a){a=a.slice(0),I(a);for(var b=[],c=0;c0?b[b.length-1]:null;if(e(i)?d=f=i:(d=i[0],f=i[1]),i=G(d,f)?d:[d,f],e(j))g=h=j;else{if(!j){b.push(i);continue}g=j[0],h=j[1]}if(G(d,[j])||G(F(d),[j])){var k=g.valueOf()f.valueOf()?h:f,m=G(k,l)?k:[k,l];b[b.length-1]=m}else b.push(i)}return b}function M(a,b){var c,d=b.getAttribute("data-date"),e=t(d);l(b,V)?(a.xtag.dragType=U,c="datetoggleoff"):(a.xtag.dragType=T,c="datetoggleon"),a.xtag.dragStartEl=b,a.xtag.dragAllowTap=!0,a.noToggle||xtag.fireEvent(a,c,{detail:{date:e,iso:d}}),a.setAttribute("active",!0),b.setAttribute("active",!0)}function N(a,b){var c=b.getAttribute("data-date"),d=t(c);b!==a.xtag.dragStartEl&&(a.xtag.dragAllowTap=!1),a.noToggle||(a.xtag.dragType!==T||l(b,V)?a.xtag.dragType===U&&l(b,V)&&xtag.fireEvent(a,"datetoggleoff",{detail:{date:d,iso:c}}):xtag.fireEvent(a,"datetoggleon",{detail:{date:d,iso:c}})),a.xtag.dragType&&b.setAttribute("active",!0)}function O(){for(var a=xtag.query(document,"x-calendar"),b=0;bq;q++){var s=(c+q)%7,t=g("span.weekday-label");t.textContent=f.weekdays[s],b(p,t)}b(k,p);var u=g("div.week"),v=i,w=42;for(q=0;w>q;q++){var x=g("span.day");if(x.setAttribute("data-date",r(v)),x.textContent=o(v),n(v)!==h&&j(x,"badmonth"),G(v,d)&&j(x,V),G(v,S)&&j(x,"today"),b(u,x),v=E(v),0===(q+1)%7){b(k,u),u=g("div.week");var y=n(v)>h||n(v)m(i);if(y)break}}return k},Y._sanitizeViewDate=function(a,b){b=void 0===b?this.chosen:b;var c;if(e(a))c=a;else if(e(b))c=b;else if(f(b)&&b.length>0){var d=b[0];c=e(d)?d:d[0]}else c=S;return c},Y._sanitizeChosenRanges=function(a,b){b=void 0===b?this.view:b;var c;c=e(a)?[a]:f(a)?a:null!==a&&void 0!==a&&b?[b]:[];var d=L(c);if(!this.multiple&&d.length>0){var g=d[0];return e(g)?[g]:[g[0]]}return d},Y.addDate=function(a,b){e(a)&&(b?(this.chosen.push(a),this.chosen=this.chosen):this.chosen=[a])},Y.removeDate=function(a){if(e(a))for(var b=this.chosen.slice(0),c=0;cc;c++)b(this.el,this.makeMonth(i)),i=x(i,0,1,0)}this._callCustomRenderer()},Y._callCustomRenderer=function(){if(this._customRenderFn){if(this._renderRecursionFlag)throw"Error: customRenderFn causes recursive loop of rendering calendar; make sure your custom rendering function doesn't modify attributes of the x-calendar that would require a re-render!";for(var a=xtag.query(this.el,".day"),b=0;b=0?b:0,this.render(!1)}},view:{attribute:{},get:function(){return this._viewDate},set:function(a){var b=this._sanitizeViewDate(a),c=this._viewDate;this._viewDate=b,this.render(n(c)===n(b)&&m(c)===m(b))}},chosen:{get:function(){return this._chosenRanges},set:function(a){this._chosenRanges=this._sanitizeChosenRanges(a),this.render(!0)}},firstWeekdayNum:{get:function(){return this._firstWeekdayNum},set:function(a){a=c(a),d(a)||(a=0),this._firstWeekdayNum=a,this.render(!1)}},lastWeekdayNum:{get:function(){return(this._firstWeekdayNum+6)%7}},customRenderFn:{get:function(){return this._customRenderFn},set:function(a){this._customRenderFn=a,this.render(!0)}},chosenString:{get:function(){if(this.multiple){for(var a=this.chosen.slice(0),b=0;b0?r(this.chosen[0]):""}},firstVisibleMonth:{get:function(){return C(this.view)}},lastVisibleMonth:{get:function(){return x(this.firstVisibleMonth,0,Math.max(0,this.span-1),0)}},firstVisibleDate:{get:function(){return A(this.firstVisibleMonth,this.firstWeekdayNum)}},lastVisibleDate:{get:function(){return B(D(this.lastVisibleMonth),this.lastWeekdayNum)}},labels:{get:function(){return this._labels},set:function(a){var b=this.labels;for(var c in b)if(c in a){var d=this._labels[c],e=a[c];if(f(d)){if(!f(e)||d.length!==e.length)throw"invalid label given for '"+c+"': expected array of "+d.length+" labels, got "+JSON.stringify(e);e=e.slice(0);for(var g=0;g0){var b=a.currentTarget;if(b.xtag.dragType)for(var c=a.touches[0],d=xtag.query(b,".day"),e=0;e0){var b=a[0];return e(b)?b:b[0]}return null},set:function(a){var b=this.multiple?u(a):t(a);this.xtag.calObj.chosen=b?b:null,this.xtag.calObj.chosenString?this.setAttribute("chosen",this.xtag.calObj.chosenString):this.removeAttribute("chosen")}},firstWeekdayNum:{attribute:{name:"first-weekday-num"},set:function(a){this.xtag.calObj.firstWeekdayNum=a}},noToggle:{attribute:{"boolean":!0,name:"notoggle"},set:function(a){a&&(this.chosen=null)}},firstVisibleMonth:{get:function(){return this.xtag.calObj.firstVisibleMonth}},lastVisibleMonth:{get:function(){return this.xtag.calObj.lastVisibleMonth}},firstVisibleDate:{get:function(){return this.xtag.calObj.firstVisibleDate}},lastVisibleDate:{get:function(){return this.xtag.calObj.lastVisibleDate}},customRenderFn:{get:function(){return this.xtag.calObj.customRenderFn},set:function(a){this.xtag.calObj.customRenderFn=a}},labels:{get:function(){return JSON.parse(JSON.stringify(this.xtag.calObj.labels))},set:function(a){this.xtag.calObj.labels=a;var b=this.xtag.calObj.labels,c=this.querySelector(".controls > .prev");c&&(c.textContent=b.prev);var d=this.querySelector(".controls > .next");d&&(d.textContent=b.next)}}},methods:{render:function(a){this.xtag.calObj.render(a)},prevMonth:function(){var a=this.xtag.calObj;a.view=z(a.view)},nextMonth:function(){var a=this.xtag.calObj;a.view=y(a.view)},toggleDateOn:function(a,b){this.xtag.calObj.addDate(a,b),this.chosen=this.chosen},toggleDateOff:function(a){this.xtag.calObj.removeDate(a),this.chosen=this.chosen},toggleDate:function(a,b){this.xtag.calObj.hasChosenDate(a)?this.toggleDateOff(a):this.toggleDateOn(a,b)},hasVisibleDate:function(a,b){return this.xtag.calObj.hasVisibleDate(a,b)}}})}(),function(){function a(a){return JSON.parse(JSON.stringify(a))}function b(a){var b;return 0===a.getUTCHours()?b=new Date(a.valueOf()):(b=new Date,b.setUTCHours(0),b.setUTCFullYear(a.getFullYear()),b.setUTCMonth(a.getMonth()),b.setUTCDate(a.getDate())),b.setUTCMinutes(0),b.setUTCSeconds(0),b.setUTCMilliseconds(0),b}function c(a){return a instanceof Date&&!!a.getTime&&!isNaN(a.getTime())}function d(a){return a.getUTCFullYear()}function e(a){return a.getUTCMonth()}function f(a){return a.getUTCDate()}function g(a,b){var c=a.toString(),d=new Array(b).join("0");return(d+c).substr(-b)}function h(a){return[g(d(a),4),g(e(a)+1,2),g(f(a),2)].join("-")}function i(a){if(c(a))return a;var d=q.exec(a);return d?b(new Date(d[1],d[2]-1,d[3])):null}function j(a){if(c(a))return a;var d=i(a);if(d)return d;var e=Date.parse(a);return isNaN(e)?null:b(new Date(e))}function k(a){var b=a.polyfill?a.xtag.polyfillInput:a.xtag.dateInput,c=j(b.value);return c?a.removeAttribute("invalid"):a.setAttribute("invalid",!0),!!c}function l(a,b){var c=a.polyfill?a.xtag.polyfillInput:a.xtag.dateInput,d=c.value,e=j(d);a.value=b&&e?e:d}function m(a,b,c){var d=a.submitValue,e=a.value;b();var f=a.submitValue,g=a.value;(d!==f||c&&e!==g)&&xtag.fireEvent(a,"change")}function n(a){var b=a.xtag._labels;return new Array(5).join(b.yearAbbr)+"-"+new Array(3).join(b.monthAbbr)+"-"+new Array(3).join(b.dayAbbr)}var o=13,p=document.createElement("x-calendar").labels,q=/(\d{4})[^\d]?(\d{2})[^\d]?(\d{2})/;xtag.register("x-datepicker",{lifecycle:{created:function(){this.innerHTML="";var b=document.createElement("input");b.setAttribute("type","date"),xtag.addClass(b,"x-datepicker-input"),this.appendChild(b),this.xtag.dateInput=b,this.xtag._labels={yearAbbr:"Y",monthAbbr:"M",dayAbbr:"D"},this.xtag._polyfillCalLabels=a(p),this.xtag.polyfillInput=null,this.xtag.polyfillUI=null,this.polyfill=this.hasAttribute("polyfill")||"date"!==b.type.toLowerCase()}},events:{"datetoggleon:delegate(x-calendar)":function(a){var b=a.currentTarget;if(a.detail&&a.detail.date){var c=j(a.detail.date);m(b,function(){b.value=c?h(c):"",xtag.fireEvent(b,"input")})}},"datetoggleoff:delegate(x-calendar)":function(a){a.currentTarget.value=null},focus:function(a){a.currentTarget.setAttribute("focused",!0)},"blur:delegate(.x-datepicker-input)":function(a){a.currentTarget.removeAttribute("focused")},"blur:delegate(.x-datepicker-polyfill-input)":function(a){var b=a.currentTarget;b.removeAttribute("focused"),m(b,function(){l(b,!0)},!0)},"touchstart:delegate(.x-datepicker-polyfill-input)":function(){this.setAttribute("readonly",!0)},"tapstart:delegate(x-calendar)":function(a){a.preventDefault(),a.baseEvent&&a.baseEvent.preventDefault()},"keypress:delegate(.x-datepicker-polyfill-input)":function(a){var b=a.keyCode,c=a.currentTarget;b===o&&m(c,function(){l(c,!0)},!0)},"input:delegate(.x-datepicker-input)":function(a){var b=a.currentTarget;m(b,function(){l(b,!0),a.stopPropagation(),xtag.fireEvent(b,"input")})},"input:delegate(.x-datepicker-polyfill-input)":function(a){var b=a.currentTarget;m(b,function(){l(b,!1),a.stopPropagation(),xtag.fireEvent(b,"input")})},"change:delegate(.x-datepicker-input)":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"change")},"change:delegate(.x-datepicker-polyfill-input)":function(a){a.stopPropagation();var b=a.currentTarget;m(b,function(){l(b,!1)})}},accessors:{name:{attribute:{selector:".x-datepicker-input"},set:function(a){var b=this.xtag.dateInput;null===a||void 0===a?b.removeAttribute("name"):b.setAttribute("name",a)}},submitValue:{get:function(){return this.xtag.dateInput.value}},value:{attribute:{skip:!0},get:function(){return this.polyfill?this.xtag.polyfillInput.value:this.xtag.dateInput.value},set:function(a){var b=j(a),c=b?h(b):null,d=this.xtag.dateInput,e=this.xtag.polyfillInput,f=this.xtag.polyfillUI;if(null===a||void 0===a)this.removeAttribute("value"),d.value="",e&&(e.value=""),f&&(f.chosen=null);else{var g,i=c?c:a;e?a!==e.value?(e.value=i,g=i):g=a:g=i,this.setAttribute("value",g),c?(d.value=c,f&&(f.chosen=b,f.view=b)):(d.value="",f&&(f.chosen=null))}k(this)}},polyfill:{attribute:{"boolean":!0},set:function(a){var b=this.xtag.dateInput;if(a){if(b.setAttribute("type","hidden"),b.setAttribute("readonly",!0),!this.xtag.polyfillInput){var c=document.createElement("input");xtag.addClass(c,"x-datepicker-polyfill-input"),c.setAttribute("type","text"),c.setAttribute("placeholder",n(this)),c.value=this.xtag.dateInput.value,this.xtag.polyfillInput=c,this.appendChild(c)}if(this.xtag.polyfillInput.removeAttribute("disabled"),!this.xtag.polyfillUI){var d=document.createElement("x-calendar");xtag.addClass(d,"x-datepicker-polyfill-ui"),d.chosen=this.value,d.view=this.xtag.dateInput.value,d.controls=!0,d.labels=this.xtag._polyfillCalLabels,this.xtag.polyfillUI=d,this.appendChild(d)}}else{"date"!==b.getAttribute("type")&&b.setAttribute("type","date"),b.removeAttribute("readonly");var e=this.xtag.polyfillInput;e&&e.setAttribute("disabled",!0)}}},labels:{get:function(){var b={},c=this.xtag._labels,d=this.xtag._polyfillCalLabels;for(var e in c)b[e]=c[e];for(e in d)b[e]=d[e];return a(b)},set:function(a){var b=this.xtag.polyfillUI,c=this.xtag.polyfillInput,d=null;if(b)b.labels=a,this.xtag._polyfillCalLabels=b.labels;else{var e=this.xtag._polyfillCalLabels;for(d in e)d in a&&(e[d]=a[d])}var f=this.xtag._labels;for(d in f)d in a&&(f[d]=a[d]);c&&c.setAttribute("placeholder",n(this))}}}})}(),function(){function a(a,b){this._historyStack=[],this.currIndex=-1,this._itemCap=void 0,this.itemCap=b,this._validatorFn=a?a:function(){return!0}}function b(a){var b=window.getComputedStyle(a),c=xtag.prefix.js+"TransitionDuration";return b.transitionDuration?b.transitionDuration:b[c]}function c(a){if("string"!=typeof a)return 0;var b=/^(\d*\.?\d+)(m?s)$/,c=a.toLowerCase().match(b);if(c){var d=c[1],e=c[2],f=parseFloat(d);if(isNaN(f))throw"value error";if("s"===e)return 1e3*f;if("ms"===e)return f;throw"unit error"}return 0}function d(a,b){return(a%b+b)%b}function e(a){return xtag.queryChildren(a,"x-card")}function f(a,b){var c=e(a);return isNaN(parseInt(b,10))||0>b||b>=c.length?null:c[b]}function g(a,b){var c=e(a);return c.indexOf(b)}function h(a,d,f,h,i){a.xtag._selectedCard=f;var j=new Date;a.xtag._lastAnimTimestamp=j;var m=function(){j===a.xtag._lastAnimTimestamp&&(k(a),xtag.fireEvent(a,"shuffleend",{detail:{oldCard:d,newCard:f}}))};if(f===d)return m(),void 0;var n=!1,o=!1,p=!1,q=function(){n&&o&&(e(a).forEach(function(a){a.removeAttribute("selected"),a.removeAttribute("leaving")}),d.setAttribute("leaving",!0),f.setAttribute("selected",!0),a.xtag._selectedCard=f,a.selectedIndex=g(a,f),i&&(d.setAttribute("reverse",!0),f.setAttribute("reverse",!0)),xtag.fireEvent(a,"shufflestart",{detail:{oldCard:d,newCard:f}}))},r=function(){p||n&&o&&s()},s=function(){p=!0;var a=!1,e=!1,g=!1,i=function(b){g||(b.target===d?(a=!0,d.removeEventListener("transitionend",i)):b.target===f&&(e=!0,f.removeEventListener("transitionend",i)),a&&e&&(g=!0,m()))};d.addEventListener("transitionend",i),f.addEventListener("transitionend",i);var j=c(b(d)),k=c(b(f)),n=Math.max(j,k),o=1.15,q="none"===h.toLowerCase()?0:Math.ceil(n*o);0===q?(g=!0,d.removeEventListener("transitionend",i),f.removeEventListener("transitionend",i),d.removeAttribute(l),f.removeAttribute(l),m()):(d.removeAttribute(l),f.removeAttribute(l),window.setTimeout(function(){g||(g=!0,d.removeEventListener("transitionend",i),f.removeEventListener("transitionend",i),m())},q))};xtag.skipTransition(d,function(){return d.setAttribute("card-anim-type",h),d.setAttribute(l,!0),n=!0,q(),r},this),xtag.skipTransition(f,function(){return f.setAttribute("card-anim-type",h),f.setAttribute(l,!0),o=!0,q(),r},this)}function i(a,b,c,d,f){var g=a.xtag._selectedCard;if(g===b){var i={detail:{oldCard:g,newCard:b}};return xtag.fireEvent(a,"shufflestart",i),xtag.fireEvent(a,"shuffleend",i),void 0}k(a),void 0===c&&(console.log("defaulting to none transition"),c="none");var j;switch(d){case"forward":j=!1;break;case"reverse":j=!0;break;default:g||(j=!1);var l=e(a);j=l.indexOf(b)0?a.xtag.history&&a.xtag.history.numStates>0?a.xtag.history.currState:b[0]:null),b.forEach(function(a){a.removeAttribute("leaving"),a.removeAttribute(l),a.removeAttribute("card-anim-type"),a.removeAttribute("reverse"),a!==c?a.removeAttribute("selected"):a.setAttribute("selected",!0)}),a.xtag._selectedCard=c,a.selectedIndex=g(a,c)}}var l="_before-animation",m=a.prototype;m.pushState=function(a){if(this.canRedo&&this._historyStack.splice(this.currIndex+1,this._historyStack.length-(this.currIndex+1)),this._historyStack.push(a),this.currIndex=this._historyStack.length-1,this.sanitizeStack(),"none"!==this._itemCap&&this._historyStack.length>this._itemCap){var b=this._historyStack.length;this._historyStack.splice(0,b-this._itemCap),this.currIndex=this._historyStack.length-1}},m.sanitizeStack=function(){for(var a,b=this._validatorFn,c=0;c=a)throw"attempted to set invalid item cap: "+a;this._itemCap=b}}},canUndo:{get:function(){return this.currIndex>0}},canRedo:{get:function(){return this.currIndex=0&&a-1&&this.shuffleTo(d(f+1,b.length),a)},shufflePrev:function(a){a=a?a:"auto";var b=e(this),c=this.xtag._selectedCard,f=b.indexOf(c);f>-1&&this.shuffleTo(d(f-1,b.length),a)},getAllCards:function(){return e(this)},getSelectedCard:function(){return this.xtag._selectedCard},getCardIndex:function(a){return g(this,a)},getCardAt:function(a){return f(this,a)},historyBack:function(a){var b=this.xtag.history;if(b.canUndo){b.backwards();var c=b.currState;c&&i(this,c,this.transitionType,a,!0)}},historyForward:function(a){var b=this.xtag.history;if(b.canRedo){b.forwards();var c=b.currState;c&&i(this,c,this.transitionType,a,!0)}}}}),xtag.register("x-card",{lifecycle:{inserted:function(){var a=this,b=a.parentNode;b&&"x-deck"===b.tagName.toLowerCase()&&(k(b),a.xtag.parentDeck=b,xtag.fireEvent(b,"cardadd",{detail:{card:a}}))},created:function(){var a=this.parentNode;a&&"x-deck"===a.tagName.toLowerCase()&&(this.xtag.parentDeck=a)},removed:function(){var a=this;if(a.xtag.parentDeck){var b=a.xtag.parentDeck;b.xtag.history.sanitizeStack(),k(b),xtag.fireEvent(b,"cardremove",{detail:{card:a}})}}},accessors:{transitionOverride:{attribute:{name:"transition-override"}}},methods:{show:function(){var a=this.parentNode;a===this.xtag.parentDeck&&a.shuffleTo(a.getCardIndex(this))}}})}(),function(){xtag.register("x-flipbox",{lifecycle:{created:function(){this.firstElementChild&&xtag.skipTransition(this.firstElementChild,function(){}),this.lastElementChild&&xtag.skipTransition(this.lastElementChild,function(){}),this.hasAttribute("direction")||(this.xtag._direction="right")}},events:{"transitionend:delegate(*:first-child)":function(a){var b=a.target,c=b.parentNode;"x-flipbox"===c.nodeName.toLowerCase()&&xtag.fireEvent(c,"flipend")},"show:delegate(*:first-child)":function(a){var b=a.target,c=b.parentNode;"x-flipbox"===c.nodeName.toLowerCase()&&(c.flipped=!1)},"show:delegate(*:last-child)":function(a){var b=a.target,c=b.parentNode;"x-flipbox"===c.nodeName.toLowerCase()&&(c.flipped=!0)}},accessors:{direction:{attribute:{},get:function(){return this.xtag._direction},set:function(a){xtag.skipTransition(this.firstElementChild,function(){this.setAttribute("_anim-direction",a)},this),xtag.skipTransition(this.lastElementChild,function(){this.setAttribute("_anim-direction",a)},this),this.xtag._direction=a}},flipped:{attribute:{"boolean":!0}}},methods:{toggle:function(){this.flipped=!this.flipped},showFront:function(){this.flipped=!1},showBack:function(){this.flipped=!0}}})}(),function(){function a(a,b){a.xtag.iconEl.nodeName===g?(b=void 0!==b?b:a.xtag.iconEl.src,b||(a.xtag.iconEl.src=f),a.xtag.iconEl.style.display=b&&b!==f?"":"none"):a.xtag.iconEl.style.display=a.xtag.iconEl.innerHTML?"":"none",a.xtag.contentEl.style.display=a.xtag.contentEl.innerHTML?"":"none"}function b(a){var b=a.xtag.iconEl,c=a.xtag.contentEl;if(c&&b){var d=b.parentNode;if(!d||c.parentNode!==d)throw"invalid parent node of iconbutton's icon / label";switch(a.iconAnchor){case"right":case"bottom":d.insertBefore(c,b);break;default:d.insertBefore(b,c)}}}function c(){xtag.query(document,"x-iconbutton[active]").forEach(function(a){a.removeAttribute("active")})}function d(){xtag.query(document,"x-iconbutton:focus").forEach(function(a){a.blur()})}function e(a){c(a),d()}var f="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",g=document.createElement("img").nodeName,h=function(a){return a.xtag.contentEl.textContent},i=function(a,b){a.xtag.contentEl.textContent=b},j=32,k=13,l=null;xtag.register("x-iconbutton",{lifecycle:{created:function(){var c=this.innerHTML;this.innerHTML="
"+""+"
"+"
",this.xtag.iconEl=this.querySelector(".x-iconbutton-icon"),this.xtag.contentEl=this.querySelector(".x-iconbutton-content"),this.xtag.contentEl.innerHTML=c,this.textGetter||(this.textGetter=h),this.textSetter||(this.textSetter=i),b(this),a(this),this.hasAttribute("tabindex")||this.setAttribute("tabindex",0)},inserted:function(){l||(l={tapend:xtag.addEvent(document,"tapend",e),dragend:xtag.addEvent(document,"dragend",e),keyup:xtag.addEvent(document,"keyup",c)}),b(this),a(this)},removed:function(){if(l&&!document.query("x-calendar")){for(var a in l)xtag.removeEvent(document,a,l[a]);l=null}},attributeChanged:function(){var c=this.iconEl,d=this.contentEl;c.parentNode&&c.parentNode.parentNode===this&&d.parentNode&&d.parentNode.parentNode===this||console.warn("inner DOM of the iconbutton appears to be out of sync; make sure that editing innerHTML or textContent is done through .contentEl, not directly on the iconbutton itself"),b(this),a(this)}},events:{tapstart:function(a){a.currentTarget.setAttribute("active",!0)},keypress:function(a){var b=a.key||a.keyCode;(b===j||b===k)&&a.currentTarget.click()},keydown:function(a){var b=a.key||a.keyCode;(b===j||b===k)&&a.currentTarget.setAttribute("active",!0)}},accessors:{src:{attribute:{},get:function(){return this.xtag.iconEl.getAttribute("src")},set:function(b){this.xtag.iconEl.setAttribute("src",b),this.xtag.iconEl.src=b,a(this,b)}},active:{attribute:{}},iconAnchor:{attribute:{name:"icon-anchor"},set:function(){b(this)}},iconEl:{get:function(){return this.xtag.iconEl}},contentEl:{get:function(){return this.xtag.contentEl}}}})}(),function(){function a(a){var b=a.firstElementChild;if(!b)return{header:null,section:null,footer:null};var c=b.nextElementSibling;return{header:"HEADER"==b.nodeName?b:null,section:"SECTION"==b.nodeName?b:c&&"SECTION"==c.nodeName?c:null,footer:"FOOTER"==a.lastElementChild.nodeName?a.lastElementChild:null}}function b(a,b){var c=b.__layoutScroll__=b.__layoutScroll__||Object.defineProperty(b,"__layoutScroll__",{value:{last:b.scrollTop}}).__layoutScroll__,d=b.scrollTop,e=a.scrollBuffer;return c.max=c.max||Math.max(d+e,e),c.min=c.min||Math.max(d-e,e),c}function c(a,b){a.setAttribute("content-maximizing",null),b.section&&(b.header&&(b.section.style.marginTop="-"+b.header.getBoundingClientRect().height+"px"),b.footer&&(b.section.style.marginBottom="-"+b.footer.getBoundingClientRect().height+"px"))}function d(a,b){a.removeAttribute("content-maximized"),a.removeAttribute("content-maximizing"),b.section&&(b.section.style.marginTop="",b.section.style.marginBottom="")}function e(e){if(!e.currentTarget.hasAttribute("content-maximizing")){var f=e.target,g=e.currentTarget;if(this.scrollhide&&(f.parentNode==g||xtag.matchSelector(f,g.scrollTarget))){var h=f.scrollTop,i=g.scrollBuffer,j=a(g),k=b(g,f);h>k.last?k.min=Math.max(h-i,i):hk.max&&!g.hasAttribute("content-maximized")?c(g,j):h x-slide[selected]")[0]||0;return[b?xtag.query(a,"x-slides > x-slide").indexOf(b):b,a.firstElementChild.children.length-1]}function b(a,b){var c=xtag.toArray(a.firstElementChild.children);c.forEach(function(a){a.removeAttribute("selected")}),c[b||0].setAttribute("selected",!0);var e="translate"+(a.getAttribute("orientation")||"x")+"("+(b||0)*(-100/c.length)+"%)";a.firstElementChild.style[d]=e,a.firstElementChild.style.transform=e}function c(a){var c=this.firstElementChild;if(c&&c.children.length&&"x-slides"==c.tagName.toLowerCase()){var e=xtag.toArray(c.children),f=100/(e.length||1),g=this.getAttribute("orientation")||"x",h="x"==g?["width","height"]:["height","width"];if(c.style[h[1]]="100%",c.style[h[0]]=100*e.length+"%",c.style[d]="translate"+g+"(0%)",c.style.transform="translate"+g+"(0%)",e.forEach(function(a){a.style[h[0]]=f+"%",a.style[h[1]]="100%"}),a){var i=c.querySelector("[selected]");i&&b(this,e.indexOf(i)||0)}}}var d=xtag.prefix.js+"Transform";xtag.register("x-slidebox",{lifecycle:{created:function(){c()}},events:{transitionend:function(a){a.target==this.firstElementChild&&xtag.fireEvent(this,"slideend")},"show:delegate(x-slide)":function(a){var b=a.target;if("x-slides"===b.parentNode.nodeName.toLowerCase()&&"x-slidebox"===b.parentNode.parentNode.nodeName.toLowerCase()){var c=b.parentNode,d=c.parentNode,e=xtag.query(c,"x-slide");d.slideTo(e.indexOf(b))}}},accessors:{orientation:{get:function(){return this.getAttribute("orientation")},set:function(a){var b=this;xtag.skipTransition(b.firstElementChild,function(){b.setAttribute("orientation",a.toLowerCase()),c.call(b,!0)})}}},methods:{slideTo:function(a){b(this,a)},slideNext:function(){var c=a(this);c[0]++,b(this,c[0]>c[1]?0:c[0])},slidePrevious:function(){var c=a(this);c[0]--,b(this,c[0]<0?c[1]:c[0])}}}),xtag.register("x-slide",{lifecycle:{inserted:function(){var a=this.parentNode.parentNode;"x-slidebox"==a.tagName.toLowerCase()&&c.call(a,!0)},created:function(){if(this.parentNode){var a=this.parentNode.parentNode;"x-slidebox"==a.tagName.toLowerCase()&&c.call(a,!0)}}}})}(),function(){function a(a){return!isNaN(parseFloat(a))}function b(b,c){return b.hasAttribute(c)&&a(b.getAttribute(c))}function c(b,c,d,e){if(e=e?e:Math.round,d=a(d)?d:0,!a(b))throw"invalid value "+b;if(!a(c)||0>=+c)throw"invalid step "+c;return e((b-d)/c)*c+d}function d(a,b,d,e){return b>a?b:a>d?Math.max(b,c(d,e,b,Math.floor)):a}function e(a,b,e){var f=c((b-a)/2+a,e,a);return d(f,a,b,e)}function f(a,b){var c=a.min,d=a.max;return(b-c)/(d-c)}function g(a,b){var c=a.min,d=a.max;return(d-c)*b+c}function h(a,b){b=Math.min(Math.max(0,b),1);var e=g(a,b),f=c(e,a.step,a.min);return d(f,a.min,a.max,a.step)}function i(a,b){var c=a.xtag.polyFillSliderThumb;if(c){var d=a.getBoundingClientRect(),e=c.getBoundingClientRect(),g=f(a,b),h=Math.max(d.width-e.width,0),i=h*g,j=i/d.width;c.style.left=100*j+"%"}}function j(a){i(a,a.value)}function k(a,b){var c=a.xtag.rangeInputEl,d=c.getBoundingClientRect(),e=b-d.left;a.value;var f=h(a,e/d.width);a.value=f,xtag.fireEvent(a,"input"),j(a)}function l(a,b,c){a.xtag.dragInitVal=a.value,k(a,b,c);var d=a.xtag.callbackFns,e=function(a,b){document.body.addEventListener(a,b)};e("mousemove",d.onMouseDragMove),e("touchmove",d.onTouchDragMove),e("mouseup",d.onDragEnd),e("touchend",d.onDragEnd);var f=a.xtag.polyFillSliderThumb;f&&f.setAttribute("active",!0)}function m(a,b,c){k(a,b,c)}function n(a){return{onMouseDragStart:function(b){b.button===p&&(l(a,b.pageX,b.pageY),b.preventDefault())},onTouchDragStart:function(b){var c=b.targetTouches;1===c.length&&(l(a,c[0].pageX,c[0].pageY),b.preventDefault())},onMouseDragMove:function(b){m(a,b.pageX,b.pageY),b.preventDefault()},onTouchDragMove:function(b){var c=b.targetTouches;1===c.length&&(m(a,c[0].pageX,c[0].pageY),b.preventDefault())},onDragEnd:function(b){var c=a.xtag.callbackFns,d=function(a,b){document.body.removeEventListener(a,b)};d("mousemove",c.onMouseDragMove),d("touchmove",c.onTouchDragMove),d("mouseup",c.onDragEnd),d("touchend",c.onDragEnd);var e=a.xtag.polyFillSliderThumb;e&&e.removeAttribute("active"),a.value!==a.xtag.dragInitVal&&xtag.fireEvent(a,"change"),a.xtag.dragInitVal=null,b.preventDefault()},onKeyDown:function(a){var b=a.keyCode;if(b in o){var c=this.value,d=this.min,e=this.max,f=this.step,g=Math.max(0,e-d),h=Math.max(g/10,f);switch(o[b]){case"LEFT_ARROW":case"DOWN_ARROW":this.value=Math.max(c-f,d);break;case"RIGHT_ARROW":case"UP_ARROW":this.value=Math.min(c+f,e);break;case"HOME":this.value=d;break;case"END":this.value=e;break;case"PAGE_DOWN":this.value=Math.max(c-h,d);break;case"PAGE_UP":this.value=Math.min(c+h,e)}this.value!==c&&xtag.fireEvent(this,"change"),a.preventDefault()}}}}var o={33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT_ARROW",38:"UP_ARROW",39:"RIGHT_ARROW",40:"DOWN_ARROW"},p=0;xtag.register("x-slider",{lifecycle:{created:function(){var a=this;a.xtag.callbackFns=n(a),a.xtag.dragInitVal=null;var c=document.createElement("input");xtag.addClass(c,"input"),c.setAttribute("type","range");var d=b(a,"max")?+a.getAttribute("max"):100,f=b(a,"min")?+a.getAttribute("min"):0,g=b(a,"step")?+a.getAttribute("step"):1;g=g>0?g:1;var h=b(a,"value")?+a.getAttribute("value"):e(f,d,g);c.setAttribute("max",d),c.setAttribute("min",f),c.setAttribute("step",g),c.setAttribute("value",h),a.xtag.rangeInputEl=c,a.appendChild(a.xtag.rangeInputEl),a.xtag.polyFillSliderThumb=null,"range"!==c.type||a.hasAttribute("polyfill")?a.setAttribute("polyfill",!0):a.removeAttribute("polyfill"),j(a)},attributeChanged:function(){j(this)}},events:{"change:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"change")},"input:delegate(input[type=range])":function(a){a.stopPropagation(),xtag.fireEvent(a.currentTarget,"input")},"focus:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"focus",{},{bubbles:!1})},"blur:delegate(input[type=range])":function(a){var b=a.currentTarget;xtag.fireEvent(b,"blur",{},{bubbles:!1})}},accessors:{polyfill:{attribute:{"boolean":!0},set:function(a){var b=this.xtag.callbackFns;if(a){if(this.setAttribute("tabindex",0),this.xtag.rangeInputEl.setAttribute("tabindex",-1),this.xtag.rangeInputEl.setAttribute("readonly",!0),!this.xtag.polyFillSliderThumb){var c=document.createElement("span");xtag.addClass(c,"slider-thumb"),this.xtag.polyFillSliderThumb=c,this.appendChild(c)}j(this),this.addEventListener("mousedown",b.onMouseDragStart),this.addEventListener("touchstart",b.onTouchDragStart),this.addEventListener("keydown",b.onKeyDown)}else this.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("tabindex"),this.xtag.rangeInputEl.removeAttribute("readonly"),this.removeEventListener("mousedown",b.onMouseDragStart),this.removeEventListener("touchstart",b.onTouchDragStart),this.removeEventListener("keydown",b.onKeyDown)}},max:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("max")}},min:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("min")}},step:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.getAttribute("step")}},name:{attribute:{selector:"input[type=range]"},set:function(a){var b=this.xtag.rangeInputEl;null===a||void 0===a?b.removeAttribute("name"):b.setAttribute("name",a)}},value:{attribute:{selector:"input[type=range]"},get:function(){return+this.xtag.rangeInputEl.value},set:function(b){a(b)||(b=e(this.min,this.max,this.step)),b=+b;var f=this.min,g=this.max,h=this.step,i=c(b,h,f),k=d(i,f,g,h);this.xtag.rangeInputEl.value=k,j(this)}},inputElem:{get:function(){return this.xtag.rangeInputEl}}},methods:{}})}(),function(){function a(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function b(b){var c=b.getBoundingClientRect(),d=a(),e=d.left,f=d.top;return{left:c.left+e,right:c.right+e,top:c.top+f,bottom:c.bottom+f,width:c.width,height:c.height}}function c(a,b,c){return c.left<=a&&a<=c.right&&c.top<=b&&b<=c.bottom}function d(a){if("x-tabbar"===a.parentNode.nodeName.toLowerCase()){var b=a.targetEvent,c=a.targetSelector?xtag.query(document,a.targetSelector):a.targetElems;c.forEach(function(a){xtag.fireEvent(a,b)})}}xtag.register("x-tabbar",{lifecycle:{created:function(){this.xtag.overallEventToFire="show"}},events:{"tap:delegate(x-tabbar-tab)":function(){var a=xtag.query(this.parentNode,"x-tabbar-tab[selected]");a.length&&a.forEach(function(a){a.removeAttribute("selected")}),this.setAttribute("selected",!0)}},accessors:{tabs:{get:function(){return xtag.queryChildren(this,"x-tabbar-tab")}},targetEvent:{attribute:{name:"target-event"},get:function(){return this.xtag.overallEventToFire},set:function(a){this.xtag.overallEventToFire=a}}},methods:{}}),xtag.register("x-tabbar-tab",{lifecycle:{created:function(){this.xtag.targetSelector=null,this.xtag.overrideTargetElems=null,this.xtag.targetEvent=null}},events:{tap:function(a){var e=a.currentTarget;if(a.changedTouches&&a.changedTouches.length>0){var f=a.changedTouches[0],g=b(e);c(f.pageX,f.pageY,g)&&d(e)}else d(e)}},accessors:{targetSelector:{attribute:{name:"target-selector"},get:function(){return this.xtag.targetSelector},set:function(a){this.xtag.targetSelector=a,a&&(this.xtag.overrideTargetElems=null)}},targetElems:{get:function(){return this.targetSelector?xtag.query(document,this.targetSelector):null!==this.xtag.overrideTargetElems?this.xtag.overrideTargetElems:[]},set:function(a){this.removeAttribute("target-selector"),this.xtag.overrideTargetElems=a}},targetEvent:{attribute:{name:"target-event"},get:function(){if(this.xtag.targetEvent)return this.xtag.targetEvent;if("x-tabbar"===this.parentNode.nodeName.toLowerCase())return this.parentNode.targetEvent;throw"tabbar-tab is missing event to fire"},set:function(a){this.xtag.targetEvent=a}}},methods:{}})}(),function(){function a(a){var b=a.xtag.inputEl.form;b?a.removeAttribute("x-toggle-no-form"):a.setAttribute("x-toggle-no-form",""),a.xtag.scope=a.parentNode?b||document:null}function b(a){var b={},c=a==document?"[x-toggle-no-form]":"";xtag.query(a,"x-toggle[name]"+c).forEach(function(d){var e=d.name;if(e&&!b[e]){var f=xtag.query(a,'x-toggle[name="'+e+'"]'+c),g=f.length>1?"radio":"checkbox";f.forEach(function(a){a.xtag&&a.xtag.inputEl&&(a.type=g)}),b[e]=!0}})}var c=!1;xtag.addEvents(document,{DOMComponentsLoaded:function(){b(document),xtag.toArray(document.forms).forEach(b)},WebComponentsReady:function(){b(document),xtag.toArray(document.forms).forEach(b)},keydown:function(a){c=a.shiftKey},keyup:function(a){c=a.shiftKey},"focus:delegate(x-toggle)":function(){this.setAttribute("focus","")},"blur:delegate(x-toggle)":function(){this.removeAttribute("focus")},"tap:delegate(x-toggle)":function(){if(c&&this.group){var a=this.groupToggles,b=this.xtag.scope.querySelector('x-toggle[group="'+this.group+'"][active]');if(b&&this!=b){var d=this,e=b.checked,f=a.indexOf(this),g=a.indexOf(b),h=Math.min(f,g),i=Math.max(f,g);a.slice(h,i).forEach(function(a){a!=d&&(a.checked=e)})}}},"change:delegate(x-toggle)":function(){var a=this.xtag.scope.querySelector('x-toggle[group="'+this.group+'"][active]');this.checked=c&&a&&this!=a?a.checked:this.xtag.inputEl.checked,this.group&&(this.groupToggles.forEach(function(a){a.active=!1}),this.active=!0)}}),xtag.register("x-toggle",{lifecycle:{created:function(){this.innerHTML='
',this.xtag.inputWrapEl=this.querySelector(".x-toggle-input-wrap"),this.xtag.inputEl=this.xtag.inputWrapEl.querySelector("input"),this.xtag.contentWrapEl=this.querySelector(".x-toggle-content-wrap"),this.xtag.checkEl=this.querySelector(".x-toggle-check"),this.xtag.contentEl=this.querySelector(".x-toggle-content"),this.type="checkbox",a(this);var b=this.getAttribute("name");b&&(this.xtag.inputEl.name=this.getAttribute("name")),this.hasAttribute("checked")&&(this.checked=!0)},inserted:function(){a(this),this.parentNode&&"x-togglegroup"===this.parentNode.nodeName.toLowerCase()&&(this.parentNode.hasAttribute("name")&&(this.name=this.parentNode.getAttribute("name")),this.parentNode.hasAttribute("group")&&(this.group=this.parentNode.getAttribute("group")),this.setAttribute("no-box",!0)),this.name&&b(this.xtag.scope)},removed:function(){b(this.xtag.scope),a(this)}},accessors:{noBox:{attribute:{name:"no-box","boolean":!0},set:function(){}},type:{attribute:{},set:function(a){this.xtag.inputEl.type=a}},label:{attribute:{},get:function(){return this.xtag.contentEl.innerHTML},set:function(a){this.xtag.contentEl.innerHTML=a}},active:{attribute:{"boolean":!0}},group:{attribute:{}},groupToggles:{get:function(){return xtag.query(this.xtag.scope,'x-toggle[group="'+this.group+'"]')}},name:{attribute:{skip:!0},get:function(){return this.getAttribute("name")},set:function(a){null===a?(this.removeAttribute("name"),this.type="checkbox"):this.setAttribute("name",a),this.xtag.inputEl.name=a,b(this.xtag.scope)}},checked:{get:function(){return this.xtag.inputEl.checked},set:function(a){var b=this.name,c="true"===a||a===!0;if(b){var d=this.xtag.scope==document?"[x-toggle-no-form]":"",e='x-toggle[checked][name="'+b+'"]'+d,f=this.xtag.scope.querySelector(e);f&&f.removeAttribute("checked")}this.xtag.inputEl.checked=c,c?this.setAttribute("checked",""):this.removeAttribute("checked")}},value:{attribute:{},get:function(){return this.xtag.inputEl.value},set:function(a){this.xtag.inputEl.value=a}}}})}(),function(){xtag.register("x-togglegroup",{lifecycle:{created:function(){this.options.forEach(function(a){this.name&&(a.name=this.name),this.group&&(a.group=this.group),a.noBox=!0}.bind(this))}},events:{},accessors:{name:{attribute:{selector:"x-toggle"},set:function(a){this.options.forEach(function(b){b.name=a})}},group:{attribute:{selector:"x-toggle"},set:function(a){this.options.forEach(function(b){b.group=a})}},options:{get:function(){return xtag.queryChildren(this,"x-toggle")}}},methods:{}})}(),function(){function a(a){return a in G}function b(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function c(a){var c=a.getBoundingClientRect(),d=b(),e=d.left,f=d.top;return{left:c.left+e,right:c.right+e,top:c.top+f,bottom:c.bottom+f,width:c.width,height:c.height}}function d(a,b){return b=void 0!==b?b:c(a),{x:a.offsetWidth?b.width/a.offsetWidth:1,y:a.offsetHeight?b.height/a.offsetHeight:1}}function e(a,b){if(a.rightf||l.bottom>g?i.push(k):h.push(k)}var m=h.length>0?h:i;return m[0].orient}function w(a){a.setAttribute("_force-display",!0)}function x(a){a.removeAttribute("_force-display")}function y(b,c){b.removeAttribute(K);var d=b.xtag.arrowEl,e=null,f=[];for(var g in G)d.setAttribute(J,G[g]),e=z(b,c,g),e&&(w(b),q(b,c)||f.push({orient:g,rect:e}),x(b));var h=v(b,f);return h||(h="top"),b.setAttribute(K,h),d.setAttribute(J,G[h]),a(h)&&h!==g?z(b,c,h):e}function z(e,f,g,h){if(!e.parentNode)return e.left="",e.top="",null;h=void 0===h?0:h;var i=e.xtag.arrowEl;if(!a(g))return y(e,f);var j=e.offsetParent?e.offsetParent:e.parentNode;h||(e.style.top="",e.style.left="",i.style.top="",i.style.left=""),w(e);var k=b(),l=c(j),o=d(j,l),p=j.clientWidth*o.x,q=j.clientHeight*o.y,v=c(f),A=v.width,B=v.height,C=c(e),D=d(e,C),E=C.width,F=C.height,G=C.width,H=C.height,I=(G-E)/2,J=(H-F)/2,K=i.offsetWidth*D.x,L=i.offsetHeight*D.y,M=45,N=r(K,L,M);K=N.width,L=N.height,"top"===g||"bottom"===g?L/=2:K/=2;var O=u(e,l),P=O.left,Q=O.top,R=O.right-E,S=O.bottom-F,T={left:v.left+(A-E)/2,top:v.top+(B-F)/2},U=T.left,V=T.top;if("top"===g)V=v.top-H-L,S-=L;else if("bottom"===g)V=v.top+B+L,S-=L;else if("left"===g)U=v.left-G-K,R-=K;else{if("right"!==g)throw"invalid orientation "+g;U=v.left+A+K,R-=K}var W=s(U,P,R),X=s(V,Q,S);W+=I,X+=J;var Y,Z,$=function(a){if(!window.getComputedStyle||a===document||a===document.documentElement)return!1;var b;try{b=window.getComputedStyle(a)}catch(c){return!1}return b&&"fixed"===b.position},_=m(f,$);if(_&&!n(e,_))Y=W-k.left,Z=X-k.top,e.setAttribute("_target-fixed",!0);else{var ab=t(W,X,window,j,o);Y=ab.left,Z=ab.top,e.removeAttribute("_target-fixed")}e.style.top=Z+"px",e.style.left=Y+"px";var bb,cb,db,eb,fb;"top"===g||"bottom"===g?(eb=(A-K)/2,fb=v.left-W,bb=E-K,cb=E,db="left"):(eb=(B-L)/2,fb=v.top-X,bb=F-L,cb=F,db="top");var gb=s(eb+fb,0,bb),hb=cb?gb/cb:0;i.style[db]=100*hb+"%";var ib=e.offsetWidth*D.x,jb=e.offsetHeight*D.y,kb=j.clientWidth*o.x,lb=j.clientHeight*o.y;x(e);var mb=2;return mb>h&&(E!==ib||F!==jb||p!==kb||q!==lb)?z(e,f,g,h+1):{left:W,top:X,width:ib,height:jb,right:W+ib,bottom:X+jb}}function A(a,b){b===a&&console.warn("The tooltip's target element is the tooltip itself! Is this intentional?");var c=a.xtag.arrowEl;c.parentNode||console.warn("The inner component DOM of the tooltip appears to be missing. Make sure to edit tooltip contents through the .contentEl property instead ofdirectly on the x-tooltip to avoid clobbering the component's internals.");var d=a.orientation,e=function(){x(a),a.setAttribute("visible",!0),xtag.fireEvent(a,"tooltipshown",{triggerElem:b})};b?(a.xtag.lastTargetElem=b,xtag.skipTransition(a,function(){return z(a,b,d),e})):(a.style.top="",a.style.left="",c.style.top="",c.style.left="",e())}function B(b){a(b.orientation)&&b.removeAttribute(K),b.hasAttribute("visible")&&(w(b),b.xtag._hideTransitionFlag=!0,b.removeAttribute("visible"))}function C(a){var b=a.xtag.cachedListeners;b.forEach(function(a){a.removeListener()}),a.xtag.cachedListeners=[],E.unregisterTooltip(a.triggerStyle,a)}function D(a,b,c){if(a.parentNode){(void 0===b||null===b)&&(b=a.targetSelector),(void 0===c||null===c)&&(c=a.triggerStyle);var d=p(a,b);-1===d.indexOf(a.xtag.lastTargetElem)&&(a.xtag.lastTargetElem=d.length>0?d[0]:null,z(a,a.xtag.lastTargetElem,a.orientation)),C(a);var e;if(c in F){var f=F[c];e=f(a,b)}else e=l(a,b,c),E.registerTooltip(c,a);e.forEach(function(a){a.attachListener()}),a.xtag.cachedListeners=e,B(a)}}var E,F,G={top:"down",bottom:"up",left:"right",right:"left"},H="_previousSibling",I="_nextSibling",J="arrow-direction",K="_auto-orientation";f.prototype.attachListener=function(){this._attachedFn||(this._attachedFn=xtag.addEvent(this.elem,this.eventType,this.listenerFn))},f.prototype.removeListener=function(){this._attachedFn&&(xtag.removeEvent(this.elem,this.eventType,this._attachedFn),this._attachedFn=null)},g.prototype.destroy=function(){this._cachedListener.removeListener(),this._cachedListener=null,this._tooltips=null},g.prototype.containsTooltip=function(a){return-1!==this._tooltips.indexOf(a)},g.prototype.addTooltip=function(a){this.containsTooltip(a)||this._tooltips.push(a)},g.prototype.removeTooltip=function(a){this.containsTooltip(a)&&this._tooltips.splice(this._tooltips.indexOf(a),1)},Object.defineProperties(g.prototype,{numTooltips:{get:function(){return this._tooltips.length}}}),h.prototype.registerTooltip=function(a,b){if(a in this.eventStructDict){var c=this.eventStructDict[a];c.containsTooltip(b)||c.addTooltip(b)}else this.eventStructDict[a]=new g(a),this.eventStructDict[a].addTooltip(b)},h.prototype.unregisterTooltip=function(a,b){if(a in this.eventStructDict&&this.eventStructDict[a].containsTooltip(b)){var c=this.eventStructDict[a];c.removeTooltip(b),0===c.numTooltips&&(c.destroy(),delete this.eventStructDict[a])}},E=new h,F={custom:function(){return[]},hover:function(a,b){var c=[],d=null,e=200,g=function(){d&&window.clearTimeout(d),d=null},h=o(function(b){g();var c=this,d=b.relatedTarget||b.toElement;n(d,a)||A(a,c)}),i=o(function(b){g();var c=b.relatedTarget||b.toElement;n(c,a)||(d=window.setTimeout(function(){"hover"===a.triggerStyle&&B(a)},e))}),j=k(a,b,"enter",h),l=k(a,b,"leave",i);c.push(j),c.push(l);var m=o(function(b){g();var c=b.relatedTarget||b.toElement,d=a.xtag.lastTargetElem;a.hasAttribute("visible")||!d||n(c,d)||A(a,d)}),p=o(function(b){g();var c=b.relatedTarget||b.toElement,f=a.xtag.lastTargetElem;f&&!n(c,f)&&(d=window.setTimeout(function(){"hover"===a.triggerStyle&&B(a)},e))});return c.push(new f(a,"enter",m)),c.push(new f(a,"leave",p)),c}},xtag.register("x-tooltip",{lifecycle:{created:function(){var a=this;a.xtag.contentEl=document.createElement("div"),a.xtag.arrowEl=document.createElement("span"),xtag.addClass(a.xtag.contentEl,"tooltip-content"),xtag.addClass(a.xtag.arrowEl,"tooltip-arrow"),a.xtag.contentEl.innerHTML=a.innerHTML,a.innerHTML="",a.appendChild(a.xtag.contentEl),a.appendChild(a.xtag.arrowEl),a.xtag._orientation="auto",a.xtag._targetSelector=H,a.xtag._triggerStyle="click";var b=p(a,a.xtag._targetSelector);a.xtag.lastTargetElem=b.length>0?b[0]:null,a.xtag.cachedListeners=[],a.xtag._hideTransitionFlag=!1,a.xtag._skipOuterClick=!1},inserted:function(){D(this,this.xtag._targetSelector,this.xtag._triggerStyle)},removed:function(){C(this)}},events:{transitionend:function(a){var b=a.currentTarget;b.xtag._hideTransitionFlag&&!b.hasAttribute("visible")&&(b.xtag._hideTransitionFlag=!1,xtag.fireEvent(b,"tooltiphidden")),x(b)}},accessors:{orientation:{attribute:{},get:function(){return this.xtag._orientation},set:function(b){b=b.toLowerCase();var c=this.querySelector(".tooltip-arrow"),d=null;a(b)?(d=G[b],c.setAttribute(J,d),this.removeAttribute(K)):c.removeAttribute(J),this.xtag._orientation=b,this.refreshPosition()}},triggerStyle:{attribute:{name:"trigger-style"},get:function(){return this.xtag._triggerStyle},set:function(a){D(this,this.targetSelector,a),this.xtag._triggerStyle=a}},targetSelector:{attribute:{name:"target-selector"},get:function(){return this.xtag._targetSelector},set:function(a){p(this,a),D(this,a,this.triggerStyle),this.xtag._targetSelector=a}},ignoreOuterTrigger:{attribute:{"boolean":!0,name:"ignore-outer-trigger"}},ignoreTooltipPointerEvents:{attribute:{"boolean":!0,name:"ignore-tooltip-pointer-events"}},allowOverflow:{attribute:{"boolean":!0,name:"allow-overflow"},set:function(){this.refreshPosition()}},contentEl:{get:function(){return this.xtag.contentEl},set:function(a){var b=this.xtag.contentEl;xtag.addClass(a,"tooltip-content"),this.replaceChild(a,b),this.xtag.contentEl=a,this.refreshPosition()}},presetTriggerStyles:{get:function(){var a=[];for(var b in F)a.push(b);return a}},targetElems:{get:function(){return p(this,this.targetSelector)}}},methods:{refreshPosition:function(){this.xtag.lastTargetElem&&z(this,this.xtag.lastTargetElem,this.orientation)},show:function(){A(this,this.xtag.lastTargetElem)},hide:function(){B(this)},toggle:function(){this.hasAttribute("visible")?this.hide():this.show()}}})}(); \ No newline at end of file diff --git a/dist/x-tag-calendar.min.js b/dist/x-tag-calendar.min.js index 4db80fd7..a8f6eaf1 100644 --- a/dist/x-tag-calendar.min.js +++ b/dist/x-tag-calendar.min.js @@ -1 +1 @@ -!function(){function a(a){var b;return 0===a.getUTCHours()?b=new Date(a.valueOf()):(b=new Date,b.setUTCHours(0),b.setUTCFullYear(a.getFullYear()),b.setUTCMonth(a.getMonth()),b.setUTCDate(a.getDate())),b.setUTCMinutes(0),b.setUTCSeconds(0),b.setUTCMilliseconds(0),b}function b(a,b){a.appendChild(b)}function c(a){return parseInt(a,10)}function d(a){var b=c(a);return b===a&&!isNaN(b)&&b>=0&&6>=b}function e(a){return a instanceof Date&&!!a.getTime&&!isNaN(a.getTime())}function f(a){return a&&a.isArray?a.isArray():"[object Array]"===Object.prototype.toString.call(a)}function g(a){var b=a.split("."),c=b.shift(),d=document.createElement(c);return d[T]=b.join(" "),d}function h(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function i(a){var b=a.getBoundingClientRect(),c=h(),d=c.left,e=c.top;return{left:b.left+d,right:b.right+d,top:b.top+e,bottom:b.bottom+e,width:b.width,height:b.height}}function j(a,b){xtag.addClass(a,b)}function k(a,b){xtag.removeClass(a,b)}function l(a,b){return xtag.hasClass(a,b)}function m(a){return a.getUTCFullYear()}function n(a){return a.getUTCMonth()}function o(a){return a.getUTCDate()}function p(a){return a.getUTCDay()}function q(a,b){var c=a.toString(),d=new Array(b).join("0");return(d+c).substr(-b)}function r(a){return[q(m(a),4),q(n(a)+1,2),q(o(a),2)].join("-")}function s(b){if(e(b))return b;var c=U.exec(b);return c?a(new Date(c[1],c[2]-1,c[3])):null}function t(b){if(e(b))return b;var c=s(b);if(c)return c;var d=Date.parse(b);return isNaN(d)?null:a(new Date(d))}function u(a){var b;if(f(a))b=a.slice(0);else{if(e(a))return[a];if(!("string"==typeof a&&a.length>0))return null;try{if(b=JSON.parse(a),!f(b))return console.warn("invalid list of ranges",a),null}catch(c){var d=t(a);return d?[d]:(console.warn("unable to parse",a,"as JSON or single date"),null)}}for(var g=0;gk.valueOf())return console.warn("invalid range",h,": start date is after end date"),null;b[g]=[j,k]}}return b}function v(b,c,d,e){return void 0===c&&(c=m(b)),void 0===d&&(d=n(b)),void 0===e&&(e=o(b)),a(new Date(c,d,e))}function w(a,b,c,d){return v(a,m(a)+b,n(a)+c,o(a)+d)}function x(a,b){b=c(b),d(b)||(b=0);for(var e=0;7>e;e++){if(p(a)===b)return a;a=C(a)}throw"unable to find week start"}function y(a,b){b=c(b),d(b)||(b=6);for(var e=0;7>e;e++){if(p(a)===b)return a;a=B(a)}throw"unable to find week end"}function z(b){return b=new Date(b.valueOf()),b.setUTCDate(1),a(b)}function A(a){return C(w(a,0,1,0))}function B(a){return w(a,0,0,1)}function C(a){return w(a,0,0,-1)}function D(a,b){if(b){b=void 0===b.length?[b]:b;var c=!1;return b.forEach(function(b){2===b.length?E(b[0],b[1],a)&&(c=!0):r(b)===r(a)&&(c=!0)}),c}}function E(a,b,c){return r(a)<=r(c)&&r(c)<=r(b)}function F(a){a.sort(function(a,b){var c=e(a)?a:a[0],d=e(b)?b:b[0];return c.valueOf()-d.valueOf()})}function G(a){var c=g("div.controls"),d=g("span.prev"),e=g("span.next");return d.innerHTML=a.prev,e.innerHTML=a.next,b(c,d),b(c,e),c}function H(a){var b=this;a=a||{},b._span=a.span||1,b._multiple=a.multiple||!1,b._viewDate=b._sanitizeViewDate(a.view,a.chosen),b._chosenRanges=b._sanitizeChosenRanges(a.chosen,a.view),b._firstWeekdayNum=a.firstWeekdayNum||0,b._el=g("div.calendar"),b._labels=O(),b._customRenderFn=null,b._renderRecursionFlag=!1,b.render(!0)}function I(a){a=a.slice(0),F(a);for(var b=[],c=0;c0?b[b.length-1]:null;if(e(i)?d=f=i:(d=i[0],f=i[1]),i=D(d,f)?d:[d,f],e(j))g=h=j;else{if(!j){b.push(i);continue}g=j[0],h=j[1]}if(D(d,[j])||D(C(d),[j])){var k=g.valueOf()f.valueOf()?h:f,m=D(k,l)?k:[k,l];b[b.length-1]=m}else b.push(i)}return b}function J(a,b){var c,d=b.getAttribute("data-date"),e=t(d);l(b,S)?(a.xtag.dragType=R,c="datetoggleoff"):(a.xtag.dragType=Q,c="datetoggleon"),a.xtag.dragStartEl=b,a.xtag.dragAllowTap=!0,a.noToggle||xtag.fireEvent(a,c,{detail:{date:e,iso:d}}),a.setAttribute("active",!0),b.setAttribute("active",!0)}function K(a,b){var c=b.getAttribute("data-date"),d=t(c);b!==a.xtag.dragStartEl&&(a.xtag.dragAllowTap=!1),a.noToggle||(a.xtag.dragType!==Q||l(b,S)?a.xtag.dragType===R&&l(b,S)&&xtag.fireEvent(a,"datetoggleoff",{detail:{date:d,iso:c}}):xtag.fireEvent(a,"datetoggleon",{detail:{date:d,iso:c}})),a.xtag.dragType&&b.setAttribute("active",!0)}function L(){for(var a=xtag.query(document,"x-calendar"),b=0;b",months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}},P=a(new Date),Q="add",R="remove",S="chosen",T="className",U=/(\d{4})[^\d]?(\d{2})[^\d]?(\d{2})/,V=H.prototype;V.makeMonth=function(a){if(!e(a))throw"Invalid view date!";var c=this.firstWeekdayNum,d=this.chosen,f=this.labels,h=n(a),i=x(z(a),c),k=g("div.month"),l=g("div.month-label");l.textContent=f.months[h]+" "+m(a),b(k,l);for(var p=g("div.weekday-labels"),q=0;7>q;q++){var s=(c+q)%7,t=g("span.weekday-label");t.textContent=f.weekdays[s],b(p,t)}b(k,p);var u=g("div.week"),v=i,w=42;for(q=0;w>q;q++){var y=g("span.day");if(y.setAttribute("data-date",r(v)),y.textContent=o(v),n(v)!==h&&j(y,"badmonth"),D(v,d)&&j(y,S),D(v,P)&&j(y,"today"),b(u,y),v=B(v),0===(q+1)%7){b(k,u),u=g("div.week");var A=n(v)>h||n(v)m(i);if(A)break}}return k},V._sanitizeViewDate=function(a,b){b=void 0===b?this.chosen:b;var c;if(e(a))c=a;else if(e(b))c=b;else if(f(b)&&b.length>0){var d=b[0];c=e(d)?d:d[0]}else c=P;return c},V._sanitizeChosenRanges=function(a,b){b=void 0===b?this.view:b;var c;c=e(a)?[a]:f(a)?a:null!==a&&void 0!==a&&b?[b]:[];var d=I(c);if(!this.multiple&&d.length>0){var g=d[0];return e(g)?[g]:[g[0]]}return d},V.addDate=function(a,b){e(a)&&(b?(this.chosen.push(a),this.chosen=this.chosen):this.chosen=[a])},V.removeDate=function(a){if(e(a))for(var b=this.chosen.slice(0),c=0;cc;c++)b(this.el,this.makeMonth(i)),i=w(i,0,1,0)}this._callCustomRenderer()},V._callCustomRenderer=function(){if(this._customRenderFn){if(this._renderRecursionFlag)throw"Error: customRenderFn causes recursive loop of rendering calendar; make sure your custom rendering function doesn't modify attributes of the x-calendar that would require a re-render!";for(var a=xtag.query(this.el,".day"),b=0;b=0?b:0,this.render(!1)}},view:{attribute:{},get:function(){return this._viewDate},set:function(a){var b=this._sanitizeViewDate(a),c=this._viewDate;this._viewDate=b,this.render(n(c)===n(b)&&m(c)===m(b))}},chosen:{get:function(){return this._chosenRanges},set:function(a){this._chosenRanges=this._sanitizeChosenRanges(a),this.render(!0)}},firstWeekdayNum:{get:function(){return this._firstWeekdayNum},set:function(a){a=c(a),d(a)||(a=0),this._firstWeekdayNum=a,this.render(!1)}},lastWeekdayNum:{get:function(){return(this._firstWeekdayNum+6)%7}},customRenderFn:{get:function(){return this._customRenderFn},set:function(a){this._customRenderFn=a,this.render(!0)}},chosenString:{get:function(){if(this.multiple){for(var a=this.chosen.slice(0),b=0;b0?r(this.chosen[0]):""}},firstVisibleMonth:{get:function(){return z(w(this.view,0,-Math.floor(this.span/2),0))}},lastVisibleMonth:{get:function(){return w(this.firstVisibleMonth,0,Math.max(0,this.span-1),0)}},firstVisibleDate:{get:function(){return x(this.firstVisibleMonth,this.firstWeekdayNum)}},lastVisibleDate:{get:function(){return y(A(this.lastVisibleMonth),this.lastWeekdayNum)}},labels:{get:function(){return this._labels},set:function(a){var b=this.labels;for(var c in b)if(c in a){var d=this._labels[c],e=a[c];if(f(d)){if(!f(e)||d.length!==e.length)throw"invalid label given for '"+c+"': expected array of "+d.length+" labels, got "+JSON.stringify(e);e=e.slice(0);for(var g=0;g0){var b=a.currentTarget;if(b.xtag.dragType)for(var c=a.touches[0],d=xtag.query(b,".day"),e=0;e0){var b=a[0];return e(b)?b:b[0]}return null},set:function(a){var b=this.multiple?u(a):t(a);this.xtag.calObj.chosen=b?b:null,this.xtag.calObj.chosenString?this.setAttribute("chosen",this.xtag.calObj.chosenString):this.removeAttribute("chosen")}},firstWeekdayNum:{attribute:{name:"first-weekday-num"},set:function(a){this.xtag.calObj.firstWeekdayNum=a}},noToggle:{attribute:{"boolean":!0,name:"notoggle"},set:function(a){a&&(this.chosen=null)}},firstVisibleMonth:{get:function(){return this.xtag.calObj.firstVisibleMonth}},lastVisibleMonth:{get:function(){return this.xtag.calObj.lastVisibleMonth}},firstVisibleDate:{get:function(){return this.xtag.calObj.firstVisibleDate}},lastVisibleDate:{get:function(){return this.xtag.calObj.lastVisibleDate}},customRenderFn:{get:function(){return this.xtag.calObj.customRenderFn},set:function(a){this.xtag.calObj.customRenderFn=a}},labels:{get:function(){return JSON.parse(JSON.stringify(this.xtag.calObj.labels))},set:function(a){this.xtag.calObj.labels=a;var b=this.xtag.calObj.labels,c=this.querySelector(".controls > .prev");c&&(c.textContent=b.prev);var d=this.querySelector(".controls > .next");d&&(d.textContent=b.next)}}},methods:{render:function(a){this.xtag.calObj.render(a)},prevMonth:function(){var a=this.xtag.calObj;a.view=w(a.view,0,-1,0)},nextMonth:function(){var a=this.xtag.calObj;a.view=w(a.view,0,1,0)},toggleDateOn:function(a,b){this.xtag.calObj.addDate(a,b),this.chosen=this.chosen},toggleDateOff:function(a){this.xtag.calObj.removeDate(a),this.chosen=this.chosen},toggleDate:function(a,b){this.xtag.calObj.hasChosenDate(a)?this.toggleDateOff(a):this.toggleDateOn(a,b)},hasVisibleDate:function(a,b){return this.xtag.calObj.hasVisibleDate(a,b)}}})}(); \ No newline at end of file +!function(){function a(a){var b=new Date(a.valueOf());return b.setHours(0),b.setMinutes(0),b.setSeconds(0),b.setMilliseconds(0),b}function b(a,b){a.appendChild(b)}function c(a){return parseInt(a,10)}function d(a){var b=c(a);return b===a&&!isNaN(b)&&b>=0&&6>=b}function e(a){return a instanceof Date&&!!a.getTime&&!isNaN(a.getTime())}function f(a){return a&&a.isArray?a.isArray():"[object Array]"===Object.prototype.toString.call(a)}function g(a){var b=a.split("."),c=b.shift(),d=document.createElement(c);return d[W]=b.join(" "),d}function h(){var a=document.documentElement,b={left:a.scrollLeft||document.body.scrollLeft||0,top:a.scrollTop||document.body.scrollTop||0,width:a.clientWidth,height:a.clientHeight};return b.right=b.left+b.width,b.bottom=b.top+b.height,b}function i(a){var b=a.getBoundingClientRect(),c=h(),d=c.left,e=c.top;return{left:b.left+d,right:b.right+d,top:b.top+e,bottom:b.bottom+e,width:b.width,height:b.height}}function j(a,b){xtag.addClass(a,b)}function k(a,b){xtag.removeClass(a,b)}function l(a,b){return xtag.hasClass(a,b)}function m(a){return a.getFullYear()}function n(a){return a.getMonth()}function o(a){return a.getDate()}function p(a){return a.getDay()}function q(a,b){var c=a.toString(),d=new Array(b).join("0");return(d+c).substr(-b)}function r(a){return[q(m(a),4),q(n(a)+1,2),q(o(a),2)].join("-")}function s(b){if(e(b))return b;var c=X.exec(b);return c?a(new Date(c[1],c[2]-1,c[3])):null}function t(b){if(e(b))return b;var c=s(b);if(c)return c;var d=Date.parse(b);return isNaN(d)?null:a(new Date(d))}function u(a){var b;if(f(a))b=a.slice(0);else{if(e(a))return[a];if(!("string"==typeof a&&a.length>0))return null;try{if(b=JSON.parse(a),!f(b))return console.warn("invalid list of ranges",a),null}catch(c){var d=t(a);return d?[d]:(console.warn("unable to parse",a,"as JSON or single date"),null)}}for(var g=0;gk.valueOf())return console.warn("invalid range",h,": start date is after end date"),null;b[g]=[j,k]}}return b}function v(b,c,d,e){return void 0===c&&(c=m(b)),void 0===d&&(d=n(b)),void 0===e&&(e=o(b)),a(new Date(c,d,e))}function w(a,b){return b||(b=(new Date).getFullYear()),new Date(b,a+1,0).getDate()}function x(a,b,c,d){return v(a,m(a)+b,n(a)+c,o(a)+d)}function y(a){var b=a.getDate(),c=w(a.getMonth()+1,a.getFullYear());return b>c&&(b=c),console.log(new Date(a.getFullYear(),a.getMonth()+1,b).toString()),new Date(a.getFullYear(),a.getMonth()+1,b)}function z(a){var b=a.getDate(),c=w(a.getMonth()-1,a.getFullYear());return b>c&&(b=c),new Date(a.getFullYear(),a.getMonth()-1,b)}function A(a,b){b=c(b),d(b)||(b=0);for(var e=0;7>e;e++){if(p(a)===b)return a;a=F(a)}throw"unable to find week start"}function B(a,b){b=c(b),d(b)||(b=6);for(var e=0;7>e;e++){if(p(a)===b)return a;a=E(a)}throw"unable to find week end"}function C(b){return b=new Date(b.valueOf()),b.setDate(1),a(b)}function D(a){return F(x(a,0,1,0))}function E(a){return x(a,0,0,1)}function F(a){return x(a,0,0,-1)}function G(a,b){if(b){b=void 0===b.length?[b]:b;var c=!1;return b.forEach(function(b){2===b.length?H(b[0],b[1],a)&&(c=!0):r(b)===r(a)&&(c=!0)}),c}}function H(a,b,c){return r(a)<=r(c)&&r(c)<=r(b)}function I(a){a.sort(function(a,b){var c=e(a)?a:a[0],d=e(b)?b:b[0];return c.valueOf()-d.valueOf()})}function J(a){var c=g("div.controls"),d=g("span.prev"),e=g("span.next");return d.innerHTML=a.prev,e.innerHTML=a.next,b(c,d),b(c,e),c}function K(a){var b=this;a=a||{},b._span=a.span||1,b._multiple=a.multiple||!1,b._viewDate=b._sanitizeViewDate(a.view,a.chosen),b._chosenRanges=b._sanitizeChosenRanges(a.chosen,a.view),b._firstWeekdayNum=a.firstWeekdayNum||0,b._el=g("div.calendar"),b._labels=R(),b._customRenderFn=null,b._renderRecursionFlag=!1,b.render(!0)}function L(a){a=a.slice(0),I(a);for(var b=[],c=0;c0?b[b.length-1]:null;if(e(i)?d=f=i:(d=i[0],f=i[1]),i=G(d,f)?d:[d,f],e(j))g=h=j;else{if(!j){b.push(i);continue}g=j[0],h=j[1]}if(G(d,[j])||G(F(d),[j])){var k=g.valueOf()f.valueOf()?h:f,m=G(k,l)?k:[k,l];b[b.length-1]=m}else b.push(i)}return b}function M(a,b){var c,d=b.getAttribute("data-date"),e=t(d);l(b,V)?(a.xtag.dragType=U,c="datetoggleoff"):(a.xtag.dragType=T,c="datetoggleon"),a.xtag.dragStartEl=b,a.xtag.dragAllowTap=!0,a.noToggle||xtag.fireEvent(a,c,{detail:{date:e,iso:d}}),a.setAttribute("active",!0),b.setAttribute("active",!0)}function N(a,b){var c=b.getAttribute("data-date"),d=t(c);b!==a.xtag.dragStartEl&&(a.xtag.dragAllowTap=!1),a.noToggle||(a.xtag.dragType!==T||l(b,V)?a.xtag.dragType===U&&l(b,V)&&xtag.fireEvent(a,"datetoggleoff",{detail:{date:d,iso:c}}):xtag.fireEvent(a,"datetoggleon",{detail:{date:d,iso:c}})),a.xtag.dragType&&b.setAttribute("active",!0)}function O(){for(var a=xtag.query(document,"x-calendar"),b=0;bq;q++){var s=(c+q)%7,t=g("span.weekday-label");t.textContent=f.weekdays[s],b(p,t)}b(k,p);var u=g("div.week"),v=i,w=42;for(q=0;w>q;q++){var x=g("span.day");if(x.setAttribute("data-date",r(v)),x.textContent=o(v),n(v)!==h&&j(x,"badmonth"),G(v,d)&&j(x,V),G(v,S)&&j(x,"today"),b(u,x),v=E(v),0===(q+1)%7){b(k,u),u=g("div.week");var y=n(v)>h||n(v)m(i);if(y)break}}return k},Y._sanitizeViewDate=function(a,b){b=void 0===b?this.chosen:b;var c;if(e(a))c=a;else if(e(b))c=b;else if(f(b)&&b.length>0){var d=b[0];c=e(d)?d:d[0]}else c=S;return c},Y._sanitizeChosenRanges=function(a,b){b=void 0===b?this.view:b;var c;c=e(a)?[a]:f(a)?a:null!==a&&void 0!==a&&b?[b]:[];var d=L(c);if(!this.multiple&&d.length>0){var g=d[0];return e(g)?[g]:[g[0]]}return d},Y.addDate=function(a,b){e(a)&&(b?(this.chosen.push(a),this.chosen=this.chosen):this.chosen=[a])},Y.removeDate=function(a){if(e(a))for(var b=this.chosen.slice(0),c=0;cc;c++)b(this.el,this.makeMonth(i)),i=x(i,0,1,0)}this._callCustomRenderer()},Y._callCustomRenderer=function(){if(this._customRenderFn){if(this._renderRecursionFlag)throw"Error: customRenderFn causes recursive loop of rendering calendar; make sure your custom rendering function doesn't modify attributes of the x-calendar that would require a re-render!";for(var a=xtag.query(this.el,".day"),b=0;b=0?b:0,this.render(!1)}},view:{attribute:{},get:function(){return this._viewDate},set:function(a){var b=this._sanitizeViewDate(a),c=this._viewDate;this._viewDate=b,this.render(n(c)===n(b)&&m(c)===m(b))}},chosen:{get:function(){return this._chosenRanges},set:function(a){this._chosenRanges=this._sanitizeChosenRanges(a),this.render(!0)}},firstWeekdayNum:{get:function(){return this._firstWeekdayNum},set:function(a){a=c(a),d(a)||(a=0),this._firstWeekdayNum=a,this.render(!1)}},lastWeekdayNum:{get:function(){return(this._firstWeekdayNum+6)%7}},customRenderFn:{get:function(){return this._customRenderFn},set:function(a){this._customRenderFn=a,this.render(!0)}},chosenString:{get:function(){if(this.multiple){for(var a=this.chosen.slice(0),b=0;b0?r(this.chosen[0]):""}},firstVisibleMonth:{get:function(){return C(this.view)}},lastVisibleMonth:{get:function(){return x(this.firstVisibleMonth,0,Math.max(0,this.span-1),0)}},firstVisibleDate:{get:function(){return A(this.firstVisibleMonth,this.firstWeekdayNum)}},lastVisibleDate:{get:function(){return B(D(this.lastVisibleMonth),this.lastWeekdayNum)}},labels:{get:function(){return this._labels},set:function(a){var b=this.labels;for(var c in b)if(c in a){var d=this._labels[c],e=a[c];if(f(d)){if(!f(e)||d.length!==e.length)throw"invalid label given for '"+c+"': expected array of "+d.length+" labels, got "+JSON.stringify(e);e=e.slice(0);for(var g=0;g0){var b=a.currentTarget;if(b.xtag.dragType)for(var c=a.touches[0],d=xtag.query(b,".day"),e=0;e0){var b=a[0];return e(b)?b:b[0]}return null},set:function(a){var b=this.multiple?u(a):t(a);this.xtag.calObj.chosen=b?b:null,this.xtag.calObj.chosenString?this.setAttribute("chosen",this.xtag.calObj.chosenString):this.removeAttribute("chosen")}},firstWeekdayNum:{attribute:{name:"first-weekday-num"},set:function(a){this.xtag.calObj.firstWeekdayNum=a}},noToggle:{attribute:{"boolean":!0,name:"notoggle"},set:function(a){a&&(this.chosen=null)}},firstVisibleMonth:{get:function(){return this.xtag.calObj.firstVisibleMonth}},lastVisibleMonth:{get:function(){return this.xtag.calObj.lastVisibleMonth}},firstVisibleDate:{get:function(){return this.xtag.calObj.firstVisibleDate}},lastVisibleDate:{get:function(){return this.xtag.calObj.lastVisibleDate}},customRenderFn:{get:function(){return this.xtag.calObj.customRenderFn},set:function(a){this.xtag.calObj.customRenderFn=a}},labels:{get:function(){return JSON.parse(JSON.stringify(this.xtag.calObj.labels))},set:function(a){this.xtag.calObj.labels=a;var b=this.xtag.calObj.labels,c=this.querySelector(".controls > .prev");c&&(c.textContent=b.prev);var d=this.querySelector(".controls > .next");d&&(d.textContent=b.next)}}},methods:{render:function(a){this.xtag.calObj.render(a)},prevMonth:function(){var a=this.xtag.calObj;a.view=z(a.view)},nextMonth:function(){var a=this.xtag.calObj;a.view=y(a.view)},toggleDateOn:function(a,b){this.xtag.calObj.addDate(a,b),this.chosen=this.chosen},toggleDateOff:function(a){this.xtag.calObj.removeDate(a),this.chosen=this.chosen},toggleDate:function(a,b){this.xtag.calObj.hasChosenDate(a)?this.toggleDateOff(a):this.toggleDateOn(a,b)},hasVisibleDate:function(a,b){return this.xtag.calObj.hasVisibleDate(a,b)}}})}(); \ No newline at end of file diff --git a/dist/x-tag-core.min.js b/dist/x-tag-core.min.js index eb312112..36e9a240 100644 --- a/dist/x-tag-core.min.js +++ b/dist/x-tag-core.min.js @@ -1,3 +1 @@ -window.Platform={};var logFlags={};(function(){function e(e){if(this._element=e,e.className!=this._classCache){if(this._classCache=e.className,!this._classCache)return;var t,n=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(t=0;n.length>t;t++)a.call(this,n[t])}}function t(e,t){e.className=t.join(" ")}function n(e,t,n){Object.defineProperty?Object.defineProperty(e,t,{get:n}):e.__defineGetter__(t,n)}if(!(window.Element===void 0||"classList"in document.documentElement)){var r=Array.prototype,o=r.indexOf,i=r.slice,a=r.push,s=r.splice,c=r.join;e.prototype={add:function(e){this.contains(e)||(a.call(this,e),t(this._element,i.call(this,0)))},contains:function(e){return-1!==o.call(this,e)},item:function(e){return this[e]||null},remove:function(e){var n=o.call(this,e);-1!==n&&(s.call(this,n,1),t(this._element,i.call(this,0)))},toString:function(){return c.call(this," ")},toggle:function(e){-1===o.call(this,e)?this.add(e):this.remove(e)}},window.DOMTokenList=e,n(Element.prototype,"classList",function(){return new e(this)})}})();var SideTable;if("undefined"!=typeof WeakMap&&0>navigator.userAgent.indexOf("Firefox/")?SideTable=WeakMap:function(){var e=Object.defineProperty,t=Date.now()%1e9;SideTable=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")},SideTable.prototype={set:function(t,n){var r=t[this.name];r&&r[0]===t?r[1]=n:e(t,this.name,{value:[t,n],writable:!0})},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){this.set(e,void 0)}}}(),function(e){function t(e){y.push(e),b||(b=!0,m(r))}function n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function r(){b=!1;var e=y;y=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var n=e.takeRecords();o(e),n.length&&(e.callback_(n,e),t=!0)}),t&&r()}function o(e){e.nodes_.forEach(function(t){var n=h.get(t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function i(e,t){for(var n=e;n;n=n.parentNode){var r=h.get(n);if(r)for(var o=0;r.length>o;o++){var i=r[o],a=i.options;if(n===e||a.subtree){var s=t(a);s&&i.enqueue(s)}}}}function a(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++w}function s(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function c(e){var t=new s(e.type,e.target);return t.addedNodes=e.addedNodes.slice(),t.removedNodes=e.removedNodes.slice(),t.previousSibling=e.previousSibling,t.nextSibling=e.nextSibling,t.attributeName=e.attributeName,t.attributeNamespace=e.attributeNamespace,t.oldValue=e.oldValue,t}function u(e,t){return E=new s(e,t)}function l(e){return L?L:(L=c(E),L.oldValue=e,L)}function d(){E=L=void 0}function f(e){return e===L||e===E}function p(e,t){return e===t?e:L&&f(e)?L:null}function v(e,t,n){this.observer=e,this.target=t,this.options=n,this.transientObservedNodes=[]}var h=new SideTable,m=window.msSetImmediate;if(!m){var _=[],g=Math.random()+"";window.addEventListener("message",function(e){if(e.data===g){var t=_;_=[],t.forEach(function(e){e()})}}),m=function(e){_.push(e),window.postMessage(g,"*")}}var b=!1,y=[],w=0;a.prototype={observe:function(e,t){if(e=n(e),!t.childList&&!t.attributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilter&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characterData)throw new SyntaxError;var r=h.get(e);r||h.set(e,r=[]);for(var o,i=0;r.length>i;i++)if(r[i].observer===this){o=r[i],o.removeListeners(),o.options=t;break}o||(o=new v(this,e,t),r.push(o),this.nodes_.push(e)),o.addListeners()},disconnect:function(){this.nodes_.forEach(function(e){for(var t=h.get(e),n=0;t.length>n;n++){var r=t[n];if(r.observer===this){r.removeListeners(),t.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}};var E,L;v.prototype={enqueue:function(e){var n=this.observer.records_,r=n.length;if(n.length>0){var o=n[r-1],i=p(o,e);if(i)return n[r-1]=i,void 0}else t(this.observer);n[r]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=h.get(e);t||h.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=h.get(e),n=0;t.length>n;n++)if(t[n]===this){t.splice(n,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,n=e.relatedNode.namespaceURI,r=e.target,o=new u("attributes",r);o.attributeName=t,o.attributeNamespace=n;var a=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;i(r,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.length&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(n)?void 0:e.attributeOldValue?l(a):o});break;case"DOMCharacterDataModified":var r=e.target,o=u("characterData",r),a=e.prevValue;i(r,function(e){return e.characterData?e.characterDataOldValue?l(a):o:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var s,c,r=e.relatedNode,f=e.target;"DOMNodeInserted"===e.type?(s=[f],c=[]):(s=[],c=[f]);var p=f.previousSibling,v=f.nextSibling,o=u("childList",r);o.addedNodes=s,o.removedNodes=c,o.previousSibling=p,o.nextSibling=v,i(r,function(e){return e.childList?o:void 0})}d()}},e.JsMutationObserver=a}(this),!window.MutationObserver&&(window.MutationObserver=window.WebKitMutationObserver||window.JsMutationObserver,!MutationObserver))throw Error("no mutation observer support");(function(e){function t(t,i){var a=i||{};if(!t)throw Error("document.register: first argument `name` must not be empty");if(0>t.indexOf("-"))throw Error("document.register: first argument ('name') must contain a dash ('-'). Argument provided was '"+(t+"")+"'.");if(a.name=t,!a.prototype)throw Error("Options missing required prototype property");return a.lifecycle=a.lifecycle||{},a.ancestry=n(a.extends),r(a),o(a),l(a.prototype),f(t,a),a.ctor=p(a),a.ctor.prototype=a.prototype,a.prototype.constructor=a.ctor,e.ready&&e.upgradeAll(document),a.ctor}function n(e){var t=w[e];return t?n(t.extends).concat([t]):[]}function r(e){for(var t,n=e.extends,r=0;t=e.ancestry[r];r++)n=t.is&&t.tag;e.tag=n||e.name,n&&(e.is=e.name)}function o(e){if(!Object.__proto__){var t=HTMLElement.prototype;if(e.is){var n=document.createElement(e.tag);t=Object.getPrototypeOf(n)}for(var r,o=e.prototype;o&&o!==t;){var r=Object.getPrototypeOf(o);o.__proto__=r,o=r}}e.native=t}function i(e){return a(E(e.tag),e)}function a(t,n){return n.is&&t.setAttribute("is",n.is),s(t,n),t.__upgraded__=!0,e.upgradeSubtree(t),u(t),t}function s(e,t){Object.__proto__?e.__proto__=t.prototype:(c(e,t.prototype,t.native),e.__proto__=t.prototype)}function c(e,t,n){for(var r={},o=t;o!==n&&o!==HTMLUnknownElement.prototype;){for(var i,a=Object.getOwnPropertyNames(o),s=0;i=a[s];s++)r[i]||(Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(o,i)),r[i]=1);o=Object.getPrototypeOf(o)}}function u(e){e.createdCallback&&e.createdCallback()}function l(e){var t=e.setAttribute;e.setAttribute=function(e,n){d.call(this,e,n,t)};var n=e.removeAttribute;e.removeAttribute=function(e,t){d.call(this,e,t,n)}}function d(e,t,n){var r=this.getAttribute(e);n.apply(this,arguments),this.attributeChangedCallback&&this.getAttribute(e)!==r&&this.attributeChangedCallback(e,r)}function f(e,t){w[e]=t}function p(e){return function(){return i(e)}}function v(e,t){var n=w[t||e];return n?new n.ctor:E(e)}function h(e){if(!e.__upgraded__&&e.nodeType===Node.ELEMENT_NODE){var t=e.getAttribute("is")||e.localName,n=w[t];return n&&a(e,n)}}function m(t){var n=L.call(this,t);return e.upgradeAll(n),n}e||(e=window.CustomElements={flags:{}});var _=e.flags,g=Boolean(document.register),b=!_.register&&g;if(b){var y=function(){};e.registry={},e.upgradeElement=y,e.watchShadow=y,e.upgrade=y,e.upgradeAll=y,e.upgradeSubtree=y,e.observeDocument=y,e.upgradeDocument=y,e.takeRecords=y}else{var w={},E=document.createElement.bind(document),L=Node.prototype.cloneNode;document.register=t,document.createElement=v,Node.prototype.cloneNode=m,e.registry=w,e.upgrade=h}e.hasNative=g,e.useNative=b})(window.CustomElements),function(e){function t(e,n,r){var o=e.firstElementChild;if(!o)for(o=e.firstChild;o&&o.nodeType!==Node.ELEMENT_NODE;)o=o.nextSibling;for(;o;)n(o,r)!==!0&&t(o,n,r),o=o.nextElementSibling;return null}function n(e,t){for(var n=e.shadowRoot;n;)r(n,t),n=n.olderShadowRoot}function r(e,r){t(e,function(e){return r(e)?!0:(n(e,r),void 0)}),n(e,r)}function o(e){return s(e)?(c(e),!0):(d(e),void 0)}function i(e){r(e,function(e){return o(e)?!0:void 0})}function a(e){return o(e)||i(e)}function s(t){if(!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var n=t.getAttribute("is")||t.localName,r=e.registry[n];if(r)return O.dom&&console.group("upgrade:",t.localName),e.upgrade(t),O.dom&&console.groupEnd(),!0}}function c(e){d(e),h(e)&&r(e,function(e){d(e)})}function u(e){if(A.push(e),!k){k=!0;var t=window.Platform&&window.Platform.endOfMicrotask||setTimeout;t(l)}}function l(){k=!1;for(var e,t=A,n=0,r=t.length;r>n&&(e=t[n]);n++)e();A=[]}function d(e){N?u(function(){f(e)}):f(e)}function f(e){(e.enteredViewCallback||e.__upgraded__&&O.dom)&&(O.dom&&console.group("inserted:",e.localName),h(e)&&(e.__inserted=(e.__inserted||0)+1,1>e.__inserted&&(e.__inserted=1),e.__inserted>1?O.dom&&console.warn("inserted:",e.localName,"insert/remove count:",e.__inserted):e.enteredViewCallback&&(O.dom&&console.log("inserted:",e.localName),e.enteredViewCallback())),O.dom&&console.groupEnd())}function p(e){v(e),r(e,function(e){v(e)})}function v(e){N?u(function(){_removed(e)}):_removed(e)}function v(e){(e.leftViewCallback||e.__upgraded__&&O.dom)&&(O.dom&&console.log("removed:",e.localName),h(e)||(e.__inserted=(e.__inserted||0)-1,e.__inserted>0&&(e.__inserted=0),0>e.__inserted?O.dom&&console.warn("removed:",e.localName,"insert/remove count:",e.__inserted):e.leftViewCallback&&e.leftViewCallback()))}function h(e){for(var t=e,n=window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(document)||document;t;){if(t==n)return!0;t=t.parentNode||t.host}}function m(e){if(e.shadowRoot&&!e.shadowRoot.__watched){O.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)_(t),t=t.olderShadowRoot}}function _(e){e.__watched||(w(e),e.__watched=!0)}function g(e){switch(e.localName){case"style":case"script":case"template":case void 0:return!0}}function b(e){if(O.dom){var t=e[0];if(t&&"childList"===t.type&&t.addedNodes&&t.addedNodes){for(var n=t.addedNodes[0];n&&n!==document&&!n.host;)n=n.parentNode;var r=n&&(n.URL||n._URL||n.host&&n.host.localName)||"";r=r.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",e.length,r||"")}e.forEach(function(e){"childList"===e.type&&(T(e.addedNodes,function(e){g(e)||a(e)}),T(e.removedNodes,function(e){g(e)||p(e)}))}),O.dom&&console.groupEnd()}function y(){b(M.takeRecords()),l()}function w(e){M.observe(e,{childList:!0,subtree:!0})}function E(e){w(e)}function L(e){O.dom&&console.group("upgradeDocument: ",(e.URL||e._URL||"").split("/").pop()),a(e),O.dom&&console.groupEnd()}var O=window.logFlags||{},N=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;e.hasPolyfillMutations=N;var k=!1,A=[],M=new MutationObserver(b),T=Array.prototype.forEach.call.bind(Array.prototype.forEach);e.watchShadow=m,e.upgradeAll=a,e.upgradeSubtree=i,e.observeDocument=E,e.upgradeDocument=L,e.takeRecords=y}(window.CustomElements),function(e){function t(e){return r(e,c)}function n(e){return r(e,u)}function r(e,t){return"link"===e.localName&&e.getAttribute("rel")===t}function o(e){return"script"===e.localName}function i(e,t){var n=e;n instanceof Document||(n=document.implementation.createHTMLDocument(c),n.body.innerHTML=e),n._URL=t;var r=n.createElement("base");return r.setAttribute("href",document.baseURI||document.URL),n.head.appendChild(r),window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(n),n}e||(e=window.HTMLImports={flags:{}});var a,s=e.xhr,c="import",u="stylesheet",l={documents:{},cache:{},preloadSelectors:["link[rel="+c+"]","element link[rel="+u+"]","template","script[src]:not([type])",'script[src][type="text/javascript"]'].join(","),loader:function(e){return a=new d(l.loaded,e),a.cache=l.cache,a},load:function(e,t){a=l.loader(t),l.preload(e)},preload:function(e){var t=e.querySelectorAll(l.preloadSelectors);t=this.filterMainDocumentNodes(e,t),t=this.extractTemplateNodes(t),a.addNodes(t)},filterMainDocumentNodes:function(e,t){return e===document&&(t=Array.prototype.filter.call(t,function(e){return!o(e)})),t},extractTemplateNodes:function(e){var t=[];return e=Array.prototype.filter.call(e,function(e){if("template"===e.localName){if(e.content){var n=e.content.querySelectorAll("link[rel="+u+"]");n.length&&(t=t.concat(Array.prototype.slice.call(n,0)))}return!1}return!0}),t.length&&(e=e.concat(t)),e},loaded:function(e,r,o){if(t(r)){var a=l.documents[e];a||(a=i(o,e),h.resolvePathsInHTML(a),l.documents[e]=a,l.preload(a)),r.import={href:e,ownerNode:r,content:a},r.content=o=a}r.__resource=o,n(r)&&h.resolvePathsInStylesheet(r)}},d=function(e,t){this.onload=e,this.oncomplete=t,this.inflight=0,this.pending={},this.cache={}};d.prototype={addNodes:function(e){this.inflight+=e.length,m(e,this.require,this),this.checkDone()},require:function(e){var t=h.nodeUrl(e);e.__nodeUrl=t,this.dedupe(t,e)||this.fetch(t,e)},dedupe:function(e,t){return this.pending[e]?(this.pending[e].push(t),!0):this.cache[e]?(this.onload(e,t,a.cache[e]),this.tail(),!0):(this.pending[e]=[t],!1)},fetch:function(e,t){var n=function(n,r){this.receive(e,t,n,r)}.bind(this);s.load(e,n)},receive:function(e,t,n,r){n||(a.cache[e]=r),a.pending[e].forEach(function(t){n||this.onload(e,t,r),this.tail()},this),a.pending[e]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}};var f=["href","src","action"],p="["+f.join("],[")+"]",v="{{.*}}",h={nodeUrl:function(e){return h.resolveUrl(h.documentURL,h.hrefOrSrc(e))},hrefOrSrc:function(e){return e.getAttribute("href")||e.getAttribute("src")},documentUrlFromNode:function(e){return h.getDocumentUrl(e.ownerDocument||e)},getDocumentUrl:function(e){var t=e&&(e._URL||e.impl&&e.impl._URL||e.baseURI||e.URL)||"";return t.split("#")[0]},resolveUrl:function(e,t){return this.isAbsUrl(t)?t:this.compressUrl(this.urlToPath(e)+t)},resolveRelativeUrl:function(e,t){return this.isAbsUrl(t)?t:this.makeDocumentRelPath(this.resolveUrl(e,t))},isAbsUrl:function(e){return/(^data:)|(^http[s]?:)|(^\/)/.test(e)},urlToPath:function(e){var t=e.split("/");return t.pop(),t.push(""),t.join("/")},compressUrl:function(e){var t="",n=e.indexOf("?");n>-1&&(t=e.substring(n),e=e.substring(n,0));for(var r,o=e.split("/"),i=0;o.length>i;i++)r=o[i],".."===r&&(o.splice(i-1,2),i-=2);return o.join("/")+t},makeDocumentRelPath:function(e){return h.urlElt.href=e,!h.urlElt.host||h.urlElt.host===window.location.host&&h.urlElt.protocol===window.location.protocol?this.makeRelPath(h.documentURL,h.urlElt.href):e},makeRelPath:function(e,t){for(var n=e.split("/"),r=t.split("/");n.length&&n[0]===r[0];)n.shift(),r.shift();for(var o=0,i=n.length-1;i>o;o++)r.unshift("..");var a=r.join("/");return a},resolvePathsInHTML:function(e,t){t=t||h.documentUrlFromNode(e),h.resolveAttributes(e,t),h.resolveStyleElts(e,t);var n=e.querySelectorAll("template");n&&m(n,function(e){e.content&&h.resolvePathsInHTML(e.content,t)})},resolvePathsInStylesheet:function(e){var t=h.nodeUrl(e);e.__resource=h.resolveCssText(e.__resource,t)},resolveStyleElts:function(e,t){var n=e.querySelectorAll("style");n&&m(n,function(e){e.textContent=h.resolveCssText(e.textContent,t)})},resolveCssText:function(e,t){return e.replace(/url\([^)]*\)/g,function(e){var n=e.replace(/["']/g,"").slice(4,-1);return n=h.resolveRelativeUrl(t,n),"url("+n+")"})},resolveAttributes:function(e,t){var n=e&&e.querySelectorAll(p);n&&m(n,function(e){this.resolveNodeAttributes(e,t)},this)},resolveNodeAttributes:function(e,t){f.forEach(function(n){var r=e.attributes[n];if(r&&r.value&&0>r.value.search(v)){var o=h.resolveRelativeUrl(t,r.value);r.value=o}})}};h.documentURL=h.getDocumentUrl(document),h.urlElt=document.createElement("a"),s=s||{async:!0,ok:function(e){return e.status>=200&&300>e.status||304===e.status||0===e.status},load:function(t,n,r){var o=new XMLHttpRequest;return(e.flags.debug||e.flags.bust)&&(t+="?"+Math.random()),o.open("GET",t,s.async),o.addEventListener("readystatechange",function(){4===o.readyState&&n.call(r,!s.ok(o)&&o,o.response,t)}),o.send(),o},loadDocument:function(e,t,n){this.load(e,t,n).responseType="document"}};var m=Array.prototype.forEach.call.bind(Array.prototype.forEach);e.path=h,e.xhr=s,e.importer=l,e.getDocumentUrl=h.getDocumentUrl,e.IMPORT_LINK_TYPE=c}(window.HTMLImports),function(e){function t(e){return"link"===e.localName&&e.getAttribute("rel")===i}function n(e){return e.parentNode&&!r(e)&&!o(e)}function r(e){return e.ownerDocument===document||e.ownerDocument.impl===document}function o(e){return e.parentNode&&"element"===e.parentNode.localName}var i="import",a={selectors:["link[rel="+i+"]","link[rel=stylesheet]","style","script:not([type])",'script[type="text/javascript"]'],map:{link:"parseLink",script:"parseScript",style:"parseGeneric"},parse:function(e){if(!e.__importParsed){e.__importParsed=!0;var t=e.querySelectorAll(a.selectors);s(t,function(e){a[a.map[e.localName]](e)})}},parseLink:function(e){t(e)?e.content&&a.parse(e.content):this.parseGeneric(e)},parseGeneric:function(e){n(e)&&document.head.appendChild(e)},parseScript:function(t){if(n(t)){var r=(t.__resource||t.textContent).trim();if(r){var o=t.__nodeUrl;if(!o){var o=e.path.documentUrlFromNode(t),i="["+Math.floor(1e3*(Math.random()+1))+"]",a=r.match(/Polymer\(['"]([^'"]*)/);i=a&&a[1]||i,o+="/"+i+".js"}r+="\n//# sourceURL="+o+"\n",eval.call(window,r)}}}},s=Array.prototype.forEach.call.bind(Array.prototype.forEach);e.parser=a}(HTMLImports),function(){function e(){HTMLImports.importer.load(document,function(){HTMLImports.parser.parse(document),HTMLImports.readyTime=(new Date).getTime(),document.dispatchEvent(new CustomEvent("HTMLImportsLoaded",{bubbles:!0}))})}"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e){var t=document.createEvent("HTMLEvents");return t.initEvent(e,!0,!0),t}),"complete"===document.readyState?e():window.addEventListener("DOMContentLoaded",e)}(),function(){function e(e){return"link"===e.localName&&e.getAttribute("rel")===t}var t=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none",n={selectors:["link[rel="+t+"]"],map:{link:"parseLink"},parse:function(e){if(!e.__parsed){e.__parsed=!0;var t=e.querySelectorAll(n.selectors);r(t,function(e){n[n.map[e.localName]](e)}),CustomElements.upgradeDocument(e),CustomElements.observeDocument(e)}},parseLink:function(t){e(t)&&this.parseImport(t)},parseImport:function(e){e.content&&n.parse(e.content)}},r=Array.prototype.forEach.call.bind(Array.prototype.forEach);CustomElements.parser=n}(),function(){function e(){CustomElements.parser.parse(document),CustomElements.upgradeDocument(document);var e=window.Platform&&Platform.endOfMicrotask?Platform.endOfMicrotask:setTimeout;e(function(){CustomElements.ready=!0,CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.body.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}if("function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e){var t=document.createEvent("HTMLEvents");return t.initEvent(e,!0,!0),t}),"complete"===document.readyState)e();else{var t=window.HTMLImports?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(t,e)}}(),function(){function e(e){var t=P.call(e);return S[t]||(S[t]=t.match(R)[1].toLowerCase())}function t(n,r){var o=t[r||e(n)];return o?o(n):n}function n(t){return-1==U.indexOf(e(t))?Array.prototype.slice.call(t,0):[t]}function r(e,t){return(t||I).length?n(e.querySelectorAll(t)):[]}function o(e,t){var n={added:[],removed:[]};t.forEach(function(t){t._mutation=!0;for(var r in n)for(var o=e._records["added"==r?"inserted":"removed"],i=t[r+"Nodes"],a=i.length,s=0;a>s&&-1==n[r].indexOf(i[s]);s++)n[r].push(i[s]),o.forEach(function(e){e(i[s],t)})})}function i(n,r,o){var i=e(o);return"object"==i&&"object"==e(n[r])?q.merge(n[r],o):n[r]=t(o,i),n}function a(e,t,n){var r={};for(var o in n)r[o.split(":")[0]]=!0;for(var i in t)r[i.split(":")[0]]||(n[i]=t[i])}function s(e){return e.mixins.forEach(function(t){var n=q.mixins[t];for(var r in n)switch(r){case"lifecycle":case"methods":a(r,n[r],e[r]);break;case"accessors":case"prototype":for(var o in n[r])a(o,n[r],e.accessors);break;case"events":}}),e}function c(e,t){var n=r(this,e.value).filter(function(e){return e==t.target||e.contains?e.contains(t.target):null})[0];return n?e.listener=e.listener.bind(n):null}function u(e){if(e.type.match("touch"))e.target.__touched__=!0;else if(e.target.__touched__&&e.type.match("mouse"))return delete e.target.__touched__,void 0;return!0}function l(e){var t="over"==e;return{attach:"OverflowEvent"in E?"overflowchanged":[],condition:function(n){return n.flow=e,n.type==e+"flow"||0===n.orient&&n.horizontalOverflow==t||1==n.orient&&n.verticalOverflow==t||2==n.orient&&n.horizontalOverflow==t&&n.verticalOverflow==t}}}function d(e,t,n,r){r?t[e]=n[e]:Object.defineProperty(t,e,{writable:!0,enumerable:!0,value:n[e]})}function f(e,t){var n=Object.getOwnPropertyDescriptor(e,"target");for(var r in t)j[r]||d(r,e,t,n);e.baseEvent=t}function p(e,t){return{value:e.boolean?"":t,method:e.boolean&&!t?"removeAttribute":"setAttribute"}}function v(e,t,n,r){var o=p(t,r);e[o.method](n,o.value)}function h(e,t,n,r,o){for(var i=t.property?[e.xtag[t.property]]:t.selector?q.query(e,t.selector):[],a=i.length;a--;)i[a][o](n,r)}function m(e,t,n){e.__view__&&e.__view__.updateBindingValue(e,t,n)}function _(e,t,n,r,o,i){var a=n.split(":"),s=a[0];if("get"==s)a[0]=t,e.prototype[t].get=q.applyPseudos(a.join(":"),r[n],e.pseudos);else if("set"==s){a[0]=t;var c=e.prototype[t].set=q.applyPseudos(a.join(":"),o?function(e){this.xtag._skipSet=!0,this.xtag._skipAttr||v(this,o,i,e),this.xtag._skipAttr&&o.skip&&delete this.xtag._skipAttr,r[n].call(this,o.boolean?!!e:e),m(this,i,e),delete this.xtag._skipSet}:r[n]?function(e){r[n].call(this,e),m(this,i,e)}:null,e.pseudos);o&&(o.setter=c)}else e.prototype[t][n]=r[n]}function g(e,t){e.prototype[t]={};var n=e.accessors[t],r=n.attribute,o=r&&r.name?r.name.toLowerCase():t;r&&(r.key=t,e.attributes[o]=r);for(var i in n)_(e,t,i,n,r,o);if(r){if(!e.prototype[t].get){var a=(r.boolean?"has":"get")+"Attribute";e.prototype[t].get=function(){return this[a](o)}}e.prototype[t].set||(e.prototype[t].set=function(e){v(this,r,o,e),m(this,o,e)})}}function b(e,t,n){e.__tap__||(e.__tap__={click:"mousedown"==n.type},e.__tap__.click?e.addEventListener("click",t.observer):(e.__tap__.scroll=t.observer.bind(e),window.addEventListener("scroll",e.__tap__.scroll,!0),e.addEventListener("touchmove",t.observer),e.addEventListener("touchcancel",t.observer),e.addEventListener("touchend",t.observer))),e.__tap__.click||(e.__tap__.x=n.touches[0].pageX,e.__tap__.y=n.touches[0].pageY)}function y(e,t){e.__tap__&&(e.__tap__.click?e.removeEventListener("click",t.observer):(window.removeEventListener("scroll",e.__tap__.scroll,!0),e.removeEventListener("touchmove",t.observer),e.removeEventListener("touchcancel",t.observer),e.removeEventListener("touchend",t.observer)),delete e.__tap__)}function w(e,t,n){var r=n.changedTouches[0];return r.pageXe.__tap__.x-t.gesture.tolerance&&r.pageYe.__tap__.y-t.gesture.tolerance?!0:void 0}var E=window,L=document,O=function(){},N=function(){return!0},k=/([\w-]+(?:\([^\)]+\))?)/g,A=/(\w*)(?:\(([^\)]*)\))?/,M=/(\d+)/g,T={action:function(e,t){return e.value.match(M).indexOf(t.keyCode+"")>-1==("keypass"==e.name)||null}},C=function(){var e=E.getComputedStyle(L.documentElement,""),t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.OLink&&["","o"])[1];return{dom:"ms"==t?"MS":t,lowercase:t,css:"-"+t+"-",js:"ms"==t?t:t[0].toUpperCase()+t.substr(1)}}(),D=Element.prototype.matchesSelector||Element.prototype[C.lowercase+"MatchesSelector"],x=E.MutationObserver||E[C.js+"MutationObserver"],S={},P=S.toString,R=/\s([a-zA-Z]+)/;t.object=function(e){var n={};for(var r in e)n[r]=t(e[r]);return n},t.array=function(e){for(var n=e.length,r=Array(n);n--;)r[n]=t(e[n]);return r};var U=["undefined","null","number","boolean","string","function"],I="",j={};for(var H in document.createEvent("CustomEvent"))j[H]=1;var q={tags:{},defaultOptions:{pseudos:[],mixins:[],events:{},methods:{},accessors:{},lifecycle:{},attributes:{},prototype:{xtag:{get:function(){return this.__xtag__?this.__xtag__:this.__xtag__={data:{}}}}}},register:function(e,t){var r;if("string"==typeof e){r=e.toLowerCase();var o=t.prototype;delete t.prototype;var i=q.tags[r]=s(q.merge({},q.defaultOptions,t));for(var a in i.events)i.events[a]=q.parseEvent(a,i.events[a]);for(a in i.lifecycle)i.lifecycle[a.split(":")[0]]=q.applyPseudos(a,i.lifecycle[a],i.pseudos);for(a in i.methods)i.prototype[a.split(":")[0]]={value:q.applyPseudos(a,i.methods[a],i.pseudos),enumerable:!0};for(a in i.accessors)g(i,a);var c=i.lifecycle.created||i.lifecycle.ready;i.prototype.createdCallback={enumerable:!0,value:function(){var e=this;q.addEvents(this,i.events),i.mixins.forEach(function(t){q.mixins[t].events&&q.addEvents(e,q.mixins[t].events)});var t=c?c.apply(this,n(arguments)):null;for(var r in i.attributes){var o=i.attributes[r],a=this.hasAttribute(r);(a||o.boolean)&&(this[o.key]=o.boolean?a:this.getAttribute(r))}return i.pseudos.forEach(function(t){t.onAdd.call(e,t)}),t}},i.lifecycle.inserted&&(i.prototype.enteredViewCallback={value:i.lifecycle.inserted,enumerable:!0}),i.lifecycle.removed&&(i.prototype.leftDocumentCallback={value:i.lifecycle.removed,enumerable:!0}),i.lifecycle.attributeChanged&&(i.prototype.attributeChangedCallback={value:i.lifecycle.attributeChanged,enumerable:!0});var u=i.prototype.setAttribute||HTMLElement.prototype.setAttribute;i.prototype.setAttribute={writable:!0,enumberable:!0,value:function(e,t){var n=i.attributes[e.toLowerCase()];this.xtag._skipAttr||u.call(this,e,n&&n.boolean?"":t),n&&(n.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,n.setter.call(this,n.boolean?!0:t)),t=n.skip?n.boolean?this.hasAttribute(e):this.getAttribute(e):t,h(this,n,e,n.boolean?"":t,"setAttribute")),delete this.xtag._skipAttr}};var l=i.prototype.removeAttribute||HTMLElement.prototype.removeAttribute;i.prototype.removeAttribute={writable:!0,enumberable:!0,value:function(e){var t=i.attributes[e.toLowerCase()];this.xtag._skipAttr||l.call(this,e),t&&(t.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,t.setter.call(this,t.boolean?!1:void 0)),h(this,t,e,void 0,"removeAttribute")),delete this.xtag._skipAttr}};var d=o?o:t["extends"]?Object.create(L.createElement(t["extends"]).constructor).prototype:E.HTMLElement.prototype;return L.register(r,{"extends":t["extends"],prototype:Object.create(d,i.prototype)})}},mixins:{},prefix:C,touches:{active:[],changed:[]},captureEvents:["focus","blur","scroll","underflow","overflow","overflowchanged"],customEvents:{overflow:l("over"),underflow:l("under"),animationstart:{attach:[C.dom+"AnimationStart"]},animationend:{attach:[C.dom+"AnimationEnd"]},transitionend:{attach:[C.dom+"TransitionEnd"]},move:{attach:["mousemove","touchmove"],condition:u},enter:{attach:["mouseover","touchenter"],condition:u},leave:{attach:["mouseout","touchleave"],condition:u},tapstart:{observe:{mousedown:L,touchstart:L},condition:u},tapend:{observe:{mouseup:L,touchend:L},condition:u},tapmove:{attach:["tapstart","dragend","touchcancel"],condition:function(e,t){switch(e.type){case"move":return!0;case"dragover":var n=t.lastDrag||{};return t.lastDrag=e,n.pageX!=e.pageX&&n.pageY!=e.pageY||null;case"tapstart":t.touches=t.touches||1,t.move||(t.current=this,t.move=q.addEvents(this,{move:t.listener,dragover:t.listener}),t.tapend=q.addEvent(L,"tapend",t.listener));break;case"tapend":case"dragend":case"touchcancel":t.touches--,t.touches||(q.removeEvents(t.current,t.move||{}),q.removeEvent(L,t.tapend||{}),delete t.lastDrag,delete t.current,delete t.tapend,delete t.move)}}}},pseudos:{keypass:T,keyfail:T,delegate:{action:c},within:{action:c,onAdd:function(e){var t=e.source.condition;t&&(e.source.condition=function(n,r){return q.query(this,e.value).filter(function(e){return e==n.target||e.contains?e.contains(n.target):null})[0]?t.call(this,n,r):null})}},preventable:{action:function(e,t){return!t.defaultPrevented}}},clone:t,typeOf:e,toArray:n,wrap:function(e,t){return function(){var r=n(arguments),o=e.apply(this,r);return o===!1?!1:t.apply(this,o!==void 0?n(o):r)}},merge:function(t,n,r){if("string"==e(n))return i(t,n,r);for(var o=1,a=arguments.length;a>o;o++){var s=arguments[o];for(var c in s)i(t,c,s[c])}return t},uid:function(){return Math.random().toString(36).substr(2,10)},query:r,skipTransition:function(e,t,n){var r=C.js+"TransitionProperty";e.style[r]=e.style.transitionProperty="none",q.requestFrame(function(){var o;t&&(o=t.call(n)),q.requestFrame(function(){e.style[r]=e.style.transitionProperty="",o&&q.requestFrame(o)})})},requestFrame:function(){var e=E.requestAnimationFrame||E[C.lowercase+"RequestAnimationFrame"]||function(e){return E.setTimeout(e,20)};return function(t){return e.call(E,t)}}(),matchSelector:function(e,t){return D.call(e,t)},set:function(e,t,n){e[t]=n,window.CustomElements&&CustomElements.upgradeAll(e)},innerHTML:function(e,t){q.set(e,"innerHTML",t)},hasClass:function(e,t){return e.className.split(" ").indexOf(t.trim())>-1},addClass:function(e,t){var n=e.className.trim().split(" ");return t.trim().split(" ").forEach(function(e){~n.indexOf(e)||n.push(e)}),e.className=n.join(" ").trim(),e},removeClass:function(e,t){var n=t.trim().split(" ");return e.className=e.className.trim().split(" ").filter(function(e){return e&&!~n.indexOf(e)}).join(" "),e},toggleClass:function(e,t){return q[q.hasClass(e,t)?"removeClass":"addClass"].call(null,e,t)},queryChildren:function(e,t){var r=e.id,o=e.id=r||"x_"+q.uid(),i="#"+o+" > ";t=i+(t+"").replace(",",","+i,"g");var a=e.parentNode.querySelectorAll(t);return r||e.removeAttribute("id"),n(a)},createFragment:function(e){var t=L.createDocumentFragment();if(e){for(var r=t.appendChild(L.createElement("div")),o=n(e.nodeName?arguments:!(r.innerHTML=e)||r.children),i=o.length,a=0;i>a;)t.insertBefore(o[a++],r);t.removeChild(r)}return t},manipulate:function(e,t){var n=e.nextSibling,r=e.parentNode,o=L.createDocumentFragment(),i=t.call(o.appendChild(e),o)||e;n?r.insertBefore(i,n):r.appendChild(i)},applyPseudos:function(e,t,r,o){var i=t,a={};if(e.match(":"))for(var s=e.match(k),c=s.length;--c;)s[c].replace(A,function(t,u,l){if(!q.pseudos[u])throw"pseudo not found: "+u+" "+s;var d=a[c]=Object.create(q.pseudos[u]);d.key=e,d.name=u,d.value=l,d.arguments=(l||"").split(","),d.action=d.action||N,d.source=o;var f=i;i=function(){var t=n(arguments),r={key:e,name:u,value:l,source:o,listener:f},i=d.action.apply(this,[r].concat(t)); -return null===i||i===!1?i:r.listener.apply(this,t)},r&&d.onAdd&&(r.getAttribute?d.onAdd.call(r,d):r.push(d))});for(var u in a)a[u].onCompiled&&(i=a[u].onCompiled(i,a[u])||i);return i},removePseudos:function(e,t){t._pseudos.forEach(function(t){t.onRemove&&t.onRemove.call(e,t)})},parseEvent:function(e,t){var r=e.split(":"),o=r.shift(),i=q.customEvents[o],a=q.merge({type:o,stack:O,condition:N,attach:[],_attach:[],pseudos:"",_pseudos:[],onAdd:O,onRemove:O},i||{});a.attach=n(a.base||a.attach),a.chain=o+(a.pseudos.length?":"+a.pseudos:"")+(r.length?":"+r.join(":"):"");var s=a.condition;a.condition=function(e){return e.touches,e.targetTouches,s.apply(this,n(arguments))};var c=q.applyPseudos(a.chain,t,a._pseudos,a);if(a.stack=function(e){e.touches,e.targetTouches;var t=e.detail||{};return t.__stack__?t.__stack__==c?(e.stopPropagation(),e.cancelBubble=!0,c.apply(this,n(arguments))):void 0:c.apply(this,n(arguments))},a.listener=function(e){var t=n(arguments),r=a.condition.apply(this,t.concat([a]));return r?e.type==o?a.stack.apply(this,t):(q.fireEvent(e.target,o,{baseEvent:e,detail:{__stack__:c}}),void 0):r},a.attach.forEach(function(e){a._attach.push(q.parseEvent(e,a.listener))}),i&&i.observe&&!i.__observing__){i.observer=function(e){var t=a.condition.apply(this,n(arguments).concat([i]));return t?(q.fireEvent(e.target,o,{baseEvent:e}),void 0):t};for(var u in i.observe)q.addEvent(i.observe[u]||document,u,i.observer,!0);i.__observing__=!0}return a},addEvent:function(e,t,n,r){var o="function"==typeof n?q.parseEvent(t,n):n;return o._pseudos.forEach(function(t){t.onAdd.call(e,t)}),o._attach.forEach(function(t){q.addEvent(e,t.type,t)}),o.onAdd.call(e,o,o.listener),e.addEventListener(o.type,o.stack,r||q.captureEvents.indexOf(o.type)>-1),o},addEvents:function(e,t){var n={};for(var r in t)n[r]=q.addEvent(e,r,t[r]);return n},removeEvent:function(e,t,n){n=n||t,n.onRemove.call(e,n,n.listener),q.removePseudos(e,n),n._attach.forEach(function(t){q.removeEvent(e,t)}),e.removeEventListener(n.type,n.stack)},removeEvents:function(e,t){for(var n in t)q.removeEvent(e,t[n])},fireEvent:function(e,t,n,r){var o=L.createEvent("CustomEvent");n=n||{},r&&console.warn("fireEvent has been modified, more info here: "),o.initCustomEvent(t,n.bubbles!==!1,n.cancelable!==!1,n.detail),n.baseEvent&&f(o,n.baseEvent);try{e.dispatchEvent(o)}catch(i){console.warn("This error may have been caused by a change in the fireEvent method, more info here: ",i)}},addObserver:function(e,t,n){e._records||(e._records={inserted:[],removed:[]},x?(e._observer=new x(function(t){o(e,t)}),e._observer.observe(e,{subtree:!0,childList:!0,attributes:!!0,characterData:!1})):["Inserted","Removed"].forEach(function(t){e.addEventListener("DOMNode"+t,function(n){n._mutation=!0,e._records[t.toLowerCase()].forEach(function(e){e(n.target,n)})},!1)})),-1==e._records[t].indexOf(n)&&e._records[t].push(n)},removeObserver:function(e,t,n){var r=e._records;r&&n?r[t].splice(r[t].indexOf(n),1):r[t]=[]}},F=0,V=null;L.addEventListener("mousedown",function(e){F++,V=e.target},!0),L.addEventListener("mouseup",function(){F--,V=null},!1);var Y={touches:{configurable:!0,get:function(){return this.__touches__||(this.identifier=0)||(this.__touches__=F?[this]:[])}},targetTouches:{configurable:!0,get:function(){return this.__targetTouches__||(this.__targetTouches__=F&&this.currentTarget&&(this.currentTarget==V||this.currentTarget.contains&&this.currentTarget.contains(V))?[this]:[])}},changedTouches:{configurable:!0,get:function(){return this.touches}}};for(H in Y)UIEvent.prototype[H]=Y[H],Object.defineProperty(UIEvent.prototype,H,Y[H]);var X={value:null,writable:!0,configurable:!0},B={touches:X,targetTouches:X,changedTouches:X};if(E.TouchEvent)for(H in B)E.TouchEvent.prototype[H]=B[H];q.customEvents.tap={observe:{mousedown:document,touchstart:document},gesture:{tolerance:8},condition:function(e,t){var n=e.target;switch(e.type){case"touchstart":return n.__tap__&&n.__tap__.click&&y(n,t),b(n,t,e),void 0;case"mousedown":return n.__tap__||b(n,t,e),void 0;case"scroll":case"touchcancel":return y(this,t),void 0;case"touchmove":case"touchend":return this.__tap__&&!w(this,t,e)?(y(this,t),void 0):"touchend"==e.type||null;case"click":return y(this,t),!0}}},E.xtag=q,"function"==typeof define&&define.amd&&define(q),L.addEventListener("WebComponentsReady",function(){q.fireEvent(L.body,"DOMComponentsLoaded")})}(); - +window.Platform={};var logFlags={};(function(){function e(e){if(this._element=e,e.className!=this._classCache){if(this._classCache=e.className,!this._classCache)return;var t,n=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(t=0;n.length>t;t++)a.call(this,n[t])}}function t(e,t){e.className=t.join(" ")}function n(e,t,n){Object.defineProperty?Object.defineProperty(e,t,{get:n}):e.__defineGetter__(t,n)}if(!(window.Element===void 0||"classList"in document.documentElement)){var r=Array.prototype,o=r.indexOf,i=r.slice,a=r.push,s=r.splice,c=r.join;e.prototype={add:function(e){this.contains(e)||(a.call(this,e),t(this._element,i.call(this,0)))},contains:function(e){return-1!==o.call(this,e)},item:function(e){return this[e]||null},remove:function(e){var n=o.call(this,e);-1!==n&&(s.call(this,n,1),t(this._element,i.call(this,0)))},toString:function(){return c.call(this," ")},toggle:function(e){-1===o.call(this,e)?this.add(e):this.remove(e)}},window.DOMTokenList=e,n(Element.prototype,"classList",function(){return new e(this)})}})(),"undefined"==typeof WeakMap&&function(){var e=Object.defineProperty,t=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.prototype={set:function(t,n){var r=t[this.name];r&&r[0]===t?r[1]=n:e(t,this.name,{value:[t,n],writable:!0})},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){this.set(e,void 0)}},window.WeakMap=n}();var SideTable;if("undefined"!=typeof WeakMap&&0>navigator.userAgent.indexOf("Firefox/")?SideTable=WeakMap:function(){var e=Object.defineProperty,t=Date.now()%1e9;SideTable=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")},SideTable.prototype={set:function(t,n){var r=t[this.name];r&&r[0]===t?r[1]=n:e(t,this.name,{value:[t,n],writable:!0})},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){this.set(e,void 0)}}}(),function(e){function t(e){y.push(e),b||(b=!0,m(r))}function n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function r(){b=!1;var e=y;y=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var n=e.takeRecords();o(e),n.length&&(e.callback_(n,e),t=!0)}),t&&r()}function o(e){e.nodes_.forEach(function(t){var n=h.get(t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function i(e,t){for(var n=e;n;n=n.parentNode){var r=h.get(n);if(r)for(var o=0;r.length>o;o++){var i=r[o],a=i.options;if(n===e||a.subtree){var s=t(a);s&&i.enqueue(s)}}}}function a(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++w}function s(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function c(e){var t=new s(e.type,e.target);return t.addedNodes=e.addedNodes.slice(),t.removedNodes=e.removedNodes.slice(),t.previousSibling=e.previousSibling,t.nextSibling=e.nextSibling,t.attributeName=e.attributeName,t.attributeNamespace=e.attributeNamespace,t.oldValue=e.oldValue,t}function u(e,t){return E=new s(e,t)}function d(e){return O?O:(O=c(E),O.oldValue=e,O)}function l(){E=O=void 0}function f(e){return e===O||e===E}function v(e,t){return e===t?e:O&&f(e)?O:null}function p(e,t,n){this.observer=e,this.target=t,this.options=n,this.transientObservedNodes=[]}var h=new SideTable,m=window.msSetImmediate;if(!m){var _=[],g=Math.random()+"";window.addEventListener("message",function(e){if(e.data===g){var t=_;_=[],t.forEach(function(e){e()})}}),m=function(e){_.push(e),window.postMessage(g,"*")}}var b=!1,y=[],w=0;a.prototype={observe:function(e,t){if(e=n(e),!t.childList&&!t.attributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilter&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characterData)throw new SyntaxError;var r=h.get(e);r||h.set(e,r=[]);for(var o,i=0;r.length>i;i++)if(r[i].observer===this){o=r[i],o.removeListeners(),o.options=t;break}o||(o=new p(this,e,t),r.push(o),this.nodes_.push(e)),o.addListeners()},disconnect:function(){this.nodes_.forEach(function(e){for(var t=h.get(e),n=0;t.length>n;n++){var r=t[n];if(r.observer===this){r.removeListeners(),t.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}};var E,O;p.prototype={enqueue:function(e){var n=this.observer.records_,r=n.length;if(n.length>0){var o=n[r-1],i=v(o,e);if(i)return n[r-1]=i,void 0}else t(this.observer);n[r]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=h.get(e);t||h.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=h.get(e),n=0;t.length>n;n++)if(t[n]===this){t.splice(n,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,n=e.relatedNode.namespaceURI,r=e.target,o=new u("attributes",r);o.attributeName=t,o.attributeNamespace=n;var a=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;i(r,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.length&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(n)?void 0:e.attributeOldValue?d(a):o});break;case"DOMCharacterDataModified":var r=e.target,o=u("characterData",r),a=e.prevValue;i(r,function(e){return e.characterData?e.characterDataOldValue?d(a):o:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var s,c,r=e.relatedNode,f=e.target;"DOMNodeInserted"===e.type?(s=[f],c=[]):(s=[],c=[f]);var v=f.previousSibling,p=f.nextSibling,o=u("childList",r);o.addedNodes=s,o.removedNodes=c,o.previousSibling=v,o.nextSibling=p,i(r,function(e){return e.childList?o:void 0})}l()}},e.JsMutationObserver=a}(this),!window.MutationObserver&&(window.MutationObserver=window.WebKitMutationObserver||window.JsMutationObserver,!MutationObserver))throw Error("no mutation observer support");(function(e){function t(t,i){var a=i||{};if(!t)throw Error("document.register: first argument `name` must not be empty");if(0>t.indexOf("-"))throw Error("document.register: first argument ('name') must contain a dash ('-'). Argument provided was '"+(t+"")+"'.");if(a.name=t,!a.prototype)throw Error("Options missing required prototype property");return a.lifecycle=a.lifecycle||{},a.ancestry=n(a.extends),r(a),o(a),d(a.prototype),f(t,a),a.ctor=v(a),a.ctor.prototype=a.prototype,a.prototype.constructor=a.ctor,e.ready&&e.upgradeAll(document),a.ctor}function n(e){var t=w[e];return t?n(t.extends).concat([t]):[]}function r(e){for(var t,n=e.extends,r=0;t=e.ancestry[r];r++)n=t.is&&t.tag;e.tag=n||e.name,n&&(e.is=e.name)}function o(e){if(!Object.__proto__){var t=HTMLElement.prototype;if(e.is){var n=document.createElement(e.tag);t=Object.getPrototypeOf(n)}for(var r,o=e.prototype;o&&o!==t;){var r=Object.getPrototypeOf(o);o.__proto__=r,o=r}}e.native=t}function i(e){return a(E(e.tag),e)}function a(t,n){return n.is&&t.setAttribute("is",n.is),s(t,n),t.__upgraded__=!0,e.upgradeSubtree(t),u(t),t}function s(e,t){Object.__proto__?e.__proto__=t.prototype:(c(e,t.prototype,t.native),e.__proto__=t.prototype)}function c(e,t,n){for(var r={},o=t;o!==n&&o!==HTMLUnknownElement.prototype;){for(var i,a=Object.getOwnPropertyNames(o),s=0;i=a[s];s++)r[i]||(Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(o,i)),r[i]=1);o=Object.getPrototypeOf(o)}}function u(e){e.createdCallback&&e.createdCallback()}function d(e){var t=e.setAttribute;e.setAttribute=function(e,n){l.call(this,e,n,t)};var n=e.removeAttribute;e.removeAttribute=function(e,t){l.call(this,e,t,n)}}function l(e,t,n){var r=this.getAttribute(e);n.apply(this,arguments),this.attributeChangedCallback&&this.getAttribute(e)!==r&&this.attributeChangedCallback(e,r)}function f(e,t){w[e]=t}function v(e){return function(){return i(e)}}function p(e,t){var n=w[t||e];return n?new n.ctor:E(e)}function h(e){if(!e.__upgraded__&&e.nodeType===Node.ELEMENT_NODE){var t=e.getAttribute("is")||e.localName,n=w[t];return n&&a(e,n)}}function m(t){var n=O.call(this,t);return e.upgradeAll(n),n}e||(e=window.CustomElements={flags:{}});var _=e.flags,g=Boolean(document.register),b=!_.register&&g;if(b){var y=function(){};e.registry={},e.upgradeElement=y,e.watchShadow=y,e.upgrade=y,e.upgradeAll=y,e.upgradeSubtree=y,e.observeDocument=y,e.upgradeDocument=y,e.takeRecords=y}else{var w={},E=document.createElement.bind(document),O=Node.prototype.cloneNode;document.register=t,document.createElement=p,Node.prototype.cloneNode=m,e.registry=w,e.upgrade=h}e.hasNative=g,e.useNative=b})(window.CustomElements),function(e){function t(e,n,r){var o=e.firstElementChild;if(!o)for(o=e.firstChild;o&&o.nodeType!==Node.ELEMENT_NODE;)o=o.nextSibling;for(;o;)n(o,r)!==!0&&t(o,n,r),o=o.nextElementSibling;return null}function n(e,t){for(var n=e.shadowRoot;n;)r(n,t),n=n.olderShadowRoot}function r(e,r){t(e,function(e){return r(e)?!0:(n(e,r),void 0)}),n(e,r)}function o(e){return s(e)?(c(e),!0):(l(e),void 0)}function i(e){r(e,function(e){return o(e)?!0:void 0})}function a(e){return o(e)||i(e)}function s(t){if(!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var n=t.getAttribute("is")||t.localName,r=e.registry[n];if(r)return L.dom&&console.group("upgrade:",t.localName),e.upgrade(t),L.dom&&console.groupEnd(),!0}}function c(e){l(e),h(e)&&r(e,function(e){l(e)})}function u(e){if(M.push(e),!k){k=!0;var t=window.Platform&&window.Platform.endOfMicrotask||setTimeout;t(d)}}function d(){k=!1;for(var e,t=M,n=0,r=t.length;r>n&&(e=t[n]);n++)e();M=[]}function l(e){N?u(function(){f(e)}):f(e)}function f(e){(e.enteredViewCallback||e.__upgraded__&&L.dom)&&(L.dom&&console.group("inserted:",e.localName),h(e)&&(e.__inserted=(e.__inserted||0)+1,1>e.__inserted&&(e.__inserted=1),e.__inserted>1?L.dom&&console.warn("inserted:",e.localName,"insert/remove count:",e.__inserted):e.enteredViewCallback&&(L.dom&&console.log("inserted:",e.localName),e.enteredViewCallback())),L.dom&&console.groupEnd())}function v(e){p(e),r(e,function(e){p(e)})}function p(e){N?u(function(){_removed(e)}):_removed(e)}function p(e){(e.leftViewCallback||e.__upgraded__&&L.dom)&&(L.dom&&console.log("removed:",e.localName),h(e)||(e.__inserted=(e.__inserted||0)-1,e.__inserted>0&&(e.__inserted=0),0>e.__inserted?L.dom&&console.warn("removed:",e.localName,"insert/remove count:",e.__inserted):e.leftViewCallback&&e.leftViewCallback()))}function h(e){for(var t=e,n=window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(document)||document;t;){if(t==n)return!0;t=t.parentNode||t.host}}function m(e){if(e.shadowRoot&&!e.shadowRoot.__watched){L.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)_(t),t=t.olderShadowRoot}}function _(e){e.__watched||(w(e),e.__watched=!0)}function g(e){switch(e.localName){case"style":case"script":case"template":case void 0:return!0}}function b(e){if(L.dom){var t=e[0];if(t&&"childList"===t.type&&t.addedNodes&&t.addedNodes){for(var n=t.addedNodes[0];n&&n!==document&&!n.host;)n=n.parentNode;var r=n&&(n.URL||n._URL||n.host&&n.host.localName)||"";r=r.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",e.length,r||"")}e.forEach(function(e){"childList"===e.type&&(A(e.addedNodes,function(e){g(e)||a(e)}),A(e.removedNodes,function(e){g(e)||v(e)}))}),L.dom&&console.groupEnd()}function y(){b(C.takeRecords()),d()}function w(e){C.observe(e,{childList:!0,subtree:!0})}function E(e){w(e)}function O(e){L.dom&&console.group("upgradeDocument: ",(e.URL||e._URL||"").split("/").pop()),a(e),L.dom&&console.groupEnd()}var L=window.logFlags||{},N=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;e.hasPolyfillMutations=N;var k=!1,M=[],C=new MutationObserver(b),A=Array.prototype.forEach.call.bind(Array.prototype.forEach);e.watchShadow=m,e.upgradeAll=a,e.upgradeSubtree=i,e.observeDocument=E,e.upgradeDocument=O,e.takeRecords=y}(window.CustomElements),function(){function e(e){return"link"===e.localName&&e.getAttribute("rel")===t}var t=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none",n={selectors:["link[rel="+t+"]"],map:{link:"parseLink"},parse:function(e){if(!e.__parsed){e.__parsed=!0;var t=e.querySelectorAll(n.selectors);r(t,function(e){n[n.map[e.localName]](e)}),CustomElements.upgradeDocument(e),CustomElements.observeDocument(e)}},parseLink:function(t){e(t)&&this.parseImport(t)},parseImport:function(e){e.content&&n.parse(e.content)}},r=Array.prototype.forEach.call.bind(Array.prototype.forEach);CustomElements.parser=n}(),function(){function e(){CustomElements.parser.parse(document),CustomElements.upgradeDocument(document);var e=window.Platform&&Platform.endOfMicrotask?Platform.endOfMicrotask:setTimeout;e(function(){CustomElements.ready=!0,CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.body.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}if("function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e){var t=document.createEvent("HTMLEvents");return t.initEvent(e,!0,!0),t}),"complete"===document.readyState)e();else{var t=window.HTMLImports?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(t,e)}}(),function(){function e(e){var t=R.call(e);return j[t]||(j[t]=t.match(I)[1].toLowerCase())}function t(n,r){var o=t[r||e(n)];return o?o(n):n}function n(t){return-1==F.indexOf(e(t))?Array.prototype.slice.call(t,0):[t]}function r(e,t){return(t||V).length?n(e.querySelectorAll(t)):[]}function o(e,t){var n={added:[],removed:[]};t.forEach(function(t){t._mutation=!0;for(var r in n)for(var o=e._records["added"==r?"inserted":"removed"],i=t[r+"Nodes"],a=i.length,s=0;a>s&&-1==n[r].indexOf(i[s]);s++)n[r].push(i[s]),o.forEach(function(e){e(i[s],t)})})}function i(n,r,o){var i=e(o);return"object"==i&&"object"==e(n[r])?Y.merge(n[r],o):n[r]=t(o,i),n}function a(e,t,n,r,o){o[t]="function"!=typeof o[t]?r:Y.wrap(o[t],Y.applyPseudos(n,r,e.pseudos))}function s(e,t,n,r){if(r){var o={};for(var i in n)o[i.split(":")[0]]=i;for(i in t)a(e,o[i.split(":")[0]]||i,i,t[i],n)}else for(var s in t)a(e,s+":__mixin__("+q++ +")",s,t[s],n)}function c(e){return e.mixins.forEach(function(t){var n=Y.mixins[t];for(var r in n){var o=n[r],i=e[r];if(i)switch(r){case"accessors":case"prototype":for(var a in o)i[a]?s(e,o[a],i[a],!0):i[a]=o[a];break;default:s(e,o,i,"events"!=r)}else e[r]=o}}),e}function u(e,t){var n,r=t.target;if(Y.matchSelector(r,e.value))n=r;else if(Y.matchSelector(r,e.value+" *"))for(var o=r.parentNode;!n;)Y.matchSelector(o,e.value)&&(n=o),o=o.parentNode;return n?e.listener=e.listener.bind(n):null}function d(e){if(e.type.match("touch"))e.target.__touched__=!0;else if(e.target.__touched__&&e.type.match("mouse"))return delete e.target.__touched__,void 0;return!0}function l(e){var t="over"==e;return{attach:"OverflowEvent"in L?"overflowchanged":[],condition:function(n){return n.flow=e,n.type==e+"flow"||0===n.orient&&n.horizontalOverflow==t||1==n.orient&&n.verticalOverflow==t||2==n.orient&&n.horizontalOverflow==t&&n.verticalOverflow==t}}}function f(e,t,n,r){r?t[e]=n[e]:Object.defineProperty(t,e,{writable:!0,enumerable:!0,value:n[e]})}function v(e,t){var n=Object.getOwnPropertyDescriptor(e,"target");for(var r in t)H[r]||f(r,e,t,n);e.baseEvent=t}function p(e,t){return{value:e.boolean?"":t,method:e.boolean&&!t?"removeAttribute":"setAttribute"}}function h(e,t,n,r){var o=p(t,r);e[o.method](n,o.value)}function m(e,t,n,r,o){for(var i=t.property?[e.xtag[t.property]]:t.selector?Y.query(e,t.selector):[],a=i.length;a--;)i[a][o](n,r)}function _(e,t,n){e.__view__&&e.__view__.updateBindingValue(e,t,n)}function g(e,t,n,r,o,i){var a=n.split(":"),s=a[0];if("get"==s)a[0]=t,e.prototype[t].get=Y.applyPseudos(a.join(":"),r[n],e.pseudos);else if("set"==s){a[0]=t;var c=e.prototype[t].set=Y.applyPseudos(a.join(":"),o?function(e){this.xtag._skipSet=!0,this.xtag._skipAttr||h(this,o,i,e),this.xtag._skipAttr&&o.skip&&delete this.xtag._skipAttr,r[n].call(this,o.boolean?!!e:e),_(this,i,e),delete this.xtag._skipSet}:r[n]?function(e){r[n].call(this,e),_(this,i,e)}:null,e.pseudos);o&&(o.setter=c)}else e.prototype[t][n]=r[n]}function b(e,t){e.prototype[t]={};var n=e.accessors[t],r=n.attribute,o=r&&r.name?r.name.toLowerCase():t;r&&(r.key=t,e.attributes[o]=r);for(var i in n)g(e,t,i,n,r,o);if(r){if(!e.prototype[t].get){var a=(r.boolean?"has":"get")+"Attribute";e.prototype[t].get=function(){return this[a](o)}}e.prototype[t].set||(e.prototype[t].set=function(e){h(this,r,o,e),_(this,o,e)})}}function y(e){W[e]=(W[e]||[]).filter(function(t){return(t.tags=t.tags.filter(function(t){return t!=e&&!Y.tags[t]})).length||t.fn()})}function w(e,t,n){e.__tap__||(e.__tap__={click:"mousedown"==n.type},e.__tap__.click?e.addEventListener("click",t.observer):(e.__tap__.scroll=t.observer.bind(e),window.addEventListener("scroll",e.__tap__.scroll,!0),e.addEventListener("touchmove",t.observer),e.addEventListener("touchcancel",t.observer),e.addEventListener("touchend",t.observer))),e.__tap__.click||(e.__tap__.x=n.touches[0].pageX,e.__tap__.y=n.touches[0].pageY)}function E(e,t){e.__tap__&&(e.__tap__.click?e.removeEventListener("click",t.observer):(window.removeEventListener("scroll",e.__tap__.scroll,!0),e.removeEventListener("touchmove",t.observer),e.removeEventListener("touchcancel",t.observer),e.removeEventListener("touchend",t.observer)),delete e.__tap__)}function O(e,t,n){var r=n.changedTouches[0],o=t.gesture.tolerance;return r.pageXe.__tap__.x-o&&r.pageYe.__tap__.y-o?!0:void 0}var L=window,N=document,k=function(){},M=function(){return!0},C=/([\w-]+(?:\([^\)]+\))?)/g,A=/(\w*)(?:\(([^\)]*)\))?/,x=/(\d+)/g,D={action:function(e,t){return e.value.match(x).indexOf(t.keyCode+"")>-1==("keypass"==e.name)||null}},T=function(){var e=L.getComputedStyle(N.documentElement,""),t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.OLink&&["","o"])[1];return{dom:"ms"==t?"MS":t,lowercase:t,css:"-"+t+"-",js:"ms"==t?t:t[0].toUpperCase()+t.substr(1)}}(),S=Element.prototype.matchesSelector||Element.prototype[T.lowercase+"MatchesSelector"],P=L.MutationObserver||L[T.js+"MutationObserver"],j={},R=j.toString,I=/\s([a-zA-Z]+)/;t.object=function(e){var n={};for(var r in e)n[r]=t(e[r]);return n},t.array=function(e){for(var n=e.length,r=Array(n);n--;)r[n]=t(e[n]);return r};var F=["undefined","null","number","boolean","string","function"],V="",q=0,H={};for(var U in document.createEvent("CustomEvent"))H[U]=1;var W={},Y={tags:{},defaultOptions:{pseudos:[],mixins:[],events:{},methods:{},accessors:{},lifecycle:{},attributes:{},prototype:{xtag:{get:function(){return this.__xtag__?this.__xtag__:this.__xtag__={data:{}}}}}},register:function(e,t){var r;if("string"==typeof e){r=e.toLowerCase();var o=t.prototype;delete t.prototype;var i=Y.tags[r]=c(Y.merge({},Y.defaultOptions,t));for(var a in i.events)i.events[a]=Y.parseEvent(a,i.events[a]);for(a in i.lifecycle)i.lifecycle[a.split(":")[0]]=Y.applyPseudos(a,i.lifecycle[a],i.pseudos);for(a in i.methods)i.prototype[a.split(":")[0]]={value:Y.applyPseudos(a,i.methods[a],i.pseudos),enumerable:!0};for(a in i.accessors)b(i,a);var s=i.lifecycle.created||i.lifecycle.ready;i.prototype.createdCallback={enumerable:!0,value:function(){var e=this;Y.addEvents(this,i.events),i.mixins.forEach(function(t){Y.mixins[t].events&&Y.addEvents(e,Y.mixins[t].events)});var t=s?s.apply(this,n(arguments)):null;for(var r in i.attributes){var o=i.attributes[r],a=this.hasAttribute(r);(a||o.boolean)&&(this[o.key]=o.boolean?a:this.getAttribute(r))}return i.pseudos.forEach(function(t){t.onAdd.call(e,t)}),t}},i.lifecycle.inserted&&(i.prototype.enteredViewCallback={value:i.lifecycle.inserted,enumerable:!0}),i.lifecycle.removed&&(i.prototype.leftDocumentCallback={value:i.lifecycle.removed,enumerable:!0}),i.lifecycle.attributeChanged&&(i.prototype.attributeChangedCallback={value:i.lifecycle.attributeChanged,enumerable:!0});var u=i.prototype.setAttribute||HTMLElement.prototype.setAttribute;i.prototype.setAttribute={writable:!0,enumberable:!0,value:function(e,t){var n=i.attributes[e.toLowerCase()];this.xtag._skipAttr||u.call(this,e,n&&n.boolean?"":t),n&&(n.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,n.setter.call(this,n.boolean?!0:t)),t=n.skip?n.boolean?this.hasAttribute(e):this.getAttribute(e):t,m(this,n,e,n.boolean?"":t,"setAttribute")),delete this.xtag._skipAttr}};var d=i.prototype.removeAttribute||HTMLElement.prototype.removeAttribute;i.prototype.removeAttribute={writable:!0,enumberable:!0,value:function(e){var t=i.attributes[e.toLowerCase()];this.xtag._skipAttr||d.call(this,e),t&&(t.setter&&!this.xtag._skipSet&&(this.xtag._skipAttr=!0,t.setter.call(this,t.boolean?!1:void 0)),m(this,t,e,void 0,"removeAttribute")),delete this.xtag._skipAttr}};var l=o?o:t["extends"]?Object.create(N.createElement(t["extends"]).constructor).prototype:L.HTMLElement.prototype,f={prototype:Object.create(l,i.prototype)};t["extends"]&&(f["extends"]=t["extends"]);var v=N.register(r,f);return y(r),v}},ready:function(e,t){var r={tags:n(e),fn:t};r.tags.reduce(function(e,t){return Y.tags[t]?e:((W[t]=W[t]||[]).push(r),void 0)},!0)&&t()},mixins:{},prefix:T,captureEvents:["focus","blur","scroll","underflow","overflow","overflowchanged","DOMMouseScroll"],customEvents:{overflow:l("over"),underflow:l("under"),animationstart:{attach:[T.dom+"AnimationStart"]},animationend:{attach:[T.dom+"AnimationEnd"]},transitionend:{attach:[T.dom+"TransitionEnd"]},move:{attach:["mousemove","touchmove"],condition:d},enter:{attach:["mouseover","touchenter"],condition:d},leave:{attach:["mouseout","touchleave"],condition:d},scrollwheel:{attach:["DOMMouseScroll","mousewheel"],condition:function(e){return e.delta=e.wheelDelta?e.wheelDelta/40:Math.round(-1*(e.detail/3.5)),!0}},tapstart:{observe:{mousedown:N,touchstart:N},condition:d},tapend:{observe:{mouseup:N,touchend:N},condition:d},tapmove:{attach:["tapstart","dragend","touchcancel"],condition:function(e,t){switch(e.type){case"move":return!0;case"dragover":var n=t.lastDrag||{};return t.lastDrag=e,n.pageX!=e.pageX&&n.pageY!=e.pageY||null;case"tapstart":t.move||(t.current=this,t.move=Y.addEvents(this,{move:t.listener,dragover:t.listener}),t.tapend=Y.addEvent(N,"tapend",t.listener));break;case"tapend":case"dragend":case"touchcancel":e.touches.length||(t.move&&Y.removeEvents(t.current,t.move||{}),t.tapend&&Y.removeEvent(N,t.tapend||{}),delete t.lastDrag,delete t.current,delete t.tapend,delete t.move)}}}},pseudos:{__mixin__:{},keypass:D,keyfail:D,delegate:{action:u},within:{action:u,onAdd:function(e){var t=e.source.condition;t&&(e.source.condition=function(n,r){return Y.query(this,e.value).filter(function(e){return e==n.target||e.contains?e.contains(n.target):null})[0]?t.call(this,n,r):null})}},preventable:{action:function(e,t){return!t.defaultPrevented}}},clone:t,typeOf:e,toArray:n,wrap:function(e,t){return function(){var r=n(arguments),o=e.apply(this,r);return t.apply(this,r),o}},merge:function(t,n,r){if("string"==e(n))return i(t,n,r);for(var o=1,a=arguments.length;a>o;o++){var s=arguments[o];for(var c in s)i(t,c,s[c])}return t},uid:function(){return Math.random().toString(36).substr(2,10)},query:r,skipTransition:function(e,t){var n=T.js+"TransitionProperty";e.style[n]=e.style.transitionProperty="none";var r=t();return Y.requestFrame(function(){Y.requestFrame(function(){e.style[n]=e.style.transitionProperty="",r&&Y.requestFrame(r)})})},requestFrame:function(){var e=L.requestAnimationFrame||L[T.lowercase+"RequestAnimationFrame"]||function(e){return L.setTimeout(e,20)};return function(t){return e(t)}}(),cancelFrame:function(){var e=L.cancelAnimationFrame||L[T.lowercase+"CancelAnimationFrame"]||L.clearTimeout;return function(t){return e(t)}}(),matchSelector:function(e,t){return S.call(e,t)},set:function(e,t,n){e[t]=n,window.CustomElements&&CustomElements.upgradeAll(e)},innerHTML:function(e,t){Y.set(e,"innerHTML",t)},hasClass:function(e,t){return e.className.split(" ").indexOf(t.trim())>-1},addClass:function(e,t){var n=e.className.trim().split(" ");return t.trim().split(" ").forEach(function(e){~n.indexOf(e)||n.push(e)}),e.className=n.join(" ").trim(),e},removeClass:function(e,t){var n=t.trim().split(" ");return e.className=e.className.trim().split(" ").filter(function(e){return e&&!~n.indexOf(e)}).join(" "),e},toggleClass:function(e,t){return Y[Y.hasClass(e,t)?"removeClass":"addClass"].call(null,e,t)},queryChildren:function(e,t){var r=e.id,o=e.id=r||"x_"+Y.uid(),i="#"+o+" > ";t=i+(t+"").replace(",",","+i,"g");var a=e.parentNode.querySelectorAll(t);return r||e.removeAttribute("id"),n(a)},createFragment:function(e){var t=N.createDocumentFragment();if(e){for(var r=t.appendChild(N.createElement("div")),o=n(e.nodeName?arguments:!(r.innerHTML=e)||r.children),i=o.length,a=0;i>a;)t.insertBefore(o[a++],r);t.removeChild(r)}return t},manipulate:function(e,t){var n=e.nextSibling,r=e.parentNode,o=N.createDocumentFragment(),i=t.call(o.appendChild(e),o)||e;n?r.insertBefore(i,n):r.appendChild(i)},applyPseudos:function(e,t,r,o){var i=t,a={};if(e.match(":"))for(var s=e.match(C),c=s.length;--c;)s[c].replace(A,function(t,u,d){if(!Y.pseudos[u])throw"pseudo not found: "+u+" "+s;var l=a[c]=Object.create(Y.pseudos[u]);l.key=e,l.name=u,l.value=d,l.arguments=(d||"").split(","),l.action=l.action||M,l.source=o;var f=i;i=function(){var t=n(arguments),r={key:e,name:u,value:d,source:o,arguments:l.arguments,listener:f},i=l.action.apply(this,[r].concat(t));return null===i||i===!1?i:r.listener.apply(this,t)},r&&l.onAdd&&(r.nodeName?l.onAdd.call(r,l):r.push(l))});for(var u in a)a[u].onCompiled&&(i=a[u].onCompiled(i,a[u])||i);return i},removePseudos:function(e,t){t.forEach(function(t){t.onRemove&&t.onRemove.call(e,t)})},parseEvent:function(e,t){var r=e.split(":"),o=r.shift(),i=Y.customEvents[o],a=Y.merge({type:o,stack:k,condition:M,attach:[],_attach:[],pseudos:"",_pseudos:[],onAdd:k,onRemove:k},i||{});a.attach=n(a.base||a.attach),a.chain=o+(a.pseudos.length?":"+a.pseudos:"")+(r.length?":"+r.join(":"):"");var s=a.condition;a.condition=function(e){return e.touches,e.targetTouches,s.apply(this,n(arguments))};var c=Y.applyPseudos(a.chain,t,a._pseudos,a);if(a.stack=function(e){e.touches,e.targetTouches;var t=e.detail||{};return t.__stack__?t.__stack__==c?(e.stopPropagation(),e.cancelBubble=!0,c.apply(this,n(arguments))):void 0:c.apply(this,n(arguments))},a.listener=function(e){var t=n(arguments),r=a.condition.apply(this,t.concat([a]));return r?e.type==o?a.stack.apply(this,t):(Y.fireEvent(e.target,o,{baseEvent:e,detail:r!==!0&&(r.__stack__=c)?r:{__stack__:c}}),void 0):r},a.attach.forEach(function(e){a._attach.push(Y.parseEvent(e,a.listener))}),i&&i.observe&&!i.__observing__){i.observer=function(e){var t=a.condition.apply(this,n(arguments).concat([i]));return t?(Y.fireEvent(e.target,o,{baseEvent:e,detail:t!==!0?t:{}}),void 0):t};for(var u in i.observe)Y.addEvent(i.observe[u]||document,u,i.observer,!0);i.__observing__=!0}return a},addEvent:function(e,t,n,r){var o="function"==typeof n?Y.parseEvent(t,n):n;return o._pseudos.forEach(function(t){t.onAdd.call(e,t)}),o._attach.forEach(function(t){Y.addEvent(e,t.type,t)}),o.onAdd.call(e,o,o.listener),e.addEventListener(o.type,o.stack,r||Y.captureEvents.indexOf(o.type)>-1),o},addEvents:function(e,t){var n={};for(var r in t)n[r]=Y.addEvent(e,r,t[r]);return n},removeEvent:function(e,t,n){n=n||t,n.onRemove.call(e,n,n.listener),Y.removePseudos(e,n._pseudos),n._attach.forEach(function(t){Y.removeEvent(e,t)}),e.removeEventListener(n.type,n.stack)},removeEvents:function(e,t){for(var n in t)Y.removeEvent(e,t[n])},fireEvent:function(e,t,n,r){var o=N.createEvent("CustomEvent");n=n||{},r&&console.warn("fireEvent has been modified"),o.initCustomEvent(t,n.bubbles!==!1,n.cancelable!==!1,n.detail),n.baseEvent&&v(o,n.baseEvent);try{e.dispatchEvent(o)}catch(i){console.warn("This error may have been caused by a change in the fireEvent method",i)}},addObserver:function(e,t,n){e._records||(e._records={inserted:[],removed:[]},P?(e._observer=new P(function(t){o(e,t)}),e._observer.observe(e,{subtree:!0,childList:!0,attributes:!!0,characterData:!1})):["Inserted","Removed"].forEach(function(t){e.addEventListener("DOMNode"+t,function(n){n._mutation=!0,e._records[t.toLowerCase()].forEach(function(e){e(n.target,n)})},!1)})),-1==e._records[t].indexOf(n)&&e._records[t].push(n)},removeObserver:function(e,t,n){var r=e._records;r&&n?r[t].splice(r[t].indexOf(n),1):r[t]=[]}},B=!1,X=null;N.addEventListener("mousedown",function(e){B=!0,X=e.target},!0),N.addEventListener("mouseup",function(){B=!1,X=null},!0),N.addEventListener("dragend",function(){B=!1,X=null},!0);var z={touches:{configurable:!0,get:function(){return this.__touches__||(this.identifier=0)||(this.__touches__=B?[this]:[])}},targetTouches:{configurable:!0,get:function(){return this.__targetTouches__||(this.__targetTouches__=B&&this.currentTarget&&(this.currentTarget==X||this.currentTarget.contains&&this.currentTarget.contains(X))?(this.identifier=0)||[this]:[])}},changedTouches:{configurable:!0,get:function(){return this.__changedTouches__||(this.identifier=0)||(this.__changedTouches__=[this])}}};for(U in z)UIEvent.prototype[U]=z[U],Object.defineProperty(UIEvent.prototype,U,z[U]);Y.customEvents.tap={observe:{mousedown:document,touchstart:document},gesture:{tolerance:8},condition:function(e,t){var n=e.target;switch(e.type){case"touchstart":return n.__tap__&&n.__tap__.click&&E(n,t),w(n,t,e),void 0;case"mousedown":return n.__tap__||w(n,t,e),void 0;case"scroll":case"touchcancel":return E(this,t),void 0;case"touchmove":case"touchend":return this.__tap__&&!O(this,t,e)?(E(this,t),void 0):"touchend"==e.type||null;case"click":return E(this,t),!0}}},L.xtag=Y,"function"==typeof define&&define.amd&&define(Y),N.addEventListener("WebComponentsReady",function(){Y.fireEvent(N.body,"DOMComponentsLoaded")})}(); \ No newline at end of file diff --git a/package.json b/package.json index 29e5054d..f0d18f95 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "brick", - "version": "1.0.0-beta8", + "version": "0.9.0", "description": "UI Web Components for Mobile Web Apps", "main": "index.js", "scripts": {