2017-04-16 18:10:55 +00:00
< html > < head > < meta charset = "UTF-8" > < / head > < body > < div hidden = "" by-vulcanize = "" > < script > ! f u n c t i o n ( ) { f u n c t i o n e ( ) { d o c u m e n t . b o d y . r e m o v e A t t r i b u t e ( " u n r e s o l v e d " ) } w i n d o w . W e b C o m p o n e n t s ? a d d E v e n t L i s t e n e r ( " W e b C o m p o n e n t s R e a d y " , e ) : " i n t e r a c t i v e " = = = d o c u m e n t . r e a d y S t a t e | | " c o m p l e t e " = = = d o c u m e n t . r e a d y S t a t e ? e ( ) : a d d E v e n t L i s t e n e r ( " D O M C o n t e n t L o a d e d " , e ) } ( ) , w i n d o w . P o l y m e r = { S e t t i n g s : f u n c t i o n ( ) { v a r e = w i n d o w . P o l y m e r | | { } ; i f ( ! e . n o U r l S e t t i n g s ) f o r ( v a r t , r = l o c a t i o n . s e a r c h . s l i c e ( 1 ) . s p l i t ( " & " ) , i = 0 ; i < r . l e n g t h & & ( t = r [ i ] ) ; i + + ) t = t . s p l i t ( " = " ) , t [ 0 ] & & ( e [ t [ 0 ] ] = t [ 1 ] | | ! 0 ) ; r e t u r n e . w a n t S h a d o w = " s h a d o w " = = = e . d o m , e . h a s S h a d o w = B o o l e a n ( E l e m e n t . p r o t o t y p e . c r e a t e S h a d o w R o o t ) , e . n a t i v e S h a d o w = e . h a s S h a d o w & & ! w i n d o w . S h a d o w D O M P o l y f i l l , e . u s e S h a d o w = e . w a n t S h a d o w & & e . h a s S h a d o w , e . h a s N a t i v e I m p o r t s = B o o l e a n ( " i m p o r t " i n d o c u m e n t . c r e a t e E l e m e n t ( " l i n k " ) ) , e . u s e N a t i v e I m p o r t s = e . h a s N a t i v e I m p o r t s , e . u s e N a t i v e C u s t o m E l e m e n t s = ! w i n d o w . C u s t o m E l e m e n t s | | w i n d o w . C u s t o m E l e m e n t s . u s e N a t i v e , e . u s e N a t i v e S h a d o w = e . u s e S h a d o w & & e . n a t i v e S h a d o w , e . u s e P o l y f i l l P r o t o = ! e . u s e N a t i v e C u s t o m E l e m e n t s & & ! O b j e c t . _ _ p r o t o _ _ , e . h a s N a t i v e C S S P r o p e r t i e s = ! n a v i g a t o r . u s e r A g e n t . m a t c h ( " A p p l e W e b K i t / 6 0 1 " ) & & w i n d o w . C S S & & C S S . s u p p o r t s & & C S S . s u p p o r t s ( " b o x - s h a d o w " , " 0 0 0 v a r ( - - f o o ) " ) , e . u s e N a t i v e C S S P r o p e r t i e s = e . h a s N a t i v e C S S P r o p e r t i e s & & e . l a z y R e g i s t e r & & e . u s e N a t i v e C S S P r o p e r t i e s , e . i s I E = n a v i g a t o r . u s e r A g e n t . m a t c h ( " T r i d e n t " ) , e } ( ) } , f u n c t i o n ( ) { v a r e = w i n d o w . P o l y m e r ; w i n d o w . P o l y m e r = f u n c t i o n ( e ) { " f u n c t i o n " = = t y p e o f e & & ( e = e . p r o t o t y p e ) , e | | ( e = { } ) , e = t ( e ) ; v a r r = e = = = e . c o n s t r u c t o r . p r o t o t y p e ? e . c o n s t r u c t o r : n u l l , i = { p r o t o t y p e : e } ; e . e x t e n d s & & ( i . e x t e n d s = e . e x t e n d s ) , P o l y m e r . t e l e m e t r y . _ r e g i s t r a t e ( e ) ; v a r o = d o c u m e n t . r e g i s t e r E l e m e n t ( e . i s , i ) ; r e t u r n r | | o } ; v a r t = f u n c t i o n ( e ) { v a r t = P o l y m e r . B a s e ; r e t u r n e . e x t e n d s & & ( t = P o l y m e r . B a s e . _ g e t E x t e n d e d P r o t o t y p e ( e . e x t e n d s ) ) , e = P o l y m e r . B a s e . c h a i n O b j e c t ( e , t ) , e . r e g i s t e r C a l l b a c k ( ) , e } ; i f ( e ) f o r ( v a r r i n e ) P o l y m e r [ r ] = e [ r ] ; P o l y m e r . C l a s s = f u n c t i o n ( e ) { r e t u r n e . f a c t o r y I m p l | | ( e . f a c t o r y I m p l = f u n c t i o n ( ) { } ) , t ( e ) . c o n s t r u c t o r } } ( ) , P o l y m e r . t e l e m e t r y = { r e g i s t r a t i o n s : [ ] , _ r e g L o g : f u n c t i o n ( e ) { c o n s o l e . l o g ( " [ " + e . i s + " ] : r e g i s t e r e d " ) } , _ r e g i s t r a t e : f u n c t i o n ( e ) { t h i s . r e g i s t r a t i o n s . p u s h ( e ) , P o l y m e r . l o g & & t h i s . _ r e g L o g ( e ) } , d u m p R e g i s t r a t i o n s : f u n c t i o n ( ) { t h i s . r e g i s t r a t i o n s . f o r E a c h ( t h i s . _ r e g L o g ) } } , O b j e c t . d e f i n e P r o p e r t y ( w i n d o w , " c u r r e n t I m p o r t " , { e n u m e r a b l e : ! 0 , c o n f i g u r a b l e : ! 0 , g e t : f u n c t i o n ( ) { r e t u r n ( d o c u m e n t . _ c u r r e n t S c r i p t | | d o c u m e n t . c u r r e n t S c r i p t | | { } ) . o w n e r D o c u m e n t } } ) , P o l y m e r . R e n d e r S t a t u s = { _ r e a d y : ! 1 , _ c a l l b a c k s : [ ] , w h e n R e a d y : f u n c t i o n ( e ) { t h i s . _ r e a d y ? e ( ) : t h i s . _ c a l l b a c k s . p u s h ( e ) } , _ m a k e R e a d y : f u n c t i o n ( ) { t h i s . _ r e a d y = ! 0 ; f o r ( v a r e = 0 ; e < t h i s . _ c a l l b a c k s . l e n g t h ; e + + ) t h i s . _ c a l l b a c k s [ e ] ( ) ; t h i s . _ c a l l b a c k s = [ ] } , _ c a t c h F i r s t R e n d e r : f u n c t i o n ( ) { r e q u e s t A n i m a t i o n F r a m e ( f u n c t i o n ( ) { P o l y m e r . R e n d e r S t a t u s . _ m a k e R e a d y ( ) } ) } , _ a f t e r N e x t R e n d e r Q u e u e : [ ] , _ w a i t i n g N e x t R e n d e r : ! 1 , a f t e r N e x t R e n d e r : f u n c t i o n ( e , t , r ) { t h i s . _ w a t c h N e x t R e n d e r ( ) , t h i s . _ a f t e r N e x t R e n d e r Q u e u e . p u s h ( [ e , t , r ] ) } , h a s R e n d e r e d : f u n c t i o n ( ) { r e t u r n t h i s . _ r e a d y } , _ w a t c h N e x t R e n d e r : f u n c t i o n ( ) { i f ( ! t h i s . _ w a i t i n g N e x t R e n d e r ) { t h i s . _ w a i t i n g N e x t R e n d e r = ! 0 ; v a r e = f u n c t i o n ( ) { P o l y m e r . R e n d e r S t a t u s . _ f l u s h N e x t R e n d e r ( ) } ; t h i s . _ r e a d y ? r e q u e s t A n i m a t i o n F r a m e ( e ) : t h i s . w h e n R e a d y ( e ) } } , _ f l u s h N e x t R e n d e r : f u n c t i o n ( ) { v a r e = t h i s ; s e t T i m e o u t ( f u n c t i o n ( ) { e . _ f l u s h R e n d e r C a l l b a c k s ( e . _ a f t e r N e x t R e n d e r Q u e u e ) , e . _ a f t e r N e x t R e n d e r Q u e u e = [ ] , e . _ w a i t i n g N e x t R e n d e r = ! 1 } ) } , _ f l u s h R e n d e r C a l l b a c k s : f u n c t i o n ( e ) { f o r ( v a r t , r = 0 ; r < e . l e n g t h ; r + + ) t = e [ r ] , t [ 1 ] . a p p l y ( t [ 0 ] , t [ 2 ] | | P o l y m e r . n a r ) } } , w i n d o w . H T M L I m p o r t s ? H T M L I m p o r t s . w h e n R e a d y ( f u n c t i o n ( ) { P o l y m e r . R e n d e r S t a t u s . _ c a t c h F i r s t R e n d e r ( ) } ) : P o l y m e r . R e n d e r S t a t u s . _ c a t c h F i r s t R e n d e r ( ) , P o l y m e r . I m p o r t S t a t u s = P o l y m e r . R e n d e r S t a t u s , P o l y m e r . I m p o r t S t a t u s . w h e n L o a d e d = P o l y m e r . I m p o r t S t a t u s . w h e n R e a d y , f u n c t i o n ( ) { " u s e s t r i c t " ; v a r e = P o l y m e r . S e t t i n g s ; P o l y m e r . B a s e = { _ _ i s P o l y m e r I n s t a n c e _ _ : ! 0 , _ a d d F e a t u r e : f u n c t i o n ( e ) { t h i s . m i x i n ( t h i s , e ) } , r e g i s t e r C a l l b a c k : f u n c t i o n ( ) { i f ( " m a x " = = = e . l a z y R e g i s t e r ) t h i s . b e f o r e R e g i s t e r & & t h i s . b e f o r e R e g i s t e r ( ) ; e l s e { t h i s . _ d e s u g a r B e h a v i o r s ( ) ; f o r ( v a r t , r = 0 ; r < t h i s . b e h a v i o r s . l e n g t h ; r + + ) t = t h i s . b e h a v i o r s [ r ] , t . b e f o r e R e g i s t e r & & t . b e f o r e R e g i s t e r . c a l l ( t h i s ) ; t h i s . b e f o r e R e g i s t e r & & t h i s . b e f o r e R e g i s t e r ( ) } t h i s . _ r e g i s t e r F e a t u r e s ( ) , e . l a z y R e g i s t e r | | t h i s . e n s u r e R e g i s t e r F i n i s h e d ( ) } , c r e a t e d C a l l b a c k : f u n c t i o n ( ) { i f ( e . d i s a b l e U p g r a d e E n a b l e d ) { i f ( t h i s . h a s A t t r i b u t
for(var e,t=this.shadyRoot._dirtyRoots,o=0,i=t.length;o< i & & ( e = t[o]);o++)e._distributeContent();this.shadyRoot._dirtyRoots=[]},_finishDistribute:function(){if(this._useContent){if(this.shadyRoot._distributionClean=!0,h.hasInsertionPoint(this.shadyRoot))this._composeTree(),d(this.shadyRoot);else if ( this . shadyRoot . _hasDistributed ) { var e = this._composeNode(this);this._updateChildNodes(this,e)}else u . Composed . clearChildNodes ( this ) , this . appendChild ( this . shadyRoot ) ; this . shadyRoot . _hasDistributed | | a ( this ) , this . shadyRoot . _hasDistributed = !0}},elementMatches:function(e,t){return t = t||this,h.matchesSelector.call(t,e)},_resetDistribution:function(){for(var e = u.Logical.getChildNodes(this),o=0;o<e.length;o++){var i = e[o];i._destinationInsertionPoints&&(i._destinationInsertionPoints=void 0 ) , n ( i ) & & t ( i ) } for ( var s = this.shadyRoot,r=s._insertionPoints,d=0;d<r.length;d++)r[d]._distributedNodes=[]},_collectPool:function(){for(var e = [],t=u.Logical.getChildNodes(this),o=0;o<t.length;o++){var i = t[o];n(i)?e.push.apply(e,i._distributedNodes):e.push(i)}return e } , _distributePool:function ( e , t ) { for ( var i , n = e._insertionPoints,s=0,r=n.length;s<r&&(i=n[s]);s++)this._distributeInsertionPoint(i,t),o(i,this)},_distributeInsertionPoint:function(t,o){for(var i , n = !1,s=0,r=o.length;s<r;s++)(i=o[s])&&this._matchesContentSelect(i,t)&&(e(i,t),o[s]=void 0 , n = !0);if(!n)for(var d = u.Logical.getChildNodes(t),a=0;a<d.length;a++)e(d[a],t)},_composeTree:function(){this._updateChildNodes(this,this._composeNode(this));for(var e , t , o = this.shadyRoot._insertionPoints,i=0,n=o.length;i<n&&(e=o[i]);i++)t=u.Logical.getParentNode(e),t._useContent||t===this||t===this.shadyRoot||this._updateChildNodes(t,this._composeNode(t))},_composeNode:function(e){for(var t = [],o=u.Logical.getChildNodes(e.shadyRoot||e),s=0;s<o.length;s++){var r = o[s];if(n(r))for(var d = r._distributedNodes,a=0;a<d.length;a++){var l = d[a];i(r,l)&&t.push(l)}else t . push ( r ) } return t } , _updateChildNodes:function ( e , t ) { for ( var o , i = u.Composed.getChildNodes(e),n=Polymer.ArraySplice.calculateSplices(t,i),s=0,r=0;s<n.length&&(o=n[s]);s++){for(var d , a = 0;a<o.removed.length&&(d=o.removed[a]);a++)u.Composed.getParentNode(d)===e&&u.Composed.removeChild(e,d),i.splice(o.index+r,1);r-=o.addedCount}for(var o , l , s = 0;s<n.length&&(o=n[s]);s++)for(l=i[o.index],a=o.index,d;a<o.index+o.addedCount;a++)d=t[a],u.Composed.insertBefore(e,d,l),i.splice(a,0,d)},_matchesContentSelect:function(e,t){var o = t.getAttribute("select");return!o||(!(o=o.trim())||e instanceof Element & & ( ! ! / ^ ( :not \ ( ) ? [ * . # [ a-zA-Z_ | ] / . test ( o ) & & this . elementMatches ( o , e ) ) ) } , _elementAdd:function ( ) { } , _elementRemove:function ( ) { } } ) ; var c = {get:function(){var e = Polymer.dom(this).getOwnerRoot();return e & & e . host } , configurable: ! 0 } ; Object . defineProperty ( Polymer . Base , " domHost " , c ) , Polymer . BaseDescriptors . domHost = c;var _ = window.CustomElements&&!CustomElements.useNative}(),Polymer.Settings.useShadow&&Polymer.Base._addFeature({_poolContent:function(){},_beginDistribute:function(){},distributeContent:function(){},_distributeContent:function(){},_finishDistribute:function(){},_createLocalRoot:function(){this.createShadowRoot(),this.shadowRoot.appendChild(this.root),this.root=this.shadowRoot}}),Polymer.Async={_currVal:0,_lastVal:0,_callbacks:[],_twiddleContent:0,_twiddle:document.createTextNode(""),run:function(e,t){return t > 0?~setTimeout(e,t):(this._twiddle.textContent=this._twiddleContent++,this._callbacks.push(e),this._currVal++)},cancel:function(e){if(e< 0 ) clearTimeout ( ~ e ) ; else { var t = e-this._lastVal;if(t > =0){if(!this._callbacks[t])throw"invalid async handle: "+e;this._callbacks[t]=null}}},_atEndOfMicrotask:function(){for(var e=this._callbacks.length,t=0;t< e ; t + + ) { var o = this._callbacks[t];if(o)try{o()}catch(e){throw t + + , this . _callbacks . splice ( 0 , t ) , this . _lastVal + = t , this . _twiddle . textContent = this._twiddleContent++,e}}this._callbacks.splice(0,e),this._lastVal+=e}},new window . MutationObserver ( function ( ) { Polymer . Async . _atEndOfMicrotask ( ) } ) . observe ( Polymer . Async . _twiddle , { characterData: ! 0 } ) , Polymer . Debounce = function(){function e ( e , t , i ) { return e ? e . stop ( ) :e = new o ( this ) , e . go ( t , i ) , e } var t = Polymer.Async,o=function(e){t
},_configure:function(){this._configureAnnotationReferences(),this._configureInstanceProperties(),this._aboveConfig=this.mixin({},this._config);for(var e={},n=0;n< this.behaviors.length ; n + + ) this . _configureProperties ( this . behaviors [ n ] . properties , e ) ; this . _configureProperties ( t ? this . __proto__ . properties:this . properties , e ) , this . mixin ( e , this . _aboveConfig ) , this . _config = e,this._clients&&this._clients.length&&this._distributeConfig(this._config)},_configureInstanceProperties:function(){for(var t in this . _propertyEffects ) ! e & & this . hasOwnProperty ( t ) & & ( this . _configValue ( t , this [ t ] ) , delete this [ t ] ) } , _configureProperties:function ( e , t ) { for ( var n in e ) { var r = e[n];if(void 0 ! = = r . value ) { var s = r.value;"function"==typeof s & & ( s = s.call(this,this._config)),t[n]=s}}},_distributeConfig:function(e){var t = this._propertyEffects;if(t)for(var n in e ) { var r = t[n];if(r)for(var s , i = 0,o=r.length;i<o&&(s=r[i]);i++)if("annotation"===s.kind){var a = this._nodes[s.effect.index],l=s.effect.propertyName,c="attribute"==s.effect.kind,h=a._propertyEffects&&a._propertyEffects[l];if(a._configValue&&(h||!c)){var u = n===s.effect.value?e[n]:this._get(s.effect.value,e);u=this._computeFinalAnnotationValue(a,l,u,s.effect),c&&(u=a.deserialize(this.serialize(u),a._propertyInfo[l].type)),a._configValue(l,u)}}}},_afterClientsReady:function(){this._executeStaticEffects(),this._applyConfig(this._config,this._aboveConfig),this._flushHandlers()},_applyConfig:function(e,t){for(var n in e ) void 0 = ==this[n]&&this.__setProperty(n,e[n],n in t ) } , _notifyListener:function ( e , t ) { if ( ! Polymer . Bind . _isEventBogus ( t , t . target ) ) { var n , r ; if ( t . detail & & ( n = t.detail.value,r=t.detail.path),this._clientsReadied)return e . call ( this , t . target , n , r ) ; this . _queueHandler ( [ e , t . target , n , r ] ) } } , _queueHandler:function ( e ) { this . _handlers . push ( e ) } , _flushHandlers:function ( ) { for ( var e , t = this._handlers,n=0,r=t.length;n<r&&(e=t[n]);n++)e[0].call(this,e[1],e[2],e[3]);this._handlers=[]}})}(),function(){"use strict " ; var e = Polymer.Path;Polymer.Base._addFeature({notifyPath:function(e,t,n){var r = {},s=this._get(e,this,r);1===arguments.length&&(t=s),r.path&&this._notifyPath(r.path,t,n)},_notifyPath:function(e,t,n){var r = this._propertySetter(e,t);if(r!==t&&(r===r||t===t))return this . _pathEffector ( e , t ) , n | | this . _notifyPathUp ( e , t ) , ! 0 } , _getPathParts:function ( e ) { if ( Array . isArray ( e ) ) { for ( var t = [],n=0;n<e.length;n++)for(var r = e[n].toString().split("."),s=0;s<r.length;s++)t.push(r[s]);return t } return e . toString ( ) . split ( " . " ) } , set:function ( e , t , n ) { var r , s = n||this,i=this._getPathParts(e),o=i[i.length-1];if(i.length > 1){for(var a=0;a< i.length-1 ; a + + ) { var l = i[a];if(r&&"#"==l[0]?s=Polymer.Collection.get(r).getItem(l):(s=s[l],r&&parseInt(l,10)==l&&(i[a]=Polymer.Collection.get(r).getKey(s))),!s)return;r=Array.isArray(s)?s:null}if(r){var c , h , u = Polymer.Collection.get(r);"#"==o[0]?(h=o,c=u.getItem(h),o=r.indexOf(c),u.setItem(h,t)):parseInt(o,10)==o&&(c=s[o],h=u.getKey(c),i[a]=h,u.setItem(h,t))}s[o]=t,n||this._notifyPath(i.join("."),t)}else s [ e ] = t } , get:function ( e , t ) { return this . _get ( e , t ) } , _get:function ( e , t , n ) { for ( var r , s = t||this,i=this._getPathParts(e),o=0;o<i.length;o++){if(!s)return;var a = i[o];r&&"#"==a[0]?s=Polymer.Collection.get(r).getItem(a):(s=s[a],n&&r&&parseInt(a,10)==a&&(i[o]=Polymer.Collection.get(r).getKey(s))),r=Array.isArray(s)?s:null}return n & & ( n . path = i.join(".")),s},_pathEffector:function(t,n){var r = e.root(t),s=this._propertyEffects&&this._propertyEffects[r];if(s)for(var i , o = 0;o<s.length&&(i=s[o]);o++){var a = i.pathFn;a&&a.call(this,t,n,i.effect)}this._boundPaths&&this._notifyBoundPaths(t,n)},_annotationPathEffect:function(t,n,r){if(e.matches(r.value,!1,t))Polymer.Bind._annotationEffect.call(this,t,n,r);else if ( ! r . negate & & e . isDescendant ( r . value , t ) ) { var s = this._nodes[r.index];if(s&&s._notifyPath){var i = e.translate(r.value,r.name,t);s._notifyPath(i,n,!0)}}},_complexObserverPathEffect:function(t,n,r){e.matches(r.trigger.name,r.trigger.wildcard,t)&&Polymer.Bind._complexObserverEffect.call(this,t,n,r)},_computePathEffect:function(t,n,r){e.matches(r.trigger.name,r.trigger.wildcard,t)&&Polymer.Bind._computeEffect.call(this,t,n,r)},_annotatedComputationPa
_styles:[],_properties:null,customStyle:{},_styleCache:new t,_element:Polymer.DomApi.wrap(document.documentElement),addStyle:function(e){this._styles.push(e),this._properties=null},get _styleProperties(){return this._properties||(e.decorateStyles(this._styles,this),this._styles._scopeStyleProperties=null,this._properties=e.hostAndRootPropertiesForScope(this).rootProps,e.mixinCustomStyle(this._properties,this.customStyle),e.reify(this._properties)),this._properties},hasStyleProperties:function(){return Boolean(this._properties)},_needsStyleProperties:function(){},_computeStyleProperties:function(){return this._styleProperties},updateStyles:function(t){this._properties=null,t&&Polymer.Base.mixin(this.customStyle,t),this._styleCache.clear(); for(var r,s=0;s< this._styles.length ; s + + ) r = this._styles[s],r=r.__importElement||r,r._apply();n&&e.updateNativeStyleProperties(document.documentElement,this.customStyle)}}}(),function(){"use strict " ; var e = Polymer.Base.serializeValueToAttribute,t=Polymer.StyleProperties,n=Polymer.StyleTransformer,r=Polymer.StyleDefaults,s=Polymer.Settings.useNativeShadow,i=Polymer.Settings.useNativeCSSProperties;Polymer.Base._addFeature({_prepStyleProperties:function(){i||(this._ownStylePropertyNames=this._styles&&this._styles.length?t.decorateStyles(this._styles,this):null)},customStyle:null,getComputedStyleValue:function(e){return i | | this . _styleProperties | | this . _computeStyleProperties ( ) , ! i & & this . _styleProperties & & this . _styleProperties [ e ] | | getComputedStyle ( this ) . getPropertyValue ( e ) } , _setupStyleProperties:function ( ) { this . customStyle = {},this._styleCache=null,this._styleProperties=null,this._scopeSelector=null,this._ownStyleProperties=null,this._customStyle=null},_needsStyleProperties:function(){return Boolean ( ! i & & this . _ownStylePropertyNames & & this . _ownStylePropertyNames . length ) } , _validateApplyShim:function ( ) { if ( this . __applyShimInvalid ) { Polymer . ApplyShim . transform ( this . _styles , this . __proto__ ) ; var e = n.elementStyles(this);if(s){var t = this._template.content.querySelector("style");t&&(t.textContent=e)}else{var r = this._scopeStyle&&this._scopeStyle.nextSibling;r&&(r.textContent=e)}}},_beforeAttached:function(){this._scopeSelector&&!this.__stylePropertiesInvalid||!this._needsStyleProperties()||(this.__stylePropertiesInvalid=!1,this._updateStyleProperties())},_findStyleHost:function(){for(var e , t = this;e=Polymer.dom(t).getOwnerRoot();){if(Polymer.isInstance(e.host))return e . host ; t = e.host}return r } , _updateStyleProperties:function ( ) { var e , n = this._findStyleHost();n._styleProperties||n._computeStyleProperties(),n._styleCache||(n._styleCache=new Polymer . StyleCache ) ; var r = t.propertyDataFromStyles(n._styles,this),i=!this.__notStyleScopeCacheable;i&&(r.key.customStyle=this.customStyle,e=n._styleCache.retrieve(this.is,r.key,this._styles));var a = Boolean(e);a?this._styleProperties=e._styleProperties:this._computeStyleProperties(r.properties),this._computeOwnStyleProperties(),a||(e=o.retrieve(this.is,this._ownStyleProperties,this._styles));var l = Boolean(e)&&!a,c=this._applyStyleProperties(e);a||(c=c&&s?c.cloneNode(!0):c,e={style:c,_scopeSelector:this._scopeSelector,_styleProperties:this._styleProperties},i&&(r.key.customStyle={},this.mixin(r.key.customStyle,this.customStyle),n._styleCache.store(this.is,e,r.key,this._styles)),l||o.store(this.is,Object.create(e),this._ownStyleProperties,this._styles))},_computeStyleProperties:function(e){var n = this._findStyleHost();n._styleProperties||n._computeStyleProperties();var r = Object.create(n._styleProperties),s=t.hostAndRootPropertiesForScope(this);this.mixin(r,s.hostProps),e=e||t.propertyDataFromStyles(n._styles,this).properties,this.mixin(r,e),this.mixin(r,s.rootProps),t.mixinCustomStyle(r,this.customStyle),t.reify(r),this._styleProperties=r},_computeOwnStyleProperties:function(){for(var e , t = {},n=0;n<this._ownStylePropertyNames.length;n++)e=this._ownStylePropertyNames[n],t[e]=this._styleProperties[e];this._ownStyleProperties=t},_scopeCount:0,_applyStyleProperties:function(e){var n = this._scopeSelector;this._scopeSelector=e?e._scopeSelector:this.is+"-"+this.__proto__._scopeCount++;var r = t.
2017-01-30 02:43:39 +00:00
window.hassUtil.DEFAULT_ICON = 'mdi:bookmark';
window.hassUtil.OFF_STATES = ['off', 'closed', 'unlocked'];
window.hassUtil.DOMAINS_WITH_CARD = [
'climate',
'cover',
'configurator',
'input_select',
'input_slider',
'media_player',
'scene',
'script',
'weblink',
];
window.hassUtil.DOMAINS_WITH_MORE_INFO = [
'alarm_control_panel', 'automation', 'camera', 'climate', 'configurator',
'cover', 'fan', 'group', 'light', 'lock', 'media_player', 'script',
'sun', 'updater',
];
window.hassUtil.DOMAINS_WITH_NO_HISTORY = ['camera', 'configurator', 'scene'];
window.hassUtil.HIDE_MORE_INFO = [
'input_select', 'scene', 'script', 'input_slider',
];
window.hassUtil.LANGUAGE = navigator.languages ?
navigator.languages[0] : navigator.language || navigator.userLanguage;
window.hassUtil.attributeClassNames = function (stateObj, attributes) {
if (!stateObj) return '';
return attributes.map(
function (attribute) {
return attribute in stateObj.attributes ? 'has-' + attribute : '';
}
).join(' ');
};
window.hassUtil.canToggleState = function (hass, stateObj) {
var domain = window.hassUtil.computeDomain(stateObj);
if (domain === 'group') {
return stateObj.state === 'on' || stateObj.state === 'off';
}
return window.hassUtil.canToggleDomain(hass, domain);
};
window.hassUtil.canToggleDomain = function (hass, domain) {
var turnOnService;
var services = hass.config.services[domain];
if (domain === 'lock') {
turnOnService = 'lock';
} else if (domain === 'cover') {
turnOnService = 'open_cover';
} else {
turnOnService = 'turn_on';
}
return services & & turnOnService in services;
};
// Update root's child element to be newElementTag replacing another existing child if any.
// Copy attributes into the child element.
window.hassUtil.dynamicContentUpdater = function (root, newElementTag, attributes) {
var rootEl = Polymer.dom(root);
var customEl;
2017-02-25 23:03:14 +00:00
if (rootEl.lastChild & & rootEl.lastChild.tagName === newElementTag) {
2017-01-30 02:43:39 +00:00
customEl = rootEl.lastChild;
} else {
if (rootEl.lastChild) {
rootEl.removeChild(rootEl.lastChild);
}
customEl = document.createElement(newElementTag);
}
Object.keys(attributes).forEach(function (key) {
customEl[key] = attributes[key];
});
if (customEl.parentNode === null) {
rootEl.appendChild(customEl);
}
};
// Check for support of native locale string options
function toLocaleStringSupportsOptions() {
try {
new Date().toLocaleString('i');
} catch (e) {
return e.name === 'RangeError';
}
return false;
}
function toLocaleDateStringSupportsOptions() {
try {
new Date().toLocaleDateString('i');
} catch (e) {
return e.name === 'RangeError';
}
return false;
}
function toLocaleTimeStringSupportsOptions() {
try {
new Date().toLocaleTimeString('i');
} catch (e) {
return e.name === 'RangeError';
}
return false;
}
window.fecha.masks.haDateTime = (window.fecha.masks.shortTime + ' ' +
window.fecha.masks.mediumDate);
if (toLocaleStringSupportsOptions()) {
window.hassUtil.formatDateTime = function (dateObj) {
return dateObj.toLocaleString(window.hassUtil.LANGUAGE, {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
minute: '2-digit',
});
};
} else {
window.hassUtil.formatDateTime = function (dateObj) {
return window.fecha.format(dateObj, 'haDateTime');
};
}
if (toLocaleDateStringSupportsOptions()) {
window.hassUtil.formatDate = function (dateObj) {
return dateObj.toLocaleDateString(window.hassUtil.LANGUAGE,
{ year: 'numeric', month: 'long', day: 'numeric' });
};
} else {
window.hassUtil.formatDate = function (dateObj) {
return window.fecha.format(dateObj, 'mediumDate');
};
}
if (toLocaleTimeStringSupportsOptions()) {
window.hassUtil.formatTime = function (dateObj) {
return dateObj.toLocaleTimeString(window.hassUtil.LANGUAGE,
{ hour: 'numeric', minute: '2-digit' });
};
} else {
window.hassUtil.formatTime = function (dateObj) {
return window.fecha.format(dateObj, 'shortTime');
};
}
window.hassUtil.relativeTime = function (dateObj) {
var delta = Math.abs(new Date() - dateObj) / 1000;
var format = new Date() > dateObj ? '%s ago' : 'in %s';
var tests = window.hassUtil.relativeTime.tests;
var i;
for (i = 0; i < tests.length ; i + = 2 ) {
if (delta < tests [ i ] ) {
delta = Math.floor(delta);
return format.replace('%s',
delta === 1 ? '1 ' + tests[i + 1] : delta + ' ' + tests[i + 1] + 's');
}
delta /= tests[i];
}
delta = Math.floor(delta);
return format.replace('%s', delta === 1 ? '1 week' : delta + ' weeks');
};
window.hassUtil.relativeTime.tests = [
60, 'second',
60, 'minute',
24, 'hour',
7, 'day',
];
window.hassUtil.stateCardType = function (hass, stateObj) {
if (stateObj.state === 'unavailable') {
return 'display';
}
var domain = window.hassUtil.computeDomain(stateObj);
if (window.hassUtil.DOMAINS_WITH_CARD.indexOf(domain) !== -1) {
return domain;
} else if (window.hassUtil.canToggleState(hass, stateObj) & &
stateObj.attributes.control !== 'hidden') {
return 'toggle';
}
return 'display';
};
window.hassUtil.stateMoreInfoType = function (stateObj) {
var domain = window.hassUtil.computeDomain(stateObj);
if (window.hassUtil.DOMAINS_WITH_MORE_INFO.indexOf(domain) !== -1) {
return domain;
}
if (window.hassUtil.HIDE_MORE_INFO.indexOf(domain) !== -1) {
return 'hidden';
}
return 'default';
};
window.hassUtil.domainIcon = function (domain, state) {
switch (domain) {
case 'alarm_control_panel':
return state & & state === 'disarmed' ? 'mdi:bell-outline' : 'mdi:bell';
case 'automation':
return 'mdi:playlist-play';
case 'binary_sensor':
return state & & state === 'off' ? 'mdi:radiobox-blank' : 'mdi:checkbox-marked-circle';
2017-01-31 15:39:01 +00:00
case 'calendar':
return 'mdi:calendar';
2017-01-30 02:43:39 +00:00
case 'camera':
return 'mdi:video';
case 'climate':
return 'mdi:nest-thermostat';
case 'configurator':
return 'mdi:settings';
case 'conversation':
return 'mdi:text-to-speech';
case 'cover':
return state & & state === 'open' ? 'mdi:window-open' : 'mdi:window-closed';
case 'device_tracker':
return 'mdi:account';
case 'fan':
return 'mdi:fan';
case 'group':
return 'mdi:google-circles-communities';
case 'homeassistant':
return 'mdi:home';
2017-01-31 15:39:01 +00:00
case 'image_processing':
return 'mdi:image-filter-frames';
2017-01-30 02:43:39 +00:00
case 'input_boolean':
return 'mdi:drawing';
case 'input_select':
return 'mdi:format-list-bulleted';
case 'input_slider':
return 'mdi:ray-vertex';
case 'light':
return 'mdi:lightbulb';
case 'lock':
return state & & state === 'unlocked' ? 'mdi:lock-open' : 'mdi:lock';
case 'media_player':
return state & & state !== 'off' & & state !== 'idle' ?
'mdi:cast-connected' : 'mdi:cast';
case 'notify':
return 'mdi:comment-alert';
case 'proximity':
return 'mdi:apple-safari';
case 'remote':
return 'mdi:remote';
case 'scene':
return 'mdi:google-pages';
case 'script':
return 'mdi:file-document';
case 'sensor':
return 'mdi:eye';
case 'simple_alarm':
return 'mdi:bell';
case 'sun':
return 'mdi:white-balance-sunny';
case 'switch':
return 'mdi:flash';
case 'updater':
return 'mdi:cloud-upload';
case 'weblink':
return 'mdi:open-in-new';
default:
/* eslint-disable no-console */
console.warn(
'Unable to find icon for domain ' + domain + ' (' + state + ')');
/* eslint-enable no-console */
return window.hassUtil.DEFAULT_ICON;
}
};
window.hassUtil.binarySensorIcon = function (state) {
var activated = state.state & & state.state === 'off';
2017-02-11 05:06:42 +00:00
switch (state.attributes.device_class) {
2017-01-30 02:43:39 +00:00
case 'connectivity':
return activated ? 'mdi:server-network-off' : 'mdi:server-network';
case 'light':
return activated ? 'mdi:brightness-5' : 'mdi:brightness-7';
case 'moisture':
return activated ? 'mdi:water-off' : 'mdi:water';
case 'motion':
return activated ? 'mdi:walk' : 'mdi:run';
case 'occupancy':
return activated ? 'mdi:home' : 'mdi:home-outline';
case 'opening':
return activated ? 'mdi:crop-square' : 'mdi:exit-to-app';
case 'sound':
return activated ? 'mdi:music-note-off' : 'mdi:music-note';
case 'vibration':
return activated ? 'mdi:crop-portrait' : 'mdi:vibrate';
case 'gas':
case 'power':
case 'safety':
case 'smoke':
return activated ? 'mdi:verified' : 'mdi:alert';
default:
return activated ? 'mdi:radiobox-blank' : 'mdi:checkbox-marked-circle';
}
};
2017-02-12 19:35:36 +00:00
window.hassUtil.coverIcon = function (state) {
var open = state.state & & state.state === 'open';
switch (state.attributes.device_class) {
case 'garage':
return open ? 'mdi:garage-open' : 'mdi:garage';
default:
return open ? 'mdi:window-open' : 'mdi:window-closed';
}
};
2017-01-30 02:43:39 +00:00
window.hassUtil.stateIcon = function (state) {
if (!state) {
return window.hassUtil.DEFAULT_ICON;
} else if (state.attributes.icon) {
return state.attributes.icon;
}
var unit = state.attributes.unit_of_measurement;
var domain = window.hassUtil.computeDomain(state);
if (unit & & domain === 'sensor') {
if (unit === '°C' || unit === '°F') {
return 'mdi:thermometer';
} else if (unit === 'Mice') {
return 'mdi:mouse-variant';
}
} else if (domain === 'binary_sensor') {
return window.hassUtil.binarySensorIcon(state);
2017-02-12 19:35:36 +00:00
} else if (domain === 'cover') {
return window.hassUtil.coverIcon(state);
2017-01-30 02:43:39 +00:00
}
return window.hassUtil.domainIcon(domain, state.state);
};
window.hassUtil.computeDomain = function (stateObj) {
if (!stateObj._domain) {
stateObj._domain = window.HAWS.extractDomain(stateObj.entity_id);
}
return stateObj._domain;
};
window.hassUtil.computeStateName = function (stateObj) {
2017-04-04 06:02:04 +00:00
if (stateObj._entityDisplay === undefined) {
2017-01-30 02:43:39 +00:00
stateObj._entityDisplay = (
stateObj.attributes.friendly_name ||
window.HAWS.extractObjectId(stateObj.entity_id)
.replace(/_/g, ' '));
}
return stateObj._entityDisplay;
};
window.hassUtil.computeStateState = function (stateObj) {
if (!stateObj._stateDisplay) {
stateObj._stateDisplay = stateObj.state.replace(/_/g, ' ');
if (stateObj.attributes.unit_of_measurement) {
stateObj._stateDisplay += ` ${stateObj.attributes.unit_of_measurement}`;
}
}
return stateObj._stateDisplay;
};
window.hassUtil.isComponentLoaded = function (hass, component) {
return hass.config.core.components.indexOf(component) !== -1;
};
window.hassUtil.computeLocationName = function (hass) {
return hass.config.core.location_name;
2017-04-16 18:10:55 +00:00
};< / script > < script > ! function ( ) { var t = [ "dockedSidebar" ] ; Polymer ( { is : "ha-pref-storage" , properties : { hass : { type : Object } , storage : { type : Object , value : window . localStorage || { } } } , storeState : function ( ) { if ( this . hass ) try { for ( var e = 0 ; e < t . length ; e ++ ) { var r = t [ e ] ; this . storage [ r ] = JSON . stringify ( this . hass [ r ] ) } } catch ( t ) { } } , getStoredState : function ( ) { for ( var e = { } , r = 0 ; r < t . length ; r ++ ) { var a = t [ r ] ; a in this . storage && ( e [ a ] = JSON . parse ( this . storage [ a ] ) ) } return e } } ) } ( ) < / script > < script > window . hassCallApi = function ( e , t , s , o , a ) { var r = e + "/api/" + o ; if ( window . HASS _DEMO ) { var n , i = o . split ( "/" , 1 ) [ 0 ] ; switch ( i ) { case "bootstrap" : n = window . hassDemoData . bootstrap ; break ; case "logbook" : n = window . hassDemoData . logbook ; break ; case "history" : n = window . hassDemoData . stateHistory ; break ; default : n = ! 1 } return new Promise ( function ( e , t ) { n ? e ( n ) : t ( "Request not allowed in demo mode." ) } ) } return new Promise ( function ( e , o ) { var n = new XMLHttpRequest ; n . open ( s , r , ! 0 ) , t . authToken && n . setRequestHeader ( "X-HA-access" , t . authToken ) , n . onload = function ( ) { var t = n . responseText ; if ( "application/json" === n . getResponseHeader ( "content-type" ) ) try { t = JSON . parse ( n . responseText ) } catch ( e ) { return void o ( { error : "Unable to parse JSON response" , status _code : n . status , body : t } ) } n . status > 199 && n . status < 300 ? e ( t ) : o ( { error : "Response error: " + n . status , status _code : n . status , body : t } ) } , n . onerror = function ( ) { o ( { error : "Request error" , status _code : n . status , body : n . responseText } ) } , a ? ( n . setRequestHeader ( "Content-Type" , "application/json;charset=UTF-8" ) , n . send ( JSON . stringify ( a ) ) ) : n . send ( ) } ) } < / script > < style is = "custom-style" > : root { --primary-text-color : var ( - - light - theme - text - color ) ; --primary-background-color : var ( - - light - theme - background - color ) ; --secondary-text-color : var ( - - light - theme - secondary - color ) ; --disabled-text-color : var ( - - light - theme - disabled - color ) ; --divider-color : var ( - - light - theme - divider - color ) ; --error-color : var ( - - paper - deep - orange - a700 ) ; --primary-color : var ( - - paper - indigo -500 ) ; --light-primary-color : var ( - - paper - indigo -100 ) ; --dark-primary-color : var ( - - paper - indigo -700 ) ; --accent-color : var ( - - paper - pink - a200 ) ; --light-accent-color : var ( - - paper - pink - a100 ) ; --dark-accent-color : var ( - - paper - pink - a400 ) ; --light-theme-background-color : #ffffff ; --light-theme-base-color : #000000 ; --light-theme-text-color : var ( - - paper - grey -900 ) ; --light-theme-secondary-color : #737373 ; --light-theme-disabled-color : #9b9b9b ; --light-theme-divider-color : #dbdbdb ; --dark-theme-background-color : var ( - - paper - grey -900 ) ; --dark-theme-base-color : #ffffff ; --dark-theme-text-color : #ffffff ; --dark-theme-secondary-color : #bcbcbc ; --dark-theme-disabled-color : #646464 ; --dark-theme-divider-color : #3c3c3c ; --text-primary-color : var ( - - dark - theme - text - color ) ; --default-primary-color : var ( - - primary - color ) } < / style > < script > ! f u n c t i o n ( ) { v a r e = { } , t = { } , i = n u l l ; P o l y m e r . I r o n M e t a = P o l y m e r ( { i s : " i r o n - m e t a " , p r o p e r t i e s : { t y p e : { t y p e : S t r i n g , v a l u e : " d e f a u l t " , o b s e r v e r : " _ t y p e C h a n g e d " } , k e y : { t y p e : S t r i n g , o b s e r v e r : " _ k e y C h a n g e d " } , v a l u e : { t y p e : O b j e c t , n o t i f y : ! 0 , o b s e r v e r : " _ v a l u e C h a n g e d " } , s e l f : { t y p e : B o o l e a n , o b s e r v e r : " _ s e l f C h a n g e d " } , l i s t : { t y p e : A r r a y , n o t i f y : ! 0 } } , h o s t A t t r i b u t e s : { h i d d e n : ! 0 } , f a c t o r y I m p l : f u n c t i o n ( e ) { i f ( e ) f o r ( v a r t i n e ) s w i t c h ( t ) { c a s e " t y p e " : c a s e " k e y " : c a s e " v a l u e " : t h i s [ t ] = e [ t ] } } , c r e a t e d : f u n c t i o n ( ) { t h i s . _ m e t a D a t a s = e , t h i s . _ m e t a A r r a y s = t } , _ k e y C h a n g e d : f u n c t i o n ( e , t ) { t h i s . _ r e s e t R e g i s t r a t i o n ( t ) } , _ v a l u e C h a n g e d : f u n c t i o n ( e ) { t h i s . _ r e s e t R e g i s t r a t i o n ( t h i s . k e y ) } , _ s e l f C h a n g e d : f u n c t i o n ( e ) { e & & ( t h i s . v a l u e = t h i s ) } , _ t y p e C h a n g e d : f u n c t i o n ( i ) { t h i s . _ u n r e g i s t e r K e y ( t h i s . k e y ) , e [ i ] | | ( e [ i ] = { } ) , t h i s . _ m e t a D a t a = e [ i ] , t [ i ] | | ( t [ i ] = [ ] ) , t h i s . l i s t = t [ i ] , t h i s . _ r e g i s t e r K e y V a l u e ( t h i s . k e y , t h i s . v a l u e ) } , b y K e y : f u n c t i o n ( e ) { r e t u r n t h i s . _ m e t a D a t a & & t h i s . _ m e t a D a t a [ e ] } , _ r e s e t R e g i s t r a t i o n : f u n c t i o n ( e ) { t h i s . _ u n r e g i s t e r K e y ( e ) , t h i s . _ r e g i s t e r K e y V a l u e ( t h i s . k e y , t h i s . v a l u e ) } , _ u n r e g i s t e r K e y : f u n c t i o n ( e ) { t h i s . _ u n r e g i s t e r ( e , t h i s . _ m e t a D a t a , t h i s . l i s t ) } , _ r e g i s t e r K e y V a l u e : f u n c t i o n ( e , t ) { t h i s . _ r e g i s t e r ( e , t , t h i s . _ m e t a D a t a , t h i s . l i s t ) } , _ r e g i s t e r : f u n c t i o n ( e , t , i , a ) { e & & i & & v o i d 0 ! = = t & & ( i [ e ] = t , a . p u s h ( t ) ) } , _ u n r e g i s t e r : f u n c t i o n ( e , t , i ) { i f ( e & & t & & e i n t ) { v a r a = t [ e ] ; d e l e t e t [ e ] , t h i s . a r r a y D e l e t e ( i , a ) } } } ) , P o l y m e r . I r o n M e t a . g e t I r o n M e t a = f u n c t i o n ( ) { r e t u r n n u l l = = = i & & ( i = n e w P o l y m e r . I r o n M e t a ) , i } , P o l y m e r . I r o n M e t a Q u e r y = P o l y m e r ( { i s : " i r o n - m e t a -
2017-02-21 05:56:38 +00:00
window.CoverEntity = function (hass, stateObj) {
this.hass = hass;
this.stateObj = stateObj;
};
function addGetter(name, getter) {
Object.defineProperty(window.CoverEntity.prototype, name,
{ get: getter });
}
addGetter('isFullyOpen', function () {
if (this.stateObj.attributes.current_position !== undefined) {
return this.stateObj.attributes.current_position === 100;
}
return this.stateObj.state === 'open';
});
addGetter('isFullyClosed', function () {
if (this.stateObj.attributes.current_position !== undefined) {
return this.stateObj.attributes.current_position === 0;
}
return this.stateObj.state === 'closed';
});
addGetter('isFullyOpenTilt', function () {
return this.stateObj.attributes.current_tilt_position === 100;
});
addGetter('isFullyClosedTilt', function () {
return this.stateObj.attributes.current_tilt_position === 0;
});
/* eslint-disable no-bitwise */
addGetter('supportsOpen', function () {
return (this.stateObj.attributes.supported_features & 1) !== 0;
});
addGetter('supportsClose', function () {
return (this.stateObj.attributes.supported_features & 2) !== 0;
});
addGetter('supportsSetPosition', function () {
return (this.stateObj.attributes.supported_features & 4) !== 0;
});
addGetter('supportsStop', function () {
return (this.stateObj.attributes.supported_features & 8) !== 0;
});
addGetter('supportsOpenTilt', function () {
return (this.stateObj.attributes.supported_features & 16) !== 0;
});
addGetter('supportsCloseTilt', function () {
return (this.stateObj.attributes.supported_features & 32) !== 0;
});
addGetter('supportsStopTilt', function () {
return (this.stateObj.attributes.supported_features & 64) !== 0;
});
addGetter('supportsSetTiltPosition', function () {
return (this.stateObj.attributes.supported_features & 128) !== 0;
});
/* eslint-enable no-bitwise */
Object.assign(window.CoverEntity.prototype, {
openCover() {
this.callService('open_cover');
},
closeCover() {
this.callService('close_cover');
},
stopCover() {
this.callService('stop_cover');
},
openCoverTilt() {
this.callService('open_cover_tilt');
},
closeCoverTilt() {
this.callService('close_cover_tilt');
},
stopCoverTilt() {
this.callService('stop_cover_tilt');
},
setCoverPosition(position) {
this.callService('set_cover_position', { position: position });
},
setCoverTiltPosition(tiltPosition) {
this.callService('set_cover_tilt_position', { tilt_position: tiltPosition });
},
// helper method
callService(service, data) {
var serviceData = data || {};
serviceData.entity_id = this.stateObj.entity_id;
this.hass.callService('cover', service, serviceData);
},
});
2017-04-16 18:10:55 +00:00
}());< / script > < dom-module id = "ha-cover-controls" assetpath = "components/" > < template > < style > . state { white-space : nowrap } [ invisible ] { visibility : hidden !important } < / style > < div class = "state" > < paper-icon-button icon = "mdi:arrow-up" on-tap = "onOpenTap" invisible $ = " [ [ ! entityObj . supportsOpen ] ] " disabled = "[[entityObj.isFullyOpen]]" > < / paper-icon-button > < paper-icon-button icon = "mdi:stop" on-tap = "onStopTap" invisible $ = " [ [ ! entityObj . supportsStop ] ] " > < / paper-icon-button > < paper-icon-button icon = "mdi:arrow-down" on-tap = "onCloseTap" invisible $ = " [ [ ! entityObj . supportsClose ] ] " disabled = "[[entityObj.isFullyClosed]]" > < / paper-icon-button > < / div > < / template > < / dom-module > < script > Polymer ( { is : "ha-cover-controls" , properties : { hass : { type : Object } , stateObj : { type : Object } , entityObj : { type : Object , computed : "computeEntityObj(hass, stateObj)" } } , computeEntityObj : function ( t , o ) { return new window . CoverEntity ( t , o ) } , onOpenTap : function ( t ) { t . stopPropagation ( ) , this . entityObj . openCover ( ) } , onCloseTap : function ( t ) { t . stopPropagation ( ) , this . entityObj . closeCover ( ) } , onStopTap : function ( t ) { t . stopPropagation ( ) , this . entityObj . stopCover ( ) } } ) < / script > < dom-module id = "state-card-cover" assetpath = "state-summary/" > < template > < style is = "custom-style" include = "iron-flex iron-flex-alignment" > < / style > < style > : host { line-height : 1.5 } < / style > < div class = "horizontal justified layout" > < state-info state-obj = "[[stateObj]]" in-dialog = "[[inDialog]]" > < / state-info > < ha-cover-controls hass = "[[hass]]" state-obj = "[[stateObj]]" > < / ha-cover-controls > < / div > < / template > < / dom-module > < script > Polymer ( { is : "state-card-cover" , properties : { hass : { type : Object } , inDialog : { type : Boolean , value : ! 1 } , stateObj : { type : Object } } } ) < / script > < dom-module id = "state-card-display" assetpath = "state-summary/" > < template > < style is = "custom-style" include = "iron-flex iron-flex-alignment" > < / style > < style > . state { @ a p p l y ( - - p a p e r - f o n t - b o d y 1 ) ; color : var ( - - primary - text - color ) ; margin-left : 16 px ; text-align : right ; line-height : 40 px } < / style > < div class = "horizontal justified layout" > < state-info state-obj = "[[stateObj]]" in-dialog = "[[inDialog]]" > < / state-info > < div class = "state" > [[computeStateDisplay(stateObj)]]< / div > < / div > < / template > < / dom-module > < script > Polymer ( { is : "state-card-display" , properties : { inDialog : { type : Boolean , value : ! 1 } , stateObj : { type : Object } } , computeStateDisplay : function ( t ) { return window . hassUtil . computeStateState ( t ) } } ) < / script > < script > P o l y m e r . P a p e r I n p u t H e l p e r = { } , P o l y m e r . P a p e r I n p u t H e l p e r . N e x t L a b e l I D = 1 , P o l y m e r . P a p e r I n p u t H e l p e r . N e x t A d d o n I D = 1 , P o l y m e r . P a p e r I n p u t B e h a v i o r I m p l = { p r o p e r t i e s : { l a b e l : { t y p e : S t r i n g } , v a l u e : { n o t i f y : ! 0 , t y p e : S t r i n g } , d i s a b l e d : { t y p e : B o o l e a n , v a l u e : ! 1 } , i n v a l i d : { t y p e : B o o l e a n , v a l u e : ! 1 , n o t i f y : ! 0 } , p r e v e n t I n v a l i d I n p u t : { t y p e : B o o l e a n } , a l l o w e d P a t t e r n : { t y p e : S t r i n g } , t y p e : { t y p e : S t r i n g } , l i s t : { t y p e : S t r i n g } , p a t t e r n : { t y p e : S t r i n g } , r e q u i r e d : { t y p e : B o o l e a n , v a l u e : ! 1 } , e r r o r M e s s a g e : { t y p e : S t r i n g } , c h a r C o u n t e r : { t y p e : B o o l e a n , v a l u e : ! 1 } , n o L a b e l F l o a t : { t y p e : B o o l e a n , v a l u e : ! 1 } , a l w a y s F l o a t L a b e l : { t y p e : B o o l e a n , v a l u e : ! 1 } , a u t o V a l i d a t e : { t y p e : B o o l e a n , v a l u e : ! 1 } , v a l i d a t o r : { t y p e : S t r i n g } , a u t o c o m p l e t e : { t y p e : S t r i n g , v a l u e : " o f f " } , a u t o f o c u s : { t y p e : B o o l e a n , o b s e r v e r : " _ a u t o f o c u s C h a n g e d " } , i n p u t m o d e : { t y p e : S t r i n g } , m i n l e n g t h : { t y p e : N u m b e r } , m a x l e n g t h : { t y p e : N u m b e r } , m i n : { t y p e : S t r i n g } , m a x : { t y p e : S t r i n g } , s t e p : { t y p e : S t r i n g } , n a m e : { t y p e : S t r i n g } , p l a c e h o l d e r : { t y p e : S t r i n g , v a l u e : " " } , r e a d o n l y : { t y p e : B o o l e a n , v a l u e : ! 1 } , s i z e : { t y p e : N u m b e r } , a u t o c a p i t a l i z e : { t y p e : S t r i n g , v a l u e : " n o n e " } , a u t o c o r r e c t : { t y p e : S t r i n g , v a l u e : " o f f " } , a u t o s a v e : { t y p e : S t r i n g } , r e s u l t s : { t y p e : N u m b e r } , a c c e p t : { t y p e : S t r i n g } , m u l t i p l e : { t y p e : B o o l e a n } , _ a r i a D e s c r i b e d B y : { t y p e : S t r i n g , v a l u e : " " } , _ a r i a L a b e l l e d B y : { t y p e : S t r i n g , v a l u e : " " } } , l i s t e n e r s : { " a d d o n - a t t a c h e d " : " _ o n A d d o n A t t a c h e d " } , k e y B i n d i n g s : { " s h i f t + t a b : k e y d o w n " : " _ o n S h i f t T a b D o w n " } , h o s t A t t r i b u t e s : { t a b i n d e x : 0 } , g e t i n p u t E l e m e n t ( ) { r e t u r n t h i s . $ . i n p u t } , g e t _ f o c u s a b l e E l e m e n t ( ) { r e t u r n t h i s . i n p u t E l e m e n t } , r e g i s t e r e d : f u n c t i o n ( ) { t h i s . _ t y p e s T h a t H a v e T e x t = [ " d a t e " , " d a t e t i m e " , " d a t e t i m e - l o c a l " , " m o n t h " , " t i m e " , " w e e k " , " f i l e " ] } , a t t a c h e d : f u n c t i o n ( ) { t h i s . _ u p d a t e A r i a L a b e l l e d B y ( ) , t h i s . i n p u t E l e m e n t & & t h i s . _ t y p e s T h a t H a v e T e x t . i n d e x O f ( t h i s . i n p u t E l e m e n t . t y p e ) ! = = - 1 & & ( t h i s . a l w a y s F l o a t L a b e l = ! 0 ) } , _ a p p e n d S t r i n g W i t h S p a c e : f u n c t i o n ( e , t ) { r e t u r n e = e ? e + " " + t : t } , _ o n A d d o n
return performance.now()};else var t=function(){return Date.now()};var e=function(t,e,i){this.target=t,this.currentTime=e,this.timelineTime=i,this.type="cancel",this.bubbles=!1,this.cancelable=!1,this.currentTarget=t,this.defaultPrevented=!1,this.eventPhase=Event.AT_TARGET,this.timeStamp=Date.now()},i=window.Element.prototype.animate;window.Element.prototype.animate=function(n,r){var o=i.call(this,n,r);o._cancelHandlers=[],o.oncancel=null;var a=o.cancel;o.cancel=function(){a.call(this);var i=new e(this,null,t()),n=this._cancelHandlers.concat(this.oncancel?[this.oncancel]:[]);setTimeout(function(){n.forEach(function(t){t.call(i.target,i)})},0)};var s=o.addEventListener;o.addEventListener=function(t,e){"function"==typeof e&&"cancel"==t?this._cancelHandlers.push(e):s.call(this,t,e)}; var u=o.removeEventListener;return o.removeEventListener=function(t,e){if("cancel"==t){var i=this._cancelHandlers.indexOf(e);i>=0& & this._cancelHandlers.splice(i,1)}else u.call(this,t,e)},o}}}(),function(t){var e=document.documentElement,i=null,n=!1;try{var r=getComputedStyle(e).getPropertyValue("opacity"),o="0"==r?"1":"0";i=e.animate({opacity:[o,o]},{duration:1}),i.currentTime=0,n=getComputedStyle(e).getPropertyValue("opacity")==o}catch(t){}finally{i& & i.cancel()}if(!n){var a=window.Element.prototype.animate;window.Element.prototype.animate=function(e,i){return window.Symbol& & Symbol.iterator& & Array.prototype.from& & e[Symbol.iterator]& & (e=Array.from(e)),Array.isArray(e)||null===e||(e=t.convertToArrayForm(e)),a.call(this,e,i)}}}(c),function(t,e,i){function n(t){var i=e.timeline;i.currentTime=t,i._discardAnimations(),0==i._animations.length?o=!1:requestAnimationFrame(n)}var r=window.requestAnimationFrame;window.requestAnimationFrame=function(t){return r(function(i){e.timeline._updateAnimationsPromises(),t(i),e.timeline._updateAnimationsPromises()})},e.AnimationTimeline=function(){this._animations=[],this.currentTime=void 0},e.AnimationTimeline.prototype={getAnimations:function(){return this._discardAnimations(),this._animations.slice()},_updateAnimationsPromises:function(){e.animationsWithPromises=e.animationsWithPromises.filter(function(t){return t._updatePromises()})},_discardAnimations:function(){this._updateAnimationsPromises(),this._animations=this._animations.filter(function(t){return"finished"!=t.playState& & "idle"!=t.playState})},_play:function(t){var i=new e.Animation(t,this);return this._animations.push(i),e.restartWebAnimationsNextTick(),i._updatePromises(),i._animation.play(),i._updatePromises(),i},play:function(t){return t&&t.remove(),this._play(t)}}; var o=!1;e.restartWebAnimationsNextTick=function(){o||(o=!0,requestAnimationFrame(n))};var a=new e.AnimationTimeline;e.timeline=a;try{Object.defineProperty(window.document,"timeline",{configurable:!0,get:function(){return a}})}catch(t){}try{window.document.timeline=a}catch(t){}}(0,e),function(t,e,i){e.animationsWithPromises=[],e.Animation=function(e,i){if(this.id="",e& & e._id& & (this.id=e._id),this.effect=e,e& & (e._animation=this),!i)throw new Error("Animation with null timeline is not supported");this._timeline=i,this._sequenceNumber=t.sequenceNumber++,this._holdTime=0,this._paused=!1,this._isGroup=!1,this._animation=null,this._childAnimations=[],this._callback=null,this._oldPlayState="idle",this._rebuildUnderlyingAnimation(),this._animation.cancel(),this._updatePromises()},e.Animation.prototype={_updatePromises:function(){var t=this._oldPlayState,e=this.playState;return this._readyPromise& & e!==t& & ("idle"==e?(this._rejectReadyPromise(),this._readyPromise=void 0):"pending"==t?this._resolveReadyPromise():"pending"==e& & (this._readyPromise=void 0)),this._finishedPromise& & e!==t& & ("idle"==e?(this._rejectFinishedPromise(),this._finishedPromise=void 0):"finished"==e?this._resolveFinishedPromise():"finished"==t& & (this._finishedPromise=void 0)),this._oldPlayState=this.playState,this._readyPromise||this._finishedPromise},_rebuildUnderlyingAnimation:function(){this._updatePromises();var t,i,n,r,o=!!this._animation;o& & (t=this.playbackRate,i=this._paused,n=this.startTime,r=this.currentTime,this._animation.c
2017-01-30 02:43:39 +00:00
window.MediaPlayerEntity = function (hass, stateObj) {
this.hass = hass;
this.stateObj = stateObj;
};
function addGetter(name, getter) {
Object.defineProperty(window.MediaPlayerEntity.prototype, name,
{ get: getter });
}
addGetter('isOff', function () {
return this.stateObj.state === 'off';
});
addGetter('isIdle', function () {
return this.stateObj.state === 'idle';
});
addGetter('isMuted', function () {
return this.stateObj.attributes.is_volume_muted;
});
addGetter('isPaused', function () {
return this.stateObj.state === 'paused';
});
addGetter('isPlaying', function () {
return this.stateObj.state === 'playing';
});
addGetter('isMusic', function () {
return this.stateObj.attributes.media_content_type === 'music';
});
addGetter('isTVShow', function () {
return this.stateObj.attributes.media_content_type === 'tvshow';
});
addGetter('hasMediaControl', function () {
return ['playing', 'paused', 'unknown'].indexOf(
this.stateObj.state) !== -1;
});
addGetter('volumeSliderValue', function () {
return this.stateObj.attributes.volume_level * 100;
});
addGetter('showProgress', function () {
return (
(this.isPlaying || this.isPaused) & &
'media_position' in this.stateObj.attributes & &
'media_position_updated_at' in this.stateObj.attributes);
});
addGetter('currentProgress', function () {
return (
this.stateObj.attributes.media_position +
((Date.now() -
new Date(this.stateObj.attributes.media_position_updated_at)) / 1000));
});
/* eslint-disable no-bitwise */
addGetter('supportsPause', function () {
2017-02-08 05:30:24 +00:00
return (this.stateObj.attributes.supported_features & 1) !== 0;
2017-01-30 02:43:39 +00:00
});
addGetter('supportsVolumeSet', function () {
2017-02-08 05:30:24 +00:00
return (this.stateObj.attributes.supported_features & 4) !== 0;
2017-01-30 02:43:39 +00:00
});
addGetter('supportsVolumeMute', function () {
2017-02-08 05:30:24 +00:00
return (this.stateObj.attributes.supported_features & 8) !== 0;
2017-01-30 02:43:39 +00:00
});
addGetter('supportsPreviousTrack', function () {
2017-02-08 05:30:24 +00:00
return (this.stateObj.attributes.supported_features & 16) !== 0;
2017-01-30 02:43:39 +00:00
});
addGetter('supportsNextTrack', function () {
2017-02-08 05:30:24 +00:00
return (this.stateObj.attributes.supported_features & 32) !== 0;
2017-01-30 02:43:39 +00:00
});
addGetter('supportsTurnOn', function () {
2017-02-08 05:30:24 +00:00
return (this.stateObj.attributes.supported_features & 128) !== 0;
2017-01-30 02:43:39 +00:00
});
addGetter('supportsTurnOff', function () {
2017-02-08 05:30:24 +00:00
return (this.stateObj.attributes.supported_features & 256) !== 0;
2017-01-30 02:43:39 +00:00
});
addGetter('supportsPlayMedia', function () {
2017-02-08 05:30:24 +00:00
return (this.stateObj.attributes.supported_features & 512) !== 0;
2017-01-30 02:43:39 +00:00
});
addGetter('supportsVolumeButtons', function () {
2017-02-08 05:30:24 +00:00
return (this.stateObj.attributes.supported_features & 1024) !== 0;
2017-01-30 02:43:39 +00:00
});
addGetter('supportsPlay', function () {
2017-02-08 05:30:24 +00:00
return (this.stateObj.attributes.supported_features & 16384) !== 0;
2017-01-30 02:43:39 +00:00
});
/* eslint-enable no-bitwise */
addGetter('primaryText', function () {
return this.stateObj.attributes.media_title ||
window.hassUtil.computeStateState(this.stateObj);
});
addGetter('secondaryText', function () {
if (this.isMusic) {
return this.stateObj.attributes.media_artist;
} else if (this.isTVShow) {
var text = this.stateObj.attributes.media_series_title;
if (this.stateObj.attributes.media_season) {
text += ' S' + this.stateObj.attributes.media_season;
if (this.stateObj.attributes.media_episode) {
text += 'E' + this.stateObj.attributes.media_episode;
}
}
return text;
} else if (this.stateObj.attributes.app_name) {
return this.stateObj.attributes.app_name;
}
return '';
});
Object.assign(window.MediaPlayerEntity.prototype, {
mediaPlayPause() {
this.callService('media_play_pause');
},
nextTrack() {
this.callService('media_next_track');
},
playbackControl() {
this.callService('media_play_pause');
},
previousTrack() {
this.callService('media_previous_track');
},
setVolume(volume) {
this.callService('volume_set', { volume_level: volume });
},
togglePower() {
if (this.isOff) {
this.turnOn();
} else {
this.turnOff();
}
},
turnOff() {
this.callService('turn_off');
},
turnOn() {
this.callService('turn_on');
},
volumeDown() {
this.callService('volume_down');
},
volumeMute(mute) {
if (!this.supportsVolumeMute) {
throw new Error('Muting volume not supported');
}
this.callService('volume_mute', { is_volume_muted: mute });
},
volumeUp() {
2017-02-21 05:56:38 +00:00
this.callService('volume_up');
2017-01-30 02:43:39 +00:00
},
// helper method
callService(service, data) {
var serviceData = data || {};
serviceData.entity_id = this.stateObj.entity_id;
this.hass.callService('media_player', service, serviceData);
},
});
2017-04-16 18:10:55 +00:00
}());< / script > < dom-module id = "ha-media_player-card" assetpath = "cards/" > < template > < style include = "paper-material iron-flex iron-flex-alignment iron-positioning" > : host { display : block ; position : relative ; font-size : 0 ; border-radius : 2 px ; overflow : hidden } . banner { position : relative ; background-color : #fff ; border-top-left-radius : 2 px ; border-top-right-radius : 2 px } . banner : before { display : block ; content : "" ; width : 100 % ; padding-top : 56 % ; transition : padding-top .8 s } . banner . no-cover { background-position : center center ; background-image : url ( /static/images/card_media_player_bg.png ) ; background-repeat : no-repeat ; background-color : var ( - - primary - color ) } . banner . content-type-music : before { padding-top : 100 % } . banner . no-cover : before { padding-top : 88 px } . banner > . cover { position : absolute ; top : 0 ; left : 0 ; right : 0 ; bottom : 0 ; border-top-left-radius : 2 px ; border-top-right-radius : 2 px ; background-position : center center ; background-size : cover ; transition : opacity .8 s ; opacity : 1 } . banner . is-off > . cover { opacity : 0 } . banner > . caption { @ a p p l y ( - - p a p e r - f o n t - c a p t i o n ) ; position : absolute ; left : 0 ; right : 0 ; bottom : 0 ; background-color : rgba ( 0 , 0 , 0 , var ( - - dark - secondary - opacity ) ) ; padding : 8 px 16 px ; font-size : 14 px ; font-weight : 500 ; color : #fff ; transition : background-color .5 s } . banner . is-off > . caption { background-color : initial } . banner > . caption . title { @ a p p l y ( - - p a p e r - f o n t - c o m m o n - n o w r a p ) ; font-size : 1.2 em ; margin : 8 px 0 4 px } . progress { width : 100 % ; --paper-progress-active-color : var ( - - accent - color ) ; --paper-progress-container-color : #FFF } . controls { position : relative ; @ a p p l y ( - - p a p e r - f o n t - b o d y 1 ) ; padding : 8 px ; border-bottom-left-radius : 2 px ; border-bottom-right-radius : 2 px ; background-color : #fff } . controls paper-icon-button { width : 44 px ; height : 44 px } paper-icon-button { opacity : var ( - - dark - primary - opacity ) } paper-icon-button [ disabled ] { opacity : var ( - - dark - disabled - opacity ) } paper-icon-button . primary { width : 56 px !important ; height : 56 px !important ; background-color : var ( - - primary - color ) ; color : #fff ; border-radius : 50 % ; padding : 8 px ; transition : background-color .5 s } paper-icon-button . primary [ disabled ] { background-color : rgba ( 0 , 0 , 0 , var ( - - dark - disabled - opacity ) ) } [ invisible ] { visibility : hidden !important } < / style > < div class $ = " [ [ computeBannerClasses ( playerObj ) ] ] " > < div class = "cover" id = "cover" > < / div > < div class = "caption" > [[computeStateName(stateObj)]]< div class = "title" > [[playerObj.primaryText]]< / div > [[playerObj.secondaryText]]< br > < / div > < / div > < paper-progress max = "[[stateObj.attributes.media_duration]]" value = "[[playbackPosition]]" hidden $ = " [ [ computeHideProgress ( playerObj ) ] ] " class = "progress" > < / paper-progress > < div class = "controls layout horizontal justified" > < paper-icon-button icon = "mdi:power" on-tap = "handleTogglePower" invisible $ = " [ [ computeHidePowerButton ( playerObj ) ] ] " class = "self-center secondary" > < / paper-icon-button > < div > < paper-icon-button icon = "mdi:skip-previous" invisible $ = " [ [ ! playerObj . supportsPreviousTrack ] ] " disabled = "[[playerObj.isOff]]" on-tap = "handlePrevious" > < / paper-icon-button > < paper-icon-button class = "primary" icon = "[[computePlaybackControlIcon(playerObj)]]" invisible $ = " [ [ ! computePlaybackControlIcon ( playerObj ) ] ] " disabled = "[[playerObj.isOff]]" on-tap = "handlePlaybackControl" > < / paper-icon-button > < paper-icon-button icon = "mdi:skip-next" invisible $ = " [ [ ! playerObj . supportsNextTrack ] ] " disabled = "[[playerObj.isOff]]" on-tap = "handleNext" > < / paper-icon-button > < / div > < paper-icon-button icon = "mdi:dots-vertical" on-tap = "handleOpenMoreInfo" class = "self-center secondary" > < / paper-icon-button > < / div > < / template > < / dom-module > < script > P o l y m e r ( { i s : " h a - m e d i a _ p l a y e r - c a r d " , p r o p e r t i e s : { h a s s : { t y p e : O b j e c t } , s t a t e O b j : { t y p e : O b j e c t } , p l a y e r O b j : { t y p e : O b j e c t , c o m p u t e d : " c o m p u t e P l a y e r O b j ( h a s s , s t a t e O b j ) " , o b s e r v e r : " p l a y e r O b j C h a n g e d " } , p l a y b a c k C o n t r o l I c o n : { t y p e : S t r i n g , c o m p u t e d : " c o m p u t e P l a y b a c k C o n t r o l I c o n ( p l a y e r O b j ) " } , p l a y b a c k P o s i t i o n : { t y p e : N u m b e r } , e l e v a t i o n : { t y p e : N u m b e r , v a l u e : 1 , r e f l e c t T o A t t r i b u t e : ! 0 } } , c r e a t e d : f u n c t i o n ( ) { t h i s . u p d a t e P l a y b a c k P o s i t i o n = t h i s . u p d a t e P l a y b a c k P o s i t i o n . b i n d ( t h i s ) } , p l a y e r O b j C h a n g e d : f u n c t i o n ( t ) { v a r e , o = t . s t a t e O b j . a t t r i b u t e s . e n t i t y _ p i c t u r e ; o ? ( e = d o c u m e n t . c r e a t e E l e m e n t ( " I M G " ) , e . o n l o a d = f u n c t i o n ( ) { t h i s . $ . c o v e r . s t y l e . b a c k g r o u n d I m a g e = " u r l ( " + o + " ) " , e . o n e r r o r = e . o n l o a d = n u l l , e . s r c = " " , e = n u l l } . b i n d ( t h i s ) , e . o n e r r o r = f u